Skip to content

fix: add prepare script so source installs trigger build#729

Merged
jackwener merged 2 commits intomainfrom
fix/source-install-build
Apr 3, 2026
Merged

fix: add prepare script so source installs trigger build#729
jackwener merged 2 commits intomainfrom
fix/source-install-build

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • 从源码安装(npm install github:jackwener/openclinpm install -g .)时 prepublishOnly 不会运行,导致 dist/ 不存在
  • 添加 prepare script,从 git 安装时自动触发 npm run build
  • [ -d src ] 判断确保从 npm registry 安装时(没有 src/)不会报错

Test plan

  • 本地 npm install -g . 验证 prepare 触发 build
  • npm install github:jackwener/opencli 验证远程源码安装

npm install from git (e.g. npm install github:jackwener/opencli) skips
prepublishOnly, so dist/ is never generated. The prepare hook runs on
git-based installs; the [ -d src ] guard skips it for registry installs.
.gitignore had conflicting rules: line 3 tried to un-ignore extension/dist/
but line 26 re-ignored it. Remove the later rule so the built extension JS
is tracked in git — users can load the extension directly after clone.
@jackwener jackwener merged commit 6cdcb9d into main Apr 3, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant