npm 脚本

1、npm scripts 脚本基础指南:https://www.cnblogs.com/shiyou00/p/10358646.html   或  https://www.cnblogs.com/liuchuanfeng/p/6759698.html   或   https://cloud.tencent.com/developer/ask/50047

总结:

  1、npm脚本可以写 shell脚本

  2、多个脚本又可以组合成一个 新的脚本。

  3、进程的环境变量可以获取package.json所有的信息。

2、将 cmd 批处理的 变成 npm-script 的脚本:只要将 cmd 批处理文件 放在  node_modules 目录下的  .bin 目录下就可以了。

  如下,打包时 删除 原来dist 文件的命令:

@IF EXIST "%cd%dist" (
  echo "dist is exist"
  rd /s/q "%cd%dist"
) ELSE (
  echo "dist is not exist"
)

3、

原文地址:https://www.cnblogs.com/wfblog/p/13655879.html