Skip to content

Commit 9c10c70

Browse files
ArnaudBarrejaredpalmer
authored andcommitted
--noClean option for watch (#282)
1 parent 5becff1 commit 9c10c70

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,14 +388,16 @@ Options
388388
--format Specify module format(s) (default cjs,esm)
389389
--tsconfig Specify your custom tsconfig path (default <root-folder>/tsconfig.json)
390390
--verbose Keep outdated console output in watch mode instead of clearing the screen
391+
--noClean Don't clean the dist folder
391392
-h, --help Displays this message
392393
393394
Examples
394395
$ tsdx watch --entry src/foo.tsx
395396
$ tsdx watch --target node
396397
$ tsdx watch --name Foo
397398
$ tsdx watch --format cjs,esm,umd
398-
$ tsdx build --tsconfig ./tsconfig.foo.json
399+
$ tsdx watch --tsconfig ./tsconfig.foo.json
400+
$ tsdx watch --noClean
399401
```
400402
401403
### `tsdx build`
@@ -478,4 +480,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
478480
479481
<!-- ALL-CONTRIBUTORS-LIST:END -->
480482
481-
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
483+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,14 +354,18 @@ prog
354354
'Keep outdated console output in watch mode instead of clearing the screen'
355355
)
356356
.example('watch --verbose')
357+
.option('--noClean', "Don't clean the dist folder")
358+
.example('watch --noClean')
357359
.option('--tsconfig', 'Specify custom tsconfig path')
358360
.example('watch --tsconfig ./tsconfig.foo.json')
359361
.option('--extractErrors', 'Extract invariant errors to ./errors/codes.json.')
360362
.example('build --extractErrors')
361363
.action(async (dirtyOpts: any) => {
362364
const opts = await normalizeOpts(dirtyOpts);
363365
const buildConfigs = createBuildConfigs(opts);
364-
await cleanDistFolder();
366+
if (!opts.noClean) {
367+
await cleanDistFolder();
368+
}
365369
await ensureDistFolder();
366370
if (opts.format.includes('cjs')) {
367371
await writeCjsEntryFile(opts.name);

0 commit comments

Comments
 (0)