From e9ee08314ea4231c907e2cc3840b8e4dd543f1b7 Mon Sep 17 00:00:00 2001 From: EGOIST <0x142857@gmail.com> Date: Mon, 22 Jul 2024 16:43:55 +0800 Subject: [PATCH 1/2] docs: CONTRIBUTING.md --- CONTRIBUTING.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..5706fae7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,17 @@ +# Contributing + +## Making changes + +1. Fork the repository. +2. Make changes. +3. Add tests in `test/`. +4. Run tests with `pnpm test`. + +## Release changes + +1. Merge PRs into dev branch. +2. Merge dev branch into main branch with `git checkout main && git merge dev` +3. Push main branch to remote with `git push` +4. GitHub action will create a release and publish it to npm. + +Feel free to improve this process by creating an issue or PR. From 49c11c3073ce977a01c84e7848fc070d5de0a652 Mon Sep 17 00:00:00 2001 From: EGOIST <0x142857@gmail.com> Date: Fri, 2 Aug 2024 15:17:01 +0800 Subject: [PATCH 2/2] fix: do not terminate dts worker in watch mode, closes #1172, closes #1171 --- src/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 1c26fd2c..7da2c640 100644 --- a/src/index.ts +++ b/src/index.ts @@ -222,6 +222,12 @@ export async function build(_options: Options) { if (options.dts) { await new Promise((resolve, reject) => { const worker = new Worker(path.join(__dirname, './rollup.js')) + + const terminateWorker = () => { + if (options.watch) return + worker.terminate() + } + worker.postMessage({ configName: item?.name, options: { @@ -238,10 +244,10 @@ export async function build(_options: Options) { }) worker.on('message', (data) => { if (data === 'error') { - worker.terminate() + terminateWorker() reject(new Error('error occured in dts build')) } else if (data === 'success') { - worker.terminate() + terminateWorker() resolve() } else { const { type, text } = data