[NPM] Pass arguments to npm scripts
Often times you’ll have variations that you’ll want to make to your npm scripts and repeating yourself is inefficient and verbose. Instead you can create a base script and pass arguments into it from another script.
For example, you have a script:
"test": "mocha spec/ --require babel-register",
And you want to add a watcher to the test script:
"test:watch": "mocha spec/ --require babel-register --watch",
Here what we do is copy the script and add a '--watch' behind. This is not good enough, because if you want to change the 'test' script, you also need to modify the 'test:watch' script.
So what you can do:
"test:watch": "npm t -- --watch"
First '--' tell the compiler that we still need to pass in some arguments; And '--watch' is what we want to pass in.
[NPM] Pass arguments to npm scripts的更多相关文章
- 输入npm install 报错npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@4.13.1 postinstall: `node scripts/build.js`
输入npm install 报以下错误 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@4.13.1 postinstall: ...
- npm run dev 和 npm run serve
1.ERR引发的思考 创建好的 vue 项目直接执行 vue run dev 报错?运行 vue run serve 就可以启动...如下 npm run dev npm ERR! missing s ...
- 解决npm安装模块时 npm err! registry error parsing json
最近还真是点背,从yeoman生成一个react项目或是github上克隆一个项目,在npm install的时候, 一直报npm err! registry error parsing json(就 ...
- 安装Vue2的devtools发生错误npm ERR! code EINTEGRITY npm ERR! sha1-HTFDXrRzR2Ew8Bv9zlMSCVgPsS0= integrity checksum failed when using sha1: wanted sha1-HTFDXrRzR2Ew8Bv9zlMSCVgPsS0= but got sha1-Z6BeTMF4nhAO6h5A
1.github下载地址:https://github.com/vuejs/vue-devtools 2.下载好后进入vue-devtools-master工程 执行npm install ---- ...
- npm ERR! code EINTEGRITY npm! ERR! shal-
npm ERR! code EINTEGRITY npm ERR! sha1-nbqdpC/e8IOA7poHctXL5+bVXsE= integrity checksum failed when u ...
- npm install出错,npm ERR! code EINTEGRITY npm ERR! Verification failed while extracting url-parse@1.4.3
npm install时出现以下错误: npm ERR! code EINTEGRITY npm ERR! Verification failed while extracting url-parse ...
- npm install报错 npm ERR! enoent ENOENT: no such file or directory
在npm之后出现如下错误: $ npm install npm WARN checkPermissions Missing write access to /Users/lucas/code/js/v ...
- npm ERR! errno 1 npm ERR! chromedriver@2.35.0 install: `node install.js`
在使用webpack+vue-cli进行vue项目构建时可能会出现一下错误,webpack@3.10.0及以上版本和vue-cli@2.9.2及以上版本会自动安装依赖(我在自己电脑上测试是这样的)不用 ...
- vue项目,npm install后,npm run dev报错问题
报错: ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! metools@1.0.0 dev: `node build/dev-server.js` npm ...
随机推荐
- Hi35xx NVR GDB调试
Hi35xx NVR GDB调试 1. 下载gdb源代码 嵌入式Linux 的GDB 调试环境由Host 和Target 两部分组成,Host 端使用arm-linuxgdb,Target Boa ...
- python登录验证程序
自己写的一个python登录验证程序: 基础需求: 让用户输入用户名密码 认证成功后显示欢迎信息 输错三次后退出程序 升级需求: 可以支持多个用户登录 (提示,通过列表存多个账户信息) 用户3次认证失 ...
- 无状态会话bean(1)---定义
无状态会话bean用于完毕在单个方法的生命周期内的操作.无状态bean能够实现很多业务操作,可是每一个方法都不能假定不论什么其它的方法会在它之前调用.后半句的意思是如今的你可能不是刚才的你.明天的你可 ...
- Codeforces Round 363 Div. 1 (A,B,C,D,E,F)
Codeforces Round 363 Div. 1 题目链接:## 点击打开链接 A. Vacations (1s, 256MB) 题目大意:给定连续 \(n\) 天,每天为如下四种状态之一: 不 ...
- jmeter--使用badboy录制脚本
JMeter录制脚本有多种方法,其中最常见的方法是用第三方工具badboy录制,另外还有JMeter自身设置(Http代理服务器+IE浏览器设置)来录制脚本,但这种方法录制出来的脚本比较多且比较乱,个 ...
- python中线程、进程和协程的区别
进程是资源分配的单位 线程是操作系统调度的单位 协程,又称微线程,纤程,协程的切换只是单纯的操作CPU的上下文,资源很小,效率高 进程切换需要的资源很最大,效率很低 一个程序至少有一个进程,一个进程至 ...
- 对inetd、xinetd与TCP_Wrapper的基本了解
在Linux系统中有一个特殊的守护进程inetd(InterNET services Daemon),它用于Internet标准服务,通常在系统启动时启动.通过命令行可以给出inetd的配置文件,该配 ...
- eclipse开发环境下集成activiti插件
一.环境 eclipse 4.3.0 Activiti Designer 5.14.1 二.Activiti Designer 5.14.1插件安装 在eclipse中菜单help->Insta ...
- Linux 系统挂载数据盘 分类: B3_LINUX 2015-01-30 18:13 228人阅读 评论(0) 收藏
适用系统:Linux(Redhat , CentOS,Debian,Ubuntu) * Linux的云服务器数据盘未做分区和格式化,可以根据以下步骤进行分区以及格式化操作. 下面的操作将会把数据盘划 ...
- angular之Http服务
原文 https://www.jianshu.com/p/53e4a4bfad7d 大纲 1.什么是angular服务 2.服务的类别 3.认识angular的Http请求 4.简单实例 5.angu ...