pob 39.1.1 → 39.1.2
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.
|
@@ -111,7 +111,7 @@ export default class CoreGitGithubGenerator extends Generator {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
async configureProtectionRule(owner, repo) {
|
|
114
|
+
async #configureProtectionRule(owner, repo) {
|
|
115
115
|
if (!this.options.ciEnabled) return;
|
|
116
116
|
if (ciContexts.length === 0) {
|
|
117
117
|
console.warn("No ci contexts: branch protection not configured");
|
|
@@ -166,7 +166,7 @@ export default class CoreGitGithubGenerator extends Generator {
|
|
|
166
166
|
* Runs a step of the repository setup, printing which step failed and what
|
|
167
167
|
* to run by hand instead of stopping the run.
|
|
168
168
|
*/
|
|
169
|
-
runStep(description, manualCommand, fn) {
|
|
169
|
+
#runStep(description, manualCommand, fn) {
|
|
170
170
|
try {
|
|
171
171
|
fn();
|
|
172
172
|
return true;
|
|
@@ -179,7 +179,7 @@ export default class CoreGitGithubGenerator extends Generator {
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
async createRepository(owner, repo, pkg) {
|
|
182
|
+
async #createRepository(owner, repo, pkg) {
|
|
183
183
|
const cwd = this.destinationPath();
|
|
184
184
|
|
|
185
185
|
try {
|
|
@@ -210,7 +210,7 @@ export default class CoreGitGithubGenerator extends Generator {
|
|
|
210
210
|
console.warn(
|
|
211
211
|
`github repository ${owner}/${repo} already exists, syncing its settings`,
|
|
212
212
|
);
|
|
213
|
-
await this
|
|
213
|
+
await this.#syncRepository(owner, repo, pkg);
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
const hasCommit =
|
|
@@ -221,7 +221,7 @@ export default class CoreGitGithubGenerator extends Generator {
|
|
|
221
221
|
}).exitCode === 0;
|
|
222
222
|
|
|
223
223
|
if (!hasCommit) {
|
|
224
|
-
const committed = this
|
|
224
|
+
const committed = this.#runStep(
|
|
225
225
|
"create the initial commit",
|
|
226
226
|
'git add --all . && git commit -m "chore: initial commit [skip ci]"',
|
|
227
227
|
() => {
|
|
@@ -238,7 +238,7 @@ export default class CoreGitGithubGenerator extends Generator {
|
|
|
238
238
|
if (!committed) return;
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
const pushed = this
|
|
241
|
+
const pushed = this.#runStep(
|
|
242
242
|
"push to github",
|
|
243
243
|
"git branch -M main && git push -u origin main",
|
|
244
244
|
() => {
|
|
@@ -248,10 +248,10 @@ export default class CoreGitGithubGenerator extends Generator {
|
|
|
248
248
|
);
|
|
249
249
|
if (!pushed) return;
|
|
250
250
|
|
|
251
|
-
await this
|
|
251
|
+
await this.#configureProtectionRule(owner, repo);
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
async syncRepository(owner, repo, pkg) {
|
|
254
|
+
async #syncRepository(owner, repo, pkg) {
|
|
255
255
|
try {
|
|
256
256
|
await githubRequest("PATCH", `repos/${owner}/${repo}`, {
|
|
257
257
|
name: repo,
|
|
@@ -282,11 +282,11 @@ export default class CoreGitGithubGenerator extends Generator {
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
if (this.options.shouldCreate) {
|
|
285
|
-
await this
|
|
285
|
+
await this.#createRepository(owner, repo, pkg);
|
|
286
286
|
} else {
|
|
287
287
|
console.log("sync github info");
|
|
288
|
-
await this
|
|
289
|
-
await this
|
|
288
|
+
await this.#syncRepository(owner, repo, pkg);
|
|
289
|
+
await this.#configureProtectionRule(owner, repo);
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
}
|
|
@@ -72,7 +72,7 @@ export default class MonorepoTypescriptGenerator extends Generator {
|
|
|
72
72
|
// linting and tsc -b: root config files (e.g. vitest.config.ts), a root
|
|
73
73
|
// scripts/ dir, and each package's scripts/ dir (matched via the workspace
|
|
74
74
|
// globs so all packages are covered)
|
|
75
|
-
hasTools() {
|
|
75
|
+
#hasTools() {
|
|
76
76
|
return (
|
|
77
77
|
hasRootConfigFiles(this.destinationPath()) ||
|
|
78
78
|
existsSync(this.destinationPath("scripts"))
|
|
@@ -81,8 +81,8 @@ export default class MonorepoTypescriptGenerator extends Generator {
|
|
|
81
81
|
|
|
82
82
|
// tsc fails on a tsconfig.json without files nor references, like the one of
|
|
83
83
|
// a new monorepo without packages
|
|
84
|
-
hasTypescriptProjects() {
|
|
85
|
-
return JSON.parse(this.options.packagePaths).length > 0 || this
|
|
84
|
+
#hasTypescriptProjects() {
|
|
85
|
+
return JSON.parse(this.options.packagePaths).length > 0 || this.#hasTools();
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
writing() {
|
|
@@ -109,7 +109,7 @@ export default class MonorepoTypescriptGenerator extends Generator {
|
|
|
109
109
|
);
|
|
110
110
|
|
|
111
111
|
if (this.options.enable) {
|
|
112
|
-
packageUtils.addOrRemoveScripts(pkg, this
|
|
112
|
+
packageUtils.addOrRemoveScripts(pkg, this.#hasTypescriptProjects(), {
|
|
113
113
|
tsc: "tsc -b",
|
|
114
114
|
});
|
|
115
115
|
packageUtils.addOrRemoveScripts(
|
|
@@ -161,7 +161,7 @@ export default class MonorepoTypescriptGenerator extends Generator {
|
|
|
161
161
|
this.fs.delete(this.destinationPath("tsconfig.root-configs.json"));
|
|
162
162
|
this.fs.delete(tsconfigTestPath);
|
|
163
163
|
|
|
164
|
-
if (!this.options.enable || !this
|
|
164
|
+
if (!this.options.enable || !this.#hasTypescriptProjects()) {
|
|
165
165
|
this.fs.delete(tsconfigPath);
|
|
166
166
|
this.fs.delete(tsconfigCheckPath);
|
|
167
167
|
this.fs.delete(tsconfigBuildPath);
|
|
@@ -171,7 +171,7 @@ export default class MonorepoTypescriptGenerator extends Generator {
|
|
|
171
171
|
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
172
172
|
|
|
173
173
|
const workspaceGlobs = pkg.workspaces || [];
|
|
174
|
-
const hasTools = this
|
|
174
|
+
const hasTools = this.#hasTools();
|
|
175
175
|
if (hasTools) {
|
|
176
176
|
await copyAndFormatTpl(
|
|
177
177
|
this.fs,
|
|
@@ -143,14 +143,14 @@ export default class PobBaseGenerator extends Generator {
|
|
|
143
143
|
this.config.set("project", this.projectConfig);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
getPackageManager() {
|
|
146
|
+
#getPackageManager() {
|
|
147
147
|
return inMonorepo && !inMonorepo.root
|
|
148
148
|
? inMonorepo.rootPackageManager
|
|
149
149
|
: (this.projectConfig?.packageManager ?? "yarn");
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
default() {
|
|
153
|
-
const packageManager = this
|
|
153
|
+
const packageManager = this.#getPackageManager();
|
|
154
154
|
|
|
155
155
|
this.composeWith("pob:core:bun", {
|
|
156
156
|
type: this.projectConfig.type,
|
|
@@ -298,7 +298,7 @@ export default class PobBaseGenerator extends Generator {
|
|
|
298
298
|
install() {
|
|
299
299
|
if (this.options.fromPob) return;
|
|
300
300
|
|
|
301
|
-
switch (this
|
|
301
|
+
switch (this.#getPackageManager()) {
|
|
302
302
|
case "npm":
|
|
303
303
|
this.spawnSync("npm", ["install"]);
|
|
304
304
|
break;
|