Skip to content

Add scope to CLI and tsconfig options; un-deprecate TS_NODE_SCOPE #1346

@cspotcode

Description

@cspotcode

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

  • double-check my old issues about scope to ensure there are no reasons against adding it to tsconfig.json

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions