reactjs - 将 npm_config_variable 传递给脚本
问题描述
我的 package.json 中有这个 npm 脚本
"scripts":{
"test:file":"react-scripts test --coverage MyFileName --collectCoverageFrom=src/app/MyFileName.jsx"
}
我想通过 npm 命令传递我的文件名,例如npm run test:file --file MyFileName
,我希望将我的脚本更改为如下所示,
"scripts":{
"test:file":"react-scripts test --coverage $npm_config_file --collectCoverageFrom=src/app/$npm_config_file.jsx"
}
目前,只有第一个$npm_config_file
被成功插入,而作为路径名一部分的第二个不起作用。
有人可以建议我如何更改脚本吗?
解决方案
推荐阅读
- python-3.x - 教师力量培训 PyTorch
- swiftui - SwiftUI 文本字段和整数
- react-native - React Native Video 海报在 ios 中不起作用
- amazon-web-services - 如何使用 AWS CLI 仅根据它们的年龄来获取所有访问密钥
- java - for 循环中的 IndexOf 只删除一个字符
- java - 如果我先调用scanner.hasNext,然后再调用scanner.next,我会扫描两次吗
- julia - 如何将函数标记为`@deprecate`d?
- django - 在 django rest 框架中上传临时文件
- r - 如何在 ggplot 条形图中重新排序 X 轴聚类
- javascript - 使用javascript设置文本输入字段的最小所需长度?