Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make --script-mode the default; add --cwd-mode to switch back to old …
…behavior; other cwd, project, and dir fixes (#1155) * Use `--script-mode` by default * Add `--cwd-mode` flag to opt-out of `--script-mode` * Add `ts-node-cwd` entry-point that uses `--cwd-mode` by default * Rename `--dir` to `--cwd`; `TS_NODE_DIR` to `TS_NODE_CWD`; parse legacy names for backwards compatibility * Rewrite `--cwd` docs to say it changes effective `cwd` * Add `projectSearchDir` API option to set directory from which tsconfig search is performed * Fix bug where resolving entry-point location could poison `require.resolve` cache and prevent correct extension from loading (#1220) * `--cwd` no longer sets `--scope` * Remove `--scope` from CLI flags and tsconfig-loaded options; it is an API-only option, to match the intended use-case: programmatically installing multiple ts-node instances * Add `scopeDir` API option * Deprecate `TS_NODE_SCOPE` env var * `ignore` rules evaluated relative to `tsconfig.json`, otherwise `cwd`; no longer tied to `--dir` * `compiler` is loaded relative to `tsconfig.json` instead of `cwd` or entrypoint script (#1225) --- *Original GH-generated squash summary* * make --script-mode the default; add --cwd-mode to switch back to old behavior * Fix bug where --script-mode entrypoint require.resolve poisons the require.resolve cache; causes entrypoint to resolve incorrectly when --prefer-ts-exts is used * WIP TODO amend / rewrite this commit * wip * WIP * add ts-node-cwd bin, which is equivalent to ts-node --cwd-mode * rename projectSearchPath to projectSearchDir * Revert undesirable changes from WIP commits * add --cwd-mode and --script-mode tests * revert undesirable logging from WIP commits * update tests which relied on --dir affecting to cwd to instead use projectSearchDir as needed * remove --script-mode from test invocations that don't need it anymore * fix lint failures * fix tests * fix requireResolveNonCached to avoid hack on node 10 & 11 * fix tests to avoid type error on ts2.7 * fix tests on node 10 * update README and final cleanup * more cleanup * Load typescript compiler relative to tsconfig.json
- Loading branch information
Showing
11 changed files
with
242 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env node | ||
|
||
import { main } from './bin' | ||
|
||
main(undefined, { '--cwd-mode': true }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.