@ornikar/repo-config 7.2.0 → 7.2.4

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 CHANGED
@@ -3,6 +3,44 @@
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
+ ## [7.2.4](https://github.com/ornikar/shared-configs/compare/@ornikar/repo-config@7.2.3...@ornikar/repo-config@7.2.4) (2022-02-10)
7
+
8
+ **Note:** Version bump only for package @ornikar/repo-config
9
+
10
+
11
+
12
+
13
+
14
+ ## [7.2.3](https://github.com/ornikar/shared-configs/compare/@ornikar/repo-config@7.2.2...@ornikar/repo-config@7.2.3) (2022-02-09)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **repo-config:** cd package location [no issue] ([#647](https://github.com/ornikar/shared-configs/issues/647)) ([bbfea60](https://github.com/ornikar/shared-configs/commit/bbfea6042e64cec11deb119699c63e8e330b2e3d))
20
+
21
+
22
+
23
+
24
+
25
+ ## [7.2.2](https://github.com/ornikar/shared-configs/compare/@ornikar/repo-config@7.2.1...@ornikar/repo-config@7.2.2) (2022-02-04)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * update husky hooks ([74b9498](https://github.com/ornikar/shared-configs/commit/74b94983cc37bc011992ca910f48946b205fae5e))
31
+
32
+
33
+
34
+
35
+
36
+ ## [7.2.1](https://github.com/ornikar/shared-configs/compare/@ornikar/repo-config@7.2.0...@ornikar/repo-config@7.2.1) (2022-01-24)
37
+
38
+ **Note:** Version bump only for package @ornikar/repo-config
39
+
40
+
41
+
42
+
43
+
6
44
  # [7.2.0](https://github.com/ornikar/shared-configs/compare/@ornikar/repo-config@7.1.3...@ornikar/repo-config@7.2.0) (2022-01-14)
7
45
 
8
46
 
@@ -22,4 +22,4 @@ if (!pm) {
22
22
 
23
23
  const pkg = JSON.parse(fs.readFileSync(path.resolve('package.json')));
24
24
 
25
- require('../lib/postinstall/install-husky.js')({ pkg, pm });
25
+ require('../lib/postinstall/install-husky')({ pkg, pm });
@@ -28,9 +28,13 @@ const ensureHuskyNotInDevDependencies = (pkg) => {
28
28
  };
29
29
 
30
30
  const writeHook = (hookName, hookContent) => {
31
- fs.writeFileSync(path.resolve(`.husky/${hookName}`), `${hookContent}\n`, {
32
- mode: '755',
33
- });
31
+ fs.writeFileSync(
32
+ path.resolve(`.husky/${hookName}`),
33
+ `#!/usr/bin/env sh\n. "$(dirname "$0")/_/husky.sh"\n\n${hookContent.trim()}\n`,
34
+ {
35
+ mode: '755',
36
+ },
37
+ );
34
38
  };
35
39
 
36
40
  const ensureHookDeleted = (hookName) => {
@@ -97,28 +101,31 @@ module.exports = function installHusky({ pkg, pm }) {
97
101
  } else {
98
102
  const runYarnInstallOnDiff = `
99
103
  if [ -n "$(git diff HEAD@{1}..HEAD@{0} -- yarn.lock)" ]; then
100
- ${
104
+ ${[
101
105
  // https://yarnpkg.com/features/zero-installs
102
106
  isYarnPnp
103
107
  ? ''
104
108
  : `yarn install ${
105
109
  isYarnBerry ? '--immutable --immutable-cache' : '--prefer-offline --pure-lockfile --ignore-optional'
106
- } || true`
107
- }
108
- ${runCleanCache ? `${pmExec} clean:cache` : ''}
110
+ } || true`,
111
+ runCleanCache ? `${pmExec} clean:cache` : '',
112
+ ]
113
+ .filter(Boolean)
114
+ .join('\n ')}
109
115
  fi`;
110
116
 
111
117
  let postHookContent = runYarnInstallOnDiff;
112
118
  const packageLocations = getPackagesLocations(pkg);
113
119
 
114
120
  packageLocations.forEach((packageLocation) => {
115
- const cdToPackageLocation = packageLocation === '.' ? '' : `cd ${packageLocation} && `;
121
+ const cdToPackageLocation = packageLocation === '.' ? '' : `cd ${packageLocation}`;
122
+ const cdToRoot = packageLocation === '.' ? '' : `cd ${path.relative(packageLocation, '.')}`;
116
123
 
117
124
  const gemfilePath = path.join(packageLocation, 'Gemfile.lock');
118
125
  if (fs.existsSync(gemfilePath)) {
119
126
  postHookContent += `
120
127
  if [ -n "$(git diff HEAD@{1}..HEAD@{0} -- ${gemfilePath})" ]; then
121
- ${cdToPackageLocation}bundle install --path vendor/bundle || true
128
+ ${[cdToPackageLocation, 'bundle install --path vendor/bundle || true', cdToRoot].filter(Boolean).join('\n ')}
122
129
  fi
123
130
  `;
124
131
  }
@@ -127,7 +134,7 @@ fi
127
134
  if (fs.existsSync(podfilePath)) {
128
135
  postHookContent += `
129
136
  if [ -n "$(git diff HEAD@{1}..HEAD@{0} -- ${podfilePath})" ]; then
130
- ${cdToPackageLocation}yarn pod-install || true
137
+ ${[cdToPackageLocation, 'yarn pod-install || true', cdToRoot].filter(Boolean).join('\n ')}
131
138
  fi
132
139
  `;
133
140
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ornikar/repo-config",
3
- "version": "7.2.0",
4
- "description": "repo config",
3
+ "version": "7.2.4",
4
+ "description": "🔧 repo config",
5
5
  "repository": "ornikar/shared-configs",
6
6
  "license": "ISC",
7
7
  "engines": {
@@ -16,14 +16,14 @@
16
16
  "ornikar-prettier-fix": "./bin/ornikar-prettier-fix.sh"
17
17
  },
18
18
  "dependencies": {
19
- "@commitlint/cli": "16.0.2",
20
- "@ornikar/commitlint-config": "^4.0.2",
19
+ "@commitlint/cli": "16.1.0",
20
+ "@ornikar/commitlint-config": "^4.0.3",
21
21
  "husky": "7.0.4",
22
- "lint-staged": "12.1.7",
22
+ "lint-staged": "12.3.3",
23
23
  "prettier-plugin-properties": "0.1.0",
24
24
  "semver": "^7.3.5",
25
25
  "which-pm-runs": "^1.0.0",
26
26
  "yarn-deduplicate": "3.1.0"
27
27
  },
28
- "gitHead": "25bc80d21466f7723e2ecc3f1cf089c301e4a3ce"
28
+ "gitHead": "d9f6369372319663305f0cdafefa8e306f8a138d"
29
29
  }