Skip to content

Allow multiple tsconfig configurations for --project flag in cli #50898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
5 tasks done
michal-minich opened this issue Sep 22, 2022 · 4 comments
Closed
5 tasks done

Allow multiple tsconfig configurations for --project flag in cli #50898

michal-minich opened this issue Sep 22, 2022 · 4 comments
Labels
Declined The issue was declined as something which matches the TypeScript vision Suggestion An idea for TypeScript

Comments

@michal-minich
Copy link

Suggestion

πŸ” Search Terms

is:open project multiple label:Suggestion

βœ… Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion / πŸ“ƒ Motivating Example

allow tsc to be invoked with multiple project configuration with --project / -p flag in cli like:

tsc --project tsconfig.dev.json tsconfig.prod.json

alternative syntax:
tsc --project tsconfig.dev.json --project tsconfig.prod.json

currently it is only possible to have 1 configuration per tsc run, so tsc has to be executed for each tsconfig like:

tsc --project tsconfig.dev.json 
tsc --project tsconfig.prod.json

Note --build / -b flag allows specify multiple projects already.

πŸ’» Use Cases

This is useful when one projects has more target configurations (e.g. for deployments / testing / user agents / devices).
This is performance optimization only. The end result is already achievable by ruining tsc multiple times.

@MartinJohns
Copy link
Contributor

MartinJohns commented Sep 22, 2022

Somewhat related: #37884

This is performance optimization only.

I doubt this brings any performance, unless it internally re-uses some data structures across the project, which likely would be a massive undertaking.

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Declined The issue was declined as something which matches the TypeScript vision labels Sep 22, 2022
@RyanCavanaugh
Copy link
Member

Apart from pure startup time, there's not anything meaningful that can be reused between two subsequent project builds. It might actually be worse from a total time perspective because of memory pressure/fragmentation.

"Merging" config files on the command line (as linked) is something that I think is still on the table as a feature, so providing some syntax to do multiple projects today just for convenience would muddy the waters in a way that I think doesn't really pay for itself in terms of added value.

If you want to run multiple projects on a single command execution, you can use tsc --build with "solution" tsconfig files.

@michal-minich
Copy link
Author

OK, I understand. Unfortunately with --build all files needs to be included with glob pattern to be "root", as only these are checked for modifications. The -p flag has ability to specify only the "main.ts" file and let tsc identify which files should be actually compiled to the output.

@typescript-bot
Copy link
Collaborator

This issue has been marked as "Declined" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Declined The issue was declined as something which matches the TypeScript vision Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants