@exercism/codemirror-lang-rescript 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +68 -27
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.0.1
2
+
3
+ The README is restructured. This release is the first published from GitHub Actions, with npm provenance.
4
+
1
5
  ## 1.0.0
2
6
 
3
7
  This is Exercism's first release of the package, published as
package/README.md CHANGED
@@ -1,28 +1,14 @@
1
1
  # rescript-lezer
2
2
 
3
- This is a ReScript grammar for the
4
- [lezer](https://lezer.codemirror.net/) parser system.
5
-
6
3
  ## Exercism's fork
7
4
 
8
- This branch is Exercism's fork of [tsnobip/rescript-lezer](https://github.com/tsnobip/rescript-lezer), by tsnobip.
9
- It is published as `@exercism/codemirror-lang-rescript` and powers ReScript in the editor on [exercism.org](https://exercism.org).
10
- Upstream's `main` stays as it is, and our work is on the `exercism` branch.
11
-
12
- Install it with:
13
-
14
- ```bash
15
- npm install @exercism/codemirror-lang-rescript
16
- ```
17
-
18
- The package keeps upstream's `parser` export and adds CodeMirror 6 support:
19
-
20
- ```js
21
- import {rescript} from "@exercism/codemirror-lang-rescript"
22
-
23
- new EditorView({extensions: [basicSetup, rescript()], parent: document.body})
24
- ```
5
+ This is Exercism's fork of [tsnobip/rescript-lezer](https://github.com/tsnobip/rescript-lezer), by tsnobip.
6
+ Exercism uses it in the ReScript editor on [exercism.org](https://exercism.org).
7
+ It is published on npm as `@exercism/codemirror-lang-rescript`.
8
+ Our changes are on the `exercism` branch, and the `main` branch follows upstream.
9
+ Below this section, the README is upstream's.
25
10
 
11
+ The package keeps upstream's `parser` export and adds CodeMirror 6 support.
26
12
  `rescript()` gives highlighting, indentation, folding and completion. Completion offers:
27
13
 
28
14
  - keywords, global functions such as `ignore`, the standard library's module names, and constructors such as `Some` and `Ok`.
@@ -45,11 +31,51 @@ The fork also changes the grammar so that it parses all of the ReScript track's
45
31
  - Value signatures such as `let keep: array<int> => array<int>` can appear at the top level. Exercism's editor uses one language for both `.res` and `.resi` files.
46
32
  - In `list{first, ...rest}`, `rest` is a binding.
47
33
 
48
- To parse a single expression instead of a full program, set the `top` option to `"SingleExpression"`.
34
+ ### Install and use
35
+
36
+ To install it, run:
37
+
38
+ ```bash
39
+ npm install @exercism/codemirror-lang-rescript
40
+ ```
41
+
42
+ Then add `rescript()` to the editor's extensions:
43
+
44
+ ```js
45
+ import {rescript} from "@exercism/codemirror-lang-rescript"
46
+
47
+ new EditorView({extensions: [basicSetup, rescript()], parent: document.body})
48
+ ```
49
49
 
50
- ## Building and testing
50
+ ### Building and testing
51
51
 
52
52
  Run `npm install`, which also builds the package into `dist/`. Run `npm run build` to rebuild it and `npm test` to run the tests.
53
+ `.github/workflows/test.yml` runs `npm test`.
54
+ To run upstream's grammar audit, described below, first run `npm install --no-save @rescript/runtime@12`.
55
+
56
+ ### Releasing
57
+
58
+ To release from the `exercism` branch, set `version` in `package.json` and push a tag of the same version:
59
+
60
+ ```bash
61
+ npm version patch # or minor / major
62
+ git push origin HEAD --follow-tags
63
+ ```
64
+
65
+ `npm version` updates the package and lockfile, commits the change, and creates the version tag. The tag starts `.github/workflows/publish.yml`. The workflow checks that the tag matches `package.json`, builds and tests the package, and publishes it to npm as `@exercism/codemirror-lang-rescript`, using the `exercism` organisation's `NPM_TOKEN` secret.
66
+
67
+ ### Contributing
68
+
69
+ Contributions to this fork follow the Exercism [Code of Conduct](https://exercism.org/docs/using/legal/code-of-conduct).
70
+ Please read about how to [contribute to Exercism](https://exercism.org/docs/building).
71
+
72
+ ---
73
+
74
+ This is a ReScript grammar for the
75
+ [lezer](https://lezer.codemirror.net/) parser system.
76
+
77
+ The `top` option can be set to `"SingleExpression"` to parse an expression instead of a
78
+ full program.
53
79
 
54
80
  ## Grammar Audit
55
81
 
@@ -69,7 +95,6 @@ cd ../..
69
95
  ### Quick run
70
96
 
71
97
  ```bash
72
- npm install --no-save @rescript/runtime@12
73
98
  npm run build
74
99
  npm run audit:grammar
75
100
  ```
@@ -85,8 +110,8 @@ checkout. It also compares fresh and incremental trees across 1,000 reproducible
85
110
  It fails on compiler-valid parse errors, incremental mismatches, or crashes.
86
111
  Compiler-rejected fixtures remain visible in the full differential audit.
87
112
 
88
- Upstream's GitHub Actions run this corpus check on pushes and pull requests.
89
- On the `exercism` branch, `.github/workflows/test.yml` runs only `npm test`.
113
+ GitHub Actions runs `npm test` and this corpus check on pushes and pull requests,
114
+ and saves the JSON audit report as the `grammar-audit` artifact.
90
115
 
91
116
  ### Strict agreement
92
117
 
@@ -119,13 +144,29 @@ against another compiler checkout.
119
144
 
120
145
  ## Publishing
121
146
 
122
- To release from the `exercism` branch, set `version` in `package.json` and push a tag of the same version:
147
+ Version tags (`v0.9.1`, for example) trigger `.github/workflows/publish.yml`.
148
+ The workflow runs the full test suite and corpus check, verifies that the tag
149
+ matches `package.json`, then builds and publishes to npm. Only stable versions
150
+ are supported.
151
+
152
+ Before the first automated release, push the workflow and configure a
153
+ [Trusted Publisher](https://docs.npmjs.com/trusted-publishers/) in the npm settings
154
+ for `@tsnobip/rescript-lezer`:
155
+
156
+ - GitHub user: `tsnobip`
157
+ - Repository: `rescript-lezer`
158
+ - Workflow filename: `publish.yml`
159
+ - Allow direct publishing with `npm publish`
160
+
161
+ Publishing uses OIDC, so no npm token secret is needed.
162
+ To release from a clean checkout of the release branch:
123
163
 
124
164
  ```bash
125
165
  npm version patch # or minor / major
126
166
  git push origin HEAD --follow-tags
127
167
  ```
128
168
 
129
- `npm version` updates the package and lockfile, commits the change, and creates the version tag. The tag starts `.github/workflows/publish.yml`. The workflow checks that the tag matches `package.json`, builds and tests the package, and publishes it to npm as `@exercism/codemirror-lang-rescript`, using the `exercism` organisation's `NPM_TOKEN` secret.
169
+ `npm version` updates the package and lockfile, commits the change, and creates
170
+ the version tag. Failed workflow runs can be rerun from GitHub Actions.
130
171
 
131
172
  The code is licensed under an MIT license.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exercism/codemirror-lang-rescript",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "ReScript language support for CodeMirror, with a Lezer grammar and autocompletion",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",