-
-
Notifications
You must be signed in to change notification settings - Fork 540
Changes to --dir, --cwd, --script-mode, add configSearchPath
#1197
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
Comments
configSearchPath
Pretty sure this is just my fault and no explicit reasoning, seemed logical at the time to have them affect everything because it's acting as if you were in that directory. IIRC the config flag was originally called I think the error paths might have been a mistake, didn't think through that one. I suspect it should have always used With the proposed change, would it help to write out how these things affect each other? I think when it comes to Question: do you think
SGTM.
Also seems reasonable to start with it internal only. |
Ok, thanks, good idea to enumerate all sensible and non-sensible combinations of flags. Also, it's possible I've subtly broken
It seems most useful for
Now I'm thinking Use-casescategorized as either useful to CLI consumers, API consumers, or both
Less common use-cases
PermutationsThe messiest conceivable combinations, with all flags being optional:
In all cases, Questions
|
configSearchPath
configSearchPath
configSearchPath
configSearchPath
@blakeembrey Do you have time to offer a sanity-check on these breaking changes? You might have some helpful historical perspective that I don't. I suspect that ts-node's current behavior is an understandable result of organic evolution over time, but we can make some changes to keep it clean and intuitive.
While working on #1155 I realized that
--dir
and--script-mode
have some interesting behaviors.--dir
is documented to change the location of config file resolution, but it actually does much more: it overridesprocess.cwd()
. As far as I know, this affectsTS_NODE_SCOPE
and--project
in a confusing way. For example,ts-node-script ./src/bin/main.ts
will set cwd to./src/bin
, affecting the interpretation of--scope
and--project
, and affecting relative paths logged in error messages. A user would be confused by that.With that in mind, do the following changes sound reasonable?
Proposed Changes
--dir
to--cwd
so behavior is more intuitive. Keep--dir
as deprecated for backwards compat.--cwd
docs to state that it overrides the cwd, which affects lots of things (can copy phrasing fromgit -C
docs)--script-mode
so that it affects tsconfig discovery but not cwd. Can accomplish via a newconfigSearchPath
API option.Questions
configSearchPath
a good name?configSearchDir
?configSearchPath
be exposed as a CLI flag / env var? I say noThe text was updated successfully, but these errors were encountered: