@pob/root 13.1.0 → 13.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/bin/postinstall/install-husky.js +29 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [13.2.0](https://github.com/christophehurpeau/pob/compare/@pob/root@13.1.0...@pob/root@13.2.0) (2024-08-15)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* improve git hooks ([6e8cc6b](https://github.com/christophehurpeau/pob/commit/6e8cc6bdddf155f5b0651201990e358c87af6d18))
|
|
11
|
+
|
|
6
12
|
## [13.1.0](https://github.com/christophehurpeau/pob/compare/@pob/root@13.0.0...@pob/root@13.1.0) (2024-08-14)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
@@ -69,7 +69,13 @@ export default function installHusky({ pkg, pm }) {
|
|
|
69
69
|
fs.mkdirSync(path.resolve(".husky"));
|
|
70
70
|
} catch {}
|
|
71
71
|
|
|
72
|
-
const {
|
|
72
|
+
const {
|
|
73
|
+
lockfile,
|
|
74
|
+
pmExec,
|
|
75
|
+
installOnDiffCommand,
|
|
76
|
+
beforeDiffCommand = "",
|
|
77
|
+
afterDiffCommand = "",
|
|
78
|
+
} = (() => {
|
|
73
79
|
if (pm.name === "yarn") {
|
|
74
80
|
return {
|
|
75
81
|
lockfile: "yarn.lock",
|
|
@@ -79,6 +85,20 @@ export default function installHusky({ pkg, pm }) {
|
|
|
79
85
|
? "--immutable"
|
|
80
86
|
: "--prefer-offline --pure-lockfile --ignore-optional"
|
|
81
87
|
}`,
|
|
88
|
+
beforeDiffCommand: isYarnBerry
|
|
89
|
+
? `yarn config set logFilters --json '[
|
|
90
|
+
{"code": "YN0002","level": "discard"},
|
|
91
|
+
{"code": "YN0007","level": "discard"},
|
|
92
|
+
{"code": "YN0008","level": "discard"},
|
|
93
|
+
{"code": "YN0013","level": "discard"},
|
|
94
|
+
{"code": "YN0018","level": "discard"},
|
|
95
|
+
{"code": "YN0060","level": "discard"},
|
|
96
|
+
{"code": "YN0061","level": "discard"}
|
|
97
|
+
]' > /dev/null`
|
|
98
|
+
: "",
|
|
99
|
+
afterDiffCommand: isYarnBerry
|
|
100
|
+
? "yarn config unset logFilters > /dev/null"
|
|
101
|
+
: "",
|
|
82
102
|
};
|
|
83
103
|
}
|
|
84
104
|
if (pm.name === "npm") {
|
|
@@ -105,21 +125,21 @@ export default function installHusky({ pkg, pm }) {
|
|
|
105
125
|
writeHook("pre-commit", `${pmExec} pob-root-lint-staged`);
|
|
106
126
|
|
|
107
127
|
if (isYarnPnp) {
|
|
128
|
+
// https://yarnpkg.com/features/zero-installs
|
|
108
129
|
ensureHookDeleted("post-checkout");
|
|
109
130
|
ensureHookDeleted("post-merge");
|
|
110
131
|
ensureHookDeleted("post-rewrite");
|
|
111
132
|
} else {
|
|
112
|
-
const runInstallOnDiff = (
|
|
133
|
+
const runInstallOnDiff = (additionalConditionInstall = "") => {
|
|
113
134
|
return `
|
|
114
|
-
if [ -n "$(git diff HEAD@{1}..HEAD@{0} -- ${lockfile})" ]; then
|
|
115
|
-
${installOnDiffCommand} || true
|
|
135
|
+
if [ -n "$(git diff HEAD@{1}..HEAD@{0} -- ${lockfile})" ]${additionalConditionInstall}; then
|
|
136
|
+
${beforeDiffCommand ? `${beforeDiffCommand}\n ` : ""}${installOnDiffCommand} || true${afterDiffCommand ? `\n ${afterDiffCommand}` : ""}
|
|
116
137
|
fi`;
|
|
117
|
-
}
|
|
138
|
+
};
|
|
118
139
|
|
|
119
|
-
|
|
120
|
-
writeHook("post-
|
|
121
|
-
writeHook("post-
|
|
122
|
-
writeHook("post-rewrite", runInstallOnDiff);
|
|
140
|
+
writeHook("post-checkout", runInstallOnDiff());
|
|
141
|
+
writeHook("post-merge", runInstallOnDiff());
|
|
142
|
+
writeHook("post-rewrite", runInstallOnDiff(' | [ "$1" = "rebase" ]'));
|
|
123
143
|
}
|
|
124
144
|
|
|
125
145
|
const prePushHook = [];
|