@ornikar/repo-config 11.0.0 → 13.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
+ ## [13.0.0](https://github.com/ornikar/shared-configs/compare/@ornikar/repo-config@12.0.0...@ornikar/repo-config@13.0.0) (2023-10-25)
7
+
8
+
9
+ ### ⚠ BREAKING CHANGES
10
+
11
+ * monorepo-config rename lerna-config to monrepo-config and reduce lerna dependencies [no issue] (#1000)
12
+
13
+ ### Features
14
+
15
+ * monorepo-config rename lerna-config to monrepo-config and reduce lerna dependencies [no issue] ([#1000](https://github.com/ornikar/shared-configs/issues/1000)) ([63bab23](https://github.com/ornikar/shared-configs/commit/63bab23fb7f9fd2870cbf4259908afa3fe70e9cd))
16
+
17
+
18
+
19
+ ## [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)
20
+
21
+
22
+ ### ⚠ BREAKING CHANGES
23
+
24
+ * **repo-config:** automate nvmrc update in repo-config and update to 18.18.2 [no issue] (#993)
25
+
26
+ ### Features
27
+
28
+ * **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))
29
+
30
+
31
+
6
32
  ## [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)
7
33
 
8
34
 
@@ -4,6 +4,7 @@
4
4
 
5
5
  const fs = require('node:fs');
6
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')();
@@ -32,8 +32,9 @@ module.exports = function createLintStagedConfig(options = {}) {
32
32
  return [
33
33
  'yarn dedupe',
34
34
  packagejsonFilenames.length === 0 ? undefined : `prettier --write ${packagejsonFilenames.join(' ')}`,
35
- isLernaRepo && require.resolve('@ornikar/lerna-config/bin/generate-eslintrc-files.mjs'),
36
- shouldGenerateTsconfigInLernaRepo && require.resolve('@ornikar/lerna-config/bin/generate-tsconfig-files.mjs'),
35
+ isLernaRepo && require.resolve('@ornikar/monorepo-config/bin/generate-eslintrc-files.mjs'),
36
+ shouldGenerateTsconfigInLernaRepo &&
37
+ require.resolve('@ornikar/monorepo-config/bin/generate-tsconfig-files.mjs'),
37
38
  shouldRunCheckPkgJSScript && 'node ./scripts/check-packagejson.js',
38
39
  shouldRunCheckPkgMJSScript && 'node ./scripts/check-packagejson.mjs',
39
40
  'git add yarn.lock .yarn',
package/lib/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 18.18.2
@@ -5,7 +5,6 @@
5
5
  const fs = require('node:fs');
6
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
 
@@ -50,16 +49,14 @@ const getPackagesLocations = (pkg) => {
50
49
  const isMonorepo = !!pkg.workspaces;
51
50
 
52
51
  if (!isMonorepo) return ['.'];
53
- // eslint-disable-next-line import/no-extraneous-dependencies, global-require
54
- const { getSyncPackageLocations } = require('@ornikar/lerna-config');
55
- const packageLocations = getSyncPackageLocations(pkg.workspaces);
52
+ // eslint-disable-next-line global-require, import/no-extraneous-dependencies
53
+ const { getSyncPackageLocations } = require('@ornikar/monorepo-config');
54
+ const packageLocations = getSyncPackageLocations({ 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornikar/repo-config",
3
- "version": "11.0.0",
3
+ "version": "13.0.0",
4
4
  "description": "🔧 repo config",
5
5
  "repository": {
6
6
  "directory": "@ornikar/repo-config",
@@ -22,7 +22,7 @@
22
22
  "ornikar-repo-config-postinstall": "./bin/ornikar-repo-config-postinstall.js"
23
23
  },
24
24
  "dependencies": {
25
- "@commitlint/cli": "17.7.1",
25
+ "@commitlint/cli": "17.8.0",
26
26
  "@ornikar/commitlint-config": "6.0.0",
27
27
  "husky": "8.0.3",
28
28
  "lint-staged": "13.3.0",
@@ -32,6 +32,5 @@
32
32
  },
33
33
  "scripts": {
34
34
  "lint:eslint": "yarn ../.. eslint --report-unused-disable-directives --quiet @ornikar/repo-config"
35
- },
36
- "gitHead": "73a88449f791b3153ac71460f397eecb47a3ac18"
37
- }
35
+ }
36
+ }