tabbit2api/docs/publishing.md at main · hajimi-kun/tabbit2api · GitHub
Skip to content

Latest commit

 

History

History
93 lines (63 loc) · 1.6 KB

publishing.md

File metadata and controls

93 lines (63 loc) · 1.6 KB

npm 发布

目标

把 tabbit2api 发布到 npm 官方 registry,并确保用户可以通过下面两种方式使用:

npx tabbit2api
npm i -g tabbit2api
tabbit2api

发布前准备

如果本机默认使用镜像 registry,发布时必须显式指定 npm 官方源:

npm login --registry=https://registry.npmjs.org

检查当前包名是否已经存在:

npm view tabbit2api --registry=https://registry.npmjs.org

本地验证

运行测试:

npm test

检查发布内容:

npm pack --dry-run --json --registry=https://registry.npmjs.org

验证 tarball 的 npx / npm exec 调用路径:

npm pack --registry=https://registry.npmjs.org
npm exec --yes --package .\\tabbit2api-<version>.tgz -- tabbit2api --version

验证临时全局安装:

npm install -g --prefix "$env:TEMP\\tabbit2api-global" .\\tabbit2api-<version>.tgz
"$env:TEMP\\tabbit2api-global\\tabbit2api.cmd" doctor

验证运行时自检和健康检查:

tabbit2api doctor
tabbit2api start
curl.exe http://127.0.0.1:50124/health

正式发布

npm publish --registry=https://registry.npmjs.org --access public

发布后验证

检查 registry:

npm view tabbit2api version --registry=https://registry.npmjs.org

检查命令入口:

npx tabbit2api --version

说明

  • 本仓库不使用 prepare 自动安装 husky
  • 开发者如需提交校验,手动执行:
npm run hooks:install