motely-wasm 20.0.1 → 20.0.2

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
@@ -10,25 +10,12 @@ npm install motely-wasm
10
10
 
11
11
  ## Boot
12
12
 
13
- The WASM binary is **sideloaded** a separate `dist/bin/motely-wasm.wasm`, **not** base64-embedded so `boot()` **must** be told where to find it. A no-arg `boot()` will not load the runtime and every search silently does nothing.
14
-
15
- In Node, read the bytes and pass them directly (`fetch` can't read `file://` URLs):
13
+ The WASM binary is **embedded** in the JS moduleno extra files to serve.
16
14
 
17
15
  ```js
18
- import { readFile } from "node:fs/promises";
19
- import { dirname, resolve } from "node:path";
20
- import { fileURLToPath } from "node:url";
21
16
  import bootsharp from "motely-wasm";
22
17
 
23
- const dist = resolve(dirname(fileURLToPath(import.meta.url)), "node_modules/motely-wasm/dist");
24
- const wasm = await readFile(resolve(dist, "bin", bootsharp.manifest.wasm));
25
- await bootsharp.boot({ wasm });
26
- ```
27
-
28
- In the browser, pass the root URL your host serves `dist/` at:
29
-
30
- ```js
31
- await bootsharp.boot("/motely-wasm/dist");
18
+ await bootsharp.boot();
32
19
  ```
33
20
 
34
21
  Guard re-boots with `bootsharp.getStatus() === bootsharp.BootStatus.Standby`.
@@ -110,7 +97,7 @@ import * as fs from "@rewaffle/bootsharp-file-system";
110
97
  import { Bootsharp } from "motely-wasm/dist/generated/modules/bootsharp/file-system.g.mjs";
111
98
 
112
99
  fs.init(Bootsharp.FileSystem.FileMounter);
113
- await bootsharp.boot("/motely-wasm/dist");
100
+ await bootsharp.boot();
114
101
  ```
115
102
 
116
103
  ## Jimmolate
package/RELEASE.md ADDED
@@ -0,0 +1,139 @@
1
+ # Releasing motely-wasm to npm — the real pipeline
2
+
3
+ This is the finished reasoning for "how do you update the README and the package
4
+ without hand-editing anything," grounded in the Bootsharp docs and the actual
5
+ state of this repo. It replaces the don't-touch comment in `Motely.Wasm.csproj`
6
+ with an *understanding* of why that comment exists and what the correct fix is.
7
+
8
+ ## What ships, and from where
9
+
10
+ `npm publish` runs from **`motely-wasm/`** (this directory). npm packs three
11
+ things from here, regardless of any `files` field:
12
+
13
+ | File | Owner today | Owner it should have |
14
+ |------|-------------|----------------------|
15
+ | `package.json` | hand-maintained | **npm** owns the version; structure hand-authored |
16
+ | `README.md` | hand-created (was *missing* for 20 weeks) | authored here, single source |
17
+ | `dist/` | Bootsharp build output (`BootsharpPublishDirectory`) | Bootsharp, regenerated on build |
18
+
19
+ `dist/bin/motely-wasm.wasm` is the sideloaded runtime (`BootsharpBinariesDirectory`
20
+ is set → separate `.wasm`, not base64-embedded → `boot()` MUST be told where it is;
21
+ that is the whole reason for the boot section in `README.md`).
22
+
23
+ ## The root bug: two version sources, already drifted
24
+
25
+ There are **two** places a version lives, and they are out of sync right now:
26
+
27
+ - `Directory.Packages.props` → `<MotelyVersion>20.0.0</MotelyVersion>` — the **.NET
28
+ assembly version**, consumed solution-wide (`Motely.csproj`, `Motely.Wasm.csproj`
29
+ both do `<Version>$(MotelyVersion)</Version>`).
30
+ - `motely-wasm/package.json` → `"version": "20.0.1"` — the **npm package version**,
31
+ the one users actually `npm install`.
32
+
33
+ The published `20.0.1` is the `20.0.0` engine + a fixed README. That patch bump is
34
+ *semantically correct* (docs-only fix), but it was done by **hand-typing `20.0.1`
35
+ into package.json**, which is exactly the foot-gun: a human typing a version is a
36
+ human introducing drift.
37
+
38
+ These two versions are genuinely different concerns and **may** legitimately
39
+ diverge (a README-only npm patch should not force an engine version bump). The fix
40
+ is not "force them equal" — it's "make each one bumped by a tool, never by hand."
41
+
42
+ ## Why Bootsharp can't own package.json
43
+
44
+ Bootsharp regenerates `package.json` on every build with a **bare** template — look
45
+ at `Motely.Wasm/obj/package.json` (where it's currently parked):
46
+
47
+ ```json
48
+ { "name": "motely-wasm", "type": "module", "exports": {...}, "browser": {...} }
49
+ ```
50
+
51
+ No `version`, no `main`, no `types`, no `author`, no `license`, no `description`.
52
+ Publishing that fails (`npm publish` with no version → the `reading 'prerelease'`
53
+ crash the csproj comment warns about). Per the Bootsharp docs, `BootsharpPackageDirectory`
54
+ defaults to the project dir and Bootsharp **overwrites** the file there on every
55
+ build. So pointing it at the real npm root clobbers the rich manifest every build.
56
+
57
+ The current mitigation — redirect `BootsharpPackageDirectory` to `obj/` and
58
+ hand-author `motely-wasm/package.json` — is **correct**. Don't undo it. The bare
59
+ template genuinely lacks what npm needs, and Bootsharp offers no hook to enrich it.
60
+
61
+ ## The correct ownership split
62
+
63
+ ```
64
+ Directory.Packages.props : MotelyVersion — engine/assembly version, bump for ENGINE releases
65
+ motely-wasm/package.json : "version" — npm package version, bump with `npm version patch`
66
+ motely-wasm/package.json : everything else — stable, hand-authored, rarely changes
67
+ motely-wasm/README.md — authored HERE (package root), single source
68
+ motely-wasm/dist/ — Bootsharp output, never hand-touched
69
+ Motely.Wasm/obj/package.json — Bootsharp's throwaway bare template, ignored
70
+ ```
71
+
72
+ The "no hand-editing" rule applies to the **version field specifically**. You never
73
+ type a version again — `npm version patch` does. The rest of package.json (exports
74
+ map with types, browser shims, author) is a small stable file; authoring it once by
75
+ hand is fine and *better* than a generator that drops the fields npm requires.
76
+
77
+ ## The release command (zero hand-edits)
78
+
79
+ From `motely-wasm/`:
80
+
81
+ ```sh
82
+ npm version patch # 20.0.1 -> 20.0.2 in package.json AND creates the git tag v20.0.2
83
+ npm publish # packs package.json + README.md + dist/, pushes to npm
84
+ ```
85
+
86
+ `npm version patch` is the tool that "knows" — it edits the version *and* tags git
87
+ atomically. Never open package.json to change the version.
88
+
89
+ ### Make it bulletproof with npm lifecycle scripts (the real automation)
90
+
91
+ Add to `motely-wasm/package.json` so a stale `dist/` can never ship:
92
+
93
+ ```json
94
+ "scripts": {
95
+ "build": "dotnet publish ../Motely.Wasm/Motely.Wasm.csproj -c Release",
96
+ "prepublishOnly": "npm run build"
97
+ }
98
+ ```
99
+
100
+ `prepublishOnly` runs **after** `npm version patch` bumps the version and **before**
101
+ the tarball is packed — so `npm publish` always ships a freshly built `dist/` that
102
+ matches. (`dotnet publish` in Release is the Bootsharp path that emits `dist/` +
103
+ the sideloaded wasm; see Bootsharp `getting-started.md` / `build-config.md`.)
104
+
105
+ > Not yet wired — this is the one concrete edit the next session should make and
106
+ > test with `npm publish --dry-run`. Left undone tonight on purpose (handoff, not
107
+ > a 2am publish).
108
+
109
+ ## The README: one source, here
110
+
111
+ `Motely.Wasm/README.md` (the C# project dir) is **stale v19** — it documents the
112
+ removed `jimmolateProbe` / `MotelySingleSearchContext`. It is NOT what ships and
113
+ should be deleted or treated as dead. The shipping README is **`motely-wasm/README.md`**
114
+ (this dir), authored against the live v20 surface. Keep exactly one. Don't add a
115
+ build "copy README" step that creates a second source to drift — author it where it
116
+ ships.
117
+
118
+ ## What's drifted right now (reconcile when clear-headed)
119
+
120
+ - `MotelyVersion` is `20.0.0`; npm is `20.0.1`. The published wasm reports `20.0.0`
121
+ internally. Cosmetic, not breaking. If you want them re-aligned, bump
122
+ `MotelyVersion` to match at the next engine touch and rebuild — don't republish
123
+ just for this.
124
+ - The `Motely.Wasm.csproj` comment block says "DO NOT re-add a FinalizeNpmPackage
125
+ target." That advice is still right (Bootsharp's bare template can't be the
126
+ source), but the *reason* is now written down here instead of as a scar.
127
+
128
+ ## Docs citations
129
+
130
+ - Bootsharp `build-config.md`: `BootsharpPackageDirectory` (default = project dir,
131
+ "Directory to publish package.json"), `BootsharpPublishDirectory`,
132
+ `BootsharpBinariesDirectory`.
133
+ - Bootsharp `sideloading.md`: binaries dir **set** → separate `.wasm`, `boot()` takes
134
+ a root URL or `{ wasm }` bytes (the v20 boot contract — see `README.md`).
135
+ - Bootsharp `getting-started.md`: `dotnet publish` (Release) produces the module +
136
+ `package.json`; Release auto-enables NativeAOT-LLVM + trimming.
137
+ - npm: `package.json` / `README.md` / `LICENSE` always ship regardless of `files`;
138
+ `npm version <patch|minor|major>` bumps version + tags git; `npm publish --dry-run`
139
+ to verify the tarball before pushing.