diff --git a/README.md b/README.md index 86a1112b5..dc0b2ff10 100644 --- a/README.md +++ b/README.md @@ -388,6 +388,7 @@ Options --format Specify module format(s) (default cjs,esm) --tsconfig Specify your custom tsconfig path (default /tsconfig.json) --verbose Keep outdated console output in watch mode instead of clearing the screen + --noClean Don't clean the dist folder -h, --help Displays this message Examples @@ -395,7 +396,8 @@ Examples $ tsdx watch --target node $ tsdx watch --name Foo $ tsdx watch --format cjs,esm,umd - $ tsdx build --tsconfig ./tsconfig.foo.json + $ tsdx watch --tsconfig ./tsconfig.foo.json + $ tsdx watch --noClean ``` ### `tsdx build` @@ -478,4 +480,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d -This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! \ No newline at end of file +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! diff --git a/src/index.ts b/src/index.ts index 320219f46..b3a3bca52 100755 --- a/src/index.ts +++ b/src/index.ts @@ -354,6 +354,8 @@ prog 'Keep outdated console output in watch mode instead of clearing the screen' ) .example('watch --verbose') + .option('--noClean', "Don't clean the dist folder") + .example('watch --noClean') .option('--tsconfig', 'Specify custom tsconfig path') .example('watch --tsconfig ./tsconfig.foo.json') .option('--extractErrors', 'Extract invariant errors to ./errors/codes.json.') @@ -361,7 +363,9 @@ prog .action(async (dirtyOpts: any) => { const opts = await normalizeOpts(dirtyOpts); const buildConfigs = createBuildConfigs(opts); - await cleanDistFolder(); + if (!opts.noClean) { + await cleanDistFolder(); + } await ensureDistFolder(); if (opts.format.includes('cjs')) { await writeCjsEntryFile(opts.name);