chore(wasm): collapse js/ into root, keep TS sources in src/#606
Merged
chore(wasm): collapse js/ into root, keep TS sources in src/#606
Conversation
The Wasm wrapper used to live under `js/` while the legacy JS impl sat at the root. After #605 dropped the legacy impl the dual layout was no longer load-bearing, just confusing — `package.json` at the root was a stub `private: true` shim while the real package.json that publishes to npm lived one directory deeper. Moves (preserving git history via `git mv`) ------------------------------------------- - js/{build.config.ts, cli.ts, entry.ts, index.ts, progress.ts, proxy.{js,ts}, tracing.ts, tsconfig.json, utils.ts, worker.ts, ximgdiff.ts, reg.wasm} → root - js/sample/ → sample/ - js/test/ → test/ - js/package.json → root package.json (overwrites the stub; keeps the top-level `packageManager` field and adds a `repository` block) - js/pnpm-lock.yaml → root pnpm-lock.yaml Path adjustments ---------------- - build.config.ts: `repoRoot = resolve(here, '..')` → just `here`. - test/{cli,library}.test.mjs: REPO/SAMPLE_REL/CLI/DIST/TMP_ROOT_* drop the leading `js/` segment. - scripts/build-wasm.sh: copies to `./reg.wasm` (was `js/reg.wasm`). - .github/workflows/ci.yml: drop `working-directory: js` from install/ build/test steps; rename them. - .gitignore: collapse the workspace path. Verification ------------ - `pnpm install --frozen-lockfile` ✓ - `pnpm build` ✓ (dist regenerated; `reg-cli-wasm.*` chunks identical byte-for-byte to pre-collapse) - `pnpm test` → 38 / 38 ✓ - `cargo +stable test -p reg_core --lib --locked` → 12 / 12 ✓ - `npm pack --dry-run` → publishable as `@bokuweb/reg-cli-wasm@0.0.0-experimental6` (32 files, 926 kB) - end-to-end: `node ./dist/cli.mjs ./sample/actual ./sample/expected /tmp/diff -I` exits 0 with classic per-file output. The package still publishes as `@bokuweb/reg-cli-wasm`. Renaming back to `reg-cli` is the next step once a publish dry-run lands cleanly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reverts the visual flatness from the previous collapse. Having a dozen
.ts files at the repo root next to package.json / Cargo.toml /
README.md was hard to scan; the npm convention is `src/` for the
TypeScript sources and the root for package metadata + build config.
Moved (history-preserving git mv): cli.ts, entry.ts, index.ts,
progress.ts, proxy.{js,ts}, tracing.ts, utils.ts, worker.ts,
ximgdiff.ts → src/
Build config:
- build.config.ts entries → ./src/{index,cli,worker,entry}.ts
- tsconfig.json `include` → ./src/**/*.ts
Stays at root: package.json, pnpm-lock.yaml, build.config.ts,
tsconfig.json, reg.wasm, sample/, test/, scripts/, crates/, template/,
report/.
Verified: pnpm build → identical tarball (`shasum 0d8db1e5...`,
926.6 kB, 32 files) as the flat layout. pnpm test → 38/38.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
After #605 dropped the legacy JS impl, the dual
root/+js/layout was no longer load-bearing —package.jsonat the root was just aprivate: truestub while the real package.json that publishes to npm lived one directory deeper.This PR collapses
js/into the repo root so the root is the published package, then organises the TypeScript sources intosrc/(the npm convention — keeps the root scannable instead of dumping a dozen .ts files next to package.json / Cargo.toml / README).The package still publishes as
@bokuweb/reg-cli-wasm@0.0.0-experimental6. Renaming toreg-cliis the next step once a publish dry-run lands cleanly.Final layout
package.json,pnpm-lock.yaml,tsconfig.json,build.config.ts,reg.wasm,Cargo.toml/Cargo.lock,rust-toolchain.toml,README.md…src/: cli.ts, entry.ts, index.ts, progress.ts, proxy.{js,ts}, tracing.ts, utils.ts, worker.ts, ximgdiff.tstest/,sample/,crates/,template/,report/,scripts/,bench/,docs/: unchangedMoves (history-preserving git mv)
js/{*.ts, *.js, package.json, pnpm-lock.yaml, reg.wasm}→ root, then*.{ts,js}→src/js/sample/→sample/js/test/→test/Path adjustments
build.config.ts:repoRoot = resolve(here, '..')→ justhere; entries →./src/{index,cli,worker,entry}.tstsconfig.json:include→./src/**/*.tstest/{cli,library}.test.mjs: REPO/SAMPLE_REL/CLI/DIST/TMP_ROOT_* drop the leadingjs/segmentscripts/build-wasm.sh: copies to./reg.wasm(wasjs/reg.wasm).github/workflows/ci.yml: dropworking-directory: js; rename steps.gitignore: collapse the workspace pathVerification
pnpm install --frozen-lockfile✓pnpm build✓ (dist regenerated; tarball shasum identical byte-for-byte to pre-collapse:0d8db1e5...)pnpm test→ 38 / 38 ✓cargo +stable test -p reg_core --lib --locked→ 12 / 12 ✓npm pack --dry-run→ publishable as@bokuweb/reg-cli-wasm@0.0.0-experimental6(32 files, 926.6 kB)Test plan
npm publish --dry-run(or actual publish) succeeds; once that's confirmed, thereg-clirename PR is unblocked.🤖 Generated with Claude Code