Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Replace prepack and postpac scripts with custom Yarn plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Nov 1, 2021
1 parent 91b5de2 commit deae442
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .yarn/plugins/plugin-remove-workspaces-field.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
name: `plugin-remove-workspaces-field`,
factory: () => ({
hooks: {
beforeWorkspacePacking(workspace, rawManifest) {
delete rawManifest.workspaces;
},
},
}),
};
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/plugin-remove-workspaces-field.cjs
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
"build": "babel --source-maps=both src -d build",
"clean": "rimraf build",
"lint": "eslint src/ --ext .jsx,.js",
"postpack": "yarn restore-workspaces",
"prepack": "yarn clean && yarn build && yarn remove-workspaces",
"remove-workspaces": "node remove_workspaces.js",
"restore-workspaces": "node restore_workspaces.js",
"prepack": "yarn clean && yarn build",
"test": "yarn lint"
},
"keywords": [
Expand Down

0 comments on commit deae442

Please sign in to comment.