@pob/root 9.5.0 → 11.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,71 @@
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
+ ## [11.0.0](https://github.com/christophehurpeau/pob/compare/@pob/root@10.0.0...@pob/root@11.0.0) (2024-06-07)
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * **deps:** use async prettier or prettier/sync
11
+
12
+ ### Features
13
+
14
+ * add package yarn-version ([e2e8be6](https://github.com/christophehurpeau/pob/commit/e2e8be65fd50f9084c519fd07503748a1d970509))
15
+ * **deps:** update @pob/eslint-config to v56 (major) ([#2036](https://github.com/christophehurpeau/pob/issues/2036)) ([b26302b](https://github.com/christophehurpeau/pob/commit/b26302bd6dbf9bf4da2e97238c59ae80282ad9a4))
16
+ * **deps:** update dependency @rollup/plugin-run to v3.1.0 ([#2079](https://github.com/christophehurpeau/pob/issues/2079)) ([c2ef4fa](https://github.com/christophehurpeau/pob/commit/c2ef4fa22322952dcb626a5d99bc16e141684cd0))
17
+ * **deps:** update dependency conventional-changelog-conventionalcommits to v8 ([#2033](https://github.com/christophehurpeau/pob/issues/2033)) ([e7a568e](https://github.com/christophehurpeau/pob/commit/e7a568e4fabea00955bc6f005d85088f947f58cb))
18
+ * **deps:** update dependency esbuild to v0.21.0 ([#2040](https://github.com/christophehurpeau/pob/issues/2040)) ([dc252dc](https://github.com/christophehurpeau/pob/commit/dc252dc815dd450e2687e3f5784c3604bcfbab3c))
19
+ * **deps:** update dependency glob to v10.4.0 ([#2061](https://github.com/christophehurpeau/pob/issues/2061)) ([05dd06f](https://github.com/christophehurpeau/pob/commit/05dd06f1fb51d3cff0b95d6457fb9060d5d2db29))
20
+ * **deps:** update dependency prettier to v3 ([#1698](https://github.com/christophehurpeau/pob/issues/1698)) ([a65e641](https://github.com/christophehurpeau/pob/commit/a65e6418d4b80680b753a773b02925603df8ea12))
21
+ * **deps:** update dependency prettier to v3.3.0 ([#2071](https://github.com/christophehurpeau/pob/issues/2071)) ([04f24c3](https://github.com/christophehurpeau/pob/commit/04f24c33fcab0472cc830675696c219ee5ba14f9))
22
+ * **deps:** update dependency yeoman-generator to v7.2.0 ([#2063](https://github.com/christophehurpeau/pob/issues/2063)) ([a5b8748](https://github.com/christophehurpeau/pob/commit/a5b8748fecedff6291475656672feb1766c60e5f))
23
+ * migrate pob.babelEnvs to pob.envs + pob.bundler ([6baa9bb](https://github.com/christophehurpeau/pob/commit/6baa9bb986a1321beefcf9de3de566c285e548d1))
24
+
25
+ ### Bug Fixes
26
+
27
+ * commit build of yarn-version ([539f4b2](https://github.com/christophehurpeau/pob/commit/539f4b2e12d8df4dc5cec272a24343721f4d2bdb))
28
+ * **deps:** update dependency esbuild to v0.21.1 ([#2042](https://github.com/christophehurpeau/pob/issues/2042)) ([2c47629](https://github.com/christophehurpeau/pob/commit/2c476296d1ecabaf272461df0901786bcea07aab))
29
+ * **deps:** update dependency esbuild to v0.21.2 ([#2051](https://github.com/christophehurpeau/pob/issues/2051)) ([8e8596f](https://github.com/christophehurpeau/pob/commit/8e8596f11350ee7e152ebec5603295edea8e6da7))
30
+ * **deps:** update dependency esbuild to v0.21.3 ([#2055](https://github.com/christophehurpeau/pob/issues/2055)) ([f27179c](https://github.com/christophehurpeau/pob/commit/f27179c5d6f4259a2885ee9097cf857b73849cef))
31
+ * **deps:** update dependency esbuild to v0.21.4 ([#2065](https://github.com/christophehurpeau/pob/issues/2065)) ([984e479](https://github.com/christophehurpeau/pob/commit/984e479c1958c224bc584936c13908578563e29d))
32
+ * **deps:** update dependency glob to v10.3.14 ([#2047](https://github.com/christophehurpeau/pob/issues/2047)) ([201fff2](https://github.com/christophehurpeau/pob/commit/201fff2e3def4a8c7344af403464e7bf16eb44bc))
33
+ * **deps:** update dependency glob to v10.3.15 ([#2050](https://github.com/christophehurpeau/pob/issues/2050)) ([8142969](https://github.com/christophehurpeau/pob/commit/8142969c29cda5fb5f8cf924522fd719ac0278d7))
34
+ * **deps:** update dependency glob to v10.3.16 ([#2056](https://github.com/christophehurpeau/pob/issues/2056)) ([d5ce7c0](https://github.com/christophehurpeau/pob/commit/d5ce7c0922a93a188250eb5e6a5eb8b14ac76630))
35
+ * **deps:** update dependency glob to v10.4.1 ([#2062](https://github.com/christophehurpeau/pob/issues/2062)) ([c9eb614](https://github.com/christophehurpeau/pob/commit/c9eb614f8b0906bf4757bb21ed2bed570dbf55c4))
36
+ * **deps:** update dependency lint-staged to v15.2.4 ([#2057](https://github.com/christophehurpeau/pob/issues/2057)) ([3266770](https://github.com/christophehurpeau/pob/commit/3266770fc90c82ccc25cd0bce67106063cf38b51))
37
+ * **deps:** update dependency lint-staged to v15.2.5 ([#2066](https://github.com/christophehurpeau/pob/issues/2066)) ([0c5396b](https://github.com/christophehurpeau/pob/commit/0c5396b73c9a99e37964c9752f2f55b4079f888e))
38
+ * **deps:** update dependency mem-fs-editor to v11.0.1 ([#2060](https://github.com/christophehurpeau/pob/issues/2060)) ([a4824cb](https://github.com/christophehurpeau/pob/commit/a4824cb89b8d94846ac7eb4ca062a500cadcc606))
39
+ * **deps:** update dependency prettier to v3.3.1 ([#2078](https://github.com/christophehurpeau/pob/issues/2078)) ([57ecb30](https://github.com/christophehurpeau/pob/commit/57ecb301bc6dded8e9063c1e3afc9f6f04d023b1))
40
+ * **deps:** update dependency semver to v7.6.1 ([#2041](https://github.com/christophehurpeau/pob/issues/2041)) ([17b20a3](https://github.com/christophehurpeau/pob/commit/17b20a3a352e4fbcda88d2e43938a8dbafe0667c))
41
+ * **deps:** update dependency semver to v7.6.2 ([#2048](https://github.com/christophehurpeau/pob/issues/2048)) ([e4a50f3](https://github.com/christophehurpeau/pob/commit/e4a50f3c11b87306ed30ec0cbcdd8f6f23a4ac75))
42
+ * **deps:** update dependency yeoman-environment to v4.4.1 ([#2073](https://github.com/christophehurpeau/pob/issues/2073)) ([528734e](https://github.com/christophehurpeau/pob/commit/528734e27f1f0b59ab5f5d87ff98e95385168b72))
43
+ * **deps:** update yarn monorepo ([#2045](https://github.com/christophehurpeau/pob/issues/2045)) ([bfce168](https://github.com/christophehurpeau/pob/commit/bfce1680e6df15f6a57e83fefc39e1257bf8f6e3))
44
+ * fix for CommonTestingGenerator ([e7f93df](https://github.com/christophehurpeau/pob/commit/e7f93df65007fe8a6e5faac6fd3d796adf6d3233))
45
+ * fix yarn-version command ([87e25ca](https://github.com/christophehurpeau/pob/commit/87e25cae86d3730f14e50e6370efe69bd2e21814))
46
+ * **pob:** leave default compressionLevel config ([3d4c5d1](https://github.com/christophehurpeau/pob/commit/3d4c5d1e92ec1194dec99e768c2743e085c1fa94))
47
+ * **pob:** missing await ([f91682b](https://github.com/christophehurpeau/pob/commit/f91682b72016733065d7d505c6be5d4fddad25d8))
48
+ * update json5 ([4034c94](https://github.com/christophehurpeau/pob/commit/4034c947a1111021ee037144cefbee0cd39b9d33))
49
+ Version bump for dependency: @pob/pretty-eslint-config
50
+ Version bump for dependency: @pob/pretty-pkg
51
+ Version bump for dependency: repository-check-dirty
52
+ Version bump for dependency: yarn-version
53
+
54
+
55
+ ## [10.0.0](https://github.com/christophehurpeau/pob/compare/@pob/root@9.5.0...@pob/root@10.0.0) (2024-05-05)
56
+
57
+
58
+ ### ⚠ BREAKING CHANGES
59
+
60
+ * change prettier config to get closer to default
61
+
62
+ ### Features
63
+
64
+ * change prettier config to get closer to default ([8e472a9](https://github.com/christophehurpeau/pob/commit/8e472a98b0a722c5cd779e4731ff625b0bfa07bb))
65
+
66
+ Version bump for dependency: pretty-eslint-config
67
+ Version bump for dependency: pretty-pkg
68
+ Version bump for dependency: repository-check-dirty
69
+
70
+
6
71
  ## [9.5.0](https://github.com/christophehurpeau/pob/compare/@pob/root@9.4.3...@pob/root@9.5.0) (2024-05-05)
7
72
 
8
73
 
package/README.md CHANGED
@@ -22,7 +22,7 @@ npm install --save @pob/root
22
22
  ## Usage
23
23
 
24
24
  ```js
25
- import pobRoot from '@pob/root';
25
+ import pobRoot from "@pob/root";
26
26
 
27
27
  console.log(pobRoot);
28
28
  ```
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import cliPath from "@commitlint/cli";
4
+
5
+ await import(cliPath);
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // eslint-disable-next-line import/no-unresolved
4
- import lintStaged from 'lint-staged';
4
+ import lintStaged from "lint-staged";
5
5
 
6
6
  lintStaged({
7
7
  concurrent: true,
@@ -1,48 +1,50 @@
1
1
  #!/usr/bin/env node
2
2
  /* eslint-disable unicorn/no-await-expression-member */
3
3
 
4
- import fs from 'node:fs';
5
- import path from 'node:path';
6
- import whichPmRuns from 'which-pm-runs';
4
+ import fs from "node:fs";
5
+ import path from "node:path";
6
+ import whichPmRuns from "which-pm-runs";
7
7
 
8
8
  if (!process.env.INIT_CWD) {
9
9
  console.error(
10
- 'Missing process.env.INIT_CWD. Did you use postinstall script ?',
10
+ "Missing process.env.INIT_CWD. Did you use postinstall script ?",
11
11
  );
12
12
  process.exit(1);
13
13
  }
14
14
 
15
15
  process.chdir(process.env.PROJECT_CWD || process.env.INIT_CWD);
16
16
 
17
- const pkg = JSON.parse(fs.readFileSync(path.resolve('package.json')));
17
+ const pkg = JSON.parse(fs.readFileSync(path.resolve("package.json")));
18
18
 
19
19
  /* Check Package Manager */
20
20
 
21
21
  const pm = process.env.POB_ROOT_FAKE_PM
22
22
  ? JSON.parse(process.env.POB_ROOT_FAKE_PM)
23
23
  : whichPmRuns() ||
24
- (fs.existsSync('package-lock.json') ? { name: 'npm' } : undefined);
24
+ (fs.existsSync("package-lock.json") ? { name: "npm" } : undefined);
25
25
 
26
26
  if (!pm) {
27
- console.error('Invalid pm, please run with postinstall hook!');
27
+ console.error("Invalid pm, please run with postinstall hook!");
28
28
  process.exit(1);
29
29
  }
30
30
 
31
- if (pm.name !== 'yarn' && pm.name !== 'npm' && pm.name !== 'bun') {
31
+ if (pm.name !== "yarn" && pm.name !== "npm" && pm.name !== "bun") {
32
32
  console.error(
33
33
  `Package manager not supported: ${pm.name}. Please run with yarn or npm!`,
34
34
  );
35
35
  process.exit(1);
36
36
  }
37
37
 
38
- (await import('./postinstall/update-yarn.js')).default({ pkg, pm });
39
- (await import('./postinstall/install-husky.js')).default({ pkg, pm });
40
- (await import('./postinstall/install-github-workflows.js')).default({
38
+ (await import("./postinstall/update-yarn.js")).default({ pkg, pm });
39
+ (await import("./postinstall/install-husky.js")).default({ pkg, pm });
40
+ (await import("./postinstall/install-github-workflows.js")).default({
41
41
  pkg,
42
42
  pm,
43
43
  });
44
- (await import('./postinstall/install-scripts.js')).default({ pkg, pm });
44
+ (await import("./postinstall/install-scripts.js")).default({ pkg, pm });
45
45
 
46
46
  if (process.env.POB_EXPERIMENTAL_VSCODE_TASKS) {
47
- (await import('./postinstall/install-vscode-tasks.js')).default({ pkg, pm });
47
+ await (
48
+ await import("./postinstall/install-vscode-tasks.js")
49
+ ).default({ pkg, pm });
48
50
  }
@@ -1,7 +1,7 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
- import semver from 'semver';
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import semver from "semver";
5
5
 
6
6
  const ensureWorkflowUninstalled = (workflowName) => {
7
7
  try {
@@ -26,23 +26,23 @@ const installWorkflow = (workflowName, condition = true) => {
26
26
  };
27
27
 
28
28
  export default function installGithubWorkflows({ pkg, pm }) {
29
- const yarnMajorVersion = pm.name === 'yarn' && semver.major(pm.version);
30
- const isYarnBerry = pm.name === 'yarn' && yarnMajorVersion >= 2;
29
+ const yarnMajorVersion = pm.name === "yarn" && semver.major(pm.version);
30
+ const isYarnBerry = pm.name === "yarn" && yarnMajorVersion >= 2;
31
31
 
32
32
  if (!isYarnBerry) return;
33
33
 
34
- if (fs.existsSync('.github')) {
35
- installWorkflow('push-renovate-pob_root');
36
- installWorkflow('push-renovate-prettier');
37
- ensureWorkflowUninstalled('push-renovate-typedoc');
34
+ if (fs.existsSync(".github")) {
35
+ installWorkflow("push-renovate-pob_root");
36
+ installWorkflow("push-renovate-prettier");
37
+ ensureWorkflowUninstalled("push-renovate-typedoc");
38
38
  if (
39
39
  pkg.devDependencies &&
40
40
  pkg.devDependencies.rollup &&
41
41
  pkg.scripts?.build
42
42
  ) {
43
- installWorkflow('push-renovate-build');
43
+ installWorkflow("push-renovate-build");
44
44
  } else {
45
- ensureWorkflowUninstalled('push-renovate-build');
45
+ ensureWorkflowUninstalled("push-renovate-build");
46
46
  }
47
47
  }
48
48
  }
@@ -1,23 +1,23 @@
1
1
  /* eslint-disable complexity */
2
2
 
3
- import fs from 'node:fs';
4
- import path from 'node:path';
5
- import husky from 'husky';
6
- import semver from 'semver';
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import husky from "husky";
6
+ import semver from "semver";
7
7
 
8
8
  const ensureLegacyHuskyConfigDeleted = () => {
9
9
  try {
10
- fs.unlinkSync(path.resolve('husky.config.js'));
10
+ fs.unlinkSync(path.resolve("husky.config.js"));
11
11
  } catch {}
12
12
  try {
13
- fs.unlinkSync(path.resolve('.huskyrc'));
13
+ fs.unlinkSync(path.resolve(".huskyrc"));
14
14
  } catch {}
15
15
  };
16
16
 
17
17
  const ensureHuskyNotInDevDependencies = (pkg) => {
18
18
  if (pkg.devDependencies && pkg.devDependencies.husky) {
19
19
  throw new Error(
20
- 'Found husky in devDependencies. Husky is provided by @pob/root, please remove',
20
+ "Found husky in devDependencies. Husky is provided by @pob/root, please remove",
21
21
  );
22
22
  }
23
23
  };
@@ -27,7 +27,7 @@ const writeHook = (hookName, hookContent) => {
27
27
  path.resolve(`.husky/${hookName}`),
28
28
  `#!/usr/bin/env sh\n\n${hookContent.trim()}\n`,
29
29
  {
30
- mode: '755',
30
+ mode: "755",
31
31
  },
32
32
  );
33
33
  };
@@ -40,19 +40,19 @@ const ensureHookDeleted = (hookName) => {
40
40
 
41
41
  const readYarnConfigFile = () => {
42
42
  try {
43
- return fs.readFileSync(path.resolve('.yarnrc.yml'));
43
+ return fs.readFileSync(path.resolve(".yarnrc.yml"));
44
44
  } catch {
45
- return '';
45
+ return "";
46
46
  }
47
47
  };
48
48
 
49
49
  export default function installHusky({ pkg, pm }) {
50
- const yarnMajorVersion = pm.name === 'yarn' && semver.major(pm.version);
51
- const isYarnBerry = pm.name === 'yarn' && yarnMajorVersion >= 2;
50
+ const yarnMajorVersion = pm.name === "yarn" && semver.major(pm.version);
51
+ const isYarnBerry = pm.name === "yarn" && yarnMajorVersion >= 2;
52
52
  const yarnConfig = isYarnBerry && readYarnConfigFile();
53
53
  const isYarnPnp =
54
- !yarnConfig.includes('nodeLinker: node-modules') &&
55
- !yarnConfig.includes('nodeLinker: pnpm');
54
+ !yarnConfig.includes("nodeLinker: node-modules") &&
55
+ !yarnConfig.includes("nodeLinker: pnpm");
56
56
 
57
57
  /* Check legacy */
58
58
 
@@ -66,33 +66,33 @@ export default function installHusky({ pkg, pm }) {
66
66
  const shouldRunLint = () => pkg.scripts && pkg.scripts.lint;
67
67
 
68
68
  try {
69
- fs.mkdirSync(path.resolve('.husky'));
69
+ fs.mkdirSync(path.resolve(".husky"));
70
70
  } catch {}
71
71
 
72
72
  const { lockfile, pmExec, installOnDiffCommand } = (() => {
73
- if (pm.name === 'yarn') {
73
+ if (pm.name === "yarn") {
74
74
  return {
75
- lockfile: 'yarn.lock',
76
- pmExec: 'yarn',
75
+ lockfile: "yarn.lock",
76
+ pmExec: "yarn",
77
77
  installOnDiffCommand: `yarn install ${
78
78
  isYarnBerry
79
- ? '--immutable'
80
- : '--prefer-offline --pure-lockfile --ignore-optional'
79
+ ? "--immutable"
80
+ : "--prefer-offline --pure-lockfile --ignore-optional"
81
81
  }`,
82
82
  };
83
83
  }
84
- if (pm.name === 'npm') {
84
+ if (pm.name === "npm") {
85
85
  return {
86
- lockfile: 'package-lock.json',
87
- pmExec: 'npx --no-install',
88
- installOnDiffCommand: 'npm i',
86
+ lockfile: "package-lock.json",
87
+ pmExec: "npx --no-install",
88
+ installOnDiffCommand: "npm i",
89
89
  };
90
90
  }
91
- if (pm.name === 'bun') {
91
+ if (pm.name === "bun") {
92
92
  return {
93
- lockfile: 'bun.lockb',
94
- pmExec: 'bun run',
95
- installOnDiffCommand: 'bun i',
93
+ lockfile: "bun.lockb",
94
+ pmExec: "bun run",
95
+ installOnDiffCommand: "bun i",
96
96
  };
97
97
  }
98
98
 
@@ -101,13 +101,13 @@ export default function installHusky({ pkg, pm }) {
101
101
  );
102
102
  })();
103
103
 
104
- writeHook('commit-msg', `${pmExec} commitlint --edit $1`);
105
- writeHook('pre-commit', `${pmExec} pob-root-lint-staged`);
104
+ writeHook("commit-msg", `${pmExec} commitlint --edit $1`);
105
+ writeHook("pre-commit", `${pmExec} pob-root-lint-staged`);
106
106
 
107
107
  if (isYarnPnp) {
108
- ensureHookDeleted('post-checkout');
109
- ensureHookDeleted('post-merge');
110
- ensureHookDeleted('post-rewrite');
108
+ ensureHookDeleted("post-checkout");
109
+ ensureHookDeleted("post-merge");
110
+ ensureHookDeleted("post-rewrite");
111
111
  } else {
112
112
  const runInstallOnDiff = (() => {
113
113
  return `
@@ -117,9 +117,9 @@ fi`;
117
117
  })();
118
118
 
119
119
  // https://yarnpkg.com/features/zero-installs
120
- writeHook('post-checkout', runInstallOnDiff);
121
- writeHook('post-merge', runInstallOnDiff);
122
- writeHook('post-rewrite', runInstallOnDiff);
120
+ writeHook("post-checkout", runInstallOnDiff);
121
+ writeHook("post-merge", runInstallOnDiff);
122
+ writeHook("post-rewrite", runInstallOnDiff);
123
123
  }
124
124
 
125
125
  const prePushHook = [];
@@ -135,19 +135,19 @@ fi`;
135
135
  if (shouldRunTest()) {
136
136
  const getTestCommand = () => {
137
137
  if (pkg.devDependencies?.jest) {
138
- return 'test --watchAll=false --changedSince=origin/main';
138
+ return "test --watchAll=false --changedSince=origin/main";
139
139
  }
140
140
  if (pkg.devDependencies?.vitest) {
141
- return 'test --run --changed origin/main';
141
+ return "test --run --changed origin/main";
142
142
  }
143
- return 'test';
143
+ return "test";
144
144
  };
145
145
  prePushHook.push(`${pmExec} ${getTestCommand()}`);
146
146
  }
147
147
 
148
148
  if (prePushHook.length > 0) {
149
149
  writeHook(
150
- 'pre-push',
150
+ "pre-push",
151
151
  `
152
152
  # z40 is the value matching the empty blob/commit/tree SHA (zero x 40)
153
153
  z40=0000000000000000000000000000000000000000
@@ -158,15 +158,15 @@ do
158
158
  # Skip if branch deletion
159
159
  if [ "$local_sha" != "$z40" ]; then
160
160
  if [ "$local_ref" = "$branch_ref" ]; then
161
- ${prePushHook.join(' && ')}
161
+ ${prePushHook.join(" && ")}
162
162
  fi
163
163
  fi
164
164
  done
165
165
  `,
166
166
  );
167
167
  } else {
168
- ensureHookDeleted('pre-push');
168
+ ensureHookDeleted("pre-push");
169
169
  }
170
170
 
171
- process.stdout.write(husky('.husky'));
171
+ process.stdout.write(husky(".husky"));
172
172
  }
@@ -1,32 +1,31 @@
1
- import fs from 'node:fs';
1
+ import fs from "node:fs";
2
2
 
3
3
  const addPobRootPostinstallInScript = (pkg, scriptName) => {
4
4
  if (!pkg.scripts[scriptName]) {
5
- pkg.scripts[scriptName] = 'pob-root-postinstall';
6
- } else if (!pkg.scripts[scriptName].includes('pob-root-postinstall')) {
7
- pkg.scripts[
8
- scriptName
9
- ] = `pob-root-postinstall ; ${pkg.scripts.postinstall}`;
5
+ pkg.scripts[scriptName] = "pob-root-postinstall";
6
+ } else if (!pkg.scripts[scriptName].includes("pob-root-postinstall")) {
7
+ pkg.scripts[scriptName] =
8
+ `pob-root-postinstall ; ${pkg.scripts.postinstall}`;
10
9
  }
11
10
  };
12
11
 
13
12
  export default function installScripts({ pkg, pm }) {
14
13
  if (!pkg.scripts) pkg.scripts = {};
15
- if (pkg.name === 'pob-monorepo') return;
14
+ if (pkg.name === "pob-monorepo") return;
16
15
 
17
- if (pm.name === 'yarn') {
16
+ if (pm.name === "yarn") {
18
17
  if (pkg.private) {
19
18
  delete pkg.scripts.postinstallDev;
20
- addPobRootPostinstallInScript(pkg, 'postinstall');
19
+ addPobRootPostinstallInScript(pkg, "postinstall");
21
20
  } else {
22
- if (pkg.scripts.postinstall === 'pob-root-postinstall') {
21
+ if (pkg.scripts.postinstall === "pob-root-postinstall") {
23
22
  delete pkg.scripts.postinstall;
24
23
  }
25
- pkg.scripts.postinstallDev = 'pob-root-postinstall';
24
+ pkg.scripts.postinstallDev = "pob-root-postinstall";
26
25
  }
27
26
  } else {
28
- addPobRootPostinstallInScript(pkg, 'prepare');
27
+ addPobRootPostinstallInScript(pkg, "prepare");
29
28
  }
30
29
 
31
- fs.writeFileSync('package.json', `${JSON.stringify(pkg, null, 2)}\n`, 'utf8');
30
+ fs.writeFileSync("package.json", `${JSON.stringify(pkg, null, 2)}\n`, "utf8");
32
31
  }
@@ -1,6 +1,6 @@
1
- import fs from 'node:fs';
2
- import JSON5 from 'json5';
3
- import prettier from 'prettier';
1
+ import fs from "node:fs";
2
+ import JSON5 from "json5";
3
+ import prettier from "prettier";
4
4
 
5
5
  function readJSON5(path, defaults = null) {
6
6
  try {
@@ -12,41 +12,41 @@ function readJSON5(path, defaults = null) {
12
12
  }
13
13
 
14
14
  function getGroupNameFromScriptName(scriptName) {
15
- if (scriptName.startsWith('lint') || scriptName === 'tsc') return 'lint';
16
- if (scriptName.startsWith('test')) return 'test';
17
- if (scriptName.startsWith('start') || scriptName.startsWith('build')) {
18
- return 'build';
15
+ if (scriptName.startsWith("lint") || scriptName === "tsc") return "lint";
16
+ if (scriptName.startsWith("test")) return "test";
17
+ if (scriptName.startsWith("start") || scriptName.startsWith("build")) {
18
+ return "build";
19
19
  }
20
20
  return undefined;
21
21
  }
22
22
 
23
23
  function getProblemMatcherFromScriptName(scriptName) {
24
- if (scriptName === 'lint:eslint') return ['$eslint-stylish'];
25
- if (scriptName === 'tsc') return ['$tsc'];
24
+ if (scriptName === "lint:eslint") return ["$eslint-stylish"];
25
+ if (scriptName === "tsc") return ["$tsc"];
26
26
  return [];
27
27
  }
28
28
 
29
- export default function installVscodeTasks({ pkg }) {
30
- const existingConfig = readJSON5('.vscode/tasks.json');
29
+ export default async function installVscodeTasks({ pkg }) {
30
+ const existingConfig = readJSON5(".vscode/tasks.json");
31
31
  const existingTasks = existingConfig?.tasks || [];
32
32
 
33
33
  // filter all npm tasks, we will recreate them right after
34
- const tasks = existingTasks.filter((task) => task.type !== 'npm');
34
+ const tasks = existingTasks.filter((task) => task.type !== "npm");
35
35
 
36
36
  if (pkg.scripts) {
37
37
  const scriptNames = Object.keys(pkg.scripts);
38
38
  Object.entries(pkg.scripts).forEach(([scriptName, scriptCommand]) => {
39
- if (scriptName === 'postinstall') return;
40
- if (scriptName === 'lint') {
39
+ if (scriptName === "postinstall") return;
40
+ if (scriptName === "lint") {
41
41
  tasks.push({
42
42
  label: scriptName,
43
43
  group: getGroupNameFromScriptName(scriptName),
44
44
  dependsOn: scriptNames.filter(
45
45
  (name) =>
46
- (name !== 'lint' &&
47
- name.startsWith('lint') &&
48
- !name.endsWith(':fix')) ||
49
- name === 'tsc',
46
+ (name !== "lint" &&
47
+ name.startsWith("lint") &&
48
+ !name.endsWith(":fix")) ||
49
+ name === "tsc",
50
50
  ),
51
51
  });
52
52
  return;
@@ -55,17 +55,17 @@ export default function installVscodeTasks({ pkg }) {
55
55
  const task = {
56
56
  label: scriptName,
57
57
  problemMatcher: getProblemMatcherFromScriptName(scriptName),
58
- type: 'npm',
58
+ type: "npm",
59
59
  script: scriptName,
60
60
  group: getGroupNameFromScriptName(scriptName),
61
61
  presentation: {
62
- panel: 'dedicated',
62
+ panel: "dedicated",
63
63
  group: getGroupNameFromScriptName(scriptName),
64
64
  clear: true,
65
65
  },
66
66
  };
67
67
 
68
- if (scriptName === 'start' || scriptName === 'watch') {
68
+ if (scriptName === "start" || scriptName === "watch") {
69
69
  task.isBackground = true;
70
70
  }
71
71
 
@@ -74,8 +74,8 @@ export default function installVscodeTasks({ pkg }) {
74
74
  }
75
75
 
76
76
  fs.writeFileSync(
77
- '.vscode/tasks.json',
78
- prettier.format(
77
+ ".vscode/tasks.json",
78
+ await prettier.format(
79
79
  `{
80
80
  // See https://go.microsoft.com/fwlink/?LinkId=733558
81
81
  // for the documentation about the tasks.json format
@@ -84,7 +84,7 @@ export default function installVscodeTasks({ pkg }) {
84
84
  }
85
85
  `,
86
86
  {
87
- filepath: '.vscode/tasks.json',
87
+ filepath: ".vscode/tasks.json",
88
88
  },
89
89
  ),
90
90
  );
@@ -1,29 +1,29 @@
1
- import { execSync } from 'node:child_process';
2
- import semver from 'semver';
1
+ import { execSync } from "node:child_process";
2
+ import semver from "semver";
3
3
 
4
4
  export default function updateYarn({ pkg, pm }) {
5
- if (pm.name !== 'yarn' || !pm.version) return;
5
+ if (pm.name !== "yarn" || !pm.version) return;
6
6
 
7
- if (semver.lt(pm.version, '3.2.1')) {
7
+ if (semver.lt(pm.version, "3.2.1")) {
8
8
  // Upgrade from yarn 1
9
- if (semver.lt(pm.version, '2.0.0')) {
10
- console.log('-- Install yarn berry --');
9
+ if (semver.lt(pm.version, "2.0.0")) {
10
+ console.log("-- Install yarn berry --");
11
11
  } else {
12
- console.log('-- Update yarn --');
12
+ console.log("-- Update yarn --");
13
13
  }
14
- execSync('yarn set version stable', { stdio: 'inherit' });
14
+ execSync("yarn set version stable", { stdio: "inherit" });
15
15
 
16
16
  // removes yarn paths (can have 2) to use the newly installed yarn
17
- const paths = process.env.PATH.split(':');
18
- while (paths[0].startsWith('/tmp/xfs-')) paths.shift();
17
+ const paths = process.env.PATH.split(":");
18
+ while (paths[0].startsWith("/tmp/xfs-")) paths.shift();
19
19
 
20
- execSync('yarn install', {
21
- stdio: 'inherit',
20
+ execSync("yarn install", {
21
+ stdio: "inherit",
22
22
  env: {
23
23
  ...process.env,
24
- PATH: paths.join(':'),
24
+ PATH: paths.join(":"),
25
25
  },
26
26
  });
27
- console.log('Yarn update success !');
27
+ console.log("Yarn update success !");
28
28
  }
29
29
  }
package/bin/prettier.cjs CHANGED
@@ -1,12 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- 'use strict';
3
+ "use strict";
4
4
 
5
- const path = require('node:path');
6
- const pkg = require('prettier/package.json');
5
+ const path = require("node:path");
6
+ const pkg = require("prettier/package.json");
7
7
 
8
8
  // eslint-disable-next-line import/no-dynamic-require
9
- require(path.join(
10
- 'prettier',
11
- typeof pkg.bin === 'string' ? pkg.bin : pkg.bin.prettier,
12
- ));
9
+ require(
10
+ path.join(
11
+ "prettier",
12
+ typeof pkg.bin === "string" ? pkg.bin : pkg.bin.prettier,
13
+ ),
14
+ );
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import '@pob/pretty-eslint-config/bin/pretty-eslint-config.js';
3
+ import "@pob/pretty-eslint-config/bin/pretty-eslint-config.js";
package/bin/pretty-pkg.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import '@pob/pretty-pkg/bin/pretty-pkg.js';
3
+ import "@pob/pretty-pkg/bin/pretty-pkg.js";
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import 'repository-check-dirty/bin/repository-check-dirty.js';
3
+ import "repository-check-dirty/bin/repository-check-dirty.js";
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import "yarn-version";
@@ -1,32 +1,32 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- const fs = require('node:fs');
4
- const path = require('node:path');
5
- const semver = require('semver');
6
- const whichPmRuns = require('which-pm-runs');
3
+ const fs = require("node:fs");
4
+ const path = require("node:path");
5
+ const semver = require("semver");
6
+ const whichPmRuns = require("which-pm-runs");
7
7
 
8
8
  const pm =
9
9
  whichPmRuns() ||
10
- (fs.existsSync('package-lock.json') ? { name: 'npm' } : undefined);
10
+ (fs.existsSync("package-lock.json") ? { name: "npm" } : undefined);
11
11
 
12
- const yarnMajorVersion = pm.name === 'yarn' && semver.major(pm.version);
12
+ const yarnMajorVersion = pm.name === "yarn" && semver.major(pm.version);
13
13
  const { lockfile, installAndDedupe } = (() => {
14
- if (pm.name === 'yarn') {
14
+ if (pm.name === "yarn") {
15
15
  return {
16
- lockfile: 'yarn.lock',
17
- installAndDedupe: ['yarn', 'yarn dedupe'],
16
+ lockfile: "yarn.lock",
17
+ installAndDedupe: ["yarn", "yarn dedupe"],
18
18
  };
19
19
  }
20
- if (pm.name === 'npm') {
20
+ if (pm.name === "npm") {
21
21
  return {
22
- lockfile: 'package-lock.json',
23
- installAndDedupe: ['npm install', 'npm dedupe'],
22
+ lockfile: "package-lock.json",
23
+ installAndDedupe: ["npm install", "npm dedupe"],
24
24
  };
25
25
  }
26
- if (pm.name === 'bun') {
26
+ if (pm.name === "bun") {
27
27
  return {
28
- lockfile: 'bun.lockb',
29
- installAndDedupe: ['bun i'],
28
+ lockfile: "bun.lockb",
29
+ installAndDedupe: ["bun i"],
30
30
  };
31
31
  }
32
32
 
@@ -36,17 +36,17 @@ const { lockfile, installAndDedupe } = (() => {
36
36
  })();
37
37
 
38
38
  // eslint-disable-next-line import/no-dynamic-require
39
- const pkg = require(path.resolve('package.json'));
39
+ const pkg = require(path.resolve("package.json"));
40
40
  const workspaces = pkg.workspaces || false;
41
41
 
42
42
  const getSrcDirectories = () => {
43
43
  if (workspaces) {
44
44
  return `${
45
- workspaces.length === 1 ? workspaces[0] : `{${workspaces.join(',')}}`
45
+ workspaces.length === 1 ? workspaces[0] : `{${workspaces.join(",")}}`
46
46
  }/{src,lib}`;
47
47
  }
48
48
 
49
- return '{src,lib}';
49
+ return "{src,lib}";
50
50
  };
51
51
 
52
52
  // const getDistDirectories = () => {
@@ -67,11 +67,11 @@ module.exports = function createLintStagedConfig() {
67
67
  workspaces
68
68
  ? `,${workspaces
69
69
  .map((workspacePath) => `${workspacePath}/package.json`)
70
- .join(',')}`
71
- : ''
70
+ .join(",")}`
71
+ : ""
72
72
  }}`]: (filenames) => {
73
73
  const packagejsonFilenames = filenames.filter((filename) =>
74
- filename.endsWith('.json'),
74
+ filename.endsWith(".json"),
75
75
  );
76
76
 
77
77
  return [
@@ -81,36 +81,36 @@ module.exports = function createLintStagedConfig() {
81
81
  ? undefined
82
82
  : `pretty-pkg "${packagejsonFilenames.join('" "')}"`,
83
83
  `git add ${lockfile}${
84
- pm.name === 'yarn' && yarnMajorVersion >= 2
85
- ? ' .yarn .yarnrc.yml'
86
- : ''
84
+ pm.name === "yarn" && yarnMajorVersion >= 2
85
+ ? " .yarn .yarnrc.yml"
86
+ : ""
87
87
  }`,
88
88
  ].filter(Boolean);
89
89
  },
90
- '!(package|package-lock|.eslintrc).json': ['prettier --write'],
91
- '.eslintrc.json': ['pretty-eslint-config'],
90
+ "!(package|package-lock|.eslintrc).json": ["prettier --write"],
91
+ ".eslintrc.json": ["pretty-eslint-config"],
92
92
  [`{scripts,config,${srcDirectories}}/**/*.{yml,yaml,md}`]: [
93
- 'prettier --write',
93
+ "prettier --write",
94
94
  ],
95
- './*.{yml,yaml,md}': ['prettier --write'],
95
+ "./*.{yml,yaml,md}": ["prettier --write"],
96
96
  [`${srcDirectories}/**/*.{js,ts,tsx}`]: [
97
- 'prettier --write',
98
- 'eslint --fix --quiet --report-unused-disable-directives --resolve-plugins-relative-to .',
97
+ "prettier --write",
98
+ "eslint --fix --quiet --report-unused-disable-directives --resolve-plugins-relative-to .",
99
99
  ],
100
- '{scripts,config,.storyboook}/**/*.{js,mjs,cjs}': [
101
- 'prettier --write',
102
- 'eslint --fix --quiet --report-unused-disable-directives --resolve-plugins-relative-to .',
100
+ "{scripts,config,.storyboook}/**/*.{js,mjs,cjs}": [
101
+ "prettier --write",
102
+ "eslint --fix --quiet --report-unused-disable-directives --resolve-plugins-relative-to .",
103
103
  ],
104
104
  [`{.storybook,${srcDirectories}}/**/*.css`]: [
105
- 'prettier --parser css --write',
105
+ "prettier --parser css --write",
106
106
  ],
107
107
  [`${srcDirectories}/**/*.{ts,tsx}`]: () =>
108
- pkg.devDependencies && pkg.devDependencies['pob-babel']
108
+ pkg.devDependencies && pkg.devDependencies["pob-babel"]
109
109
  ? [
110
- 'rollup --config rollup.config.mjs',
111
- 'tsc -b',
110
+ "rollup --config rollup.config.mjs",
111
+ "tsc -b",
112
112
  // `git --glob-pathspecs add ${getDistDirectories()}/**/*`,
113
113
  ]
114
- : ['tsc'],
114
+ : ["tsc"],
115
115
  };
116
116
  };
@@ -1,6 +1,6 @@
1
- import { createRequire } from 'node:module';
1
+ import { createRequire } from "node:module";
2
2
 
3
3
  const require = createRequire(import.meta.url);
4
4
 
5
5
  // eslint-disable-next-line import/no-commonjs
6
- export default require('./createLintStagedConfig.cjs');
6
+ export default require("./createLintStagedConfig.cjs");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/root",
3
- "version": "9.5.0",
3
+ "version": "11.0.0",
4
4
  "description": "root package",
5
5
  "keywords": [],
6
6
  "author": "Christophe Hurpeau <christophe@hurpeau.com> (https://christophe.hurpeau.com)",
@@ -17,14 +17,15 @@
17
17
  },
18
18
  "sideEffects": false,
19
19
  "bin": {
20
- "commitlint": "./bin/commitlint.cjs",
20
+ "commitlint": "./bin/commitlint.js",
21
21
  "pob-root-lint-staged": "./bin/pob-root-lint-staged.js",
22
22
  "pob-root-postinstall": "./bin/pob-root-postinstall.js",
23
23
  "pob-root-prettier": "./bin/prettier.cjs",
24
24
  "prettier": "./bin/prettier.cjs",
25
25
  "pretty-eslint-config": "./bin/pretty-eslint-config.js",
26
26
  "pretty-pkg": "./bin/pretty-pkg.js",
27
- "repository-check-dirty": "./bin/repository-check-dirty.js"
27
+ "repository-check-dirty": "./bin/repository-check-dirty.js",
28
+ "yarn-version": "./bin/yarn-version.js"
28
29
  },
29
30
  "main": "./lib/index.js",
30
31
  "exports": {
@@ -68,18 +69,19 @@
68
69
  "pob": {},
69
70
  "prettier": "@pob/root/prettier-config",
70
71
  "dependencies": {
71
- "@commitlint/cli": "18.6.1",
72
- "@pob/pretty-eslint-config": "5.4.0",
73
- "@pob/pretty-pkg": "7.1.0",
74
- "conventional-changelog-conventionalcommits": "^7.0.0",
75
- "cosmiconfig": "^8.3.6",
72
+ "@commitlint/cli": "19.3.0",
73
+ "@pob/pretty-eslint-config": "6.0.0",
74
+ "@pob/pretty-pkg": "8.0.0",
75
+ "conventional-changelog-conventionalcommits": "^8.0.0",
76
+ "cosmiconfig": "^9.0.0",
76
77
  "husky": "~9.0.11",
77
78
  "json5": "^2.2.2",
78
- "lint-staged": "15.2.2",
79
- "pob-dependencies": "11.2.4",
80
- "prettier": "2.8.8",
81
- "repository-check-dirty": "6.3.2",
79
+ "lint-staged": "15.2.5",
80
+ "pob-dependencies": "12.0.0",
81
+ "prettier": "3.3.1",
82
+ "repository-check-dirty": "7.0.0",
82
83
  "semver": "^7.3.7",
83
- "which-pm-runs": "1.1.0"
84
+ "which-pm-runs": "1.1.0",
85
+ "yarn-version": "1.0.0"
84
86
  }
85
87
  }
@@ -1,27 +1,16 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  module.exports = {
4
- trailingComma: 'all',
5
- singleQuote: true,
6
- // https://github.com/airbnb/javascript/pull/1863
7
- arrowParens: 'always',
8
-
9
4
  overrides: [
10
5
  // use json-stringify for lerna.json as lerna will reformat it on new version
11
6
  {
12
- files: ['lerna.json'],
13
- options: {
14
- parser: 'json-stringify',
15
- },
16
- },
17
- {
18
- files: ['*.yml'],
7
+ files: ["lerna.json"],
19
8
  options: {
20
- singleQuote: false,
9
+ parser: "json-stringify",
21
10
  },
22
11
  },
23
12
  {
24
- files: ['.yarnrc.yml'],
13
+ files: [".yarnrc.yml"],
25
14
  options: {
26
15
  printWidth: 9999,
27
16
  },
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- 'use strict';
4
-
5
- const path = require('node:path');
6
- const pkg = require('@commitlint/cli/package.json');
7
-
8
- // eslint-disable-next-line import/no-dynamic-require
9
- require(path.join(
10
- '@commitlint/cli',
11
- typeof pkg.bin === 'string' ? pkg.bin : pkg.bin.commitlint,
12
- ));