diff --git a/package.json b/package.json index 0c3202dd..2462078a 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "type": "module", "scripts": { "dev": "vite dev", - "build": "vite build && npm run package", + "build": "vite build && npm run package && node scripts/copy.js", "preview": "vite preview", "package": "svelte-package", "package:watch": "svelte-package --watch", diff --git a/scripts/copy.js b/scripts/copy.js new file mode 100644 index 00000000..e72cc117 --- /dev/null +++ b/scripts/copy.js @@ -0,0 +1,11 @@ +import { readFileSync, writeFileSync } from 'node:fs'; + +// read file into JSON +const pkg = JSON.parse(readFileSync('package.json', 'utf-8')); +const readme = readFileSync('README.md', 'utf-8'); +const license = readFileSync('LICENSE', 'utf-8'); + +// write it to your output directory +writeFileSync('./dist/package.json', JSON.stringify(pkg, null, 2)); +writeFileSync('./dist/README.md', readme); +writeFileSync('./dist/LICENSE', license);