@ornikar/repo-config 7.1.3 → 7.2.0-beta.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.
|
@@ -49,6 +49,16 @@ const readYarnConfigFile = () => {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
+
const getPackagesLocations = (pkg) => {
|
|
53
|
+
const isMonorepo = !!pkg.workspaces;
|
|
54
|
+
|
|
55
|
+
if (!isMonorepo) return ['.'];
|
|
56
|
+
// eslint-disable-next-line import/no-extraneous-dependencies, global-require
|
|
57
|
+
const { getSyncPackageLocations } = require('@ornikar/lerna-config');
|
|
58
|
+
const packageLocations = getSyncPackageLocations(pkg.workspaces);
|
|
59
|
+
return ['.', ...packageLocations];
|
|
60
|
+
};
|
|
61
|
+
|
|
52
62
|
module.exports = function installHusky({ pkg, pm }) {
|
|
53
63
|
const yarnMajorVersion = pm.name === 'yarn' && semver.major(pm.version);
|
|
54
64
|
const isYarnBerry = pm.name === 'yarn' && yarnMajorVersion >= 2;
|
|
@@ -88,6 +98,7 @@ module.exports = function installHusky({ pkg, pm }) {
|
|
|
88
98
|
const runYarnInstallOnDiff = `
|
|
89
99
|
if [ -n "$(git diff HEAD@{1}..HEAD@{0} -- yarn.lock)" ]; then
|
|
90
100
|
${
|
|
101
|
+
// https://yarnpkg.com/features/zero-installs
|
|
91
102
|
isYarnPnp
|
|
92
103
|
? ''
|
|
93
104
|
: `yarn install ${
|
|
@@ -97,10 +108,33 @@ if [ -n "$(git diff HEAD@{1}..HEAD@{0} -- yarn.lock)" ]; then
|
|
|
97
108
|
${runCleanCache ? `${pmExec} clean:cache` : ''}
|
|
98
109
|
fi`;
|
|
99
110
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
111
|
+
let postHookContent = runYarnInstallOnDiff;
|
|
112
|
+
const packageLocations = getPackagesLocations(pkg);
|
|
113
|
+
|
|
114
|
+
packageLocations.forEach((packageLocation) => {
|
|
115
|
+
const cdToPackageLocation = packageLocation === '.' ? '' : `cd ${packageLocation} && `;
|
|
116
|
+
|
|
117
|
+
const gemfilePath = path.join(packageLocation, 'Gemfile.lock');
|
|
118
|
+
if (fs.existsSync(gemfilePath)) {
|
|
119
|
+
postHookContent += `
|
|
120
|
+
if [ -n "$(git diff HEAD@{1}..HEAD@{0} -- ${gemfilePath})" ]; then
|
|
121
|
+
${cdToPackageLocation}bundle install --path vendor/bundle || true
|
|
122
|
+
fi
|
|
123
|
+
`;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const podfilePath = path.join(packageLocation, 'ios/Podfile.lock');
|
|
127
|
+
if (fs.existsSync(podfilePath)) {
|
|
128
|
+
postHookContent += `
|
|
129
|
+
if [ -n "$(git diff HEAD@{1}..HEAD@{0} -- ${podfilePath})" ]; then
|
|
130
|
+
${cdToPackageLocation}yarn pod-install || true
|
|
131
|
+
fi
|
|
132
|
+
`;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
writeHook('post-checkout', postHookContent);
|
|
136
|
+
writeHook('post-merge', postHookContent);
|
|
137
|
+
writeHook('post-rewrite', postHookContent);
|
|
104
138
|
}
|
|
105
139
|
|
|
106
140
|
const prePushHook = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ornikar/repo-config",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0-beta.0",
|
|
4
4
|
"description": "repo config",
|
|
5
5
|
"repository": "ornikar/shared-configs",
|
|
6
6
|
"license": "ISC",
|
|
@@ -24,6 +24,5 @@
|
|
|
24
24
|
"semver": "^7.3.5",
|
|
25
25
|
"which-pm-runs": "^1.0.0",
|
|
26
26
|
"yarn-deduplicate": "3.1.0"
|
|
27
|
-
}
|
|
28
|
-
"gitHead": "1b8d8a5f9aa3d14a7387e1b6cddbbcdbdeb812ad"
|
|
27
|
+
}
|
|
29
28
|
}
|