From 1df333aa4b81b8e4535d2da97a2823aa8997f869 Mon Sep 17 00:00:00 2001 From: Katsuhiro Ueno Date: Mon, 5 Aug 2024 22:12:47 +0900 Subject: [PATCH] fix: include LICENSE in each package --- .gitignore | 1 + rollup.config.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1eae0cf..8b113bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ dist/ node_modules/ +packages/*/LICENSE diff --git a/rollup.config.js b/rollup.config.js index 9a17c51..a6ee88d 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -30,6 +30,13 @@ const cleanup = outDir => ({ buildStart: () => fs.rmSync(outDir, { recursive: true, force: true }) }) +const copyLicense = dir => ({ + name: 'copyFiles', + closeBundle() { + fs.copyFileSync('LICENSE', path.join(dir, 'LICENSE')) + } +}) + const externalNames = ({ json }) => [ ...Object.keys(json.dependencies ?? {}), ...Object.keys(json.peerDependencies ?? {}) @@ -66,7 +73,7 @@ const build = pkg => { }, { external: [...external, /^node:/], - plugins: [dts()], + plugins: [dts(), copyLicense(pkg.dir)], input, output: [ { dir: outDir, entryFileNames: '[name].d.ts' },