@deallony/shared

中文文档
1.2.83发布于 2026/11/09TypeScriptESM + CJS近 30 天下载 4772

Shared TypeScript types, DTOs, Zod schemas, and utilities for Deallony projects.

原始使用文档
文档目录5 节
  1. One-command releases
  2. Automatic npm login
  3. npm authentication
  4. Publish without browser approval
  5. Failure recovery

@deallony/shared

Shared TypeScript types, DTOs, Zod schemas, and utilities for Deallony projects.

One-command releases

Run from a clean, synchronized main branch with push access to origin/main.

CommandAction
npm run deployBump patch, build, publish to npm, commit/tag/push GitLab
npm run deploy:minornpm + GitLab minor release
npm run deploy:majornpm + GitLab major release
npm run deploy:dry-runPreview version and inspect current package, no mutation
npm run deploy:gitBump patch, build, commit/tag/push GitLab without npm publish
npm run deploy:git:minorGitLab-only minor release
npm run deploy:git:majorGitLab-only major release
npm run deploy:git:dry-runPreview GitLab-only release

Version increments follow semantic versioning; 1.2.99 becomes 1.2.100.

Automatic npm login

npm run deploy first checks npm whoami. If npm returns E401 or ENEEDAUTH, the script runs npm login --registry=https://registry.npmjs.org/ --auth-type=web and opens the browser sign-in flow. After you finish logging in, it rechecks your identity and continues the same release. Network failures and canceled logins stop the release before modifying the package version. deploy:git never logs into npm.

npm authentication

Run npm login --registry=https://registry.npmjs.org/ and ensure your account has publishing permission for the public scoped package @deallony/shared. Complete any npm 2FA prompts when required. Never commit npm tokens.

Publish without browser approval

A normal npm login session still makes npm publish open the browser for 2FA on every release. A granular token with "bypass 2FA" removes that step:

  1. On npmjs.com open your avatar > Access Tokens > Generate New Token > Granular Access Token.
  2. Name it deallony-shared-publish, pick an expiration (npm caps write tokens, so note the date to renew), and tick Bypass two-factor authentication (2FA).
  3. Under Packages and scopes choose Read and write, Only select packages and scopes, and select @deallony/shared. Leave organizations at no access. Generate and copy the token.
  4. Run notepad $HOME\.npmrc (PowerShell) and set this line, replacing any existing //registry.npmjs.org/:_authToken= line: //registry.npmjs.org/:_authToken=<paste token>. Save. Editing the file keeps the token out of shell history; never paste it into a repo .npmrc.
  5. Check with npm whoami, then npm run deploy:dry-run.

When the token expires, npm whoami fails and the script falls back to browser login; generate a new token and repeat step 4.

Failure recovery

If publishing fails, inspect and restore generated local changes before retrying. If npm publication succeeds but Git push/commit fails, do not republish that version. Resolve the Git issue and push the existing release commit and vX.Y.Z tag.

Merge this feature branch first; merging does not trigger publication automatically.

版本与发布记录

@deallony/shared 共发布 205 个版本,首次发布于 2026/01/14;过去 12 个月发布了 205 个版本。

版本发布日期距今
1.2.83latest2026/11/093 天前
1.2.822026/11/074 天前
1.2.812026/11/065 天前
1.2.802026/11/0110 天前
1.2.792026/10/3111 天前
1.2.762026/10/3111 天前

关于 @deallony/shared 的常见问题

@deallony/shared 是什么?

Shared TypeScript types, DTOs, Zod schemas, and utilities for Deallony projects.

如何安装 @deallony/shared?

在项目目录运行 npm install @deallony/shared,或使用 pnpm add / yarn add / bun add。

@deallony/shared 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@deallony/shared 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@deallony/shared 可以商用吗?

@deallony/shared 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@deallony/shared 的下载量有多少?

根据 npm 官方下载统计,@deallony/shared 在 2026/10/12 – 2026/11/10 这 30 天内被下载 4,772 次,日均约 159 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@deallony/shared 还在维护吗?

最新版本 1.2.83 发布于 2026/11/09(3 天前);至今共发布 205 个版本,其中过去 12 个月发布了 205 个;首次发布于 2026/01/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。