@pob/root 15.0.0 → 15.1.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,20 @@
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
+ ## [15.1.0](https://github.com/christophehurpeau/pob/compare/@pob/root@15.0.0...@pob/root@15.1.0) (2024-12-19)
7
+
8
+ ### Features
9
+
10
+ * improve bun support ([24accc2](https://github.com/christophehurpeau/pob/commit/24accc26c5fbf429befdecdc0da663fa10cd00a6))
11
+
12
+ ### Bug Fixes
13
+
14
+ * **deps:** update dependency @commitlint/cli to v19.6.1 ([#2370](https://github.com/christophehurpeau/pob/issues/2370)) ([b78c1d5](https://github.com/christophehurpeau/pob/commit/b78c1d53c5a155c622256f724b7f5c3f2ca46954))
15
+ * install workflow ([b2b7bf7](https://github.com/christophehurpeau/pob/commit/b2b7bf76011ba8a6173ec49c6d357582ef810c61))
16
+
17
+ Version bump for dependency: yarn-version
18
+
19
+
6
20
  ## [15.0.0](https://github.com/christophehurpeau/pob/compare/@pob/root@14.4.0...@pob/root@15.0.0) (2024-12-10)
7
21
 
8
22
  ### Bug Fixes
@@ -13,14 +13,13 @@ jobs:
13
13
  with:
14
14
  token: ${{ secrets.GH_TOKEN }}
15
15
 
16
- - name: Enable Corepack
17
- run: corepack enable
16
+ - $ciPreStep$
18
17
 
19
18
  - name: Install Dependencies
20
- run: yarn install --immutable
19
+ run: $installOnCICommand$
21
20
 
22
21
  - name: Run Build
23
- run: yarn build
22
+ run: $pmExec$ build
24
23
 
25
24
  - name: Check for added or modified files
26
25
  id: git-check-modified
@@ -15,17 +15,16 @@ jobs:
15
15
  with:
16
16
  token: ${{ secrets.GH_TOKEN }}
17
17
 
18
- - name: Enable Corepack
19
- run: corepack enable
18
+ - $ciPreStep$
20
19
 
21
20
  - name: Install Dependencies
22
21
  # no immutable here
23
- run: yarn install
22
+ run: $installMutableCommand$
24
23
  env:
25
24
  YARN_ENABLE_IMMUTABLE_INSTALLS: false
26
25
 
27
26
  - name: Run pob-root-postinstall
28
- run: yarn run pob-root-postinstall
27
+ run: $pmExec$ pob-root-postinstall
29
28
 
30
29
  - name: Run pob update
31
30
  run: npx pob update --force
@@ -14,14 +14,13 @@ jobs:
14
14
  with:
15
15
  token: ${{ secrets.GH_TOKEN }}
16
16
 
17
- - name: Enable Corepack
18
- run: corepack enable
17
+ - $ciPreStep$
19
18
 
20
19
  - name: Install Dependencies
21
- run: yarn install --immutable
20
+ run: $installOnCICommand$
22
21
 
23
22
  - name: Run Prettier
24
- run: yarn prettier --write .
23
+ run: $pmExec$ prettier --write .
25
24
 
26
25
  - name: Check for added or modified files
27
26
  id: git-check-modified
@@ -2,6 +2,7 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import semver from "semver";
5
+ import { getPackageManagerCommands } from "./packageManagerHelpers.js";
5
6
 
6
7
  const ensureWorkflowUninstalled = (workflowName) => {
7
8
  try {
@@ -9,16 +10,26 @@ const ensureWorkflowUninstalled = (workflowName) => {
9
10
  } catch {}
10
11
  };
11
12
 
12
- const installWorkflow = (workflowName, condition = true) => {
13
+ const installWorkflow = (
14
+ workflowName,
15
+ { pmExec, installOnCICommand, installMutableCommand, ciPreStep },
16
+ condition = true,
17
+ ) => {
13
18
  if (condition) {
14
19
  fs.writeFileSync(
15
20
  path.resolve(`.github/workflows/${workflowName}.yml`),
16
- fs.readFileSync(
17
- path.resolve(
18
- path.dirname(fileURLToPath(import.meta.url)),
19
- `github-workflows/${workflowName}.yml`,
20
- ),
21
- ),
21
+ fs
22
+ .readFileSync(
23
+ path.resolve(
24
+ path.dirname(fileURLToPath(import.meta.url)),
25
+ `github-workflows/${workflowName}.yml`,
26
+ ),
27
+ { encoding: "utf8" },
28
+ )
29
+ .replaceAll("$pmExec$", pmExec)
30
+ .replaceAll("$ciPreStep$", ciPreStep)
31
+ .replaceAll("$installOnCICommand$", installOnCICommand)
32
+ .replaceAll("$installMutableCommand$", installMutableCommand),
22
33
  );
23
34
  } else {
24
35
  ensureWorkflowUninstalled(workflowName);
@@ -29,18 +40,18 @@ export default function installGithubWorkflows({ pkg, pm }) {
29
40
  const yarnMajorVersion = pm.name === "yarn" && semver.major(pm.version);
30
41
  const isYarnBerry = pm.name === "yarn" && yarnMajorVersion >= 2;
31
42
 
32
- if (!isYarnBerry) return;
43
+ const pmCommands = getPackageManagerCommands(pm, isYarnBerry);
33
44
 
34
45
  if (fs.existsSync(".github")) {
35
- installWorkflow("push-renovate-pob_root");
36
- installWorkflow("push-renovate-prettier");
46
+ installWorkflow("push-renovate-pob_root", pmCommands);
47
+ installWorkflow("push-renovate-prettier", pmCommands);
37
48
  ensureWorkflowUninstalled("push-renovate-typedoc");
38
49
  if (
39
50
  pkg.devDependencies &&
40
51
  pkg.devDependencies.rollup &&
41
52
  pkg.scripts?.build
42
53
  ) {
43
- installWorkflow("push-renovate-build");
54
+ installWorkflow("push-renovate-build", pmCommands);
44
55
  } else {
45
56
  ensureWorkflowUninstalled("push-renovate-build");
46
57
  }
@@ -4,6 +4,7 @@ import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import husky from "husky";
6
6
  import semver from "semver";
7
+ import { getPackageManagerCommands } from "./packageManagerHelpers.js";
7
8
 
8
9
  const ensureLegacyHuskyConfigDeleted = () => {
9
10
  try {
@@ -50,9 +51,10 @@ export default function installHusky({ pkg, pm }) {
50
51
  const yarnMajorVersion = pm.name === "yarn" && semver.major(pm.version);
51
52
  const isYarnBerry = pm.name === "yarn" && yarnMajorVersion >= 2;
52
53
  const yarnConfig = isYarnBerry && readYarnConfigFile();
53
- const isYarnPnp =
54
- !yarnConfig.includes("nodeLinker: node-modules") &&
55
- !yarnConfig.includes("nodeLinker: pnpm");
54
+ const isYarnPnp = yarnConfig
55
+ ? !yarnConfig.includes("nodeLinker: node-modules") &&
56
+ !yarnConfig.includes("nodeLinker: pnpm")
57
+ : false;
56
58
 
57
59
  /* Check legacy */
58
60
 
@@ -75,51 +77,7 @@ export default function installHusky({ pkg, pm }) {
75
77
  installOnDiffCommand,
76
78
  beforeDiffCommand = "",
77
79
  afterDiffCommand = "",
78
- } = (() => {
79
- if (pm.name === "yarn") {
80
- return {
81
- lockfile: "yarn.lock",
82
- pmExec: "yarn",
83
- installOnDiffCommand: `yarn install ${
84
- isYarnBerry
85
- ? "--immutable"
86
- : "--prefer-offline --pure-lockfile --ignore-optional"
87
- }`,
88
- beforeDiffCommand: isYarnBerry
89
- ? `yarn config set logFilters --json '[
90
- {"code": "YN0002","level": "discard"},
91
- {"code": "YN0007","level": "discard"},
92
- {"code": "YN0008","level": "discard"},
93
- {"code": "YN0013","level": "discard"},
94
- {"code": "YN0018","level": "discard"},
95
- {"code": "YN0060","level": "discard"},
96
- {"code": "YN0061","level": "discard"}
97
- ]' > /dev/null`
98
- : "",
99
- afterDiffCommand: isYarnBerry
100
- ? "yarn config unset logFilters > /dev/null"
101
- : "",
102
- };
103
- }
104
- if (pm.name === "npm") {
105
- return {
106
- lockfile: "package-lock.json",
107
- pmExec: "npx --no-install",
108
- installOnDiffCommand: "npm i",
109
- };
110
- }
111
- if (pm.name === "bun") {
112
- return {
113
- lockfile: "bun.lockb",
114
- pmExec: "bun run",
115
- installOnDiffCommand: "bun i",
116
- };
117
- }
118
-
119
- throw new Error(
120
- `Package manager not supported: ${pm.name}. Please run with yarn, npm or bun !`,
121
- );
122
- })();
80
+ } = getPackageManagerCommands(pm, isYarnBerry);
123
81
 
124
82
  writeHook("commit-msg", `${pmExec} commitlint --edit $1`);
125
83
  writeHook("pre-commit", `${pmExec} pob-root-lint-staged`);
@@ -0,0 +1,56 @@
1
+ export const getPackageManagerCommands = (pm, isYarnBerry) => {
2
+ if (pm.name === "yarn") {
3
+ return {
4
+ lockfile: "yarn.lock",
5
+ pmExec: "yarn",
6
+ ciPreStep: `name: Enable Corepack
7
+ run: corepack enable`,
8
+ installOnCICommand: "yarn install --immutable",
9
+ installMutableCommand: "yarn install",
10
+ installOnDiffCommand: `yarn install ${
11
+ isYarnBerry
12
+ ? "--immutable"
13
+ : "--prefer-offline --pure-lockfile --ignore-optional"
14
+ }`,
15
+ beforeDiffCommand: isYarnBerry
16
+ ? `yarn config set logFilters --json '[
17
+ {"code": "YN0002","level": "discard"},
18
+ {"code": "YN0007","level": "discard"},
19
+ {"code": "YN0008","level": "discard"},
20
+ {"code": "YN0013","level": "discard"},
21
+ {"code": "YN0018","level": "discard"},
22
+ {"code": "YN0060","level": "discard"},
23
+ {"code": "YN0061","level": "discard"}
24
+ ]' > /dev/null`
25
+ : "",
26
+ afterDiffCommand: isYarnBerry
27
+ ? "yarn config unset logFilters > /dev/null"
28
+ : "",
29
+ };
30
+ }
31
+ if (pm.name === "npm") {
32
+ return {
33
+ lockfile: "package-lock.json",
34
+ pmExec: "npx --no-install",
35
+ ciPreStep: "",
36
+ installOnCICommand: "npm i",
37
+ installMutableCommand: "npm i",
38
+ installOnDiffCommand: "npm i",
39
+ };
40
+ }
41
+ if (pm.name === "bun") {
42
+ return {
43
+ lockfile: "bun.lock",
44
+ pmExec: "bun run",
45
+ ciPreStep: `name: Install bun
46
+ uses: oven-sh/setup-bun@v1`,
47
+ installOnCICommand: "bun i --frozen-lockfile",
48
+ installMutableCommand: "bun i",
49
+ installOnDiffCommand: "bun i --frozen-lockfile",
50
+ };
51
+ }
52
+
53
+ throw new Error(
54
+ `Package manager not supported: ${pm.name}. Please run with yarn, npm or bun !`,
55
+ );
56
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/root",
3
- "version": "15.0.0",
3
+ "version": "15.1.0",
4
4
  "description": "root package",
5
5
  "keywords": [],
6
6
  "author": "Christophe Hurpeau <christophe@hurpeau.com> (https://christophe.hurpeau.com)",
@@ -69,7 +69,7 @@
69
69
  "pob": {},
70
70
  "prettier": "@pob/root/prettier-config",
71
71
  "dependencies": {
72
- "@commitlint/cli": "19.6.0",
72
+ "@commitlint/cli": "19.6.1",
73
73
  "@pob/pretty-eslint-config": "8.0.0",
74
74
  "@pob/pretty-pkg": "11.0.0",
75
75
  "conventional-changelog-conventionalcommits": "^8.0.0",
@@ -77,11 +77,11 @@
77
77
  "husky": "~9.1.0",
78
78
  "json5": "^2.2.2",
79
79
  "lint-staged": "15.2.11",
80
- "pob-dependencies": "16.0.0",
80
+ "pob-dependencies": "16.1.0",
81
81
  "prettier": "3.4.2",
82
82
  "repository-check-dirty": "9.0.0",
83
83
  "semver": "^7.3.7",
84
84
  "which-pm-runs": "1.1.0",
85
- "yarn-version": "5.0.0"
85
+ "yarn-version": "5.1.0"
86
86
  }
87
87
  }