Skip to content

Commit 6bf3f65

Browse files
committed
fix: patch update, copy README and LICENSE on build
1 parent 2b98fc3 commit 6bf3f65

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import fs from 'fs';
2+
import path from 'path'
3+
const root = process.cwd()
4+
const filesToCopy = ['./package.json', './README.md', "./LICENSE"];
5+
filesToCopy.forEach(file => {
6+
const __dirname = path.dirname(root);
7+
fs.copyFileSync(path.resolve(__dirname,file), `./dist/${file}`);
8+
})
29

3-
// read file into JSON
4-
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
10+
console.log('files written to /dist');
511

6-
// adjust pkg json however you like ..
7-
8-
// write it to your output directory
9-
fs.writeFileSync(
10-
'./dist/package.json', // path to your output directory may vary
11-
JSON.stringify(pkg, null, 2)
12-
);
13-
console.log('package.json written to /dist')

0 commit comments

Comments
 (0)