-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathprepublish.js
46 lines (43 loc) · 1.02 KB
/
prepublish.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
36
37
38
39
40
41
42
43
44
45
46
const fs = require("fs");
const pkg = require("./package.json");
// NOTE(roerohan): remove dependencies that are not needed for the library.
const {
react,
"react-scripts": reactScripts,
"react-dom": reactDom,
"@testing-library/jest-dom": testingLibraryjestDom,
"@testing-library/react": testingLibraryReact,
"@testing-library/user-event": testingLibraryUserEvent,
"@types/jest": typesJest,
"@types/node": typesNode,
"@types/react": typesReact,
"@types/react-dom": typesReactDom,
"web-vitals": webVitals,
...dependencies
} = pkg.dependencies;
const peerDependencies = {
react: ">=18.0.0",
"react-scripts": ">=5.0.0",
"react-dom": ">=18.0.0",
};
fs.writeFileSync(
"package.json",
JSON.stringify(
{
name: pkg.name,
description: pkg.description,
version: pkg.version,
repository: pkg.repository,
keywords: pkg.keywords,
main: pkg.main,
module: pkg.module,
exports: pkg.exports,
typings: pkg.typings,
publishConfig: pkg.publishConfig,
dependencies,
peerDependencies,
},
null,
4,
),
);