@releasekit/notes 0.3.0-next.1 → 0.3.0-next.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.
@@ -3,8 +3,8 @@ import {
3
3
  detectMonorepo,
4
4
  splitByPackage,
5
5
  writeMonorepoChangelogs
6
- } from "./chunk-O4VCGEZT.js";
7
- import "./chunk-H7G2HRHI.js";
6
+ } from "./chunk-TSLTZ26C.js";
7
+ import "./chunk-QCF6V2IY.js";
8
8
  export {
9
9
  aggregateToRoot,
10
10
  detectMonorepo,
@@ -39,9 +39,10 @@ function formatEntry(entry) {
39
39
  }
40
40
  return line;
41
41
  }
42
- function formatVersion(context) {
42
+ function formatVersion(context, options) {
43
43
  const lines = [];
44
- const versionHeader = context.previousVersion ? `## [${context.version}]` : `## ${context.version}`;
44
+ const versionLabel = options?.includePackageName && context.packageName ? `${context.packageName}@${context.version}` : context.version;
45
+ const versionHeader = context.previousVersion ? `## [${versionLabel}]` : `## ${versionLabel}`;
45
46
  lines.push(`${versionHeader} - ${context.date}`);
46
47
  lines.push("");
47
48
  if (context.compareUrl) {
@@ -73,14 +74,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
73
74
 
74
75
  `;
75
76
  }
76
- function renderMarkdown(contexts) {
77
+ function renderMarkdown(contexts, options) {
77
78
  const sections = [formatHeader()];
78
79
  for (const context of contexts) {
79
- sections.push(formatVersion(context));
80
+ sections.push(formatVersion(context, options));
80
81
  }
81
82
  return sections.join("\n");
82
83
  }
83
- function prependVersion(existingPath, context) {
84
+ function prependVersion(existingPath, context, options) {
84
85
  let existing = "";
85
86
  if (fs.existsSync(existingPath)) {
86
87
  existing = fs.readFileSync(existingPath, "utf-8");
@@ -88,7 +89,7 @@ function prependVersion(existingPath, context) {
88
89
  if (headerEnd >= 0) {
89
90
  const header = existing.slice(0, headerEnd);
90
91
  const body = existing.slice(headerEnd + 1);
91
- const newVersion = formatVersion(context);
92
+ const newVersion = formatVersion(context, options);
92
93
  return `${header}
93
94
 
94
95
  ${newVersion}
@@ -2,7 +2,7 @@ import {
2
2
  formatVersion,
3
3
  renderMarkdown,
4
4
  writeMarkdown
5
- } from "./chunk-H7G2HRHI.js";
5
+ } from "./chunk-QCF6V2IY.js";
6
6
 
7
7
  // src/core/config.ts
8
8
  import {
@@ -1376,7 +1376,8 @@ async function runPipeline(input, config, dryRun) {
1376
1376
  }
1377
1377
  const files = [];
1378
1378
  for (const output of config.output) {
1379
- info3(`Generating ${output.format} output`);
1379
+ const outputLabel = output.file ? `${output.format} output \u2192 ${output.file}` : `${output.format} output`;
1380
+ info3(`Generating ${outputLabel}`);
1380
1381
  switch (output.format) {
1381
1382
  case "markdown": {
1382
1383
  const file = output.file ?? "CHANGELOG.md";
@@ -1435,7 +1436,7 @@ async function runPipeline(input, config, dryRun) {
1435
1436
  }
1436
1437
  }
1437
1438
  if (config.monorepo?.mode) {
1438
- const { detectMonorepo, writeMonorepoChangelogs } = await import("./aggregator-BDTUZWOA.js");
1439
+ const { detectMonorepo, writeMonorepoChangelogs } = await import("./aggregator-JZ3VUZKP.js");
1439
1440
  const cwd = process.cwd();
1440
1441
  const detected = detectMonorepo(cwd);
1441
1442
  if (detected.isMonorepo) {
@@ -1,7 +1,8 @@
1
1
  import {
2
+ formatVersion,
2
3
  prependVersion,
3
4
  renderMarkdown
4
- } from "./chunk-H7G2HRHI.js";
5
+ } from "./chunk-QCF6V2IY.js";
5
6
 
6
7
  // src/monorepo/aggregator.ts
7
8
  import * as fs from "fs";
@@ -54,10 +55,25 @@ function aggregateToRoot(contexts) {
54
55
  function writeMonorepoChangelogs(contexts, options, config, dryRun) {
55
56
  const files = [];
56
57
  if (options.mode === "root" || options.mode === "both") {
57
- const aggregated = aggregateToRoot(contexts);
58
58
  const rootPath = path.join(options.rootPath, "CHANGELOG.md");
59
+ const fmtOpts = { includePackageName: true };
59
60
  info(`Writing root changelog to ${rootPath}`);
60
- const rootContent = config.updateStrategy === "prepend" && fs.existsSync(rootPath) ? prependVersion(rootPath, aggregated) : renderMarkdown([aggregated]);
61
+ let rootContent;
62
+ if (config.updateStrategy === "prepend" && fs.existsSync(rootPath)) {
63
+ const newSections = contexts.map((ctx) => formatVersion(ctx, fmtOpts)).join("\n");
64
+ const existing = fs.readFileSync(rootPath, "utf-8");
65
+ const headerEnd = existing.indexOf("\n## ");
66
+ if (headerEnd >= 0) {
67
+ rootContent = `${existing.slice(0, headerEnd)}
68
+
69
+ ${newSections}
70
+ ${existing.slice(headerEnd + 1)}`;
71
+ } else {
72
+ rootContent = renderMarkdown(contexts, fmtOpts);
73
+ }
74
+ } else {
75
+ rootContent = renderMarkdown(contexts, fmtOpts);
76
+ }
61
77
  if (writeFile(rootPath, rootContent, dryRun)) {
62
78
  files.push(rootPath);
63
79
  }
package/dist/cli.cjs CHANGED
@@ -59,9 +59,10 @@ function formatEntry(entry) {
59
59
  }
60
60
  return line;
61
61
  }
62
- function formatVersion(context) {
62
+ function formatVersion(context, options) {
63
63
  const lines = [];
64
- const versionHeader = context.previousVersion ? `## [${context.version}]` : `## ${context.version}`;
64
+ const versionLabel = options?.includePackageName && context.packageName ? `${context.packageName}@${context.version}` : context.version;
65
+ const versionHeader = context.previousVersion ? `## [${versionLabel}]` : `## ${versionLabel}`;
65
66
  lines.push(`${versionHeader} - ${context.date}`);
66
67
  lines.push("");
67
68
  if (context.compareUrl) {
@@ -93,14 +94,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
93
94
 
94
95
  `;
95
96
  }
96
- function renderMarkdown(contexts) {
97
+ function renderMarkdown(contexts, options) {
97
98
  const sections = [formatHeader()];
98
99
  for (const context of contexts) {
99
- sections.push(formatVersion(context));
100
+ sections.push(formatVersion(context, options));
100
101
  }
101
102
  return sections.join("\n");
102
103
  }
103
- function prependVersion(existingPath, context) {
104
+ function prependVersion(existingPath, context, options) {
104
105
  let existing = "";
105
106
  if (fs2.existsSync(existingPath)) {
106
107
  existing = fs2.readFileSync(existingPath, "utf-8");
@@ -108,7 +109,7 @@ function prependVersion(existingPath, context) {
108
109
  if (headerEnd >= 0) {
109
110
  const header = existing.slice(0, headerEnd);
110
111
  const body = existing.slice(headerEnd + 1);
111
- const newVersion = formatVersion(context);
112
+ const newVersion = formatVersion(context, options);
112
113
  return `${header}
113
114
 
114
115
  ${newVersion}
@@ -222,10 +223,25 @@ function aggregateToRoot(contexts) {
222
223
  function writeMonorepoChangelogs(contexts, options, config, dryRun) {
223
224
  const files = [];
224
225
  if (options.mode === "root" || options.mode === "both") {
225
- const aggregated = aggregateToRoot(contexts);
226
226
  const rootPath = path6.join(options.rootPath, "CHANGELOG.md");
227
+ const fmtOpts = { includePackageName: true };
227
228
  (0, import_core8.info)(`Writing root changelog to ${rootPath}`);
228
- const rootContent = config.updateStrategy === "prepend" && fs8.existsSync(rootPath) ? prependVersion(rootPath, aggregated) : renderMarkdown([aggregated]);
229
+ let rootContent;
230
+ if (config.updateStrategy === "prepend" && fs8.existsSync(rootPath)) {
231
+ const newSections = contexts.map((ctx) => formatVersion(ctx, fmtOpts)).join("\n");
232
+ const existing = fs8.readFileSync(rootPath, "utf-8");
233
+ const headerEnd = existing.indexOf("\n## ");
234
+ if (headerEnd >= 0) {
235
+ rootContent = `${existing.slice(0, headerEnd)}
236
+
237
+ ${newSections}
238
+ ${existing.slice(headerEnd + 1)}`;
239
+ } else {
240
+ rootContent = renderMarkdown(contexts, fmtOpts);
241
+ }
242
+ } else {
243
+ rootContent = renderMarkdown(contexts, fmtOpts);
244
+ }
229
245
  if (writeFile(rootPath, rootContent, dryRun)) {
230
246
  files.push(rootPath);
231
247
  }
@@ -1680,7 +1696,8 @@ async function runPipeline(input, config, dryRun) {
1680
1696
  }
1681
1697
  const files = [];
1682
1698
  for (const output of config.output) {
1683
- (0, import_core9.info)(`Generating ${output.format} output`);
1699
+ const outputLabel = output.file ? `${output.format} output \u2192 ${output.file}` : `${output.format} output`;
1700
+ (0, import_core9.info)(`Generating ${outputLabel}`);
1684
1701
  switch (output.format) {
1685
1702
  case "markdown": {
1686
1703
  const file = output.file ?? "CHANGELOG.md";
package/dist/cli.js CHANGED
@@ -8,8 +8,8 @@ import {
8
8
  parsePackageVersioner,
9
9
  runPipeline,
10
10
  saveAuth
11
- } from "./chunk-LKJLUB7X.js";
12
- import "./chunk-H7G2HRHI.js";
11
+ } from "./chunk-QUBVC5LF.js";
12
+ import "./chunk-QCF6V2IY.js";
13
13
 
14
14
  // src/cli.ts
15
15
  import * as fs from "fs";
package/dist/index.cjs CHANGED
@@ -59,9 +59,10 @@ function formatEntry(entry) {
59
59
  }
60
60
  return line;
61
61
  }
62
- function formatVersion(context) {
62
+ function formatVersion(context, options) {
63
63
  const lines = [];
64
- const versionHeader = context.previousVersion ? `## [${context.version}]` : `## ${context.version}`;
64
+ const versionLabel = options?.includePackageName && context.packageName ? `${context.packageName}@${context.version}` : context.version;
65
+ const versionHeader = context.previousVersion ? `## [${versionLabel}]` : `## ${versionLabel}`;
65
66
  lines.push(`${versionHeader} - ${context.date}`);
66
67
  lines.push("");
67
68
  if (context.compareUrl) {
@@ -93,14 +94,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
93
94
 
94
95
  `;
95
96
  }
96
- function renderMarkdown(contexts) {
97
+ function renderMarkdown(contexts, options) {
97
98
  const sections = [formatHeader()];
98
99
  for (const context of contexts) {
99
- sections.push(formatVersion(context));
100
+ sections.push(formatVersion(context, options));
100
101
  }
101
102
  return sections.join("\n");
102
103
  }
103
- function prependVersion(existingPath, context) {
104
+ function prependVersion(existingPath, context, options) {
104
105
  let existing = "";
105
106
  if (fs2.existsSync(existingPath)) {
106
107
  existing = fs2.readFileSync(existingPath, "utf-8");
@@ -108,7 +109,7 @@ function prependVersion(existingPath, context) {
108
109
  if (headerEnd >= 0) {
109
110
  const header = existing.slice(0, headerEnd);
110
111
  const body = existing.slice(headerEnd + 1);
111
- const newVersion = formatVersion(context);
112
+ const newVersion = formatVersion(context, options);
112
113
  return `${header}
113
114
 
114
115
  ${newVersion}
@@ -222,10 +223,25 @@ function aggregateToRoot(contexts) {
222
223
  function writeMonorepoChangelogs(contexts, options, config, dryRun) {
223
224
  const files = [];
224
225
  if (options.mode === "root" || options.mode === "both") {
225
- const aggregated = aggregateToRoot(contexts);
226
226
  const rootPath = path6.join(options.rootPath, "CHANGELOG.md");
227
+ const fmtOpts = { includePackageName: true };
227
228
  (0, import_core8.info)(`Writing root changelog to ${rootPath}`);
228
- const rootContent = config.updateStrategy === "prepend" && fs8.existsSync(rootPath) ? prependVersion(rootPath, aggregated) : renderMarkdown([aggregated]);
229
+ let rootContent;
230
+ if (config.updateStrategy === "prepend" && fs8.existsSync(rootPath)) {
231
+ const newSections = contexts.map((ctx) => formatVersion(ctx, fmtOpts)).join("\n");
232
+ const existing = fs8.readFileSync(rootPath, "utf-8");
233
+ const headerEnd = existing.indexOf("\n## ");
234
+ if (headerEnd >= 0) {
235
+ rootContent = `${existing.slice(0, headerEnd)}
236
+
237
+ ${newSections}
238
+ ${existing.slice(headerEnd + 1)}`;
239
+ } else {
240
+ rootContent = renderMarkdown(contexts, fmtOpts);
241
+ }
242
+ } else {
243
+ rootContent = renderMarkdown(contexts, fmtOpts);
244
+ }
229
245
  if (writeFile(rootPath, rootContent, dryRun)) {
230
246
  files.push(rootPath);
231
247
  }
@@ -1727,7 +1743,8 @@ async function runPipeline(input, config, dryRun) {
1727
1743
  }
1728
1744
  const files = [];
1729
1745
  for (const output of config.output) {
1730
- (0, import_core9.info)(`Generating ${output.format} output`);
1746
+ const outputLabel = output.file ? `${output.format} output \u2192 ${output.file}` : `${output.format} output`;
1747
+ (0, import_core9.info)(`Generating ${outputLabel}`);
1731
1748
  switch (output.format) {
1732
1749
  case "markdown": {
1733
1750
  const file = output.file ?? "CHANGELOG.md";
package/dist/index.d.cts CHANGED
@@ -208,8 +208,12 @@ declare function detectMonorepo(cwd: string): {
208
208
  declare function renderJson(contexts: TemplateContext[]): string;
209
209
  declare function writeJson(outputPath: string, contexts: TemplateContext[], dryRun: boolean): void;
210
210
 
211
- declare function formatVersion(context: TemplateContext): string;
212
- declare function renderMarkdown(contexts: TemplateContext[]): string;
211
+ interface FormatVersionOptions {
212
+ /** Include the package name in the version header (e.g. `## [pkg@1.0.0]`). */
213
+ includePackageName?: boolean;
214
+ }
215
+ declare function formatVersion(context: TemplateContext, options?: FormatVersionOptions): string;
216
+ declare function renderMarkdown(contexts: TemplateContext[], options?: FormatVersionOptions): string;
213
217
  declare function writeMarkdown(outputPath: string, contexts: TemplateContext[], config: Config, dryRun: boolean): void;
214
218
 
215
219
  export { NotesError as ChangelogCreatorError, type ChangelogEntry, type ChangelogInput, type ChangelogType, type CompleteOptions, type Config, ConfigError, type DocumentContext, type EnhancedData, GitHubError, InputParseError, type InputSource, type LLMCategory, type LLMConfig, LLMError, type LLMOptions, type LLMPromptOverrides, type LLMPromptsConfig, type MonorepoConfig, type MonorepoMode, NotesError, type OutputConfig, type OutputFormat, type PackageChangelog, type PipelineResult, type RetryOptions, type ScopeConfig, type ScopeRules, type TemplateConfig, type TemplateContext, type TemplateEngine, TemplateError, type UpdateStrategy, aggregateToRoot, createTemplateContext, detectMonorepo, formatVersion, getDefaultConfig, getExitCode, loadConfig, parsePackageVersioner, parsePackageVersionerFile, parsePackageVersionerStdin, processInput, renderJson, renderMarkdown, runPipeline, writeJson, writeMarkdown, writeMonorepoChangelogs };
package/dist/index.d.ts CHANGED
@@ -208,8 +208,12 @@ declare function detectMonorepo(cwd: string): {
208
208
  declare function renderJson(contexts: TemplateContext[]): string;
209
209
  declare function writeJson(outputPath: string, contexts: TemplateContext[], dryRun: boolean): void;
210
210
 
211
- declare function formatVersion(context: TemplateContext): string;
212
- declare function renderMarkdown(contexts: TemplateContext[]): string;
211
+ interface FormatVersionOptions {
212
+ /** Include the package name in the version header (e.g. `## [pkg@1.0.0]`). */
213
+ includePackageName?: boolean;
214
+ }
215
+ declare function formatVersion(context: TemplateContext, options?: FormatVersionOptions): string;
216
+ declare function renderMarkdown(contexts: TemplateContext[], options?: FormatVersionOptions): string;
213
217
  declare function writeMarkdown(outputPath: string, contexts: TemplateContext[], config: Config, dryRun: boolean): void;
214
218
 
215
219
  export { NotesError as ChangelogCreatorError, type ChangelogEntry, type ChangelogInput, type ChangelogType, type CompleteOptions, type Config, ConfigError, type DocumentContext, type EnhancedData, GitHubError, InputParseError, type InputSource, type LLMCategory, type LLMConfig, LLMError, type LLMOptions, type LLMPromptOverrides, type LLMPromptsConfig, type MonorepoConfig, type MonorepoMode, NotesError, type OutputConfig, type OutputFormat, type PackageChangelog, type PipelineResult, type RetryOptions, type ScopeConfig, type ScopeRules, type TemplateConfig, type TemplateContext, type TemplateEngine, TemplateError, type UpdateStrategy, aggregateToRoot, createTemplateContext, detectMonorepo, formatVersion, getDefaultConfig, getExitCode, loadConfig, parsePackageVersioner, parsePackageVersionerFile, parsePackageVersionerStdin, processInput, renderJson, renderMarkdown, runPipeline, writeJson, writeMarkdown, writeMonorepoChangelogs };
package/dist/index.js CHANGED
@@ -19,17 +19,17 @@ import {
19
19
  runPipeline,
20
20
  saveAuth,
21
21
  writeJson
22
- } from "./chunk-LKJLUB7X.js";
22
+ } from "./chunk-QUBVC5LF.js";
23
23
  import {
24
24
  aggregateToRoot,
25
25
  detectMonorepo,
26
26
  writeMonorepoChangelogs
27
- } from "./chunk-O4VCGEZT.js";
27
+ } from "./chunk-TSLTZ26C.js";
28
28
  import {
29
29
  formatVersion,
30
30
  renderMarkdown,
31
31
  writeMarkdown
32
- } from "./chunk-H7G2HRHI.js";
32
+ } from "./chunk-QCF6V2IY.js";
33
33
  export {
34
34
  NotesError as ChangelogCreatorError,
35
35
  ConfigError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@releasekit/notes",
3
- "version": "0.3.0-next.1",
3
+ "version": "0.3.0-next.2",
4
4
  "description": "Release notes and changelog generation with LLM-powered enhancement and flexible templating",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",