I
I
Igorek982021-06-07 13:32:08
typescript
Igorek98, 2021-06-07 13:32:08

How to create two commands to compile ts?

Good afternoon, tell me please.
How to create two teams in one?
As I understand it, the line "build": "tsc"says that you need to run a file in the same folder tsconfig.json, but how to write two commands in it?
I need to compile the other two folders into separate ones as well, how can I write more than one command for "build": "tsc"?
And tell me about tsconfig, maybe something else is usually added, otherwise I just started to study it.

package.json

{
  "name": "project",
  "version": "1.0.0",
  "description": "modules",
  "main": "dist/server.js",
  "scripts": {
    "build": "tsc",
    "start": "node dist/server.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },


tsconfig.json
{
  "compilerOptions": {
    "esModuleInterop": true,
    "outDir": "dist",
    "baseUrl": "."
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egor Kharlamov, 2021-06-08
@madbaddad

Greetings!
To learn more about tsconfig, nothing can help better than the official documentation - https://www.typescriptlang.org/docs/handbook/tscon...
Regarding running multiple commands, you can either do this:

"start": "tsc && node dist/server.js"

or you can see what a makefile is , for example here https://ru.makefile.site/
In addition, you can look at such a tool ( for the terminal ) https://www.npmjs.com/package/ts-node
and here on such ( for the web ) https://parceljs.org/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question