lawspec 0.2.0 → 0.2.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.
package/README.md CHANGED
@@ -8,28 +8,35 @@ WebAssembly with a Node CLI and an asynchronous, typed JavaScript API.
8
8
 
9
9
  ## Install and try it
10
10
 
11
- The checkout includes the npm package in `npm/`. Build an installable archive:
11
+ Install [LawSpec from npm](https://www.npmjs.com/package/lawspec):
12
12
 
13
13
  ```sh
14
- npm pack ./npm
15
- npm install --save-dev ./lawspec-0.2.0.tgz
14
+ npm install --save-dev lawspec@0.2.1
15
+ npx lawspec --version
16
16
  ```
17
17
 
18
- No Haskell toolchain is needed to install or run the npm package. Node 22+ and the
19
- selected target's build tools are required. The reference platforms are macOS
20
- and Linux. Stable releases are available as the `lawspec` package on npm.
18
+ Node 22+ and the selected target's build tools are required. No Haskell toolchain
19
+ is needed to install or run LawSpec. The reference platforms are macOS and Linux.
20
+ Use `npx lawspec` to run the locally installed CLI.
21
21
 
22
- From an empty application directory, use the installed `lawspec` command:
22
+ To try it in a **new, empty directory**, initialize the starter before installing
23
+ local dependencies so LawSpec can create its `package.json` and test script:
23
24
 
24
25
  ```sh
25
- lawspec init --target javascript
26
- npm install
27
- lawspec check
28
- lawspec explain 'example.atoi_codec::itoa and then atoi yields a'
29
- lawspec doctor
30
- lawspec generate
26
+ mkdir lawspec-example
27
+ cd lawspec-example
28
+ npm exec --package=lawspec@0.2.1 -- lawspec init --target javascript
29
+ npm install --save-dev lawspec@0.2.1
30
+ npx lawspec check
31
+ npx lawspec explain 'example.atoi_codec::itoa and then atoi yields a'
32
+ npx lawspec doctor
33
+ npx lawspec generate
31
34
  ```
32
35
 
36
+ In an existing project, install LawSpec first, then run
37
+ `npx lawspec init --target javascript`. Existing build files are preserved;
38
+ apply the printed dependency and test-runner setup instructions before generation.
39
+
33
40
  Implement `src/example/atoi_codec.mjs`, then run `npm test`:
34
41
 
35
42
  ```javascript
@@ -192,7 +199,7 @@ This expands to `for all (x :: Int32) . render (x) = referenceRender (x)`.
192
199
  The example inherits the input name `x` from the prelude. Both functions are
193
200
  user-owned adapter functions; either may delegate to your existing code.
194
201
 
195
- [The complete example](examples/specs/equivalent.lawspec) compares decimal
202
+ [The complete example](https://github.com/brain-fuel/lawspec/blob/v0.2.1/examples/specs/equivalent.lawspec) compares decimal
196
203
  renderers and two implementations that clamp negative integers to zero. For
197
204
  JavaScript, their adapters can be:
198
205
 
@@ -247,6 +254,10 @@ by the JS shim.
247
254
 
248
255
  ## Build and verify
249
256
 
257
+ For contributors working from a repository checkout, build a local archive with
258
+ `npm pack ./npm` and install it with `npm install --save-dev ./lawspec-0.2.1.tgz`.
259
+ The package payload lives in `npm/`.
260
+
250
261
  ```sh
251
262
  stack test
252
263
  # With wasm32-wasi-cabal and wasm32-wasi-ghc installed:
package/bin/lawspec.mjs CHANGED
@@ -153,13 +153,13 @@ async function init() {
153
153
  async function main() {
154
154
  if (!verb || ["help", "--help", "-h"].includes(verb)) {
155
155
  output(
156
- "LawSpec 0.2.0\nUsage: lawspec init --target <language> [--project <directory>]\n lawspec check | doctor | explain <unit>::<law> | generate\nOptions: --config <path>, --target <language>, --json\nGeneration: --dry-run, --check\nTargets: " +
156
+ "LawSpec 0.2.1\nUsage: lawspec init --target <language> [--project <directory>]\n lawspec check | doctor | explain <unit>::<law> | generate\nOptions: --config <path>, --target <language>, --json\nGeneration: --dry-run, --check\nTargets: " +
157
157
  targets.join(", "),
158
158
  );
159
159
  return;
160
160
  }
161
161
  if (verb === "--version") {
162
- output("0.2.0");
162
+ output("0.2.1");
163
163
  return;
164
164
  }
165
165
  if (positional.length > (verb === "explain" ? 1 : 0))
package/build.json CHANGED
@@ -17,10 +17,10 @@
17
17
  "wasm/lawspec-wasm.cabal"
18
18
  ],
19
19
  "digests": {
20
- "package.yaml": "f8d2b6bbf4308890903787813994500d4843cd08ee5bc1ae3808a49461d51380",
20
+ "package.yaml": "2cc5254bf0c1de94adbb98ee193dd45f5d8e5efced9ce255508112ccbca96793",
21
21
  "src/LawSpec/Api.hs": "00b1e4bc81231ebd387f10652463904084ebf9c3c4486fd2c2217a6d4dbfc157",
22
22
  "src/LawSpec/Compile.hs": "c1727ba7d6ece9725567f9561d341d8660b3293ff845c2de1d936ebdd2cd5fc6",
23
- "src/LawSpec/Emit.hs": "24edca3a078ea10349b3a229b56464c37bfd5303c688a11ed45f9479ce3b7bd1",
23
+ "src/LawSpec/Emit.hs": "4e223dfc975c5b66021e7a012a063edd159fe38ca12df7d009aa3de472a2e646",
24
24
  "src/LawSpec/Gen.hs": "b283001bc18971ddb2159f2ec7e51ac58aa7e191b52577006140694b09a06987",
25
25
  "src/LawSpec/Model.hs": "8f501e134cd1480261ae8bb9e3df8255efd38a02eb883468c6bc2c342e200970",
26
26
  "src/LawSpec/Parser.hs": "f546502c6eedb0a4ccd30d11e3b017aedf5a7145080ea58cfd34753fd9b509c6",
@@ -30,8 +30,8 @@
30
30
  "wasm/app/Exports.hs": "4ecbdac8faa2449e6fc61b93c82e6278fa14374154f29b4dacf0eef433f06a47",
31
31
  "wasm/cabal.project": "021e560afdc5eb4cb7169e7119ecb8f92c9ee170245af909c94b612941bff5cc",
32
32
  "wasm/cabal.project.freeze": "733dbed3d2ecccb26e874fd58f136296dad772184deb1658c196b5d54a0814dc",
33
- "wasm/lawspec-wasm.cabal": "48a9a7587f183565043e313e20e531c72d2eeb4ec706a1052ff0e7b461961002",
34
- "npm/core.wasm": "fe4048e604bbdf5ddbecf9ea2e9b27ac60161788fff35524cbcf9825e2e8faeb",
33
+ "wasm/lawspec-wasm.cabal": "139de82d2d6063eb82fc86438a82e59d9b9315318009cad199f488bca14cb56d",
34
+ "npm/core.wasm": "943abf2084a7395ef6c5441ef4fd93aa0d57e581a0e71723bf6187afa2c3b48c",
35
35
  "npm/core_jsffi.js": "88d136efe92f7cff5758c8fec8d9b6bbc9707fe37741cebeeb415fe34ce3d72b",
36
36
  "npm/api.mjs": "d6df654600172131ac66a55b86876fc29cde2a76a0a63bbefff3183488a4837b",
37
37
  "npm/index.d.ts": "8003304d88dbb01a07bd3dbdc4d680a193db1ec323c5712b9860e166ca9cc94b"
package/core.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lawspec",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "State the law once. Check it everywhere.",
5
5
  "license": "MIT",
6
6
  "type": "module",