forked from framesurge/perseus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bonnie.toml
229 lines (217 loc) · 11.6 KB
/
bonnie.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
version="0.3.2"
env_files = [ ".env" ]
[scripts]
setup.cmd.generic = [
"cargo build",
"npm i --prefix ./website",
"echo \"\n\nThe Perseus repository is ready for local development! Type 'bonnie help' to see the available commands you can run here. Also, please ensure that you have 'npx' available and that you've installed 'tailwindcss', `concurrently`, `serve` and 'browser-sync' ('npm i -g tailwindcss concurrently serve browser-sync') if you'll be working with the website or running `bonnie dev export-serve ...`.\""
]
setup.cmd.targets.windows = [
"cargo build",
"npm i --prefix ./website",
"Write-Host \"\n\nThe Perseus repository is ready for local development! Type 'bonnie help' to see the available commands you can run here. Also, please ensure that you have 'npx' available and that you've installed 'tailwindcss', `concurrently`, `serve` and 'browser-sync' ('npm i -g tailwindcss concurrently serve browser-sync') if you'll be working with the website or running `bonnie dev export-serve ...`.\""
]
setup.desc = "sets everything up for local development"
dev.subcommands.export-serve-deploy-relative.cmd.generic = [
"PERSEUS_BASE_PATH=http://localhost:8080/relative bonnie dev example %category %example deploy --export-static",
"cd examples/%category/%example",
"mkdir pkg.new",
"mv pkg/ pkg.new/",
"mv pkg.new/ pkg/",
"mv pkg/pkg/ pkg/relative",
"serve -p 8080 pkg/"
]
dev.subcommands.export-serve-deploy-relative.cmd.targets.windows = [
"powershell -Command { $env:PERSEUS_BASE_PATH=\"http://localhost:8080/relative\"; bonnie dev example %category %example deploy --export-static }",
"cd examples\\%category\\%example",
"New-Item -Force -ItemType directory -Path pkg.new",
"Move-Item -Path pkg -Destination pkg.new",
"Rename-Item -Path pkg.new -NewName pkg",
"Rename-Item -Path pkg\\pkg -NewName relative",
"serve -p 8080 pkg/"
]
dev.subcommands.export-serve-deploy-relative.args = [ "category", "example" ]
dev.subcommands.export-serve-deploy-relative.desc = "deploys (exported) and serves the given example at a relative local path"
dev.subcommands.example.cmd = "rust-script scripts/example.rs %category %example %EXAMPLE_INTEGRATION %%"
dev.subcommands.example.args = [ "category", "example" ]
dev.subcommands.example.env_vars = [ "EXAMPLE_INTEGRATION" ] # This will be set automatically to Warp by `.env` unless overridden
dev.subcommands.example.desc = "runs the given example using a live version of the cli"
bench.subcommands.size.cmd = "rust-script scripts/wasm_size_bench.rs %category %example %%"
bench.subcommands.size.args = [ "category", "example" ]
bench.subcommands.size.desc = "benchmarks the production size of the given example"
site.cmd = "concurrently \"bonnie site export\" \"bonnie site build-tailwind\""
site.desc = "builds and serves the site for local development (requires `concurrently`)"
site.subcommands.export.cmd = [
"cd website",
"perseus export -sw --custom-watch ../docs/ --cargo-engine-path cargo-clif"
]
site.subcommands.export.desc = "exports and serves the site, watching for changes"
site.subcommands.check.cmd = [
"cd website",
"perseus check -w --cargo-engine-path cargo-clif"
]
site.subcommands.check.desc = "checks the code of the website"
site.subcommands.tinker.cmd = [
"cd website",
"perseus tinker"
]
site.subcommands.tinker.desc = "runs tinkers on the website"
site.subcommands.build-tailwind.cmd = [
"cd website",
"tailwindcss -c ./tailwind.config.js -o ./static/tailwind.css -w"
]
site.subcommands.build-tailwind.desc = "builds a tailwind stylesheet for development, watching for changes"
site.subcommands.build-tailwind.subcommands.prod.cmd.generic = [
"cd website",
"NODE_ENV=production tailwindcss -c ./tailwind.config.js -o ./static/tailwind.css --minify"
]
site.subcommands.build-tailwind.subcommands.prod.cmd.targets.windows = [
"cd website",
"powershell -Command { $env:NODE_ENV=\"production\"; tailwindcss -s tailwind.config.js -o static/tailwind.css --minify }"
]
site.subcommands.build-tailwind.subcommands.prod.desc = "builds a tailwind stylesheet for production (minifying)"
site.subcommands.deploy.cmd.generic = [
"bonnie site build-tailwind prod",
"cd website",
"PERSEUS_BASE_PATH=http://localhost:8080/perseus perseus tinker",
# Point this live version of the CLI at the given example
"PERSEUS_BASE_PATH=http://localhost:8080/perseus perseus deploy -e"
]
site.subcommands.deploy.cmd.targets.windows = [
"bonnie site build-tailwind prod",
"cd website",
"powershell -Command { $env:PERSEUS_BASE_PATH=\"http://localhost:8080/perseus\"; perseus tinker }",
# Point this live version of the CLI at the given example
"powershell -Command { $env:PERSEUS_BASE_PATH=\"http://localhost:8080/perseus\"; perseus deploy -e }"
]
site.subcommands.deploy.desc = "builds the website for production and finalizes it at `website/pkg`"
site.subcommands.deploy-prod.cmd.generic = [
"bonnie site build-tailwind prod",
"cd website",
"PERSEUS_BASE_PATH=http://localhost:8080/perseus perseus tinker",
# Point this live version of the CLI at the given example
"PERSEUS_BASE_PATH=https://framesurge.sh/perseus perseus deploy -e",
"PERSEUS_BASE_PATH=https://framesurge.sh/perseus perseus export-error-page --code 404 --output pkg/404.html",
# Build the Tribble contributing docs
"cd ..",
"tribble deploy --path https://framesurge.sh/perseus/tribble -o tribble",
"mv tribble website/pkg/"
]
site.subcommands.deploy-prod.cmd.targets.windows = [
"bonnie site build-tailwind prod",
"cd website",
"powershell -Command { $env:PERSEUS_BASE_PATH=\"http://localhost:8080/perseus\"; perseus tinker }",
# Point this live version of the CLI at the given example
"powershell -Command { $env:PERSEUS_BASE_PATH=\"https://framesurge.sh/perseus\"; perseus deploy -e }",
"powershell -Command { $env:PERSEUS_BASE_PATH=\"https://framesurge.sh/perseus\"; perseus export-error-page --code 404 --output pkg/404.html } ",
# Build the Tribble contributing docs
"cd ..",
"tribble deploy --path https://framesurge.sh/perseus/tribble -o tribble",
"Move-Item -Path tribble -Destination website\\pkg"
]
site.subcommands.deploy-prod.desc = "builds the website for production on GitHub Pages and finalizes it at `website/pkg`"
site.subcommands.deploy.subcommands.serve.cmd.generic = [
"cd website",
"mkdir pkgs",
"mv pkg pkgs/perseus",
"mv pkgs pkg",
"serve -p 8080 pkg/"
]
site.subcommands.deploy.subcommands.serve.cmd.targets.windows = [
"cd website",
"New-Item -Force -ItemType directory -Path pkgs",
"Move-Item -Path pkg -Destination pkgs/perseus",
"Rename-Item -Path pkgs -NewName pkg",
"serve -p 8080 pkg/"
]
site.subcommands.deploy.subcommands.serve.desc = "serves the website for local testing after it's been built for production"
site.subcommands.run.cmd = [
"bonnie site build-tailwind",
"cd website",
# Point this live version of the CLI at the given example
"perseus serve",
]
site.subcommands.run.desc = "runs the website without watching for changes"
check.cmd = [
"cargo check --all",
"cargo fmt --all -- --check",
"cargo clippy --all",
# We also have to check the `perseus` package in particular on Wasm (the examples are handled by the E2E tests)
"cd packages/perseus",
"cargo check --target wasm32-unknown-unknown"
]
check.desc = "checks code for formatting errors and the like"
test.cmd = [
"cargo test", # This will ignore Wasm tests
# Run tests for each example
"bonnie test example-all-integrations core basic --headless",
"bonnie test example-all-integrations core unreactive --headless",
"bonnie test example-all-integrations core i18n --headless",
"bonnie test example-all-integrations core plugins --headless",
"bonnie test example-all-integrations core state_generation --headless",
"bonnie test example-all-integrations core freezing_and_thawing --headless",
"bonnie test example-all-integrations core global_state --headless",
"bonnie test example-all-integrations core idb_freezing --headless",
"bonnie test example-all-integrations core router_state --headless",
"bonnie test example-all-integrations core rx_state --headless",
"bonnie test example-all-integrations core index_view --headless",
"bonnie test example-all-integrations core set_headers --headless",
"bonnie test example-all-integrations core static_content --headless",
"bonnie test example-all-integrations core custom_server --headless"
]
test.desc = "runs all tests headlessly (assumes geckodriver running in background)"
test.subcommands.core.cmd = "cargo test"
test.subcommands.core.desc = "runs cargo tests only"
test.subcommands.example.cmd = "rust-script scripts/test.rs %category %example %integration %%" # A script can do backgrounding properly
test.subcommands.example.args = [ "category", "example", "integration" ]
test.subcommands.example.desc = "tests a single example with the given integration (assumes geckodriver running in background), use `--headless` to run headlessly"
test.subcommands.example-all-integrations.cmd = [
"rust-script scripts/test.rs %category %example actix-web %%",
"rust-script scripts/test.rs %category %example warp %%",
"rust-script scripts/test.rs %category %example axum %%"
]
test.subcommands.example-all-integrations.args = [ "category", "example" ]
test.subcommands.example-all-integrations.desc = "tests a single example with all integrations (assumes geckodriver running in background), use `--headless` to run headlessly"
# Releases the project (maintainers only)
# We commit all staged files so we can manually bump the Cargo version
release.cmd = [
"git checkout stable",
"git merge main",
# Build the CLI to make sure all the version numbers are up to date
"cd packages/perseus-cli",
"cargo build",
"cd ../..",
"standard-version --sign --commit-all %%",
"git push --follow-tags origin stable",
"git checkout main",
"git merge stable",
"git push origin main"
]
release.desc = "creates a new project release and pushes it to github (cargo version must be manually bumped)"
# --- COMMANDS FOLLOWING THIS POINT ARE LINUX-ONLY ---
replace-versions.cmd = "find . \\( \\( -name \"*Cargo.toml\" -or -name \"*Cargo.toml.example\" -or \\( -name \"*.md\" -not -name \"*.proj.md\" \\) \\) -not -name \"CHANGELOG.md\" -not -path \"./target/*\" -not -path \"./website/*\" \\) -exec sed -i -e 's/%old_version/%new_version/g' {} \\;"
replace-versions.args = [ "old_version", "new_version" ]
replace-versions.desc = "replaces an old version number with a new one in all relevant files (Linux only)"
# Publishes each package
publish.cmd = [
"bonnie check-branch stable",
"cd packages/perseus-macro",
"cargo publish %%",
"sleep 60", # Wait for `crates.io` to be ready
"cd ../perseus",
"cargo publish %%",
"cd ../perseus-cli",
"cargo publish %%",
# We delay this so that `crates.io` can have time to host the core
"cd ../perseus-actix-web",
"cargo publish %%",
"cd ../perseus-warp",
"cargo publish %%",
"cd ../perseus-axum",
"cargo publish %%"
]
publish.desc = "publishes all packages to crates.io (needs branch 'stable', Linux only)"
check-branch.cmd.exec = "[[ $(git rev-parse --abbrev-ref HEAD) == \"%branch\" ]] && exit 0 || echo \"You need to be on Git branch '%branch' to run this command.\"; exit 1"
check-branch.cmd.shell = ["bash", "-c", "{COMMAND}"] # We need support for inline conditionals, so we can't use `sh`
check-branch.args = [ "branch" ]
check-branch.desc = "checks if the current git branch is the given argument, signals with exit codes (and warns), this will prevent following commands from running if it fails (Linux only)"