Skip to content

Commit 5ad88c9

Browse files
committed
Update documentation for CLI flags
1 parent 98c0c9b commit 5ad88c9

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ You can require `ts-node` and register the loader for future requires by using `
4848

4949
**Note:** If you need to use advanced node.js CLI arguments (e.g. `--inspect`), use them with `node -r ts-node/register` instead of the `ts-node` CLI.
5050

51+
#### Developers
52+
53+
**TS Node** exports a `create()` function that can be used to initialize a TypeScript compiler that isn't registered to `require.extensions`, and it uses the same code as `register`.
54+
5155
### Mocha
5256

5357
```sh
@@ -118,7 +122,7 @@ ts-node --compiler ntypescript --project src/tsconfig.json hello-world.ts
118122

119123
### CLI Options
120124

121-
Supports `--print`, `--eval` and `--require` from [node.js CLI options](https://nodejs.org/api/cli.html).
125+
Supports `--print`, `--eval`, `--require` and `--interactive` similar to the [node.js CLI options](https://nodejs.org/api/cli.html).
122126

123127
* `--help` Prints help text
124128
* `--version` Prints version information
@@ -139,8 +143,8 @@ _Environment variable denoted in parentheses._
139143
* `--pretty` Use pretty diagnostic formatter (`TS_NODE_PRETTY`, default: `false`)
140144
* `--skip-project` Skip project config resolution and loading (`TS_NODE_SKIP_PROJECT`, default: `false`)
141145
* `--skip-ignore` Skip ignore checks (`TS_NODE_SKIP_IGNORE`, default: `false`)
142-
* `--log-error` Logs errors of types instead of exit the process (`TS_NODE_LOG_ERROR`, default: `false`)
143146
* `--prefer-ts-exts` Re-order file extensions so that TypeScript imports are preferred (`TS_NODE_PREFER_TS_EXTS`, default: `false`)
147+
* `--log-error` Logs TypeScript errors to stderr instead of throwing exceptions (`TS_NODE_LOG_ERROR`, default: `false`)
144148

145149
### Programmatic Only Options
146150

src/bin.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,11 @@ export function main (argv: string[]) {
110110
-e, --eval [code] Evaluate code
111111
-p, --print Print result of \`--eval\`
112112
-r, --require [path] Require a node module before execution
113+
-i, --interactive Opens the REPL even if stdin does not appear to be a terminal
113114
114115
-h, --help Print CLI usage
115116
-v, --version Print module version information
117+
-s, --script-mode Use cwd from <script.ts> instead of current directory
116118
117119
-T, --transpile-only Use TypeScript's faster \`transpileModule\`
118120
-I, --ignore [pattern] Override the path patterns to skip compilation
@@ -121,13 +123,14 @@ export function main (argv: string[]) {
121123
-D, --ignore-diagnostics [code] Ignore TypeScript warnings by diagnostic code
122124
-O, --compiler-options [opts] JSON object to merge with compiler options
123125
126+
--dir Specify working directory for config resolution
127+
--scope Scope compiler to files within \`cwd\` only
124128
--files Load files from \`tsconfig.json\` on startup
125129
--pretty Use pretty diagnostic formatter (usually enabled by default)
126-
--script-mode Use cwd from <script.ts> instead of current directory
127130
--skip-project Skip reading \`tsconfig.json\`
128131
--skip-ignore Skip \`--ignore\` checks
129132
--prefer-ts-exts Prefer importing TypeScript files over JavaScript files
130-
--interactive Opens the REPL even if stdin does not appear to be a terminal
133+
--log-error Logs TypeScript errors to stderr instead of throwing exceptions
131134
`)
132135

133136
process.exit(0)

0 commit comments

Comments
 (0)