代码拉取完成,页面将自动刷新
用于检查当前git分支是否满足执行命令的条件,用在npm script hook上,防止在错误的分支执行了错误的命令
npm install git-branch-check -D
yarn add git-branch-check -D
//package.json
{
"name": "xxx",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "node ./build.js",
"prebuild": "npx git-branch-check include master",
"staging": "node ./staging.js",
"prestaging": "npx git-branch-check exclude master"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"colors": "^1.4.0",
"commander": "^6.0.0",
"execa": "^4.0.3"
}
}
如上配置,npm run build
只能在master
分支运行,其他分支运行则会报错,而npm run staging
则是只能在master
分支之外的分支执行,master
分支执行则会报错
Usage: git-branch-check [options] [command]
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
include <branches> 允许在限制的分支中执行,多个分支以","符号分割
exclude <branches> 允许在排除的分支中执行,多个分支以","符号分割
help [command] display help for command
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型