forked from accordproject/web-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare.js
35 lines (32 loc) · 914 Bytes
/
prepare.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const fs = require('fs');
const pkg = require('./package.json');
const dependencies = ['prop-types', 'react', 'react-dom'];
const newPackage = {
...pkg,
husky: {
hooks: {
'pre-commit': 'lint-staged',
'pre-push': 'CI=true yarn test --passWithNoTests',
},
},
dependencies: Object.fromEntries(
Object.keys(pkg.dependencies)
.filter(key => dependencies.some(dependency => dependency === key))
.map(name => [name, pkg.dependencies[name]])
),
devDependencies: Object.fromEntries(
Object.keys(pkg.dependencies)
.filter(key => dependencies.some(dependency => dependency !== key))
.map(name => [name, pkg.dependencies[name]])
),
peerDependencies: {
react: '>=16.8.0',
'react-dom': '>=16.8.0',
},
files: ['lib'],
engines: {
node: '>=10',
},
private: false,
};
fs.writeFileSync('package.json', JSON.stringify(newPackage, null, 2));