diff --git a/README.md b/README.md index 1c228c2..fb344bb 100644 --- a/README.md +++ b/README.md @@ -219,7 +219,7 @@ python archive.py --zip 同一个工作流也会将三个平台的 Python wheel 发布到 PyPI。请在同一位置创建 `PYPI_API_TOKEN` secret,值为 PyPI 创建的 API token;首次发布前还应确认 PyPI 上的 `crt-cpp-app` 项目名归当前账号或组织所有。已存在的 wheel 会被跳过。 -同一个工作流还会将 Windows、Linux 和 macOS 对应的 npm 包发布到 npmjs.com。请创建 `NPM_TOKEN` secret,值为具备发布权限的 npm automation token,或已启用 **Bypass 2FA** 的 granular access token;普通 token 会因 npm 要求一次性验证码(`EOTP`)而无法在 CI 中发布。当前三个包名分别为 `crt-cpp-app-win32-x64`、`crt-cpp-app-linux-x64` 和 `crt-cpp-app-darwin-arm64`;它们都必须归该 token 对应的 npm 账号或组织所有。重跑工作流时,已存在的包版本会被跳过。 +同一个工作流还会将 Windows、Linux 和 macOS 对应的 npm 包发布到 npmjs.com。请创建 `NPM_TOKEN` secret,值为对 `@prettycadstudio` scope 具备发布权限的 npm automation token,或已启用 **Bypass 2FA** 的 granular access token;普通 token 会因 npm 要求一次性验证码(`EOTP`)而无法在 CI 中发布。当前三个包名分别为 `@prettycadstudio/crt-cpp-app-win32-x64`、`@prettycadstudio/crt-cpp-app-linux-x64` 和 `@prettycadstudio/crt-cpp-app-darwin-arm64`;重跑工作流时,已存在的包版本会被跳过。 ### 安装脚本 diff --git a/archive.py b/archive.py index 0fb09ee..d3af432 100644 --- a/archive.py +++ b/archive.py @@ -13,6 +13,7 @@ DIST_DIR = "dist" DOCUMENTATION_FILE = os.path.join("docs", "doc.md") APPLICATION_NAME = "crt-cpp-app" +NPM_PACKAGE_SCOPE = "@prettycadstudio" NODE_LAUNCHER = os.path.join("nodejs", "crt-cpp-app.js") @@ -188,7 +189,7 @@ def archive_nodejs(version): node_platform = get_node_platform_name() architecture = get_architecture_name() - package_name = f"{APPLICATION_NAME}-{node_platform}-{architecture}" + package_name = f"{NPM_PACKAGE_SCOPE}/{APPLICATION_NAME}-{node_platform}-{architecture}" with tempfile.TemporaryDirectory(prefix="crt-cpp-app-node-") as package_dir: app_dir = os.path.join(package_dir, "app") bin_dir = os.path.join(package_dir, "bin") diff --git a/docs/doc.md b/docs/doc.md index 08c1e1b..3f3bb9b 100644 --- a/docs/doc.md +++ b/docs/doc.md @@ -60,10 +60,10 @@ pip 会将命令入口安装到当前 Python 环境的 scripts 目录;使用 通过 npm 安装与当前平台对应的包: ```bash -npm install --global crt-cpp-app-win32-x64 +npm install --global @prettycadstudio/crt-cpp-app-win32-x64 ``` -包名会包含目标平台和架构,例如 Windows x64 为 `crt-cpp-app-win32-x64`。安装后可直接使用 `crt-cpp-app`;npm 包同样内嵌自包含的 C# 程序,因此不需要安装 .NET runtime 或 SDK。 +包名使用 `@prettycadstudio` scope,并包含目标平台和架构,例如 Windows x64 为 `@prettycadstudio/crt-cpp-app-win32-x64`。安装后可直接使用 `crt-cpp-app`;npm 包同样内嵌自包含的 C# 程序,因此不需要安装 .NET runtime 或 SDK。 ## 通过 NuGet 使用 @@ -81,7 +81,7 @@ dotnet tool install --global crt-cpp-app 工作流也会发布 Python wheel 到 PyPI。请在相同页面添加 `PYPI_API_TOKEN` repository secret,其值为 PyPI 的 API token。首次发布前,`crt-cpp-app` 这一 PyPI 项目名必须已由该 token 对应的账号或组织拥有;已有的 wheel 会自动跳过。 -工作流还会发布各平台的 npm 包。请添加 `NPM_TOKEN` repository secret,其值为拥有发布权限的 npm automation token,或已启用 **Bypass 2FA** 的 granular access token。普通 token 会触发 `EOTP`,而 CI 无法提供一次性验证码。当前发布的包名为 `crt-cpp-app-win32-x64`、`crt-cpp-app-linux-x64` 和 `crt-cpp-app-darwin-arm64`;首次发布前,它们必须归该 token 对应的 npm 账号或组织所有。已有版本会自动跳过。 +工作流还会发布各平台的 npm 包。请添加 `NPM_TOKEN` repository secret,其值为对 `@prettycadstudio` scope 拥有发布权限的 npm automation token,或已启用 **Bypass 2FA** 的 granular access token。普通 token 会触发 `EOTP`,而 CI 无法提供一次性验证码。当前发布的包名为 `@prettycadstudio/crt-cpp-app-win32-x64`、`@prettycadstudio/crt-cpp-app-linux-x64` 和 `@prettycadstudio/crt-cpp-app-darwin-arm64`;已有版本会自动跳过。 ## 创建项目