diff --git a/src/index.ts b/src/index.ts index dd8190c8..a12d2489 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,17 +2,19 @@ import * as realFs from 'fs'; import getStream = require('get-stream'); import { basename } from 'path'; import CLIEngine from './CLIEngine'; -import Config, { Printer } from './Config'; +import Config from './Config'; import Options, { Command } from './Options'; import { SourceTransformResult } from './TransformRunner'; function optionAnnotation( - value: boolean | Array | Map + value: boolean | Array | Map | string ): string { if (Array.isArray(value) || value instanceof Map) { return ' (allows multiple)'; } else if (typeof value === 'boolean') { return ` (default: ${value ? 'on' : 'off'})`; + } else if (typeof value === 'string') { + return ` (default: ${value})`; } else { return ''; } @@ -51,8 +53,8 @@ OPTIONS defaults.findBabelConfig )}. --printer PRINTER Specify which printer to use${optionAnnotation( - Printer[defaults.printer] - )} + defaults.printer + )}. -s, --stdio Read source from stdin and print to stdout${optionAnnotation( defaults.stdio )}. @@ -82,6 +84,9 @@ EXAMPLES } EOS + # Reprint modified files with prettier. + $ ${$0} --printer prettier -p some-plugin src/ + # Pass options to a plugin. $ ${$0} -p ./a.js -o a='{"foo":true}' src/ diff --git a/tsconfig.json b/tsconfig.json index e00ddadb..0f7e9f43 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,6 @@ "strictNullChecks": true, "declaration": true }, - "exclude": [ - "test/fixtures/**/*.ts" - ] -} \ No newline at end of file + "exclude": ["test/fixtures/**/*.ts"], + "compileOnSave": true +}