@afoures/auto-release 0.2.11 → 0.2.12

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.
@@ -37,11 +37,12 @@ async function parse_change_file(path) {
37
37
  const filename = basename(path);
38
38
  const match = CHANGE_FILENAME_REGEX.exec(filename);
39
39
  if (!match) return /* @__PURE__ */ new Error(`Invalid change filename format: ${path} (expected: <kind>.<slug>.md)`);
40
- const file_content = await read_file(path);
40
+ let file_content = await read_file(path);
41
+ file_content = file_content?.trim() ?? null;
41
42
  if (file_content === null) return /* @__PURE__ */ new Error(`Change file is missing: ${path}`);
42
- if (!file_content.trim()) return /* @__PURE__ */ new Error("Change file is empty");
43
+ if (!file_content) return /* @__PURE__ */ new Error("Change file is empty");
43
44
  const [title, ...rest] = file_content.split("\n");
44
- const text = `- ${title}\n${rest.map((line) => ` ${line}`).join("\n")}`;
45
+ const text = [`- ${title}`, ...rest.map((line) => ` ${line}`)].join("\n");
45
46
  return new ChangeFile({
46
47
  slug: match.groups.slug,
47
48
  kind: match.groups.kind,
@@ -65,7 +65,7 @@ const generate_release_pr = create_command({
65
65
  for (const [kind, kind_changes] of changes_by_kind.entries()) {
66
66
  const label = display_map[kind]?.plural ?? display_map[kind]?.singular ?? kind;
67
67
  message_lines.push(`\n${label}:`);
68
- for (const change of kind_changes) message_lines.push(` ${change.summary}`);
68
+ for (const change of kind_changes) message_lines.push(` ${change.summary}`);
69
69
  }
70
70
  logger.note(`Release ${app.name} ${next_version}`, message_lines.join("\n"));
71
71
  if (dry_run) continue;
@@ -126,14 +126,14 @@ const manual_release = create_command({
126
126
  log.warn(`Could not check remote tag existence: ${error.message}`);
127
127
  log.warn("Continuing with local tag check only...");
128
128
  }
129
- const changes_summary = changes.list.map((change) => ` ${change.summary.split("\n").join("\n ")}`).join("\n");
129
+ const changes_summary = changes.list.map((change) => ` ${change.summary.split("\n").join("\n ")}`).join("\n");
130
130
  note(`Manual release plan:
131
131
  - App: ${app_name}
132
132
  - Current version: ${current_version}
133
133
  - Next version: ${next_version}
134
134
  - Tag: ${tag}
135
135
  - Change files:
136
- ${changes_summary}`, "Release details");
136
+ ${changes_summary || " No changes in this release."}`, "Release details");
137
137
  const proceed_confirmation = await confirm({
138
138
  message: "Proceed with generating changelog and version bump?",
139
139
  initialValue: false
@@ -188,7 +188,7 @@ ${changes_summary}`, "Release details");
188
188
  if (diff) note(diff, "Changes to be committed");
189
189
  const confirm_commit = await confirm({
190
190
  message: "Review the changes above. Proceed with commit?",
191
- initialValue: true
191
+ initialValue: false
192
192
  });
193
193
  if (isCancel(confirm_commit) || !confirm_commit) {
194
194
  await reset(root);
@@ -69,8 +69,8 @@ function default_formatter({ allowed_changes, display_map }) {
69
69
  for (const item of node.children) {
70
70
  const start = item.position?.start.offset ?? 0;
71
71
  const end = item.position?.end.offset ?? 0;
72
- const summary = original_text.slice(start, end);
73
- if (!summary.trim()) continue;
72
+ const summary = original_text.slice(start, end).trim();
73
+ if (!summary) continue;
74
74
  current_release.changes.push(new ChangeFile({
75
75
  kind: kind_for_items,
76
76
  summary
@@ -132,8 +132,8 @@ function default_formatter({ allowed_changes, display_map }) {
132
132
  lines.push("");
133
133
  lines.push(`## ${heading}`);
134
134
  for (const change of items) {
135
- const [title, ...description] = change.summary.split("\n");
136
- lines.push(`- ${title}`, ...description.map((line) => ` ${line}`));
135
+ lines.push(change.summary);
136
+ lines.push("");
137
137
  }
138
138
  }
139
139
  if (grouped.size === 0) {
@@ -194,7 +194,7 @@ async function get_staged_diff(cwd) {
194
194
  const options = cwd ? { cwd } : void 0;
195
195
  try {
196
196
  const { stdout } = await exec("git diff --cached --stat", options);
197
- return stdout.trim();
197
+ return stdout;
198
198
  } catch {
199
199
  return "";
200
200
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afoures/auto-release",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "A file based release management tool for monorepos",
5
5
  "homepage": "https://github.com/afoures/auto-release#readme",
6
6
  "bugs": {