我在windows上运行npm并且想在运行脚本中使用&style并行操作但是在cmd中并行运行在我的package.json文件中有点乱 - 我想写 -
脚本:{"go":"cmd1&cmd2"}
但是npm执行cmd.exe下的脚本,该脚本不知道; 我可以将其更改为脚本:{"go":"bats/bat1.bat")其中bat1.bat是一个cmd bat文件,它使用windows样式调用或启动命令来并行运行命令.哪个有效,但给了我一个仅适用于Windows的脚本
如果我可以让npm在bash克隆或cygwin下运行脚本我会尝试配置:{"shell":"bash"}但是仍然运行cmd.exe会简单得多
有没有办法告诉npm使用特定的shell(而不是cmd.exe)运行脚本?
我在 Windows 10 中工作,并尝试使用 npm 脚本进行 git commit,其中包含包含提交日期和时间的消息:
"deploy": "cd dist && git add . && git commit -m \"Release at $(date)\" && git push"
Run Code Online (Sandbox Code Playgroud)
结果 git commit 消息是
在 $(date) 发布
代替
于 03/06/2019 11:43:57 发布
我在终端中运行相同的命令时得到:
git commit -m "Release at $(date)"
Run Code Online (Sandbox Code Playgroud)
什么是跨平台解决方案?
你能解释导致不同结果的原因吗?