@qlover/fe-release 5.0.4 → 5.0.5

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/dist/cli.cjs CHANGED
@@ -28,7 +28,7 @@ var import_commander = require("commander");
28
28
 
29
29
  // package.json
30
30
  var description = "A tool for releasing front-end projects, supporting multiple release modes and configurations, simplifying the release process and improving efficiency.";
31
- var version = "5.0.4";
31
+ var version = "5.0.5";
32
32
 
33
33
  // src/cli.ts
34
34
  var import_semver = __toESM(require("semver"), 1);
@@ -69,16 +69,23 @@ var releaseJson = {
69
69
  autoMergeReleasePR: false,
70
70
  pushChangeLabels: false,
71
71
  skipCreateReleasePR: false,
72
- PRTitle: "Release ${env} ${pkgName} ${tagName}",
72
+ /** Used when releasing 1–2 packages */
73
+ PRTitle: "Release ${spaces}",
74
+ /** Used when releasing more than 2 packages */
75
+ PRTitleMany: "Release ${count} packages: ${spaces}",
73
76
  PRBody: "## Changelog\n\n${changelog}",
74
- batchPRBody: "\n## ${name} ${newVersion}\n${changelog}\n",
77
+ /**
78
+ * Per-workspace section in the PR body (single and multi package).
79
+ * `${changeTypeSection}` is Patch/Minor/Major Changes from increment.
80
+ */
81
+ batchPRBody: "\n### ${name}@${newVersion}\n\n#### ${changeTypeSection}\n\n${changelog}\n",
75
82
  branchName: "release/${repoName}-${releaseId}",
76
83
  releaseTagName: "release-tag-${count}-patch-${releaseId}",
77
84
  commitMessage: "chore(release): ${spaces}",
78
85
  label: {
79
86
  name: "CI-Release",
80
87
  color: "1A7F37",
81
- description: "Release PR"
88
+ description: "Automated release PR (merge to publish)"
82
89
  }
83
90
  },
