@ucdjs/release-scripts 0.1.0-beta.58 → 0.1.0-beta.59

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.
Files changed (2) hide show
  1. package/dist/index.mjs +75 -49
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,60 +1,16 @@
1
1
  import { t as Eta } from "./eta-DAZlmVBQ.mjs";
2
- import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
3
- import { join, relative } from "node:path";
4
- import { getCommits, groupByType } from "commit-parser";
5
2
  import process from "node:process";
6
3
  import readline from "node:readline";
7
4
  import farver from "farver";
8
5
  import mri from "mri";
9
6
  import { exec } from "tinyexec";
7
+ import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
8
+ import { join, relative } from "node:path";
9
+ import { getCommits, groupByType } from "commit-parser";
10
10
  import { dedent } from "@luxass/utils";
11
11
  import semver, { gt } from "semver";
12
12
  import prompts from "prompts";
13
13
 
14
- //#region src/operations/changelog-format.ts
15
- function formatCommitLine({ commit, owner, repo, authors }) {
16
- const commitUrl = `https://github.com/${owner}/${repo}/commit/${commit.hash}`;
17
- let line = `${commit.description}`;
18
- const references = commit.references ?? [];
19
- for (const ref of references) {
20
- if (!ref.value) continue;
21
- const number = Number.parseInt(ref.value.replace(/^#/, ""), 10);
22
- if (Number.isNaN(number)) continue;
23
- if (ref.type === "issue") {
24
- line += ` ([Issue ${ref.value}](https://github.com/${owner}/${repo}/issues/${number}))`;
25
- continue;
26
- }
27
- line += ` ([PR ${ref.value}](https://github.com/${owner}/${repo}/pull/${number}))`;
28
- }
29
- line += ` ([${commit.shortHash}](${commitUrl}))`;
30
- if (authors.length > 0) {
31
- const authorList = authors.map((author) => author.login ? `[@${author.login}](https://github.com/${author.login})` : author.name).join(", ");
32
- line += ` (by ${authorList})`;
33
- }
34
- return line;
35
- }
36
- function buildTemplateGroups(options) {
37
- const { commits, owner, repo, types, commitAuthors } = options;
38
- const grouped = groupByType(commits, {
39
- includeNonConventional: false,
40
- mergeKeys: Object.fromEntries(Object.entries(types).map(([key, value]) => [key, value.types ?? [key]]))
41
- });
42
- return Object.entries(types).map(([key, value]) => {
43
- const formattedCommits = (grouped.get(key) ?? []).map((commit) => ({ line: formatCommitLine({
44
- commit,
45
- owner,
46
- repo,
47
- authors: commitAuthors.get(commit.hash) ?? []
48
- }) }));
49
- return {
50
- name: key,
51
- title: value.title,
52
- commits: formattedCommits
53
- };
54
- });
55
- }
56
-
57
- //#endregion
58
14
  //#region src/shared/utils.ts
59
15
  const args = mri(process.argv.slice(2));
60
16
  const isDryRun = !!args.dry;
@@ -133,6 +89,50 @@ if (isDryRun || isVerbose$1 || isForce) {
133
89
  logger.verbose();
134
90
  }
135
91
 
92
+ //#endregion
93
+ //#region src/operations/changelog-format.ts
94
+ function formatCommitLine({ commit, owner, repo, authors }) {
95
+ const commitUrl = `https://github.com/${owner}/${repo}/commit/${commit.hash}`;
96
+ let line = `${commit.description}`;
97
+ const references = commit.references ?? [];
98
+ for (const ref of references) {
99
+ if (!ref.value) continue;
100
+ const number = Number.parseInt(ref.value.replace(/^#/, ""), 10);
101
+ if (Number.isNaN(number)) continue;
102
+ if (ref.type === "issue") {
103
+ line += ` ([Issue ${ref.value}](https://github.com/${owner}/${repo}/issues/${number}))`;
104
+ continue;
105
+ }
106
+ line += ` ([PR ${ref.value}](https://github.com/${owner}/${repo}/pull/${number}))`;
107
+ }
108
+ line += ` ([${commit.shortHash}](${commitUrl}))`;
109
+ if (authors.length > 0) {
110
+ const authorList = authors.map((author) => author.login ? `[@${author.login}](https://github.com/${author.login})` : author.name).join(", ");
111
+ line += ` (by ${authorList})`;
112
+ }
113
+ return line;
114
+ }
115
+ function buildTemplateGroups(options) {
116
+ const { commits, owner, repo, types, commitAuthors } = options;
117
+ const grouped = groupByType(commits, {
118
+ includeNonConventional: false,
119
+ mergeKeys: Object.fromEntries(Object.entries(types).map(([key, value]) => [key, value.types ?? [key]]))
120
+ });
121
+ return Object.entries(types).map(([key, value]) => {
122
+ const formattedCommits = (grouped.get(key) ?? []).map((commit) => ({ line: formatCommitLine({
123
+ commit,
124
+ owner,
125
+ repo,
126
+ authors: commitAuthors.get(commit.hash) ?? []
127
+ }) }));
128
+ return {
129
+ name: key,
130
+ title: value.title,
131
+ commits: formattedCommits
132
+ };
133
+ });
134
+ }
135
+
136
136
  //#endregion
137
137
  //#region src/shared/errors.ts
138
138
  const isVerbose = !!mri(process.argv.slice(2)).verbose;
@@ -1417,6 +1417,14 @@ async function discoverWorkspacePackages(workspaceRoot, options) {
1417
1417
  if (missing.length > 0) exitWithError(`Package${missing.length > 1 ? "s" : ""} not found in workspace: ${missing.join(", ")}`, "Check your package names or run 'pnpm ls' to see available packages");
1418
1418
  }
1419
1419
  const isPackagePromptEnabled = options.prompts?.packages !== false;
1420
+ logger.verbose("Package prompt gating", {
1421
+ isCI,
1422
+ isPackagePromptEnabled,
1423
+ hasExplicitPackages: Boolean(explicitPackages),
1424
+ include: workspaceOptions.include ?? [],
1425
+ exclude: workspaceOptions.exclude ?? [],
1426
+ excludePrivate: workspaceOptions.excludePrivate ?? false
1427
+ });
1420
1428
  if (!isCI && isPackagePromptEnabled && !explicitPackages) {
1421
1429
  const selectedNames = await selectPackagePrompt(workspacePackages);
1422
1430
  workspacePackages = workspacePackages.filter((pkg) => selectedNames.includes(pkg.name));
@@ -2429,11 +2437,13 @@ async function publishPackage(packageName, version, workspaceRoot, options) {
2429
2437
  15e3
2430
2438
  ];
2431
2439
  for (let attempt = 1; attempt <= maxAttempts; attempt++) try {
2432
- await runIfNotDry("pnpm", args, { nodeOptions: {
2440
+ const result = await runIfNotDry("pnpm", args, { nodeOptions: {
2433
2441
  cwd: workspaceRoot,
2434
- stdio: "inherit",
2442
+ stdio: "pipe",
2435
2443
  env
2436
2444
  } });
2445
+ if (result?.stdout && result.stdout.trim()) logger.verbose(result.stdout.trim());
2446
+ if (result?.stderr && result.stderr.trim()) logger.verbose(result.stderr.trim());
2437
2447
  return ok(void 0);
2438
2448
  } catch (error) {
2439
2449
  const code = classifyPublishErrorCode(error);
@@ -2712,6 +2722,22 @@ async function verifyWorkflow(options) {
2712
2722
  //#region src/index.ts
2713
2723
  async function createReleaseScripts(options) {
2714
2724
  const normalizedOptions = normalizeReleaseScriptsOptions(options);
2725
+ logger.verbose("Release scripts config", {
2726
+ repo: `${normalizedOptions.owner}/${normalizedOptions.repo}`,
2727
+ workspaceRoot: normalizedOptions.workspaceRoot,
2728
+ dryRun: normalizedOptions.dryRun,
2729
+ safeguards: normalizedOptions.safeguards,
2730
+ branch: normalizedOptions.branch,
2731
+ globalCommitMode: normalizedOptions.globalCommitMode,
2732
+ prompts: normalizedOptions.prompts,
2733
+ packages: normalizedOptions.packages,
2734
+ npm: {
2735
+ access: normalizedOptions.npm.access,
2736
+ provenance: normalizedOptions.npm.provenance,
2737
+ otp: normalizedOptions.npm.otp ? "set" : "unset"
2738
+ },
2739
+ changelog: normalizedOptions.changelog
2740
+ });
2715
2741
  return {
2716
2742
  async verify() {
2717
2743
  return verifyWorkflow(normalizedOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucdjs/release-scripts",
3
- "version": "0.1.0-beta.58",
3
+ "version": "0.1.0-beta.59",
4
4
  "description": "@ucdjs release scripts",
5
5
  "type": "module",
6
6
  "license": "MIT",