@acalcutt/node-pre-gyp-github

中文文档
2.0.3发布于 2026/06/02MITES Module构建来源已验证近 30 天下载 3.5万

A node-pre-gyp module which provides the ability to publish to GitHub releases.

原始使用文档
文档目录6 节
  1. Usage
  2. Options for publish command
  3. Install
  4. Configuration
  5. Example (Publish to GitHub as a Draft Release)
  6. Example (Publish to GitHub as a Release)

node-pre-gyp-github

A node-pre-gyp module which provides the ability to publish to GitHub releases.

Coverage Status Join the chat at https://gitter.im/bchr02/node-pre-gyp-github

Usage

Instead of node-pre-gyp publish use node-pre-gyp-github publish

Options for publish command

  • --silent : Turns verbose messages off.
  • --release : Publish the GitHub Release immediately instead of creating a Draft. For Ex. node-pre-gyp-github publish --release
  • --commitish : Defines the branch to be used for the target_commitish parameter. Defaults to 'main' if omitted. For Ex. node-pre-gyp-github publish --commitish master

Install

npm install -g @acalcutt/node-pre-gyp-github
# or
yarn global add @acalcutt/node-pre-gyp-github

Configuration

This module is intended to be used with node-pre-gyp. Therefore, be sure to configure and install node-pre-gyp first. After having done that, within package.json update the binary properties host and remote_path so it matches the following format:

  "host": "https://github.com/[owner]/[repo]/releases/download/",
  "remote_path": "{version}"

Be sure to replace [owner], [repo], with actual values, but DO NOT replace {version} with actual version.

WARNING: Variable substitutions are not supported on the host property and on the remote_path only {version} placeholder is supported. The value of remote_path after substitution will become a release tag name. Do not use forbidden git tag characters for version and remote_path properties.

Within GitHub, create a new authorization:

  1. go to Settings -> Developer settings
  2. click Personal access tokens
  3. click Generate new token
  4. Select public_repo and repo_deployment
  5. Generate Token
  6. copy the key that's generated and set NODE_PRE_GYP_GITHUB_TOKEN environment variable to it. Within your command prompt:
SET NODE_PRE_GYP_GITHUB_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Example (Publish to GitHub as a Draft Release)

  1. node-pre-gyp configure
  2. node-pre-gyp build
  3. node-pre-gyp package
  4. node-pre-gyp-github publish

Example (Publish to GitHub as a Release)

  1. node-pre-gyp configure
  2. node-pre-gyp build
  3. node-pre-gyp package
  4. node-pre-gyp-github publish --release

版本与发布记录

@acalcutt/node-pre-gyp-github 共发布 10 个版本,首次发布于 2022/04/26;过去 12 个月发布了 2 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.0.3latest2026/06/025 个月前
2.0.22026/02/288 个月前
2.0.12025/04/211.5 年前
2.0.1-pre.1next2025/04/211.5 年前
2.0.1-pre.02025/04/211.5 年前
1.4.92024/04/292 年前

关于 @acalcutt/node-pre-gyp-github 的常见问题

@acalcutt/node-pre-gyp-github 是什么?

A node-pre-gyp module which provides the ability to publish to GitHub releases.

如何安装 @acalcutt/node-pre-gyp-github?

在项目目录运行 npm install @acalcutt/node-pre-gyp-github,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 node-pre-gyp-github,可以用 npx node-pre-gyp-github 直接运行。

@acalcutt/node-pre-gyp-github 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/acalcutt__node-pre-gyp-github 是否存在。

@acalcutt/node-pre-gyp-github 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@acalcutt/node-pre-gyp-github 可以商用吗?

@acalcutt/node-pre-gyp-github 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@acalcutt/node-pre-gyp-github 的下载量有多少?

根据 npm 官方下载统计,@acalcutt/node-pre-gyp-github 在 2026/10/05 – 2026/11/03 这 30 天内被下载 34,603 次,日均约 1,153 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@acalcutt/node-pre-gyp-github 还在维护吗?

最新版本 2.0.3 发布于 2026/06/02(5 个月前);至今共发布 10 个版本,其中过去 12 个月发布了 2 个;首次发布于 2022/04/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。