From b1baff2326f31364ac6b00957feb78986d5d81fd Mon Sep 17 00:00:00 2001 From: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com> Date: Wed, 12 Apr 2023 02:46:24 +0530 Subject: [PATCH] fix: copy package & other meta files Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com> --- package.json | 2 +- scripts/copy.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 scripts/copy.js 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);