-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Allow specifying exclude as a command line option #46005
Comments
I just ran into this issue. It was a little surprising that CLI has so many params but not the exclude. My case is the same: type checking of all ts files and building without tests. |
i would love an exclude option too. there are too many configs in a monorepo with all the toolings (prettier, tsconfig, ...). it would make things easier |
Absolutely agree with this. I was surprised there's no way to do this as it is. I'm also trying to keep to one |
Just hopping on, agreed that a |
Would like this too! I have a use case for using the |
I also want this. My client and server code is in a flatter directory structure than a complete "client" & "server" separation (as there is some shared model code), and I'm currently building server code with tsc and bundling client and React code with Parcel. tsconfig includes the entire source folder i.e. the client and server code. Currently I cannot have the flexibility of node scripts:
I either have to change the tsconfig each time or use a CLI exclude flag that can be added to another node script. Of course there are solutions but I prefer the flexibility of an exclude flag on the CLI |
I also have this exact same usecase. I would like to compile my code without tests so that I can quickly prototype something and then fix the tests at the end. |
#54410 is somewhat related. |
The more I look into this, the more complex it seems, and the less sure I am with both the way I have things now, as well as whether I like the other options instead. I think I may just stick with TSC for compiling my package code in general, and if anything I can still do/try out the dual-build setup with ESM/CJS, but maybe just use TSC, since I can ensure that things are built consistently. Should I provide synchronous APIs from NBTify? I think learning about how to work with async has really helped me progress, and I don't want to prevent someone else from learning that if I go with providing a sync option to my API. Or rather, if anything, that would only work in Node, because the Compression Streams API is only an asynchronous implementation. I'd have to use Node Zlib as a fallback to allow for a synchronous implementation, and it would be for Node only. I'm not sure I like the splintering of that either. I think I have realized afterall, that I don't specifically want to use ESBuild for building my packages, since it's meant to bundle code, and I think I would only want to use that in a situation of building an ESM bundle for the browser. I may look into that as well though. Maybe I can use pkgbuild for that instead though? It kind of works a bit nicer for plain TS type generation support out of the box, as well as the configuation for things just plain working. Maybe I can look into making my own tool kind of like that, since it feels like all of the tools for this that I find, they all don't quite work exactly like how I want them to, unfortunately. https://www.reddit.com/r/node/comments/14os7zv/the_esmcjs_situation/ https://github.com/wooorm/npm-esm-vs-cjs https://stackoverflow.com/questions/46515764/how-can-i-use-async-await-at-the-top-level https://stackoverflow.com/questions/71517624/because-i-cant-run-await-on-the-top-level-i-have-to-put-it-into-an-async-funct https://commerce.nearform.com/blog/2021/node-esm-and-exports/ https://dev.to/a0viedo/nodejs-typescript-and-esm-it-doesnt-have-to-be-painful-438e https://www.reddit.com/r/node/comments/14rg9ym/esm_not_gaining_traction_in_backend_node/ nodejs/node#49432 https://github.com/azu/tsconfig-to-dual-package https://www.breakp.dev/blog/simple-library-package-setup-with-esbuild/ https://esbuild.github.io/api/#build evanw/esbuild#263 evanw/esbuild#618 microsoft/TypeScript#46005 https://guitar.com/news/music-news/devin-townsend-shredding-dreams-steve-vai/ https://www.reddit.com/r/DevinTownsend/comments/17s332s/devin_and_the_vai_years/ https://www.reddit.com/r/DevinTownsend/comments/k9jot4/devin_townsend_i_was_unable_to_articulate_my/ https://www.kerrang.com/devin-townsend-i-was-unable-to-articulate-my-discontent-so-i-tended-to-act-up-i-even-took-a-sh-t-in-steve-vais-guitar-case https://www.reddit.com/r/DevinTownsend/comments/6tia0r/is_vai_comparing_devin_to_zappa/
The more I look into this, the more complex it seems, and the less sure I am with both the way I have things now, as well as whether I like the other options instead. I think I may just stick with TSC for compiling my package code in general, and if anything I can still do/try out the dual-build setup with ESM/CJS, but maybe just use TSC, since I can ensure that things are built consistently. Should I provide synchronous APIs from NBTify? I think learning about how to work with async has really helped me progress, and I don't want to prevent someone else from learning that if I go with providing a sync option to my API. Or rather, if anything, that would only work in Node, because the Compression Streams API is only an asynchronous implementation. I'd have to use Node Zlib as a fallback to allow for a synchronous implementation, and it would be for Node only. I'm not sure I like the splintering of that either. I think I have realized afterall, that I don't specifically want to use ESBuild for building my packages, since it's meant to bundle code, and I think I would only want to use that in a situation of building an ESM bundle for the browser. I may look into that as well though. Maybe I can use pkgbuild for that instead though? It kind of works a bit nicer for plain TS type generation support out of the box, as well as the configuation for things just plain working. Maybe I can look into making my own tool kind of like that, since it feels like all of the tools for this that I find, they all don't quite work exactly like how I want them to, unfortunately. https://www.reddit.com/r/node/comments/14os7zv/the_esmcjs_situation/ https://github.com/wooorm/npm-esm-vs-cjs https://stackoverflow.com/questions/46515764/how-can-i-use-async-await-at-the-top-level https://stackoverflow.com/questions/71517624/because-i-cant-run-await-on-the-top-level-i-have-to-put-it-into-an-async-funct https://commerce.nearform.com/blog/2021/node-esm-and-exports/ https://dev.to/a0viedo/nodejs-typescript-and-esm-it-doesnt-have-to-be-painful-438e https://www.reddit.com/r/node/comments/14rg9ym/esm_not_gaining_traction_in_backend_node/ nodejs/node#49432 https://github.com/azu/tsconfig-to-dual-package https://www.breakp.dev/blog/simple-library-package-setup-with-esbuild/ https://esbuild.github.io/api/#build evanw/esbuild#263 evanw/esbuild#618 microsoft/TypeScript#46005 https://guitar.com/news/music-news/devin-townsend-shredding-dreams-steve-vai/ https://www.reddit.com/r/DevinTownsend/comments/17s332s/devin_and_the_vai_years/ https://www.reddit.com/r/DevinTownsend/comments/k9jot4/devin_townsend_i_was_unable_to_articulate_my/ https://www.kerrang.com/devin-townsend-i-was-unable-to-articulate-my-discontent-so-i-tended-to-act-up-i-even-took-a-sh-t-in-steve-vais-guitar-case https://www.reddit.com/r/DevinTownsend/comments/6tia0r/is_vai_comparing_devin_to_zappa/
is there an option to do this? |
It seems natural to expect parity between the command line flags of the My use case is that I'd like to download a github repo by tag with the tsc --declaration --emitDeclarationOnly --declarationDir ./myDeclarations --exclude "src/**/*.spec.ts" I want this to be a helper npm script in my project root as |
Have we heard any comment from anyone on the TypeScript team? This has been open for almost 3 years with many folks having similar needs and no response? I would greatly appreciate it if the TypeScript team could at least acknowledge the "issue", maybe provide a recommended "workaround" and if the TypeScript team down not feel this is a good thing to add to the CLI then it would be wonderful to have an explanation. Thanks! |
Why has this not been done? This is a no-brainer. |
3 years???? |
Suggestion
π Search Terms
List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily and help provide feedback.
exclude cli
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
I would like to be able to specify the
exclude
option which exists intsconfig.json
as a command line option.π Motivating Example
The
tsc
command line tool now supports the--exclude
option. This option behaves the same as the"exclude": []
option intsconfig.json
.π» Use Cases
In my experienct a TypeScript project currently typically needs 3 files (excluding actual code);
tsconfig.json
for type checking, including tests etc.:tsconfig.build.json
for building a project, excluding tests etc. (this can be named however you like)package.json
including a prepack script for building the project:Introducing the
--exclude
command line option removes the need for a custom build tsconfig. This unclutters the project root by removing the need for a specific tsconfig file only for building. So basically the following changes can be made:tsconfig.build.json
is deleted:package.json
now uses thetsconfig.json
file, but specifies the exclude pattern:The text was updated successfully, but these errors were encountered: