Skip to content

Commit aa18724

Browse files
add bacon.toml for easier running of development commands (#143)
* add bacon.toml for easier new dev experience
1 parent c4ada6d commit aa18724

File tree

2 files changed

+200
-0
lines changed

2 files changed

+200
-0
lines changed

CONTRIBUTING.md

+31
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,37 @@ cargo run -p ezno-parser --example parse path/to/file.ts
6060
cargo run -p ezno-parser --example lex path/to/file.ts
6161
```
6262

63+
### Bacon (script runner)
64+
65+
The [Bacon script runner](https://dystroy.org/bacon/) is configured for this repo. This can watch your files and re-run things like checks or tests on file change.
66+
The configuration is managed in the [`bacon.toml`](./bacon.toml) file. The configuration has dedicated jobs for the checker specification tests mentioned above.
67+
68+
#### Installing Bacon
69+
70+
To install bacon, simply run `cargo install --locked bacon`, and you're ready to go.
71+
72+
#### Using Bacon
73+
74+
To use bacon, you can start it by running `bacon check`. This will spin up a job that listens to the source and runs checks on file changes!
75+
There are also hotkeys you can use to switch jobs, or manually trigger a re-run of a job (for jobs where watch functionality is disabled).
76+
We have some custom jobs defined as well:
77+
78+
| Job Name | Description | Hotkey |
79+
| ------------- | ------------- | ------------- |
80+
| test-spec-no-watch | this job runs `cargo test -p ezno-checker-specification` and does *not* watch for file changes | 1 |
81+
| test-staging-no-watch | this job runs `cargo test -p ezno-checker-specification -F staging` and does *not* watch for file changes | 2 |
82+
| test-all-no-watch | this job runs `cargo test -p ezno-checker-specification -F all` and does *not* watch for file changes | 3 |
83+
| test-spec | this job runs `cargo test -p ezno-checker-specification` and watches for file changes | 4 |
84+
| test-staging | this job runs `cargo test -p ezno-checker-specification -F staging` and watches for file changes | 5 |
85+
| test-all | this job runs `cargo test -p ezno-checker-specification -F all` and watches for file changes | 6 |
86+
87+
At any point, you can press `?` to see a list of all available hotkeys.
88+
89+
#### Adding new jobs to our Bacon config
90+
91+
New jobs can easily be added to our `bacon.toml` config if we find there are repetitive actions we're doing frequently.
92+
[The Bacon documentation](https://dystroy.org/bacon/config/#jobs) does a good job of explaining how to do so.
93+
6394
### Useful commands
6495

6596
- Check source is valid with `cargo check --workspace`

bacon.toml

+169
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
# This is a configuration file for the bacon tool
2+
#
3+
# Bacon repository: https://github.com/Canop/bacon
4+
# Complete help on configuration: https://dystroy.org/bacon/config/
5+
# You can also check bacon's own bacon.toml file
6+
# as an example: https://github.com/Canop/bacon/blob/main/bacon.toml
7+
8+
default_job = "check"
9+
10+
[jobs.check]
11+
command = ["cargo", "check", "--color", "always"]
12+
need_stdout = false
13+
14+
[jobs.check-all]
15+
command = ["cargo", "check", "--all-targets", "--color", "always"]
16+
need_stdout = false
17+
18+
# Run clippy on the default target
19+
[jobs.clippy]
20+
command = ["cargo", "clippy", "--color", "always"]
21+
need_stdout = false
22+
23+
# Run clippy on all targets
24+
# To disable some lints, you may change the job this way:
25+
# [jobs.clippy-all]
26+
# command = [
27+
# "cargo", "clippy",
28+
# "--all-targets",
29+
# "--color", "always",
30+
# "--",
31+
# "-A", "clippy::bool_to_int_with_if",
32+
# "-A", "clippy::collapsible_if",
33+
# "-A", "clippy::derive_partial_eq_without_eq",
34+
# ]
35+
# need_stdout = false
36+
[jobs.clippy-all]
37+
command = ["cargo", "clippy", "--all-targets", "--color", "always"]
38+
need_stdout = false
39+
40+
# You can run your application and have the result displayed in bacon,
41+
# *if* it makes sense for this crate.
42+
# Don't forget the `--color always` part or the errors won't be
43+
# properly parsed.
44+
# If your program never stops (eg a server), you may set `background`
45+
# to false to have the cargo run output immediately displayed instead
46+
# of waiting for program's end.
47+
[jobs.run]
48+
command = [
49+
"cargo",
50+
"run",
51+
"--color",
52+
"always",
53+
# put launch parameters for your program behind a `--` separator
54+
]
55+
need_stdout = true
56+
allow_warnings = true
57+
background = true
58+
59+
# You may define here keybindings that would be specific to
60+
# a project, for example a shortcut to launch a specific job.
61+
# Shortcuts to internal functions (scrolling, toggling, etc.)
62+
# should go in your personal global prefs.toml file instead.
63+
[keybindings]
64+
# alt-m = "job:my-job"
65+
c = "job:clippy-all" # comment this to have 'c' run clippy on only the default target
66+
1 = "job:test-spec-no-watch"
67+
2 = "job:test-staging-no-watch"
68+
3 = "job:test-all-no-watch"
69+
4 = "job:test-spec"
70+
5 = "job:test-staging"
71+
6 = "job:test-all"
72+
73+
[jobs.test-spec]
74+
command = [
75+
"cargo",
76+
"test",
77+
"-p",
78+
"ezno-checker-specification",
79+
"--color",
80+
"always",
81+
"--",
82+
"--color",
83+
"always",
84+
]
85+
need_stdout = true
86+
watch = ["checker", "parser"]
87+
88+
[jobs.test-staging]
89+
command = [
90+
"cargo",
91+
"test",
92+
"-p",
93+
"ezno-checker-specification",
94+
"-F",
95+
"staging",
96+
"--color",
97+
"always",
98+
"--",
99+
"--color",
100+
"always",
101+
]
102+
need_stdout = true
103+
watch = ["checker", "parser"]
104+
105+
[jobs.test-all]
106+
command = [
107+
"cargo",
108+
"test",
109+
"-p",
110+
"ezno-checker-specification",
111+
"-F",
112+
"all",
113+
"--color",
114+
"always",
115+
"--",
116+
"--color",
117+
"always",
118+
]
119+
need_stdout = true
120+
watch = ["checker", "parser"]
121+
122+
[jobs.test-spec-no-watch]
123+
command = [
124+
"cargo",
125+
"test",
126+
"-p",
127+
"ezno-checker-specification",
128+
"--color",
129+
"always",
130+
"--",
131+
"--color",
132+
"always",
133+
]
134+
need_stdout = true
135+
default_watch = false
136+
137+
[jobs.test-staging-no-watch]
138+
command = [
139+
"cargo",
140+
"test",
141+
"-p",
142+
"ezno-checker-specification",
143+
"-F",
144+
"staging",
145+
"--color",
146+
"always",
147+
"--",
148+
"--color",
149+
"always",
150+
]
151+
need_stdout = true
152+
default_watch = false
153+
154+
[jobs.test-all-no-watch]
155+
command = [
156+
"cargo",
157+
"test",
158+
"-p",
159+
"ezno-checker-specification",
160+
"-F",
161+
"all",
162+
"--color",
163+
"always",
164+
"--",
165+
"--color",
166+
"always",
167+
]
168+
need_stdout = true
169+
default_watch = false

0 commit comments

Comments
 (0)