4

I have two tsconfig.json, in the root and in the test folder:

.
├── 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.

From the root, I can to run tsc -w or tsc -w --project test for watching file changes. 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. Only the first directive is being implemented and its compiled only dist.

UPD: My question is no duplicate How can I run multiple npm scripts in parallel? because I work with one utility tsc which, I believe in this, can handle two projects at once. I do not need parallel processing with different programs.

ktretyak
  • 27,251
  • 11
  • 40
  • 63
  • Possible duplicate of [How can I run multiple npm scripts in parallel?](https://stackoverflow.com/questions/30950032/how-can-i-run-multiple-npm-scripts-in-parallel) - not quite the same question, but the answers are identical. – Joe Clay Dec 20 '17 at 13:50
  • @JoeClay, no this is not a duplicate, although it's relative. – ktretyak Dec 20 '17 at 13:53
  • As far as I know, there is no way to compile multiple projects in a single call to `tsc` (unless something has changed since [this comment](https://github.com/Microsoft/TypeScript/issues/3645#issuecomment-117826581)). – Joe Clay Dec 20 '17 at 14:21

1 Answers1

-4

your question is more a "bash" question instead of a typescript:

You're right with starting 2 instances of tsc, as much as I know you need at least one instance for each 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.

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.

iSkriD
  • 118
  • 2