Skip to content
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

TS_NODE_OPTIONS to mimic NODE_OPTIONS #1204

Open
cspotcode opened this issue Jan 28, 2021 · 2 comments
Open

TS_NODE_OPTIONS to mimic NODE_OPTIONS #1204

cspotcode opened this issue Jan 28, 2021 · 2 comments
Milestone

Comments

@cspotcode
Copy link
Collaborator

cspotcode commented Jan 28, 2021

Desired Behavior

TS_NODE_OPTIONS allows specifying multiple ts-node CLI flags in a single env var. Perhaps we deprecate various other env vars in the process, to reduce our env var API surface.

Not sure if it should work with programmatic ts-node usage though. Would require parsing TS_NODE_OPTIONS as argv but outside of bin.ts

@seivan
Copy link

seivan commented Apr 7, 2021

How would these options merge with what's defined inside a tsconfig?
I am assuming there are other sources of arguments as well, but let's try to keep it simple for now.

My guess would be that the values within TS_NODE_OPTIONS should take precedence, in which case the question becomes do we merge or overwrite?

@cspotcode
Copy link
Collaborator Author

I figure they can be treated the same as if they had been passed in the argv array, so they can get the same level of precedence as when you pass them to our CLI.

When you do ts-node --transpile-only --./index.ts it will load tsconfig.json by default, and it is already merging the --transpile-only with whatever it finds in tsconfig.json. We should keep the same logic here.

For splitting the TS_NODE_OPTIONS into an array, we can use the same function we use to parse NODE_OPTIONS, which we have to do for some of our ESM loader stuff. Then we can pass this array to the same code we use for parsing the argv array today.

We might need to slightly refactor bin.ts, since now we will be attempting argv parsing even when we're not being invoked as a CLI tool.

@cspotcode cspotcode added this to the next milestone May 15, 2021
@cspotcode cspotcode modified the milestones: 10.2.0, next Aug 8, 2021
@cspotcode cspotcode modified the milestones: 10.5.0, next Jan 31, 2022
@cspotcode cspotcode modified the milestones: 10.6.0 or 10.5.1, next Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants