英文:
Within a monorepo (using Turborepo) is it possible to start dev and Storybook (lives in a child package) with a single command?
问题
在开发环境中,不是首先使用npm run dev
(使用Turborepo)启动我的monorepo,然后进入Storybook所在的包并执行npm run storybook
,是否有一种方法可以使用一个命令(即npm run dev
)同时启动两者?
英文:
In a dev environment instead of spinning up my monorepo first with npm run dev
(which uses Turborepo) then cd'ing into a package where Storybook lives and executing npm run storybook
, is there a way to spin up both with one command (ie. npm run dev
)?
答案1
得分: 1
是的,有的。
我建议您使用concurrently来实现这一点。您可以编写一个单独的运行配置,使用concurrently:
- 首先,安装concurrently
npm i -D concurrently
- 在您的
package.json
中引入一个新的脚本配置
{
...
"scripts": {
"dev": "...",
"start": "concurrently -n dev,storybook -c yellow,green 'npm run dev' 'cd .storybook && npm run storybook dev -p 6006'"
}
}
- 然后您应该能够运行
npm start
。
英文:
Yes, there is.
I'd recommend you to use concurrently for that. You can write a separate run config that uses concurrently:
- first, install concurrently
npm i -D concurrently
- introduce a new script configuration in your
package.json
{
...
"scripts": {
"dev": "...",
"start": "concurrently -n dev,storybook -c yellow,green 'npm run dev' 'cd .storybook && npm run storybook dev -p 6006'"
}
}
- you should then be able to run
npm start
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论