【发布时间】:2021-10-04 16:00:50
【问题描述】:
我目前正在使用 npm 脚本做一些工作,但在网上找不到我的问题的答案!
我想通过输入一个命令来运行 3 个 NPM 脚本。这里是脚本:
"start-jsonserver:platform": "ng serve --configuration jsonserver"
"start:corePlugins": "ng serve corePlugins",
"start:jsonserver": "cd ../json-server & npm run start",
"start:allJsonEnvironment": "npm run start-jsonserver:platform && npm run start:corePlugins && npm run start:jsonserver",
请注意,最后一个命令没有像我希望的那样工作,因为它在第一个 ng serve “完成”后停止。我也用一个& 尝试了相同的命令,但这具有相同的效果
我找到了一个打开 3 个单独的 Powershell 窗口的解决方案:
"start:allJsonEnvironment": "start powershell npm run start-jsonserver:platform && start powershell npm run start:corePlugins && start powershell npm run start:jsonserver"
问题是这会打开普通的“独立”Powershell 窗口,说实话真的很难看,我习惯于看到 VS Code 内部的 Powershell 窗口(同时 3 个),因为如果出现问题,很容易发现。 像这样:
因此,如果有办法从 npm 脚本打开这些“内部”Powershell 窗口,我将不胜感激。
(我知道有一种方法可以在一个内部窗口中运行所有三个脚本,但这不是我想要的!)
【问题讨论】:
标签: powershell npm visual-studio-code