Add --scope to the CLI and add scope as an option which can be specified in tsconfig.json
Un-deprecate TS_NODE_SCOPE
Update docs
Update ts-node --help output
Update: also added TS_NODE_SCOPE_DIR and --scope-dir / tsconfig scopeDir in #1367
Motivating use-case
Based on conversation starting here:
#693 (comment)
- The user has a monorepos,
./packages/a/node_modules/b symlinks to ./packages/b
- running tests and scripts in
./packages/a
allowJS is enabled
- code in
a imports b, which resolves to ./packages/b/dist/index.js
- The user does not want
ts-node to compile anything in b; only in a
- philosophically, each package in the monorepo is a separate entity with its own build scripts
- One package should not make assumptions about its ability to transpile the source of another
rootDir is ./packages/a/src but ts-node is running unit-tests in ./packages/a/unit-tests
- This can be addressed by overriding
rootDir for ts-node
Add
--scopeto the CLI and addscopeas an option which can be specified intsconfig.jsonUn-deprecate
TS_NODE_SCOPEUpdate docs
Update
ts-node --helpoutputUpdate: also added TS_NODE_SCOPE_DIR and
--scope-dir/ tsconfigscopeDirin #1367scopeto ensure there are no reasons against adding it totsconfig.jsonMotivating use-case
Based on conversation starting here:
#693 (comment)
./packages/a/node_modules/bsymlinks to./packages/b./packages/aallowJSis enabledaimportsb, which resolves to./packages/b/dist/index.jsts-nodeto compile anything inb; only inarootDiris./packages/a/srcbutts-nodeis running unit-tests in./packages/a/unit-testsrootDirforts-node