Skip to content

Commit

Permalink
Update documentation for CLI flags
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Nov 10, 2019
1 parent 98c0c9b commit 5ad88c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ You can require `ts-node` and register the loader for future requires by using `

**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.

#### Developers

**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`.

### Mocha

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

### CLI Options

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

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

### Programmatic Only Options

Expand Down
7 changes: 5 additions & 2 deletions src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@ export function main (argv: string[]) {
-e, --eval [code] Evaluate code
-p, --print Print result of \`--eval\`
-r, --require [path] Require a node module before execution
-i, --interactive Opens the REPL even if stdin does not appear to be a terminal
-h, --help Print CLI usage
-v, --version Print module version information
-s, --script-mode Use cwd from <script.ts> instead of current directory
-T, --transpile-only Use TypeScript's faster \`transpileModule\`
-I, --ignore [pattern] Override the path patterns to skip compilation
Expand All @@ -121,13 +123,14 @@ export function main (argv: string[]) {
-D, --ignore-diagnostics [code] Ignore TypeScript warnings by diagnostic code
-O, --compiler-options [opts] JSON object to merge with compiler options
--dir Specify working directory for config resolution
--scope Scope compiler to files within \`cwd\` only
--files Load files from \`tsconfig.json\` on startup
--pretty Use pretty diagnostic formatter (usually enabled by default)
--script-mode Use cwd from <script.ts> instead of current directory
--skip-project Skip reading \`tsconfig.json\`
--skip-ignore Skip \`--ignore\` checks
--prefer-ts-exts Prefer importing TypeScript files over JavaScript files
--interactive Opens the REPL even if stdin does not appear to be a terminal
--log-error Logs TypeScript errors to stderr instead of throwing exceptions
`)

process.exit(0)
Expand Down

0 comments on commit 5ad88c9

Please sign in to comment.