Skip to content

Commit

Permalink
Provide ability to preserve console output during watch (#158)
Browse files Browse the repository at this point in the history
* Preserve console output during watch

* Update README.md

* Update index.ts
  • Loading branch information
johnrjj authored and jaredpalmer committed Jul 5, 2019
1 parent a382fd2 commit 37d7664
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,13 @@ Usage
$ tsdx watch [options]

Options
-i, --entry Entry module(s)
--target Specify your target environment (default web)
--name Specify name exposed in UMD builds
--format Specify module format(s) (default cjs,esm)
--tsconfig Specify your custom tsconfig path (default <root-folder>/tsconfig.json)
-h, --help Displays this message
-i, --entry Entry module(s)
--target Specify your target environment (default web)
--name Specify name exposed in UMD builds
--format Specify module format(s) (default cjs,esm)
--tsconfig Specify your custom tsconfig path (default <root-folder>/tsconfig.json)
--verbose Keep outdated console output in watch mode instead of clearing the screen
-h, --help Displays this message

Examples
$ tsdx watch --entry src/foo.tsx
Expand Down
9 changes: 8 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ prog
.example('watch --name Foo')
.option('--format', 'Specify module format(s)', 'cjs,esm')
.example('watch --format cjs,esm')
.option(
'--verbose',
'Keep outdated console output in watch mode instead of clearing the screen'
)
.example('watch --verbose')
.option('--tsconfig', 'Specify custom tsconfig path')
.example('build --tsconfig ./tsconfig.foo.json')
.action(async (dirtyOpts: any) => {
Expand All @@ -294,7 +299,9 @@ prog
}))
).on('event', async event => {
if (event.code === 'START') {
clearConsole();
if (!opts.verbose) {
clearConsole();
}
spinner.start(chalk.bold.cyan('Compiling modules...'));
}
if (event.code === 'ERROR') {
Expand Down

0 comments on commit 37d7664

Please sign in to comment.