logo
0
1
WeChat Login
orician<orician@nexsea.net>
docs: 在README中添加cli工具下载使用说明

Helper script

包含了一系列开发帮助脚本,这些脚本旨在帮助开发者快速设置环境、配置依赖和解决常见问题,无需记忆复杂的命令或手动编辑配置文件。

下载cli工具

go install cnb.cool/1024hub/helper-script/helper@latest

然后就能使用 helper 命令来执行各种脚本。

可用脚本

  • setup-cnb-npmrc.sh
  • editorconfig-downloader.sh

CNB NPM Registry 配置助手

这个脚本可以帮助你快速配置 CNB NPM Registry 的 .npmrc 文件,并配置作用域。以便于下载cnb制品库的包。作用域之外的包,默认使用https://registry.npmmirror.com/作为registry

使用方法

交互式命令执行:

直接执行

bash -c "$(curl -s https://cnb.cool/1024hub/helper-script/-/git/raw/master/scripts/setup-cnb-npmrc.sh)"

非交互式命令执行:

bash <(curl -s https://cnb.cool/1024hub/helper-script/-/git/raw/master/scripts/setup-cnb-npmrc.sh) -t "{your_token}" -p "{your_artifactory_path} -s {your_scope}"

注意事项

  • 生成的 .npmrc 文件应与你的 package.json 文件位于同一目录
  • 请妥善保管你的访问令牌,不要将其提交到版本控制系统中
  • 如果你已经有 .npmrc 文件,该脚本会覆盖它,请提前备份

配置示例

生成的 .npmrc 文件内容类似于:

; CNB NPM Registry 配置 @your-scope:registry=https://npm.cnb.cool/org/artifactory/-/packages/ always-auth=true //npm.cnb.cool/org/artifactory/-/packages/:username=cnb //npm.cnb.cool/org/artifactory/-/packages/:_authToken=your-token

下载editorconfig文件

bash <(curl -s https://cnb.cool/1024hub/helper-script/-/git/raw/master/scripts/editorconfig-downloader.sh)

可以把以下命令直接加入到你的~/.bashrc~/.zshrc中,方便使用。

export CNB_TOKEN={your_cnb_token} export CNB_ARTIFACTORY_PATH={default_cnb_artifactory_path} export CNB_SCOPE={default_cnb_scope} alias setup-cnb-npmrc="bash <(curl -s https://cnb.cool/1024hub/helper-script/-/git/raw/master/scripts/setup-cnb-npmrc.sh)" alias editorconfig-downloader="bash <(curl -s https://cnb.cool/1024hub/helper-script/-/git/raw/master/scripts/editorconfig-downloader.sh)"