@ornikar/repo-config 10.6.0 → 12.0.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 CHANGED
@@ -3,6 +3,32 @@
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
+ ## [12.0.0](https://github.com/ornikar/shared-configs/compare/@ornikar/repo-config@11.0.0...@ornikar/repo-config@12.0.0) (2023-10-18)
7
+
8
+
9
+ ### ⚠ BREAKING CHANGES
10
+
11
+ * **repo-config:** automate nvmrc update in repo-config and update to 18.18.2 [no issue] (#993)
12
+
13
+ ### Features
14
+
15
+ * **repo-config:** automate nvmrc update in repo-config and update to 18.18.2 [no issue] ([#993](https://github.com/ornikar/shared-configs/issues/993)) ([fc02ac8](https://github.com/ornikar/shared-configs/commit/fc02ac8e2db7b641faea1e5b27c4d73fcd9f5114))
16
+
17
+
18
+
19
+ ## [11.0.0](https://github.com/ornikar/shared-configs/compare/@ornikar/repo-config@10.6.0...@ornikar/repo-config@11.0.0) (2023-09-27)
20
+
21
+
22
+ ### ⚠ BREAKING CHANGES
23
+
24
+ * **rollup-config:** requires node 18 and requires to update exports as dist path changed
25
+
26
+ ### Features
27
+
28
+ * **rollup-config:** update to node 18 ECF-281 ([#979](https://github.com/ornikar/shared-configs/issues/979)) ([26eaaf9](https://github.com/ornikar/shared-configs/commit/26eaaf9db689de9ec474919881ce87784427cc5c))
29
+
30
+
31
+
6
32
  ## [10.6.0](https://github.com/ornikar/shared-configs/compare/@ornikar/repo-config@10.5.6...@ornikar/repo-config@10.6.0) (2023-09-13)
7
33
 
8
34
 
package/bin/commitlint.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  'use strict';
4
4
 
5
- const path = require('path');
5
+ const path = require('node:path');
6
6
  const pkg = require('@commitlint/cli/package.json');
7
7
 
8
8
  // eslint-disable-next-line import/no-dynamic-require
@@ -2,8 +2,9 @@
2
2
 
3
3
  'use strict';
4
4
 
5
- const fs = require('fs');
6
- const path = require('path');
5
+ const fs = require('node:fs');
6
+ const path = require('node:path');
7
+ const semver = require('semver');
7
8
  const whichPmRuns = require('which-pm-runs');
8
9
 
9
10
  if (!process.env.INIT_CWD) {
@@ -20,6 +21,16 @@ if (!pm) {
20
21
  process.exit(1);
21
22
  }
22
23
 
24
+ const yarnMajorVersion = pm.name === 'yarn' && semver.major(pm.version);
25
+ const isYarnBerry = pm.name === 'yarn' && yarnMajorVersion >= 2;
26
+
27
+ if (!isYarnBerry) {
28
+ console.error(`Invalid yarn version used ("${pm.version}"), please update to yarn berry!`);
29
+ console.error('https://ornikar.atlassian.net/wiki/spaces/TECH/pages/3196223545/How+to+migrate+to+yarn+berry');
30
+ process.exit(1);
31
+ }
32
+
23
33
  const pkg = JSON.parse(fs.readFileSync(path.resolve('package.json')));
24
34
 
25
- require('../lib/postinstall/install-husky')({ pkg, pm });
35
+ require('../lib/postinstall/install-husky')({ pkg });
36
+ require('../lib/postinstall/update-nvmrc')();
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const fs = require('fs');
4
- const path = require('path');
3
+ const fs = require('node:fs');
4
+ const path = require('node:path');
5
5
 
6
6
  // eslint-disable-next-line import/no-dynamic-require
7
7
  const pkg = require(path.resolve('package.json'));
package/lib/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 18.18.2
@@ -2,10 +2,9 @@
2
2
 
3
3
  'use strict';
4
4
 
5
- const fs = require('fs');
6
- const path = require('path');
5
+ const fs = require('node:fs');
6
+ const path = require('node:path');
7
7
  const husky = require('husky');
8
- const semver = require('semver');
9
8
  const { readYarnConfigFile } = require('../yarn');
10
9
  const { phrasePrePush } = require('./phrase-pre-push');
11
10
 
@@ -56,10 +55,8 @@ const getPackagesLocations = (pkg) => {
56
55
  return ['.', ...packageLocations];
57
56
  };
58
57
 
59
- module.exports = function installHusky({ pkg, pm }) {
60
- const yarnMajorVersion = pm.name === 'yarn' && semver.major(pm.version);
61
- const isYarnBerry = pm.name === 'yarn' && yarnMajorVersion >= 2;
62
- const isYarnPnp = isYarnBerry && !readYarnConfigFile().includes('nodeLinker: node-modules');
58
+ module.exports = function installHusky({ pkg }) {
59
+ const isYarnPnp = !readYarnConfigFile().includes('nodeLinker: node-modules');
63
60
 
64
61
  /* Check legacy */
65
62
 
@@ -79,17 +76,15 @@ module.exports = function installHusky({ pkg, pm }) {
79
76
  // if the directory already exists, continue
80
77
  }
81
78
 
82
- const pmExec = pm.name === 'npm' ? 'npx --no-install' : pm.name;
83
-
84
- writeHook('commit-msg', `${pmExec} commitlint --edit $1`);
79
+ writeHook('commit-msg', 'yarn commitlint --edit $1');
85
80
  writeHook(
86
81
  'pre-commit',
87
82
  `
88
83
  if [ ! -f node_modules/.bin/ornikar-lint-staged ]; then
89
- ${pmExec}
84
+ yarn
90
85
  fi
91
86
 
92
- ${pmExec} ornikar-lint-staged
87
+ yarn ornikar-lint-staged
93
88
  `,
94
89
  );
95
90
 
@@ -103,12 +98,8 @@ ${pmExec} ornikar-lint-staged
103
98
  if [ -n "$(git diff HEAD@{1}..HEAD@{0} -- yarn.lock)" ]; then
104
99
  ${[
105
100
  // https://yarnpkg.com/features/zero-installs
106
- isYarnPnp
107
- ? ''
108
- : `yarn install ${
109
- isYarnBerry ? '--immutable --immutable-cache' : '--prefer-offline --pure-lockfile --ignore-optional'
110
- } || true`,
111
- runCleanCache ? `${pmExec} clean:cache:on-dependencies-changes` : '',
101
+ isYarnPnp ? '' : 'yarn install --immutable --immutable-cache || true',
102
+ runCleanCache ? 'yarn clean:cache:on-dependencies-changes' : '',
112
103
  ]
113
104
  .filter(Boolean)
114
105
  .join('\n ')}
@@ -149,19 +140,19 @@ fi
149
140
 
150
141
  if (shouldRunTest()) {
151
142
  if (pkg.scripts.test === 'node --test') {
152
- prePushHook.push(`CI=true ${pm.name} test`);
143
+ prePushHook.push('CI=true yarn test');
153
144
  } else {
154
145
  prePushHookPreCommands.push(
155
146
  '# autodetect main branch (usually master or main)',
156
147
  'mainBranch=$(LANG=en_US git remote show origin | grep "HEAD branch" | cut -d\' \' -f5)',
157
148
  '',
158
149
  );
159
- prePushHook.push(`CI=true ${pm.name} test --changedSince=origin/$mainBranch`);
150
+ prePushHook.push('CI=true yarn test --changedSince=origin/$mainBranch');
160
151
  }
161
152
  }
162
153
 
163
154
  if (shouldRunChecks()) {
164
- prePushHook.push(`${pm.name} run checks`);
155
+ prePushHook.push('yarn run checks');
165
156
  }
166
157
 
167
158
  if (prePushHook.length > 0) {
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ const fs = require('node:fs');
4
+ const path = require('node:path');
5
+
6
+ module.exports = function updateNvmrc() {
7
+ const nvmrcContent = fs.readFileSync(path.resolve(__dirname, '../.nvmrc'), 'utf8');
8
+
9
+ fs.writeFileSync(path.resolve('.nvmrc'), `${nvmrcContent.trim()}\n`, {
10
+ mode: '644',
11
+ });
12
+ };
package/lib/yarn.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const fs = require('fs');
4
- const path = require('path');
3
+ const fs = require('node:fs');
4
+ const path = require('node:path');
5
5
 
6
6
  const readYarnConfigFile = () => {
7
7
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornikar/repo-config",
3
- "version": "10.6.0",
3
+ "version": "12.0.0",
4
4
  "description": "🔧 repo config",
5
5
  "repository": {
6
6
  "directory": "@ornikar/repo-config",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "license": "ISC",
11
11
  "engines": {
12
- "node": ">=16.16.0"
12
+ "node": ">=18.18.0"
13
13
  },
14
14
  "publishConfig": {
15
15
  "access": "public"
@@ -22,8 +22,8 @@
22
22
  "ornikar-repo-config-postinstall": "./bin/ornikar-repo-config-postinstall.js"
23
23
  },
24
24
  "dependencies": {
25
- "@commitlint/cli": "17.7.1",
26
- "@ornikar/commitlint-config": "^5.0.2",
25
+ "@commitlint/cli": "17.8.0",
26
+ "@ornikar/commitlint-config": "6.0.0",
27
27
  "husky": "8.0.3",
28
28
  "lint-staged": "13.3.0",
29
29
  "prettier-plugin-properties": "0.2.0",
@@ -33,5 +33,5 @@
33
33
  "scripts": {
34
34
  "lint:eslint": "yarn ../.. eslint --report-unused-disable-directives --quiet @ornikar/repo-config"
35
35
  },
36
- "gitHead": "38fe746c8f54e2777ab8b038b1176730f86b18ed"
36
+ "gitHead": "0e2165006c0b479de4acdbfe47a08cf057e03b48"
37
37
  }