[英]TypeScript tsc: How to watch multiple projects at the same time?
I have two tsconfig.json
, in the root and in the test
folder: 我在根目录和
test
文件夹中有两个tsconfig.json
:
.
├── dist
│ └── file...
├── dist-test
│ └── file...
├── src
│ └── file...
├── test
│ ├── file...
│ └── tsconfig.json
└── tsconfig.json
As you can guess, files from src
compiling into dist
and files from test
compiling into dist-test
folder. 正如您可以猜到,从文件
src
编译成dist
和文件test
编译成dist-test
文件夹。
From the root, I can to run tsc -w
or tsc -w --project test
for watching file changes. 从根开始,我可以运行
tsc -w
或tsc -w --project test
来观察文件更改。 How can I run them at the same time (inside one terminal)? 如何同时(在一个终端内)运行它们?
I tried to do (tsc -w) && (tsc -w --project test)
, but not succeed. 我试图做
(tsc -w) && (tsc -w --project test)
,但没有成功。 Only the first directive is being implemented and its compiled only dist
. 仅执行第一个指令,仅编译
dist
。
UPD : My question is no duplicate How can I run multiple npm scripts in parallel? UPD :我的问题没有重复之处如何并行运行多个npm脚本? because I work with one utility
tsc
which, I believe in this, can handle two projects at once. 因为我使用一个实用程序
tsc
,我相信它可以一次处理两个项目。 I do not need parallel processing with different programs. 我不需要与其他程序并行处理。
your question is more a "bash" question instead of a typescript: 您的问题更多是一个“ bash”问题,而不是打字稿:
You're right with starting 2 instances of tsc, as much as I know you need at least one instance for each tsconfig.json. 您以正确的方式启动了2个tsc实例,就我所知,每个tsconfig.json至少需要一个实例。
In Your example it will start the 1st tsc in watch mode and waits till it ends, after that it'll start the 2nd tsc. 在您的示例中,它将在监视模式下启动第一个tsc,并一直等到结束,然后再启动第二个tsc。
please try this: 请尝试以下操作:
(tsc -w &) && (tsc -w --project test)
This will start the 1st tsc in background (so you have to kill it manually if you need) and the 2nd one in front. 这将在后台启动第一个tsc(因此,如果需要,您必须手动将其杀死),第二个在前面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.