Skip to content

Commit f767ea5

Browse files
Add scripts to CONTRIBUTING
1 parent b0f54fe commit f767ea5

1 file changed

Lines changed: 87 additions & 4 deletions

File tree

CONTRIBUTING.md

Lines changed: 87 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,89 @@ like.
107107

108108
Find all _technical_ details in [the doc about 📝 Comments][docs-comments].
109109

110+
## Tools
110111

111-
[issue-discussion]: https://github.com/exercism/javascript-analyzer/issues?q=is%3Aopen+is%3Aissue+label%3A%22discussion%22%3Aspeech_balloon%3A
112-
[issue-new-exercise]: https://github.com/exercism/javascript-analyzer/labels/new%20exercise%20%3Asparkles%3A
113-
[sample-resistor-color]: https://github.com/exercism/javascript-analyzer/issues/13
112+
We use various tools to maintain this repository and this analyzer. In order
113+
to contribute to the _code_ of this track, you'll need NodeJS (LTS or higher)
114+
installed, with some of the [`bin/*`][file-bin] files having extra dependencies,
115+
as listed in their file-level commentary.
116+
117+
### `analyze` (.sh, .bat)
118+
119+
```shell
120+
./bin/analyze.sh two-fer ~/folder/to/solution -dcp
121+
```
122+
123+
This runs the analyzer using `two-fer` as exercise and a path to a solution.
124+
Most scripts, including this one, accept a wide range of flags to change or
125+
enhance the behaviour, as coded in [`execution_options.ts`][file-execution-options].
126+
127+
Run with the `-h` / `--help` flag to get a list of flags and their description.
128+
129+
```shell
130+
./bin/analyze.sh --help
131+
```
132+
133+
You'll most likely want `-dcp` (`--debug`,`--console` and `--pretty`) during
134+
development, which enables console output (instead of `stdout`/`stderr`) and
135+
shows `logger.log` as well as `logger.error` and `logger.fatal`. It will also
136+
format the output JSON with 2 space indentation, both in the output file and
137+
the console.
138+
139+
If you wish to _preview_ the actual messages, pass in `--noTemplates` to use
140+
the analyzer `Comment`Factories to generate actual messages. If the comment
141+
factories are kept in-sync with `website-copy`, it will be the exact same
142+
output as on the site.
143+
144+
### `batch` (.sh, .bat)
145+
146+
```shell
147+
./bin/batch.sh two-fer -cp
148+
```
149+
150+
Runs all the fixtures in `~/test/fixtures/two-fer` through the analyzer, giving
151+
a summary at the end with all results. This places an `analysis.json` in the
152+
source fixture folder.
153+
154+
You'll most likely want `-cp` (`--console` and `--pretty`) during development,
155+
which enables console output (instead of `stdout`/`stderr`) and formats the
156+
output JSON with 2 space indentation.
157+
158+
If you wish to _preview_ the actual messages, pass in `--noTemplates` to use
159+
the analyzer `Comment`Factories to generate actual messages. If the comment
160+
factories are kept in-sync with `website-copy`, it will be the exact same
161+
output as on the site.
162+
163+
### `remote` (.sh, .bat)
164+
165+
```shell
166+
./bin/remote.sh https://exercism.io/tracks/javascript/exercises/two-fer/solutions/df3bb5d7131c44ea9c62206cc8d6c225 -dcp --dry
167+
```
168+
169+
You need the [`exercism` cli][cli] in order for this to work. It takes an
170+
_exercism solution url_. and downloads it using the `exercism` cli. It then
171+
runs the analyzer on it.
172+
173+
You'll most likely want `-dcp --dry` (`--debug`, `--pretty`, `--console` and
174+
`dry run`) during development, which enables console output (instead of
175+
`stdout`/`stderr`), shows `logger.log` as well as `logger.error` and
176+
`logger.fatal`, pretty prints the JSON output and disables writing the output
177+
to `analysis.json`.
178+
179+
You can pass the following type of URLs:
180+
181+
- Published solutions: `/tracks/javascript/exercises/<slug>/<id>`
182+
- Mentor solutions: `/mentor/solutions/<id>`
183+
- Your solutions: `/my/solutions/<id>`
184+
- Private solutions: `/solutions/<id>`
185+
186+
If you wish to _preview_ the actual messages, pass in `--noTemplates` to use
187+
the analyzer `Comment`Factories to generate actual messages. If the comment
188+
factories are kept in-sync with `website-copy`, it will be the exact same
189+
output as on the site.
190+
191+
[ast-explorer]: https://astexplorer.net/
192+
[cli]: https://github.com/exercism/cli
114193
[contributing-javascript]: https://github.com/exercism/javascript/blob/master/CONTRIBUTING.md
115194
[contributing-typescript]: https://github.com/exercism/typescript/
116195
[contributing-typescript-analyzer]: https://github.com/exercism/typescript-analyzer/blob/master/CONTRIBUTING.md
@@ -121,5 +200,9 @@ Find all _technical_ details in [the doc about 📝 Comments][docs-comments].
121200
[docs-comments]: /docs/comments.md
122201
[docs-interface]: https://github.com/exercism/automated-mentoring-support/blob/master/docs/interface.md
123202
[docs-guidelines]: https://github.com/exercism/automated-mentoring-support/blob/master/docs/guidelines.md
203+
[file-bin]: https://github.com/exercism/javascript-analyzer/tree/master/bin
204+
[file-execution-options]: https://github.com/exercism/javascript-analyzer/blob/master/src/utils/execution_options.ts
205+
[issue-discussion]: https://github.com/exercism/javascript-analyzer/issues?q=is%3Aopen+is%3Aissue+label%3A%22discussion%22%3Aspeech_balloon%3A
206+
[issue-new-exercise]: https://github.com/exercism/javascript-analyzer/labels/new%20exercise%20%3Asparkles%3A
124207
[mentor-notes]: https://github.com/exercism/website-copy/tree/master/tracks/javascript/exercises
125-
[ast-explorer]: https://astexplorer.net/
208+
[sample-resistor-color]: https://github.com/exercism/javascript-analyzer/issues/13

0 commit comments

Comments
 (0)