Skip to content

Commit

Permalink
Rename --build to --emit
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Nov 11, 2019
1 parent 6045a24 commit 4dbc15d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)

Expand Down
6 changes: 3 additions & 3 deletions src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 4dbc15d

Please sign in to comment.