pob 26.10.0 → 27.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,34 @@
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
+ ## [27.0.0](https://github.com/christophehurpeau/pob/compare/pob@26.11.0...pob@27.0.0) (2025-04-27)
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * remove postinstallDev plugin
11
+
12
+ ### Features
13
+
14
+ * remove postinstallDev plugin ([a0ddde0](https://github.com/christophehurpeau/pob/commit/a0ddde0cbd970bf7e4b698f735b849ca5440607e))
15
+
16
+ Version bump for dependency: @pob/root
17
+
18
+
19
+ ## [26.11.0](https://github.com/christophehurpeau/pob/compare/pob@26.10.0...pob@26.11.0) (2025-03-15)
20
+
21
+ ### Features
22
+
23
+ * **deps:** update yarn monorepo ([#2478](https://github.com/christophehurpeau/pob/issues/2478)) ([8b2de64](https://github.com/christophehurpeau/pob/commit/8b2de64cb6899a76ea716963911644a7b08182ae))
24
+ * yarn 4.7 ([c9fcb63](https://github.com/christophehurpeau/pob/commit/c9fcb6322b8c14393c7632b501f2c48c80c308e9))
25
+
26
+ ### Bug Fixes
27
+
28
+ * fix configure protection rule ([78c4ad3](https://github.com/christophehurpeau/pob/commit/78c4ad331cc820616246cc87374a27cdb0aecc8d))
29
+
30
+ Version bump for dependency: yarn-workspace-utils
31
+ Version bump for dependency: @pob/root
32
+
33
+
6
34
  ## [26.10.0](https://github.com/christophehurpeau/pob/compare/pob@26.9.0...pob@26.10.0) (2025-03-14)
7
35
 
8
36
  ### Features
@@ -24,27 +24,45 @@ const putJson = (url, jsonBody) =>
24
24
  },
25
25
  }).then((res) => (res.ok ? res.json() : null));
26
26
 
27
- const configureProtectionRule = async (owner, repo, onlyLatestLTS) => {
27
+ const configureProtectionRule = async (
28
+ owner,
29
+ repo,
30
+ onlyLatestLTS,
31
+ spawnCommandSync,
32
+ ) => {
28
33
  if (!ciContexts || ciContexts.length === 0) {
29
34
  throw new Error("Invalid ciContexts: []");
30
35
  }
31
36
 
32
37
  for (const branch of ["main", "master"]) {
33
38
  try {
34
- await putJson(`repos/${owner}/${repo}/branches/${branch}/protection`, {
35
- required_status_checks: {
36
- strict: false,
37
- contexts: ciContexts,
38
- },
39
- enforce_admins: false, // true,
40
- required_pull_request_reviews: null,
41
- restrictions: null,
42
- required_linear_history: true,
43
- allow_force_pushes: true, // false
44
- allow_deletions: false,
45
- });
46
- if (branch === "master") {
47
- console.warn('You should rename your "master" branch to "main"');
39
+ const result = spawnCommandSync(
40
+ "git",
41
+ ["ls-remote", "--heads", `git@github.com:${owner}/${repo}.git`, branch],
42
+ { stdio: "pipe" },
43
+ );
44
+
45
+ const isBranchExists =
46
+ result.exitCode === 0 && result.stdout.toString().trim() !== "";
47
+
48
+ if (isBranchExists) {
49
+ await putJson(`repos/${owner}/${repo}/branches/${branch}/protection`, {
50
+ required_status_checks: {
51
+ strict: false,
52
+ contexts: ciContexts,
53
+ },
54
+ enforce_admins: false, // true,
55
+ required_pull_request_reviews: null,
56
+ restrictions: null,
57
+ required_linear_history: true,
58
+ allow_force_pushes: true, // false
59
+ allow_deletions: false,
60
+ });
61
+ if (branch === "master") {
62
+ console.warn('You should rename your "master" branch to "main"');
63
+ }
64
+ } else if (branch === "main") {
65
+ throw new Error(`Branch ${branch} does not exist`);
48
66
  }
49
67
  } catch (error) {
50
68
  if (branch === "main") {
@@ -167,7 +185,12 @@ export default class CoreGitGithubGenerator extends Generator {
167
185
  cwd,
168
186
  });
169
187
 
170
- configureProtectionRule(owner, repo, this.options.onlyLatestLTS);
188
+ await configureProtectionRule(
189
+ owner,
190
+ repo,
191
+ this.options.onlyLatestLTS,
192
+ this.spawnCommandSync.bind(this),
193
+ );
171
194
 
172
195
  // await gh.put(`/repos/${owner}/${repo}/topics`, {
173
196
  // names: pkg.keywords,
@@ -189,7 +212,12 @@ export default class CoreGitGithubGenerator extends Generator {
189
212
  ...githubRepoConfig,
190
213
  });
191
214
 
192
- configureProtectionRule(owner, repo, this.options.onlyLatestLTS);
215
+ await configureProtectionRule(
216
+ owner,
217
+ repo,
218
+ this.options.onlyLatestLTS,
219
+ this.spawnCommandSync.bind(this),
220
+ );
193
221
  }
194
222
  }
195
223
  }
@@ -368,8 +368,8 @@ export default class CorePackageGenerator extends Generator {
368
368
  uninstallPostinstallScript("postinstall");
369
369
  }
370
370
  } else if (this.options.packageManager === "yarn") {
371
- uninstallPostinstallScript("postinstall");
372
- installPostinstallScript("postinstallDev");
371
+ uninstallPostinstallScript("postinstallDev");
372
+ installPostinstallScript("postinstall");
373
373
  } else {
374
374
  uninstallPostinstallScript("postinstallDev");
375
375
  installPostinstallScript("postinstall");
@@ -80,24 +80,24 @@ export default class CoreYarnGenerator extends Generator {
80
80
  const isPluginInstalled = (name) =>
81
81
  installedPlugins.some((plugin) => plugin.name === name);
82
82
 
83
- const installPlugin = (nameOrUrl) => {
84
- this.spawnSync("yarn", ["plugin", "import", nameOrUrl]);
85
- };
83
+ // const installPlugin = (nameOrUrl) => {
84
+ // this.spawnSync("yarn", ["plugin", "import", nameOrUrl]);
85
+ // };
86
86
  const removePlugin = (name) => {
87
87
  this.spawnSync("yarn", ["plugin", "remove", name]);
88
88
  };
89
89
 
90
- const installPluginIfNotInstalled = (
91
- name,
92
- nameOrUrl = name,
93
- forceInstallIfInstalled = () => false,
94
- ) => {
95
- if (!isPluginInstalled(name)) {
96
- installPlugin(nameOrUrl);
97
- } else if (forceInstallIfInstalled()) {
98
- installPlugin(nameOrUrl);
99
- }
100
- };
90
+ // const installPluginIfNotInstalled = (
91
+ // name,
92
+ // nameOrUrl = name,
93
+ // forceInstallIfInstalled = () => false,
94
+ // ) => {
95
+ // if (!isPluginInstalled(name)) {
96
+ // installPlugin(nameOrUrl);
97
+ // } else if (forceInstallIfInstalled()) {
98
+ // installPlugin(nameOrUrl);
99
+ // }
100
+ // };
101
101
 
102
102
  const removePluginIfInstalled = (name) => {
103
103
  if (isPluginInstalled(name)) {
@@ -108,13 +108,20 @@ export default class CoreYarnGenerator extends Generator {
108
108
  const postinstallDevPluginName = "@yarnpkg/plugin-postinstall-dev";
109
109
  const legacyVersionPluginName = "@yarnpkg/plugin-conventional-version";
110
110
 
111
+ removePluginIfInstalled(postinstallDevPluginName);
111
112
  if (!inMonorepo && !pkg.private) {
112
- installPluginIfNotInstalled(
113
- postinstallDevPluginName,
114
- "https://raw.githubusercontent.com/sachinraja/yarn-plugin-postinstall-dev/main/bundles/%40yarnpkg/plugin-postinstall-dev.js",
115
- );
113
+ packageUtils.addDevDependencies(pkg, ["pinst"]);
114
+ packageUtils.addScripts(pkg, {
115
+ prepack: "pinst --disable",
116
+ postpack: "pinst --enable",
117
+ });
116
118
  } else {
117
- removePluginIfInstalled(postinstallDevPluginName);
119
+ if (pkg.scripts.prepack === "pinst --disable") {
120
+ delete pkg.scripts.prepack;
121
+ }
122
+ if (pkg.scripts.postpack === "pinst --enable") {
123
+ delete pkg.scripts.postpack;
124
+ }
118
125
  }
119
126
 
120
127
  if (pkg.name !== "yarn-plugin-conventional-version") {
@@ -135,9 +142,9 @@ export default class CoreYarnGenerator extends Generator {
135
142
  if (
136
143
  !pkg.packageManager ||
137
144
  !pkg.packageManager.startsWith("yarn@") ||
138
- lt(pkg.packageManager.slice("yarn@".length), "4.6.0")
145
+ lt(pkg.packageManager.slice("yarn@".length), "4.7.0")
139
146
  ) {
140
- pkg.packageManager = "yarn@4.6.0";
147
+ pkg.packageManager = "yarn@4.7.0";
141
148
  }
142
149
 
143
150
  // must be done after plugins installed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pob",
3
- "version": "26.10.0",
3
+ "version": "27.0.0",
4
4
  "description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
5
5
  "keywords": [
6
6
  "skeleton"
@@ -48,9 +48,9 @@
48
48
  "@pob/sort-pkg": "11.0.1",
49
49
  "@prettier/sync": "0.5.2",
50
50
  "@types/inquirer": "9.0.7",
51
- "@yarnpkg/cli": "4.6.0",
52
- "@yarnpkg/core": "4.2.0",
53
- "@yarnpkg/fslib": "3.1.1",
51
+ "@yarnpkg/cli": "4.7.0",
52
+ "@yarnpkg/core": "4.2.1",
53
+ "@yarnpkg/fslib": "3.1.2",
54
54
  "@yeoman/types": "1.5.0",
55
55
  "eslint": "9.22.0",
56
56
  "findup-sync": "^5.0.0",
@@ -64,17 +64,17 @@
64
64
  "mem-fs-editor": "11.1.4",
65
65
  "minimist": "1.2.8",
66
66
  "parse-author": "2.0.0",
67
- "pob-dependencies": "17.8.0",
67
+ "pob-dependencies": "18.0.0",
68
68
  "prettier": "3.5.3",
69
69
  "semver": "7.7.1",
70
70
  "typescript": "5.8.2",
71
71
  "validate-npm-package-name": "^6.0.0",
72
- "yarn-workspace-utils": "8.4.0",
72
+ "yarn-workspace-utils": "8.5.0",
73
73
  "yeoman-environment": "4.4.3",
74
74
  "yeoman-generator": "7.5.0"
75
75
  },
76
76
  "devDependencies": {
77
- "@pob/root": "16.8.0",
77
+ "@pob/root": "17.0.0",
78
78
  "@types/node": "22.13.10"
79
79
  }
80
80
  }