Files
jackwener__opencli/package.json
jakevin 93bc374437 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
2026-05-12 04:00:24 +08:00

103 lines
3.4 KiB
JSON

{
"name": "@jackwener/opencli",
"version": "1.7.18",
"publishConfig": {
"access": "public"
},
"description": "Make any website or Electron App your CLI. AI-powered.",
"engines": {
"node": ">=21.0.0"
},
"type": "module",
"main": "dist/src/main.js",
"bin": {
"opencli": "dist/src/main.js"
},
"exports": {
".": "./dist/src/main.js",
"./registry": "./dist/src/registry-api.js",
"./errors": "./dist/src/errors.js",
"./types": "./dist/src/types.js",
"./utils": "./dist/src/utils.js",
"./logger": "./dist/src/logger.js",
"./launcher": "./dist/src/launcher.js",
"./browser/cdp": "./dist/src/browser/cdp.js",
"./browser/page": "./dist/src/browser/page.js",
"./browser/utils": "./dist/src/browser/utils.js",
"./download": "./dist/src/download/index.js",
"./download/article-download": "./dist/src/download/article-download.js",
"./download/media-download": "./dist/src/download/media-download.js",
"./download/progress": "./dist/src/download/progress.js",
"./pipeline": "./dist/src/pipeline/index.js"
},
"files": [
"dist/src/",
"clis/",
"cli-manifest.json",
"scripts/",
"README.md",
"LICENSE"
],
"scripts": {
"dev": "tsx src/main.ts",
"dev:bun": "bun src/main.ts",
"build": "npm run clean-dist && npm run copy-yaml && npm run build-manifest",
"prebuild-manifest": "tsc --build",
"build-manifest": "tsx src/build-manifest.ts",
"clean-dist": "node scripts/clean-dist.cjs",
"copy-yaml": "node scripts/copy-yaml.cjs",
"start": "node dist/src/main.js",
"start:bun": "bun dist/src/main.js",
"preuninstall": "node -e \"fetch('http://127.0.0.1:'+(process.env.OPENCLI_DAEMON_PORT||'19825')+'/shutdown',{method:'POST',headers:{'X-OpenCLI':'1'},signal:AbortSignal.timeout(3000)}).catch(()=>{})\" || true",
"postinstall": "node scripts/postinstall.js || true; node scripts/fetch-adapters.js || true",
"typecheck": "tsc --noEmit",
"prepare": "[ -d src ] && npm run build || true",
"prepublishOnly": "npm run build",
"test": "vitest run --project unit --project extension --project adapter",
"test:bun": "bun vitest run --project unit --project extension --project adapter",
"test:adapter": "vitest run --project adapter",
"test:all": "vitest run",
"test:e2e": "vitest run --project e2e",
"advise:listing-id-pairing": "node scripts/check-listing-id-pairing.mjs",
"check:silent-column-drop": "node scripts/check-silent-column-drop.mjs",
"check:typed-error-lint": "node scripts/check-typed-error-lint.mjs",
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs"
},
"keywords": [
"cli",
"browser",
"web",
"ai"
],
"author": "jackwener",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/jackwener/opencli.git"
},
"dependencies": {
"@mozilla/readability": "^0.6.0",
"cli-table3": "^0.6.5",
"commander": "^14.0.3",
"js-yaml": "^4.1.0",
"turndown": "^7.2.2",
"turndown-plugin-gfm": "^1.0.2",
"undici": "^8.0.2",
"ws": "^8.18.0"
},
"devDependencies": {
"@types/jsdom": "^27.0.0",
"@types/js-yaml": "^4.0.9",
"@types/node": "^25.5.2",
"@types/turndown": "^5.0.6",
"@types/ws": "^8.5.13",
"jsdom": "^29.0.2",
"tsx": "^4.19.3",
"typescript": "^6.0.2",
"vitepress": "^1.6.4",
"vitest": "^4.1.0"
}
}