Skip to content

Commit 7da6f99

Browse files
committed
fix: remove development dependencies from the published bundle
1 parent c405c7b commit 7da6f99

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
- *js_deps_cache_key
4040
- *js_deps_backup_cache_key
4141
- run: yarn build
42+
- run: node scripts/prepare-deploy-package-json.js
4243
- run: yarn semantic-release
4344

4445
workflows:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* eslint-disable @typescript-eslint/no-var-requires */
2+
"use strict";
3+
4+
const fs = require("fs");
5+
const path = require("path");
6+
7+
const pickFields = [
8+
"name",
9+
"version",
10+
"license",
11+
"author",
12+
"homepage",
13+
"repository",
14+
"bugs",
15+
"keywords",
16+
"module",
17+
"main",
18+
"typings",
19+
"dependencies",
20+
"peerDependencies",
21+
"files",
22+
];
23+
24+
const filePath = path.resolve(__dirname, "..", "package.json");
25+
const contents = fs.readFileSync(filePath);
26+
const packageJson = JSON.parse(contents);
27+
const newPackageJson = Object.fromEntries(
28+
Object.entries(packageJson).filter(([key]) => pickFields.includes(key))
29+
);
30+
fs.writeFileSync(filePath, JSON.stringify(newPackageJson, null, 2));

0 commit comments

Comments
 (0)