npm link & run npm script
https://blog.csdn.net/juhaotian/article/details/78672390
npm link命令可以将一个任意位置的npm包链接到全局执行环境,从而在任意位置使用命令行都可以直接运行该npm包。
app-cmd.cmd
#!/usr/bin/env node
echo "666" && npm run app
package.json
{
"scripts": {
"app": "npm run rmrf-all && webpack -p",
"dev": "npm run rmrf && webpack -p -w",
"prod": "webpack -p",
"rmrf": "rimraf build/js && rimraf build/css",
"rmrf-all": "rimraf build/*",
"page": "cd modules && browser-sync start --server --files './*.html'",
"index": "cd build && browser-sync start --server --files './index.html'",
"test": "cd src && browser-sync start --server --files './*.*'"
},
"private": true,
"bin": {
"app": "app-shell",
"cmd": "app-cmd"
},
}
npm
https://docs.npmjs.com/cli/link
https://docs.npmjs.com/cli/run-script
https://docs.npmjs.com/misc/scripts
symbolic link
https://en.wikipedia.org/wiki/Symbolic_link
npm link
https://docs.npmjs.com/cli/link
https://segmentfault.com/a/1190000016208716#articleHeader2