Skip to content

Commit

Permalink
fix: remove development dependencies from the published bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
n1ru4l committed May 11, 2020
1 parent c405c7b commit 7da6f99
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
- *js_deps_cache_key
- *js_deps_backup_cache_key
- run: yarn build
- run: node scripts/prepare-deploy-package-json.js
- run: yarn semantic-release

workflows:
Expand Down
30 changes: 30 additions & 0 deletions scripts/prepare-deploy-package-json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* eslint-disable @typescript-eslint/no-var-requires */
"use strict";

const fs = require("fs");
const path = require("path");

const pickFields = [
"name",
"version",
"license",
"author",
"homepage",
"repository",
"bugs",
"keywords",
"module",
"main",
"typings",
"dependencies",
"peerDependencies",
"files",
];

const filePath = path.resolve(__dirname, "..", "package.json");
const contents = fs.readFileSync(filePath);
const packageJson = JSON.parse(contents);
const newPackageJson = Object.fromEntries(
Object.entries(packageJson).filter(([key]) => pickFields.includes(key))
);
fs.writeFileSync(filePath, JSON.stringify(newPackageJson, null, 2));

0 comments on commit 7da6f99

Please sign in to comment.