Skip to content

Commit 27bfdad

Browse files
committed
build: patch-package integration
- https://github.com/ds300/patch-package/tree/v6.4.7 - ds300/patch-package#272 Signed-off-by: Lexus Drumgold <[email protected]>
1 parent ec98117 commit 27bfdad

File tree

9 files changed

+233
-17
lines changed

9 files changed

+233
-17
lines changed

.cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"LICENSE.md",
2525
"__tests__/report.json",
2626
"dist/",
27+
"patches/",
2728
"yarn.lock"
2829
],
2930
"ignoreRegExpList": [],

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ yarn-error.log*
2626
# ------------------------------------------------------------------------------
2727
.pnp.*
2828
.yarn/*
29-
!.yarn/patches
3029
!.yarn/plugins
3130
!.yarn/releases
3231
!.yarn/sdks

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@
140140
"format": "svg",
141141
"icon": "temp"
142142
},
143+
{
144+
"extensions": ["patches"],
145+
"format": "svg",
146+
"icon": "include"
147+
},
143148
{
144149
"extensions": ["setup"],
145150
"format": "svg",

.yarnrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ npmScopes:
2323
npmAuthToken: ${GITHUB_TOKEN}
2424
npmRegistryServer: https://npm.pkg.github.com
2525

26+
patchFolder: ./patches
27+
2628
yarnPath: .yarn/releases/yarn-4.0.0-rc.14.cjs

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
"type": "module",
3030
"files": [
3131
"dist",
32+
"patches",
33+
"scripts/postinstall.sh",
3234
"src"
3335
],
3436
"bin": {
@@ -74,10 +76,9 @@
7476
"fix:dedupe": "yarn dedupe --strategy=highest",
7577
"fix:format": "prettier --cache --write .",
7678
"fix:lint": "yarn check:lint --cache --fix",
77-
"postinstall": "chmod +x .husky/* && husky install",
78-
"postpack": "toggle-scripts +postinstall",
79+
"postinstall": "bash ./scripts/postinstall.sh",
7980
"postpublish": "toggle-scripts +prepack",
80-
"prepack": "toggle-scripts -postinstall && yarn build",
81+
"prepack": "yarn build",
8182
"prepublishOnly": "toggle-scripts -prepack",
8283
"recommended-bump": "conventional-recommended-bump --preset=conventionalcommits --tag-prefix=$(jq .tagPrefix package.json -r) --verbose",
8384
"release": "bash ./scripts/release.sh",
@@ -90,7 +91,9 @@
9091
"esbuild": "0.15.6",
9192
"fs-extra": "10.1.0",
9293
"globby": "13.1.2",
93-
"mlly": "0.5.14"
94+
"mlly": "0.5.14",
95+
"patch-package": "6.4.7",
96+
"postinstall-postinstall": "2.1.0"
9497
},
9598
"devDependencies": {
9699
"@commitlint/cli": "17.1.1",
@@ -164,7 +167,7 @@
164167
},
165168
"resolutions": {
166169
"@ardatan/sync-fetch": "larsgw/sync-fetch#head=worker_threads",
167-
"graphql-config": "patch:graphql-config@npm%3A4.3.5#~/.yarn/patches/graphql-config-npm-4.3.5-8989a92a82.patch"
170+
"graphql-config": "patch:graphql-config@4.3.5#patches/graphql-config+4.3.5.dev.patch"
168171
},
169172
"engines": {
170173
"yarn": "4.0.0-rc.14"

patches/.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# NPM IGNORE
2+
# https://npm.github.io/publishing-pkgs-docs/publishing/the-npmignore-file.html
3+
# https://github.com/yarnpkg/yarn/issues/685#issuecomment-457618561
4+
5+
*.dev.patch

scripts/postinstall.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
# Post Install Workflow
4+
#
5+
# References:
6+
#
7+
# - https://github.com/ds300/patch-package
8+
# - https://typicode.github.io/husky
9+
10+
if [ -f node_modules/.bin/husky ]; then
11+
chmod +x .husky/* && husky install
12+
else
13+
patch-package
14+
fi

0 commit comments

Comments
 (0)