Skip to content

Conversation

animafps
Copy link
Contributor

@animafps animafps commented Oct 1, 2021

fixes consistency issues with ts-node references described in #1317

  • All references are ts-node except when explicitly referred to in the context of the usage of the CLI which is ts-node

Copy link
Collaborator

@cspotcode cspotcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I marked a couple places where I think the backticks are still appropriate, but I can make those changes before merging.

## Via tsconfig.json (recommended)

`ts-node` automatically finds and loads `tsconfig.json`. Most `ts-node` options can be specified in a `"ts-node"` object using their programmatic, camelCase names. We recommend this because it works even when you cannot pass CLI flags, such as `node --require ts-node/register` and when using shebangs.
ts-node automatically finds and loads `tsconfig.json`. Most ts-node options can be specified in a "ts-node" object using their programmatic, camelCase names. We recommend this because it works even when you cannot pass CLI flags, such as `node --require ts-node/register` and when using shebangs.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "ts-node" should still be in backticks since it's JSON syntax.

| Transforms `import` into `require()` | Does not transform `import` |
| Node executes scripts using the classic [CommonJS loader](https://nodejs.org/dist/latest-v16.x/docs/api/modules.html) | Node executes scripts using the new [ESM loader](https://nodejs.org/dist/latest-v16.x/docs/api/esm.html) |
| Use any of:<br/>`ts-node` CLI<br/>`node -r ts-node/register`<br/>`NODE_OPTIONS="ts-node/register" node`<br/>`require('ts-node').register({/* options */})` | Must use the ESM loader via:<br/>`node --loader ts-node/esm`<br/>`NODE_OPTIONS="--loader ts-node/esm" node` |
| Use any of:<br/>ts-node CLI<br/>`node -r ts-node/register`<br/>`NODE_OPTIONS="ts-node/register" node`<br/>`require('ts-node').register({/* options */})` | Must use the ESM loader via:<br/>`node --loader ts-node/esm`<br/>`NODE_OPTIONS="--loader ts-node/esm" node` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be in backticks since it refers to the binary's name?

`ts-node` uses sensible default configurations to reduce boilerplate while still respecting `tsconfig.json` if you
ts-node uses sensible default configurations to reduce boilerplate while still respecting `tsconfig.json` if you
have one. If you are unsure which configuration is used, you can log it with `ts-node --show-config`. This is similar to
`tsc --showConfig` but includes `"ts-node"` options as well.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto previous comment about "ts-node" as JSON syntax.

You can require ts-node and register the loader for future requires by using `require('ts-node').register({ /* options */ })`. You can also use file shortcuts - `node -r ts-node/register` or `node -r ts-node/register/transpile-only` - depending on your preferences.

**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.
**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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto question about ts-node referring to the binary's name.

@cspotcode cspotcode merged commit b7162ab into TypeStrong:docs Oct 3, 2021
@cspotcode
Copy link
Collaborator

@animafps Thank you!

cspotcode added a commit that referenced this pull request Oct 11, 2021
* upgrade typedoc (#1454)

* update esm messaging in docs (#1455)

* Update vscode debug config (#1466)

* changed all references to ts-node consistent (#1481)

* changed all references to ts-node consistent

* Pesky maintainer-prerogative nitpicks

Co-authored-by: Andrew Bradley <[email protected]>

Co-authored-by: Anima <[email protected]>
@cspotcode cspotcode added this to the 10.3.0 milestone Oct 11, 2021
@cspotcode cspotcode mentioned this pull request Oct 11, 2021
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants