xgqfrms-GitHub / Node-CLI-Tools

一个 Node.js CLI 工具,查看指定 git 仓库的 commit history ; 能对 commit history 进行搜索; 能查看指定时间范围的 commit history.
https://node-cli-tools.xgqfrms.xyz
MIT License
6 stars 2 forks source link

npm link & run npm script #23

Open xgqfrms opened 6 years ago

xgqfrms commented 6 years ago

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

xgqfrms commented 6 years ago

npm

https://docs.npmjs.com/cli/link

https://docs.npmjs.com/cli/run-script

https://docs.npmjs.com/misc/scripts

xgqfrms commented 3 years ago

rimraf

rmrf & clear build / dist folder caches

https://www.npmjs.com/package/rimraf

$ yarn add -D rimraf
# OR
$ npm i -D rimraf
{
  "clear": "rm -rf dist",
  "rmrf": "rimraf dist"
}

{
  "clear": "rm -rf build/**/*.js",
  "rmrf": "rimraf build/**/*.js"
}
xgqfrms commented 9 months ago

npm package and peerDependencies All In One