From 4dbc15dc20da90c0496d117481a7467b6d637cb8 Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Mon, 11 Nov 2019 14:19:46 +1100 Subject: [PATCH] Rename `--build` to `--emit` --- README.md | 2 +- src/bin.ts | 6 +++--- src/index.ts | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e60b40e3a..0cfaccc0a 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ _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`) -* `--build` Emit output files into `.ts-node` directory (`TS_NODE_BUILD`, default: `false`) +* `--emit` Emit output files into `.ts-node` directory (`TS_NODE_EMIT`, 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`) diff --git a/src/bin.ts b/src/bin.ts index bacfeed8e..6a78a2e69 100644 --- a/src/bin.ts +++ b/src/bin.ts @@ -58,7 +58,7 @@ export function main (argv: string[]) { '--skip-ignore': Boolean, '--prefer-ts-exts': Boolean, '--log-error': Boolean, - '--build': Boolean, + '--emit': Boolean, // Aliases. '-e': '--eval', @@ -68,7 +68,6 @@ export function main (argv: string[]) { '-h': '--help', '-s': '--script-mode', '-v': '--version', - '-B': '--build', '-T': '--transpile-only', '-I': '--ignore', '-P': '--project', @@ -101,7 +100,7 @@ export function main (argv: string[]) { '--skip-ignore': skipIgnore = DEFAULTS.skipIgnore, '--prefer-ts-exts': preferTsExts = DEFAULTS.preferTsExts, '--log-error': logError = DEFAULTS.logError, - '--build': build = DEFAULTS.build + '--emit': emit = DEFAULTS.emit } = args if (help) { @@ -152,6 +151,7 @@ export function main (argv: string[]) { // Register the TypeScript compiler instance. const service = register({ dir: getCwd(dir, scriptMode, scriptPath), + emit, files, pretty, transpileOnly, diff --git a/src/index.ts b/src/index.ts index 45c77af58..e12653371 100644 --- a/src/index.ts +++ b/src/index.ts @@ -73,7 +73,7 @@ export const VERSION = require('../package.json').version */ export interface CreateOptions { dir?: string - build?: boolean | null + emit?: boolean | null scope?: boolean | null pretty?: boolean | null transpileOnly?: boolean | null @@ -121,7 +121,7 @@ export interface TypeInfo { */ export const DEFAULTS: RegisterOptions = { dir: process.env.TS_NODE_DIR, - build: yn(process.env.TS_NODE_BUILD), + emit: yn(process.env.TS_NODE_EMIT), scope: yn(process.env.TS_NODE_SCOPE), files: yn(process.env.TS_NODE_FILES), pretty: yn(process.env.TS_NODE_PRETTY), @@ -421,7 +421,7 @@ export function create (options: CreateOptions = {}): Register { output[0] = file } - if (options.build) sys.writeFile(path, file, writeByteOrderMark) + if (options.emit) sys.writeFile(path, file, writeByteOrderMark) }, undefined, undefined, getCustomTransformers()) if (result.emitSkipped) { @@ -467,7 +467,7 @@ export function create (options: CreateOptions = {}): Register { } // Write `.tsbuildinfo` when `--build` is enabled. - if (options.build && config.options.incremental) { + if (options.emit && config.options.incremental) { process.on('exit', () => { // Emits `.tsbuildinfo` to filesystem. (builderProgram.getProgram() as any).emitBuildInfo()