简体   繁体   English

TypeScript tsc:如何同时观看多个项目?

[英]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 -wtsc -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.

相关问题 如何在多个项目中使用 TypeScript 中的监视标志? - How to use watch flag in TypeScript with multiple projects? 如何在VSCode中观看多个TypeScript项目? - How do I watch multiple TypeScript projects in VSCode? TypeScript:同时监视和编译多个目录(monorepo) - TypeScript: Watch & compile multiple directories at the same time (monorepo) 如何同时执行 typescript watch 和 running server? - How do I execute typescript watch and running server at the same time? VSCode TypeScript problemMatcher `$tsc-watch` 不看 - VSCode TypeScript problemMatcher `$tsc-watch` not watching 有没有办法通过单击 VSCode 上的按钮/快捷方式同时运行“tsc -watch”和“npm start”? - Is there a way to run “tsc -watch” and “npm start” at the same time, with a click of a button/ shortcut on VSCode? 运行多个Typescript'tsc'命令 - Running multiple Typescript 'tsc' commands 如何在Windows上的“监视输出文件”模式(tsc -w)中使用TypeScript编译器? - How do I use the TypeScript compiler in the 'Watch output files' mode (tsc -w) on Windows? tsc TypeScript编译器是怎么编译的? - How is the tsc TypeScript compiler compiled? 如何优雅地退出tsc“观看”模式? - How to exit from tsc “watch” mode gracefully?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM