-
Notifications
You must be signed in to change notification settings - Fork 0
/
bonnie.toml
224 lines (212 loc) · 11.1 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
version="0.3.2"
[scripts]
setup.cmd.generic = [
"rust-script scripts/setup.rs",
"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 = [
"rust-script scripts/setup.rs",
"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.generic = [
"cd packages/perseus-cli",
# Point this live version of the CLI at the given example
"TEST_EXAMPLE=../../examples/%category/%example cargo run -- %%"
]
dev.subcommands.example.cmd.targets.windows = [
"cd packages\\perseus-cli",
# Point this live version of the CLI at the given example
"powershell -Command { $env:TEST_EXAMPLE=\"..\\..\\examples\\%category\\%example\"; cargo run -- %% }"
]
dev.subcommands.example.args = [ "category", "example" ]
dev.subcommands.example.desc = "runs the given example using a live version of the cli"
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"
]
site.subcommands.export.desc = "exports and serves the site, watching for changes"
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://arctic-hen7.github.io/perseus perseus deploy -e",
# Build the Tribble contributing docs
"cd ..",
"tribble deploy --path https://arctic-hen7.github.io/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://arctic-hen7.github.io/perseus\"; perseus deploy -e }",
# Build the Tribble contributing docs
"cd ..",
"tribble deploy --path https://arctic-hen7.github.io/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"
]
check.desc = "checks code for formatting errors and the like"
ci-prep.cmd.generic = [
"mkdir -p examples/core/basic/.perseus/dist",
"mkdir -p examples/core/basic/.perseus/dist/static",
]
ci-prep.cmd.targets.windows = [
"New-Item -Force -ItemType directory -Path examples\\core\\basic\\.perseus\\dist",
"New-Item -Force -ItemType directory -Path examples\\core\\basic\\.perseus\\static",
]
ci-prep.desc = "creates empty directories to preserve the file structure that testing expects"
# TODO Cross-platform
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"
]
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 = "bash ./test.sh %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 = [
"bash ./test.sh %category %example actix-web %%",
"bash ./test.sh %category %example warp %%"
]
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",
"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 \"CHANGELOG.md\" -not -path \"./target/*\" -not -path \"./website/*\" -not -path \"*.perseus*\" -or \\( -name \"*Cargo.toml\" -path \"./examples/core/basic/.perseus/*\" -not -path \"./examples/core/basic/.perseus/dist/*\" \\) \\) -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 --allow-dirty %%", # Without this flag, `.perseus` will be a problem because it's not in Git
# 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 %%"
]
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)"