84
91
  changesetVersion: {
@@ -3375,23 +3382,33 @@ var ReleaseFormatter = class {
3375
3382
  if (workspaces.length === 0) {
3376
3383
  return "";
3377
3384
  }
3378
- if (workspaces.length === 1) {
3379
- return workspaces[0].changelog || "";
3380
- }
3385
+ const changeTypeSection = this.getChangeTypeSection();
3386
+ const batchTpl = this.config.batchPRBody || releaseJson.github.batchPRBody;
3381
3387
  return workspaces.map(
3382
- (workspace) => this.templateEngine.render(
3383
- this.config.batchPRBody || releaseJson.github.batchPRBody,
3384
- {
3385
- ...workspace,
3386
- // Prefer bumped version in PR changelog section headers
3387
- version: workspace.newVersion || workspace.version,
3388
- newVersion: workspace.newVersion || workspace.version
3389
- }
3390
- )
3388
+ (workspace) => this.templateEngine.render(batchTpl, {
3389
+ ...workspace,
3390
+ // Prefer bumped version in PR changelog section headers
3391
+ version: workspace.newVersion || workspace.version,
3392
+ newVersion: workspace.newVersion || workspace.version,
3393
+ changeTypeSection
3394
+ })
3391
3395
  ).join("\n");
3392
3396
  }
3397
+ /**
3398
+ * Map semver increment to Changesets-style section title.
3399
+ */
3400
+ getChangeTypeSection() {
3401
+ const increment = (this.config.increment || "patch").toLowerCase();
3402
+ if (increment === "major") {
3403
+ return "Major Changes";
3404
+ }
3405
+ if (increment === "minor") {
3406
+ return "Minor Changes";
3407
+ }
3408
+ return "Patch Changes";
3409
+ }
3393
3410
  formatPRTagName(workspaces, releaseBranchResult) {
3394
- if (workspaces.length <= 1) {
3411
+ if (workspaces.length === 0) {
3395
3412
  return releaseBranchResult.releaseTagName;
3396
3413
  }
3397
3414
  return workspaces.map(
@@ -3399,7 +3416,8 @@ var ReleaseFormatter = class {
3399
3416
  ).join(" ");
3400
3417
  }
3401
3418
  getPRTitle(releaseBranchResult, context, workspaces = []) {
3402
- const prTitleTpl = this.config.PRTitle || releaseJson.github.PRTitle;
3419
+ const count = workspaces.length;
3420
+ const prTitleTpl = count > 2 ? this.config.PRTitleMany || this.config.PRTitle || releaseJson.github.PRTitleMany : this.config.PRTitle || releaseJson.github.PRTitle;
3403
3421
  return this.templateEngine.render(
3404
3422
  prTitleTpl,
3405
3423
  this.buildPRTemplateVars(workspaces, releaseBranchResult, context)
@@ -3437,7 +3455,8 @@ var Github = class extends GitBase {
3437
3455
  repoName: this.context.options.repoName,
3438
3456
  authorName: this.context.options.authorName,
3439
3457
  env: this.context.options.releaseEnv,
3440
- releaseId: this.context.releaseId
3458
+ releaseId: this.context.releaseId,
3459
+ increment: this.context.parameters.changesetVersion?.increment || releaseJson.changesetVersion.increment
3441
3460
  });
3442
3461
  this.logger.info(`Github mode: ${this.mode}`);
3443
3462
  }
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import { Command } from "commander";
5
5
 
6
6
  // package.json
7
7
  var description = "A tool for releasing front-end projects, supporting multiple release modes and configurations, simplifying the release process and improving efficiency.";
8
- var version = "5.0.4";
8
+ var version = "5.0.5";
9
9
 
10
10
  // src/cli.ts
11
11
  import semver from "semver";
@@ -46,16 +46,23 @@ var releaseJson = {
46
46
  autoMergeReleasePR: false,
47
47
  pushChangeLabels: false,
48
48
  skipCreateReleasePR: false,
49
- PRTitle: "Release ${env} ${pkgName} ${tagName}",
49
+ /** Used when releasing 1–2 packages */
50
+ PRTitle: "Release ${spaces}",
51
+ /** Used when releasing more than 2 packages */
52
+ PRTitleMany: "Release ${count} packages: ${spaces}",
50
53
  PRBody: "## Changelog\n\n${changelog}",
51
- batchPRBody: "\n## ${name} ${newVersion}\n${changelog}\n",
54
+ /**
55
+ * Per-workspace section in the PR body (single and multi package).
56
+ * `${changeTypeSection}` is Patch/Minor/Major Changes from increment.
57
+ */
58
+ batchPRBody: "\n### ${name}@${newVersion}\n\n#### ${changeTypeSection}\n\n${changelog}\n",
52
59
  branchName: "release/${repoName}-${releaseId}",
53
60
  releaseTagName: "release-tag-${count}-patch-${releaseId}",
54
61
  commitMessage: "chore(release): ${spaces}",
55
62
  label: {
56
63
  name: "CI-Release",
57
64
  color: "1A7F37",
58
- description: "Release PR"
65
+ description: "Automated release PR (merge to publish)"
59
66
  }
60
67
  },
61
68
  changesetVersion: {
@@ -3355,23 +3362,33 @@ var ReleaseFormatter = class {
3355
3362
  if (workspaces.length === 0) {
3356
3363
  return "";
3357
3364
  }
3358
- if (workspaces.length === 1) {
3359
- return workspaces[0].changelog || "";
3360
- }
3365
+ const changeTypeSection = this.getChangeTypeSection();
3366
+ const batchTpl = this.config.batchPRBody || releaseJson.github.batchPRBody;
3361
3367
  return workspaces.map(
3362
- (workspace) => this.templateEngine.render(
3363
- this.config.batchPRBody || releaseJson.github.batchPRBody,
3364
- {
3365
- ...workspace,
3366
- // Prefer bumped version in PR changelog section headers
3367
- version: workspace.newVersion || workspace.version,
3368
- newVersion: workspace.newVersion || workspace.version
3369
- }
3370
- )
3368
+ (workspace) => this.templateEngine.render(batchTpl, {
3369
+ ...workspace,
3370
+ // Prefer bumped version in PR changelog section headers
3371
+ version: workspace.newVersion || workspace.version,
3372
+ newVersion: workspace.newVersion || workspace.version,
3373
+ changeTypeSection
3374
+ })
3371
3375
  ).join("\n");
3372
3376
  }
3377
+ /**
3378
+ * Map semver increment to Changesets-style section title.
3379
+ */
3380
+ getChangeTypeSection() {
3381
+ const increment = (this.config.increment || "patch").toLowerCase();
3382
+ if (increment === "major") {
3383
+ return "Major Changes";
3384
+ }
3385
+ if (increment === "minor") {
3386
+ return "Minor Changes";
3387
+ }
3388
+ return "Patch Changes";
3389
+ }
3373
3390
  formatPRTagName(workspaces, releaseBranchResult) {
3374
- if (workspaces.length <= 1) {
3391
+ if (workspaces.length === 0) {
3375
3392
  return releaseBranchResult.releaseTagName;
3376
3393
  }
3377
3394
  return workspaces.map(
@@ -3379,7 +3396,8 @@ var ReleaseFormatter = class {
3379
3396
  ).join(" ");
3380
3397
  }
3381
3398
  getPRTitle(releaseBranchResult, context, workspaces = []) {
3382
- const prTitleTpl = this.config.PRTitle || releaseJson.github.PRTitle;
3399
+ const count = workspaces.length;
3400
+ const prTitleTpl = count > 2 ? this.config.PRTitleMany || this.config.PRTitle || releaseJson.github.PRTitleMany : this.config.PRTitle || releaseJson.github.PRTitle;
3383
3401
  return this.templateEngine.render(
3384
3402
  prTitleTpl,
3385
3403
  this.buildPRTemplateVars(workspaces, releaseBranchResult, context)
@@ -3417,7 +3435,8 @@ var Github = class extends GitBase {
3417
3435
  repoName: this.context.options.repoName,
3418
3436
  authorName: this.context.options.authorName,
3419
3437
  env: this.context.options.releaseEnv,
3420
- releaseId: this.context.releaseId
3438
+ releaseId: this.context.releaseId,
3439
+ increment: this.context.parameters.changesetVersion?.increment || releaseJson.changesetVersion.increment
3421
3440
  });
3422
3441
  this.logger.info(`Github mode: ${this.mode}`);
3423
3442
  }
package/dist/index.cjs CHANGED
@@ -66,16 +66,23 @@ var releaseJson = {
66
66
  autoMergeReleasePR: false,
67
67
  pushChangeLabels: false,
68
68
  skipCreateReleasePR: false,
69
- PRTitle: "Release ${env} ${pkgName} ${tagName}",
69
+ /** Used when releasing 1–2 packages */
70
+ PRTitle: "Release ${spaces}",
71
+ /** Used when releasing more than 2 packages */
72
+ PRTitleMany: "Release ${count} packages: ${spaces}",
70
73
  PRBody: "## Changelog\n\n${changelog}",
71
- batchPRBody: "\n## ${name} ${newVersion}\n${changelog}\n",
74
+ /**
75
+ * Per-workspace section in the PR body (single and multi package).
76
+ * `${changeTypeSection}` is Patch/Minor/Major Changes from increment.
77
+ */
78
+ batchPRBody: "\n### ${name}@${newVersion}\n\n#### ${changeTypeSection}\n\n${changelog}\n",
72
79
  branchName: "release/${repoName}-${releaseId}",
73
80
  releaseTagName: "release-tag-${count}-patch-${releaseId}",
74
81
  commitMessage: "chore(release): ${spaces}",
75
82
  label: {
76
83
  name: "CI-Release",
77
84
  color: "1A7F37",
78
- description: "Release PR"
85
+ description: "Automated release PR (merge to publish)"
79
86
  }
80
87
  },
81
88
  changesetVersion: {
@@ -3380,23 +3387,33 @@ var ReleaseFormatter = class {
3380
3387
  if (workspaces.length === 0) {
3381
3388
  return "";
3382
3389
  }
3383
- if (workspaces.length === 1) {
3384
- return workspaces[0].changelog || "";
3385
- }
3390
+ const changeTypeSection = this.getChangeTypeSection();
3391
+ const batchTpl = this.config.batchPRBody || releaseJson.github.batchPRBody;
3386
3392
  return workspaces.map(
3387
- (workspace) => this.templateEngine.render(
3388
- this.config.batchPRBody || releaseJson.github.batchPRBody,
3389
- {
3390
- ...workspace,
3391
- // Prefer bumped version in PR changelog section headers
3392
- version: workspace.newVersion || workspace.version,
3393
- newVersion: workspace.newVersion || workspace.version
3394
- }
3395
- )
3393
+ (workspace) => this.templateEngine.render(batchTpl, {
3394
+ ...workspace,
3395
+ // Prefer bumped version in PR changelog section headers
3396
+ version: workspace.newVersion || workspace.version,
3397
+ newVersion: workspace.newVersion || workspace.version,
3398
+ changeTypeSection
3399
+ })
3396
3400
  ).join("\n");
3397
3401
  }
3402
+ /**
3403
+ * Map semver increment to Changesets-style section title.
3404
+ */
3405
+ getChangeTypeSection() {
3406
+ const increment = (this.config.increment || "patch").toLowerCase();
3407
+ if (increment === "major") {
3408
+ return "Major Changes";
3409
+ }
3410
+ if (increment === "minor") {
3411
+ return "Minor Changes";
3412
+ }
3413
+ return "Patch Changes";
3414
+ }
3398
3415
  formatPRTagName(workspaces, releaseBranchResult) {
3399
- if (workspaces.length <= 1) {
3416
+ if (workspaces.length === 0) {
3400
3417
  return releaseBranchResult.releaseTagName;
3401
3418
  }
3402
3419
  return workspaces.map(
@@ -3404,7 +3421,8 @@ var ReleaseFormatter = class {
3404
3421
  ).join(" ");
3405
3422
  }
3406
3423
  getPRTitle(releaseBranchResult, context, workspaces = []) {
3407
- const prTitleTpl = this.config.PRTitle || releaseJson.github.PRTitle;
3424
+ const count = workspaces.length;
3425
+ const prTitleTpl = count > 2 ? this.config.PRTitleMany || this.config.PRTitle || releaseJson.github.PRTitleMany : this.config.PRTitle || releaseJson.github.PRTitle;
3408
3426
  return this.templateEngine.render(
3409
3427
  prTitleTpl,
3410
3428
  this.buildPRTemplateVars(workspaces, releaseBranchResult, context)
@@ -3442,7 +3460,8 @@ var Github = class extends GitBase {
3442
3460
  repoName: this.context.options.repoName,
3443
3461
  authorName: this.context.options.authorName,
3444
3462
  env: this.context.options.releaseEnv,
3445
- releaseId: this.context.releaseId
3463
+ releaseId: this.context.releaseId,
3464
+ increment: this.context.parameters.changesetVersion?.increment || releaseJson.changesetVersion.increment
3446
3465
  });
3447
3466
  this.logger.info(`Github mode: ${this.mode}`);
3448
3467
  }
package/dist/index.d.ts CHANGED
@@ -216,11 +216,19 @@ interface ReleaseFormatterConfig {
216
216
  more: string;
217
217
  };
218
218
  /**
219
- * Pull request title template
219
+ * Pull request title template (1–2 packages)
220
220
  *
221
- * @default {@link DEFAULT_PR_TITLE}
221
+ * @default {@link releaseJson.github.PRTitle}
222
222
  */
223
223
  PRTitle?: string;
224
+ /**
225
+ * Pull request title template when releasing more than 2 packages
226
+ *
227
+ * Falls back to {@link PRTitle} when unset.
228
+ *
229
+ * @default {@link releaseJson.github.PRTitleMany}
230
+ */
231
+ PRTitleMany?: string;
224
232
  /**
225
233
  * Pull request body template
226
234
  *
@@ -228,11 +236,19 @@ interface ReleaseFormatterConfig {
228
236
  */
229
237
  PRBody?: string;
230
238
  /**
231
- * Template for each workspace section in a multi-workspace PR body
239
+ * Template for each workspace section in the PR body
240
+ *
241
+ * Used for both single- and multi-workspace releases.
242
+ * Supports `${changeTypeSection}` (Patch/Minor/Major Changes).
232
243
  *
233
244
  * @default from release.json
234
245
  */
235
246
  batchPRBody?: string;
247
+ /**
248
+ * Semver increment used to title changelog sections (patch | minor | major)
249
+ * @default 'patch'
250
+ */
251
+ increment?: string;
236
252
  }
237
253
 
238
254
  /**
@@ -1415,16 +1431,23 @@ declare const releaseJson: {
1415
1431
  readonly autoMergeReleasePR: false;
1416
1432
  readonly pushChangeLabels: false;
1417
1433
  readonly skipCreateReleasePR: false;
1418
- readonly PRTitle: "Release ${env} ${pkgName} ${tagName}";
1434
+ /** Used when releasing 1–2 packages */
1435
+ readonly PRTitle: "Release ${spaces}";
1436
+ /** Used when releasing more than 2 packages */
1437
+ readonly PRTitleMany: "Release ${count} packages: ${spaces}";
1419
1438
  readonly PRBody: "## Changelog\n\n${changelog}";
1420
- readonly batchPRBody: "\n## ${name} ${newVersion}\n${changelog}\n";
1439
+ /**
1440
+ * Per-workspace section in the PR body (single and multi package).
1441
+ * `${changeTypeSection}` is Patch/Minor/Major Changes from increment.
1442
+ */
1443
+ readonly batchPRBody: "\n### ${name}@${newVersion}\n\n#### ${changeTypeSection}\n\n${changelog}\n";
1421
1444
  readonly branchName: "release/${repoName}-${releaseId}";
1422
1445
  readonly releaseTagName: "release-tag-${count}-patch-${releaseId}";
1423
1446
  readonly commitMessage: "chore(release): ${spaces}";
1424
1447
  readonly label: {
1425
1448
  readonly name: "CI-Release";
1426
1449
  readonly color: "1A7F37";
1427
- readonly description: "Release PR";
1450
+ readonly description: "Automated release PR (merge to publish)";
1428
1451
  };
1429
1452
  };
1430
1453
  readonly changesetVersion: {
package/dist/index.js CHANGED
@@ -14,16 +14,23 @@ var releaseJson = {
14
14
  autoMergeReleasePR: false,
15
15
  pushChangeLabels: false,
16
16
  skipCreateReleasePR: false,
17
- PRTitle: "Release ${env} ${pkgName} ${tagName}",
17
+ /** Used when releasing 1–2 packages */
18
+ PRTitle: "Release ${spaces}",
19
+ /** Used when releasing more than 2 packages */
20
+ PRTitleMany: "Release ${count} packages: ${spaces}",
18
21
  PRBody: "## Changelog\n\n${changelog}",
19
- batchPRBody: "\n## ${name} ${newVersion}\n${changelog}\n",
22
+ /**
23
+ * Per-workspace section in the PR body (single and multi package).
24
+ * `${changeTypeSection}` is Patch/Minor/Major Changes from increment.
25
+ */
26
+ batchPRBody: "\n### ${name}@${newVersion}\n\n#### ${changeTypeSection}\n\n${changelog}\n",
20
27
  branchName: "release/${repoName}-${releaseId}",
21
28
  releaseTagName: "release-tag-${count}-patch-${releaseId}",
22
29
  commitMessage: "chore(release): ${spaces}",
23
30
  label: {
24
31
  name: "CI-Release",
25
32
  color: "1A7F37",
26
- description: "Release PR"
33
+ description: "Automated release PR (merge to publish)"
27
34
  }
28
35
  },
29
36
  changesetVersion: {
@@ -3331,23 +3338,33 @@ var ReleaseFormatter = class {
3331
3338
  if (workspaces.length === 0) {
3332
3339
  return "";
3333
3340
  }
3334
- if (workspaces.length === 1) {
3335
- return workspaces[0].changelog || "";
3336
- }
3341
+ const changeTypeSection = this.getChangeTypeSection();
3342
+ const batchTpl = this.config.batchPRBody || releaseJson.github.batchPRBody;
3337
3343
  return workspaces.map(
3338
- (workspace) => this.templateEngine.render(
3339
- this.config.batchPRBody || releaseJson.github.batchPRBody,
3340
- {
3341
- ...workspace,
3342
- // Prefer bumped version in PR changelog section headers
3343
- version: workspace.newVersion || workspace.version,
3344
- newVersion: workspace.newVersion || workspace.version
3345
- }
3346
- )
3344
+ (workspace) => this.templateEngine.render(batchTpl, {
3345
+ ...workspace,
3346
+ // Prefer bumped version in PR changelog section headers
3347
+ version: workspace.newVersion || workspace.version,
3348
+ newVersion: workspace.newVersion || workspace.version,
3349
+ changeTypeSection
3350
+ })
3347
3351
  ).join("\n");
3348
3352
  }
3353
+ /**
3354
+ * Map semver increment to Changesets-style section title.
3355
+ */
3356
+ getChangeTypeSection() {
3357
+ const increment = (this.config.increment || "patch").toLowerCase();
3358
+ if (increment === "major") {
3359
+ return "Major Changes";
3360
+ }
3361
+ if (increment === "minor") {
3362
+ return "Minor Changes";
3363
+ }
3364
+ return "Patch Changes";
3365
+ }
3349
3366
  formatPRTagName(workspaces, releaseBranchResult) {
3350
- if (workspaces.length <= 1) {
3367
+ if (workspaces.length === 0) {
3351
3368
  return releaseBranchResult.releaseTagName;
3352
3369
  }
3353
3370
  return workspaces.map(
@@ -3355,7 +3372,8 @@ var ReleaseFormatter = class {
3355
3372
  ).join(" ");
3356
3373
  }
3357
3374
  getPRTitle(releaseBranchResult, context, workspaces = []) {
3358
- const prTitleTpl = this.config.PRTitle || releaseJson.github.PRTitle;
3375
+ const count = workspaces.length;
3376
+ const prTitleTpl = count > 2 ? this.config.PRTitleMany || this.config.PRTitle || releaseJson.github.PRTitleMany : this.config.PRTitle || releaseJson.github.PRTitle;
3359
3377
  return this.templateEngine.render(
3360
3378
  prTitleTpl,
3361
3379
  this.buildPRTemplateVars(workspaces, releaseBranchResult, context)
@@ -3393,7 +3411,8 @@ var Github = class extends GitBase {
3393
3411
  repoName: this.context.options.repoName,
3394
3412
  authorName: this.context.options.authorName,
3395
3413
  env: this.context.options.releaseEnv,
3396
- releaseId: this.context.releaseId
3414
+ releaseId: this.context.releaseId,
3415
+ increment: this.context.parameters.changesetVersion?.increment || releaseJson.changesetVersion.increment
3397
3416
  });
3398
3417
  this.logger.info(`Github mode: ${this.mode}`);
3399
3418
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qlover/fe-release",
3
3
  "description": "A tool for releasing front-end projects, supporting multiple release modes and configurations, simplifying the release process and improving efficiency.",
4
- "version": "5.0.4",
4
+ "version": "5.0.5",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "homepage": "https://github.com/qlover/fe-base/tree/master/packages/fe-release",
@@ -61,8 +61,8 @@
61
61
  "semver": "^7.5.4",
62
62
  "@qlover/env-loader": "1.0.2",
63
63
  "@qlover/fe-corekit": "3.3.0",
64
- "@qlover/scripts-context": "2.3.3",
65
- "@qlover/logger": "1.2.1"
64
+ "@qlover/logger": "1.2.1",
65
+ "@qlover/scripts-context": "2.3.3"
66
66
  },
67
67
  "scripts": {
68
68
  "lint": "eslint src --fix",