Skip to content

Commit 93bc374

Browse files
authored
chore(scripts): auto-refresh dist/ before build-manifest (#1490)
* chore(scripts): auto-refresh dist/ before build-manifest `build-manifest.ts` is invoked via tsx so its own imports go to TS source, but the adapter `.js` files it loads import `@jackwener/opencli/registry` through package exports, which resolves to `dist/src/registry-api.js`. When `dist/` is stale relative to `src/` (e.g. a contributor edits `src/registry.ts` and runs only `npm run build-manifest` instead of the full `npm run build`), the stale dist drops fields like `siteSession` from the rebuilt manifest. CI catches the resulting diff via the "cli-manifest.json is up-to-date" gate, but locally it surfaces as mysterious unrelated diff lines for adapter files the contributor never touched. Add an npm pre-script that runs `tsc --build` (incremental, ~0.6s when warm) so `npm run build-manifest` is safe to use directly. `npm run build` is unchanged — it still does the full `clean-dist + tsc + copy-yaml + build-manifest` sequence, and `prebuild-manifest` will be a no-op there since TS is already compiled by the time it runs. Verified: - `rm -rf dist && npm run build-manifest` now restores dist via the pre-hook and produces a 0-line diff against committed manifest - `npm run build` still produces the same clean output * fix(scripts): force manifest dist refresh * fix(scripts): avoid duplicate manifest compile
1 parent eb59b74 commit 93bc374

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"scripts": {
4242
"dev": "tsx src/main.ts",
4343
"dev:bun": "bun src/main.ts",
44-
"build": "npm run clean-dist && tsc && npm run copy-yaml && npm run build-manifest",
44+
"build": "npm run clean-dist && npm run copy-yaml && npm run build-manifest",
45+
"prebuild-manifest": "tsc --build",
4546
"build-manifest": "tsx src/build-manifest.ts",
4647
"clean-dist": "node scripts/clean-dist.cjs",
4748
"copy-yaml": "node scripts/copy-yaml.cjs",

0 commit comments

Comments
 (0)