@releasekit/release 0.7.10 → 0.7.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.
- package/dist/aggregator-IUQUAVJC-OQZ5KHNS.js +18 -0
- package/dist/baseError-DQHIJACF-4NWA3LJM.js +12 -0
- package/dist/chunk-275AVVZE.js +382 -0
- package/dist/chunk-3AKDKIIQ.js +78 -0
- package/dist/{chunk-D6HRZXZZ.js → chunk-6UI4L62T.js} +24 -12
- package/dist/{chunk-ALHJU3KL.js → chunk-FEMWVXXM.js} +6 -1
- package/dist/chunk-NOZSTVTV.js +55 -0
- package/dist/chunk-QDGNHERK.js +1983 -0
- package/dist/chunk-QUY54CTL.js +25427 -0
- package/dist/chunk-TC44YA6X.js +25 -0
- package/dist/chunk-TJ2FXMEO.js +14177 -0
- package/dist/chunk-YG3UFSB6.js +2001 -0
- package/dist/cli.js +6 -2
- package/dist/commandExecutor-E44ID5U4-P3RGRKGM.js +14 -0
- package/dist/dispatcher.js +22 -6
- package/dist/dist-4RETAAT2.js +42 -0
- package/dist/dist-7RSHM4ZO.js +37 -0
- package/dist/dist-HVRDLODI.js +59 -0
- package/dist/dist-OP3T7BV6.js +114 -0
- package/dist/dist-TLL55DUA.js +448 -0
- package/dist/index.d.ts +98 -3
- package/dist/index.js +7 -1
- package/package.json +6 -6
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
aggregateToRoot,
|
|
3
|
+
detectMonorepo,
|
|
4
|
+
splitByPackage,
|
|
5
|
+
writeMonorepoChangelogs
|
|
6
|
+
} from "./chunk-275AVVZE.js";
|
|
7
|
+
import {
|
|
8
|
+
init_esm_shims
|
|
9
|
+
} from "./chunk-NOZSTVTV.js";
|
|
10
|
+
|
|
11
|
+
// ../notes/dist/aggregator-IUQUAVJC.js
|
|
12
|
+
init_esm_shims();
|
|
13
|
+
export {
|
|
14
|
+
aggregateToRoot,
|
|
15
|
+
detectMonorepo,
|
|
16
|
+
splitByPackage,
|
|
17
|
+
writeMonorepoChangelogs
|
|
18
|
+
};
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_esm_shims
|
|
3
|
+
} from "./chunk-NOZSTVTV.js";
|
|
4
|
+
|
|
5
|
+
// ../notes/dist/chunk-7TJSPQPW.js
|
|
6
|
+
init_esm_shims();
|
|
7
|
+
import chalk from "chalk";
|
|
8
|
+
import * as fs2 from "fs";
|
|
9
|
+
import * as path2 from "path";
|
|
10
|
+
var LOG_LEVELS = {
|
|
11
|
+
error: 0,
|
|
12
|
+
warn: 1,
|
|
13
|
+
info: 2,
|
|
14
|
+
debug: 3,
|
|
15
|
+
trace: 4
|
|
16
|
+
};
|
|
17
|
+
var PREFIXES = {
|
|
18
|
+
error: "[ERROR]",
|
|
19
|
+
warn: "[WARN]",
|
|
20
|
+
info: "[INFO]",
|
|
21
|
+
debug: "[DEBUG]",
|
|
22
|
+
trace: "[TRACE]"
|
|
23
|
+
};
|
|
24
|
+
var COLORS = {
|
|
25
|
+
error: chalk.red,
|
|
26
|
+
warn: chalk.yellow,
|
|
27
|
+
info: chalk.blue,
|
|
28
|
+
debug: chalk.gray,
|
|
29
|
+
trace: chalk.dim
|
|
30
|
+
};
|
|
31
|
+
var currentLevel = "info";
|
|
32
|
+
var quietMode = false;
|
|
33
|
+
function setLogLevel(level) {
|
|
34
|
+
currentLevel = level;
|
|
35
|
+
}
|
|
36
|
+
function setQuietMode(quiet) {
|
|
37
|
+
quietMode = quiet;
|
|
38
|
+
}
|
|
39
|
+
function shouldLog(level) {
|
|
40
|
+
if (quietMode && level !== "error") return false;
|
|
41
|
+
return LOG_LEVELS[level] <= LOG_LEVELS[currentLevel];
|
|
42
|
+
}
|
|
43
|
+
function log(message, level = "info") {
|
|
44
|
+
if (!shouldLog(level)) return;
|
|
45
|
+
const formatted = COLORS[level](`${PREFIXES[level]} ${message}`);
|
|
46
|
+
console.error(formatted);
|
|
47
|
+
}
|
|
48
|
+
function error(message) {
|
|
49
|
+
log(message, "error");
|
|
50
|
+
}
|
|
51
|
+
function warn(message) {
|
|
52
|
+
log(message, "warn");
|
|
53
|
+
}
|
|
54
|
+
function info(message) {
|
|
55
|
+
log(message, "info");
|
|
56
|
+
}
|
|
57
|
+
function success(message) {
|
|
58
|
+
if (!shouldLog("info")) return;
|
|
59
|
+
console.error(chalk.green(`[SUCCESS] ${message}`));
|
|
60
|
+
}
|
|
61
|
+
function debug(message) {
|
|
62
|
+
log(message, "debug");
|
|
63
|
+
}
|
|
64
|
+
var ReleaseKitError = class _ReleaseKitError extends Error {
|
|
65
|
+
constructor(message) {
|
|
66
|
+
super(message);
|
|
67
|
+
this.name = this.constructor.name;
|
|
68
|
+
}
|
|
69
|
+
logError() {
|
|
70
|
+
log(this.message, "error");
|
|
71
|
+
if (this.suggestions.length > 0) {
|
|
72
|
+
log("\nSuggested solutions:", "info");
|
|
73
|
+
for (const [i, suggestion] of this.suggestions.entries()) {
|
|
74
|
+
log(`${i + 1}. ${suggestion}`, "info");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
static isReleaseKitError(error2) {
|
|
79
|
+
return error2 instanceof _ReleaseKitError;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var EXIT_CODES = {
|
|
83
|
+
SUCCESS: 0,
|
|
84
|
+
GENERAL_ERROR: 1,
|
|
85
|
+
CONFIG_ERROR: 2,
|
|
86
|
+
INPUT_ERROR: 3,
|
|
87
|
+
TEMPLATE_ERROR: 4,
|
|
88
|
+
LLM_ERROR: 5,
|
|
89
|
+
GITHUB_ERROR: 6,
|
|
90
|
+
GIT_ERROR: 7,
|
|
91
|
+
VERSION_ERROR: 8,
|
|
92
|
+
PUBLISH_ERROR: 9
|
|
93
|
+
};
|
|
94
|
+
var TYPE_ORDER = ["added", "changed", "deprecated", "removed", "fixed", "security"];
|
|
95
|
+
var TYPE_LABELS = {
|
|
96
|
+
added: "Added",
|
|
97
|
+
changed: "Changed",
|
|
98
|
+
deprecated: "Deprecated",
|
|
99
|
+
removed: "Removed",
|
|
100
|
+
fixed: "Fixed",
|
|
101
|
+
security: "Security"
|
|
102
|
+
};
|
|
103
|
+
function groupEntriesByType(entries) {
|
|
104
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
105
|
+
for (const type of TYPE_ORDER) {
|
|
106
|
+
grouped.set(type, []);
|
|
107
|
+
}
|
|
108
|
+
for (const entry of entries) {
|
|
109
|
+
const existing = grouped.get(entry.type) ?? [];
|
|
110
|
+
existing.push(entry);
|
|
111
|
+
grouped.set(entry.type, existing);
|
|
112
|
+
}
|
|
113
|
+
return grouped;
|
|
114
|
+
}
|
|
115
|
+
function formatEntry(entry) {
|
|
116
|
+
let line;
|
|
117
|
+
if (entry.breaking && entry.scope) {
|
|
118
|
+
line = `- **BREAKING** **${entry.scope}**: ${entry.description}`;
|
|
119
|
+
} else if (entry.breaking) {
|
|
120
|
+
line = `- **BREAKING** ${entry.description}`;
|
|
121
|
+
} else if (entry.scope) {
|
|
122
|
+
line = `- **${entry.scope}**: ${entry.description}`;
|
|
123
|
+
} else {
|
|
124
|
+
line = `- ${entry.description}`;
|
|
125
|
+
}
|
|
126
|
+
if (entry.issueIds && entry.issueIds.length > 0) {
|
|
127
|
+
line += ` (${entry.issueIds.join(", ")})`;
|
|
128
|
+
}
|
|
129
|
+
return line;
|
|
130
|
+
}
|
|
131
|
+
function formatVersion(context, options) {
|
|
132
|
+
const lines = [];
|
|
133
|
+
const versionLabel = options?.includePackageName && context.packageName ? `${context.packageName}@${context.version}` : context.version;
|
|
134
|
+
const versionHeader = context.previousVersion ? `## [${versionLabel}]` : `## ${versionLabel}`;
|
|
135
|
+
lines.push(`${versionHeader} - ${context.date}`);
|
|
136
|
+
lines.push("");
|
|
137
|
+
if (context.compareUrl) {
|
|
138
|
+
lines.push(`[Full Changelog](${context.compareUrl})`);
|
|
139
|
+
lines.push("");
|
|
140
|
+
}
|
|
141
|
+
if (context.enhanced?.summary) {
|
|
142
|
+
lines.push(context.enhanced.summary);
|
|
143
|
+
lines.push("");
|
|
144
|
+
}
|
|
145
|
+
const grouped = groupEntriesByType(context.entries);
|
|
146
|
+
for (const [type, entries] of grouped) {
|
|
147
|
+
if (entries.length === 0) continue;
|
|
148
|
+
lines.push(`### ${TYPE_LABELS[type]}`);
|
|
149
|
+
for (const entry of entries) {
|
|
150
|
+
lines.push(formatEntry(entry));
|
|
151
|
+
}
|
|
152
|
+
lines.push("");
|
|
153
|
+
}
|
|
154
|
+
return lines.join("\n");
|
|
155
|
+
}
|
|
156
|
+
function formatHeader() {
|
|
157
|
+
return `# Changelog
|
|
158
|
+
|
|
159
|
+
All notable changes to this project will be documented in this file.
|
|
160
|
+
|
|
161
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
162
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
163
|
+
|
|
164
|
+
`;
|
|
165
|
+
}
|
|
166
|
+
function renderMarkdown(contexts, options) {
|
|
167
|
+
const sections = [formatHeader()];
|
|
168
|
+
for (const context of contexts) {
|
|
169
|
+
sections.push(formatVersion(context, options));
|
|
170
|
+
}
|
|
171
|
+
return sections.join("\n");
|
|
172
|
+
}
|
|
173
|
+
function prependVersion(existingPath, context, options) {
|
|
174
|
+
let existing = "";
|
|
175
|
+
if (fs2.existsSync(existingPath)) {
|
|
176
|
+
existing = fs2.readFileSync(existingPath, "utf-8");
|
|
177
|
+
const headerEnd = existing.indexOf("\n## ");
|
|
178
|
+
if (headerEnd >= 0) {
|
|
179
|
+
const header = existing.slice(0, headerEnd);
|
|
180
|
+
const body = existing.slice(headerEnd + 1);
|
|
181
|
+
const newVersion = formatVersion(context, options);
|
|
182
|
+
return `${header}
|
|
183
|
+
|
|
184
|
+
${newVersion}
|
|
185
|
+
${body}`;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return renderMarkdown([context]);
|
|
189
|
+
}
|
|
190
|
+
function writeMarkdown(outputPath, contexts, config, dryRun, options) {
|
|
191
|
+
const content = renderMarkdown(contexts, options);
|
|
192
|
+
const label = /changelog/i.test(outputPath) ? "Changelog" : "Release notes";
|
|
193
|
+
if (dryRun) {
|
|
194
|
+
info(`[DRY RUN] ${label} preview (would write to ${outputPath}):`);
|
|
195
|
+
info(content);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const dir = path2.dirname(outputPath);
|
|
199
|
+
if (!fs2.existsSync(dir)) {
|
|
200
|
+
fs2.mkdirSync(dir, { recursive: true });
|
|
201
|
+
}
|
|
202
|
+
if (outputPath === "-") {
|
|
203
|
+
process.stdout.write(content);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (config.updateStrategy !== "regenerate" && fs2.existsSync(outputPath) && contexts.length === 1) {
|
|
207
|
+
const firstContext = contexts[0];
|
|
208
|
+
if (firstContext) {
|
|
209
|
+
const updated = prependVersion(outputPath, firstContext, options);
|
|
210
|
+
fs2.writeFileSync(outputPath, updated, "utf-8");
|
|
211
|
+
}
|
|
212
|
+
} else {
|
|
213
|
+
fs2.writeFileSync(outputPath, content, "utf-8");
|
|
214
|
+
}
|
|
215
|
+
success(`${label} written to ${outputPath}`);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// ../notes/dist/chunk-F7MUVHZ2.js
|
|
219
|
+
init_esm_shims();
|
|
220
|
+
import * as fs from "fs";
|
|
221
|
+
import * as path from "path";
|
|
222
|
+
function splitByPackage(contexts) {
|
|
223
|
+
const byPackage = /* @__PURE__ */ new Map();
|
|
224
|
+
for (const ctx of contexts) {
|
|
225
|
+
byPackage.set(ctx.packageName, ctx);
|
|
226
|
+
}
|
|
227
|
+
return byPackage;
|
|
228
|
+
}
|
|
229
|
+
function writeFile(outputPath, content, dryRun) {
|
|
230
|
+
if (dryRun) {
|
|
231
|
+
info(`Would write to ${outputPath}`);
|
|
232
|
+
debug(content);
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
const dir = path.dirname(outputPath);
|
|
236
|
+
if (!fs.existsSync(dir)) {
|
|
237
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
238
|
+
}
|
|
239
|
+
fs.writeFileSync(outputPath, content, "utf-8");
|
|
240
|
+
success(`Changelog written to ${outputPath}`);
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
function aggregateToRoot(contexts) {
|
|
244
|
+
const aggregated = {
|
|
245
|
+
packageName: "monorepo",
|
|
246
|
+
version: contexts[0]?.version ?? "0.0.0",
|
|
247
|
+
previousVersion: contexts[0]?.previousVersion ?? null,
|
|
248
|
+
date: (/* @__PURE__ */ new Date()).toISOString().split("T")[0] ?? "",
|
|
249
|
+
repoUrl: contexts[0]?.repoUrl ?? null,
|
|
250
|
+
entries: []
|
|
251
|
+
};
|
|
252
|
+
for (const ctx of contexts) {
|
|
253
|
+
for (const entry of ctx.entries) {
|
|
254
|
+
aggregated.entries.push({
|
|
255
|
+
...entry,
|
|
256
|
+
scope: entry.scope ? `${ctx.packageName}/${entry.scope}` : ctx.packageName
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return aggregated;
|
|
261
|
+
}
|
|
262
|
+
function writeMonorepoChangelogs(contexts, options, config, dryRun) {
|
|
263
|
+
const files = [];
|
|
264
|
+
if (options.mode === "root" || options.mode === "both") {
|
|
265
|
+
const rootPath = path.join(options.rootPath, options.fileName ?? "CHANGELOG.md");
|
|
266
|
+
const fmtOpts = { includePackageName: true };
|
|
267
|
+
info(`Writing root changelog to ${rootPath}`);
|
|
268
|
+
let rootContent;
|
|
269
|
+
if (config.updateStrategy !== "regenerate" && fs.existsSync(rootPath)) {
|
|
270
|
+
const newSections = contexts.map((ctx) => formatVersion(ctx, fmtOpts)).join("\n");
|
|
271
|
+
const existing = fs.readFileSync(rootPath, "utf-8");
|
|
272
|
+
const headerEnd = existing.indexOf("\n## ");
|
|
273
|
+
if (headerEnd >= 0) {
|
|
274
|
+
rootContent = `${existing.slice(0, headerEnd)}
|
|
275
|
+
|
|
276
|
+
${newSections}
|
|
277
|
+
${existing.slice(headerEnd + 1)}`;
|
|
278
|
+
} else {
|
|
279
|
+
rootContent = renderMarkdown(contexts, fmtOpts);
|
|
280
|
+
}
|
|
281
|
+
} else {
|
|
282
|
+
rootContent = renderMarkdown(contexts, fmtOpts);
|
|
283
|
+
}
|
|
284
|
+
if (writeFile(rootPath, rootContent, dryRun)) {
|
|
285
|
+
files.push(rootPath);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
if (options.mode === "packages" || options.mode === "both") {
|
|
289
|
+
const byPackage = splitByPackage(contexts);
|
|
290
|
+
const packageDirMap = buildPackageDirMap(options.rootPath, options.packagesPath);
|
|
291
|
+
for (const [packageName, ctx] of byPackage) {
|
|
292
|
+
const simpleName = packageName.split("/").pop();
|
|
293
|
+
const packageDir = packageDirMap.get(packageName) ?? (simpleName ? packageDirMap.get(simpleName) : void 0) ?? null;
|
|
294
|
+
if (packageDir) {
|
|
295
|
+
const changelogPath = path.join(packageDir, options.fileName ?? "CHANGELOG.md");
|
|
296
|
+
info(`Writing changelog for ${packageName} to ${changelogPath}`);
|
|
297
|
+
const pkgContent = config.updateStrategy !== "regenerate" && fs.existsSync(changelogPath) ? prependVersion(changelogPath, ctx) : renderMarkdown([ctx]);
|
|
298
|
+
if (writeFile(changelogPath, pkgContent, dryRun)) {
|
|
299
|
+
files.push(changelogPath);
|
|
300
|
+
}
|
|
301
|
+
} else {
|
|
302
|
+
info(`Could not find directory for package ${packageName}, skipping`);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return files;
|
|
307
|
+
}
|
|
308
|
+
function buildPackageDirMap(rootPath, packagesPath) {
|
|
309
|
+
const map = /* @__PURE__ */ new Map();
|
|
310
|
+
const packagesDir = path.join(rootPath, packagesPath);
|
|
311
|
+
if (!fs.existsSync(packagesDir)) {
|
|
312
|
+
return map;
|
|
313
|
+
}
|
|
314
|
+
for (const entry of fs.readdirSync(packagesDir, { withFileTypes: true })) {
|
|
315
|
+
if (!entry.isDirectory()) continue;
|
|
316
|
+
const dirPath = path.join(packagesDir, entry.name);
|
|
317
|
+
map.set(entry.name, dirPath);
|
|
318
|
+
const packageJsonPath = path.join(dirPath, "package.json");
|
|
319
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
320
|
+
try {
|
|
321
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
322
|
+
if (pkg.name) {
|
|
323
|
+
map.set(pkg.name, dirPath);
|
|
324
|
+
}
|
|
325
|
+
} catch {
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return map;
|
|
330
|
+
}
|
|
331
|
+
function detectMonorepo(cwd) {
|
|
332
|
+
const pnpmWorkspacesPath = path.join(cwd, "pnpm-workspace.yaml");
|
|
333
|
+
const packageJsonPath = path.join(cwd, "package.json");
|
|
334
|
+
if (fs.existsSync(pnpmWorkspacesPath)) {
|
|
335
|
+
const content = fs.readFileSync(pnpmWorkspacesPath, "utf-8");
|
|
336
|
+
const packagesMatch = content.match(/packages:\s*\n\s*-\s*['"]([^'"]+)['"]/);
|
|
337
|
+
if (packagesMatch?.[1]) {
|
|
338
|
+
const packagesGlob = packagesMatch[1];
|
|
339
|
+
const packagesPath = packagesGlob.replace(/\/?\*$/, "").replace(/\/\*\*$/, "");
|
|
340
|
+
return { isMonorepo: true, packagesPath: packagesPath || "packages" };
|
|
341
|
+
}
|
|
342
|
+
return { isMonorepo: true, packagesPath: "packages" };
|
|
343
|
+
}
|
|
344
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
345
|
+
try {
|
|
346
|
+
const content = fs.readFileSync(packageJsonPath, "utf-8");
|
|
347
|
+
const pkg = JSON.parse(content);
|
|
348
|
+
if (pkg.workspaces) {
|
|
349
|
+
const workspaces = Array.isArray(pkg.workspaces) ? pkg.workspaces : pkg.workspaces.packages;
|
|
350
|
+
if (workspaces?.length) {
|
|
351
|
+
const firstWorkspace = workspaces[0];
|
|
352
|
+
if (firstWorkspace) {
|
|
353
|
+
const packagesPath = firstWorkspace.replace(/\/?\*$/, "").replace(/\/\*\*$/, "");
|
|
354
|
+
return { isMonorepo: true, packagesPath: packagesPath || "packages" };
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
} catch {
|
|
359
|
+
return { isMonorepo: false, packagesPath: "" };
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return { isMonorepo: false, packagesPath: "" };
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
export {
|
|
366
|
+
setLogLevel,
|
|
367
|
+
setQuietMode,
|
|
368
|
+
error,
|
|
369
|
+
warn,
|
|
370
|
+
info,
|
|
371
|
+
success,
|
|
372
|
+
debug,
|
|
373
|
+
ReleaseKitError,
|
|
374
|
+
EXIT_CODES,
|
|
375
|
+
formatVersion,
|
|
376
|
+
renderMarkdown,
|
|
377
|
+
writeMarkdown,
|
|
378
|
+
splitByPackage,
|
|
379
|
+
aggregateToRoot,
|
|
380
|
+
writeMonorepoChangelogs,
|
|
381
|
+
detectMonorepo
|
|
382
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_esm_shims
|
|
3
|
+
} from "./chunk-NOZSTVTV.js";
|
|
4
|
+
|
|
5
|
+
// ../version/dist/chunk-Q3FHZORY.js
|
|
6
|
+
init_esm_shims();
|
|
7
|
+
import chalk from "chalk";
|
|
8
|
+
var LOG_LEVELS = {
|
|
9
|
+
error: 0,
|
|
10
|
+
warn: 1,
|
|
11
|
+
info: 2,
|
|
12
|
+
debug: 3,
|
|
13
|
+
trace: 4
|
|
14
|
+
};
|
|
15
|
+
var PREFIXES = {
|
|
16
|
+
error: "[ERROR]",
|
|
17
|
+
warn: "[WARN]",
|
|
18
|
+
info: "[INFO]",
|
|
19
|
+
debug: "[DEBUG]",
|
|
20
|
+
trace: "[TRACE]"
|
|
21
|
+
};
|
|
22
|
+
var COLORS = {
|
|
23
|
+
error: chalk.red,
|
|
24
|
+
warn: chalk.yellow,
|
|
25
|
+
info: chalk.blue,
|
|
26
|
+
debug: chalk.gray,
|
|
27
|
+
trace: chalk.dim
|
|
28
|
+
};
|
|
29
|
+
var currentLevel = "info";
|
|
30
|
+
var quietMode = false;
|
|
31
|
+
function shouldLog(level) {
|
|
32
|
+
if (quietMode && level !== "error") return false;
|
|
33
|
+
return LOG_LEVELS[level] <= LOG_LEVELS[currentLevel];
|
|
34
|
+
}
|
|
35
|
+
function log(message, level = "info") {
|
|
36
|
+
if (!shouldLog(level)) return;
|
|
37
|
+
const formatted = COLORS[level](`${PREFIXES[level]} ${message}`);
|
|
38
|
+
console.error(formatted);
|
|
39
|
+
}
|
|
40
|
+
var ReleaseKitError = class _ReleaseKitError extends Error {
|
|
41
|
+
constructor(message) {
|
|
42
|
+
super(message);
|
|
43
|
+
this.name = this.constructor.name;
|
|
44
|
+
}
|
|
45
|
+
logError() {
|
|
46
|
+
log(this.message, "error");
|
|
47
|
+
if (this.suggestions.length > 0) {
|
|
48
|
+
log("\nSuggested solutions:", "info");
|
|
49
|
+
for (const [i, suggestion] of this.suggestions.entries()) {
|
|
50
|
+
log(`${i + 1}. ${suggestion}`, "info");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static isReleaseKitError(error2) {
|
|
55
|
+
return error2 instanceof _ReleaseKitError;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
function sanitizePackageName(name) {
|
|
59
|
+
return name.startsWith("@") ? name.slice(1).replace(/\//g, "-") : name;
|
|
60
|
+
}
|
|
61
|
+
var BaseVersionError = class _BaseVersionError extends ReleaseKitError {
|
|
62
|
+
code;
|
|
63
|
+
suggestions;
|
|
64
|
+
constructor(message, code, suggestions) {
|
|
65
|
+
super(message);
|
|
66
|
+
this.code = code;
|
|
67
|
+
this.suggestions = suggestions ?? [];
|
|
68
|
+
}
|
|
69
|
+
static isVersionError(error) {
|
|
70
|
+
return error instanceof _BaseVersionError;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export {
|
|
75
|
+
ReleaseKitError,
|
|
76
|
+
sanitizePackageName,
|
|
77
|
+
BaseVersionError
|
|
78
|
+
};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_esm_shims
|
|
3
|
+
} from "./chunk-NOZSTVTV.js";
|
|
4
|
+
|
|
1
5
|
// ../core/dist/index.js
|
|
6
|
+
init_esm_shims();
|
|
2
7
|
import * as fs from "fs";
|
|
3
8
|
import * as path from "path";
|
|
4
9
|
import { fileURLToPath } from "url";
|
|
@@ -98,19 +103,19 @@ var EXIT_CODES = {
|
|
|
98
103
|
};
|
|
99
104
|
|
|
100
105
|
// src/release.ts
|
|
106
|
+
init_esm_shims();
|
|
101
107
|
import { execSync } from "child_process";
|
|
102
108
|
|
|
103
109
|
// ../config/dist/index.js
|
|
104
|
-
|
|
105
|
-
import * as path2 from "path";
|
|
110
|
+
init_esm_shims();
|
|
106
111
|
import * as TOML from "smol-toml";
|
|
107
112
|
import * as fs3 from "fs";
|
|
108
113
|
import * as path3 from "path";
|
|
109
114
|
import { z as z2 } from "zod";
|
|
110
115
|
import { z } from "zod";
|
|
111
|
-
import * as
|
|
116
|
+
import * as fs2 from "fs";
|
|
112
117
|
import * as os from "os";
|
|
113
|
-
import * as
|
|
118
|
+
import * as path2 from "path";
|
|
114
119
|
var ConfigError = class extends ReleaseKitError {
|
|
115
120
|
code = "CONFIG_ERROR";
|
|
116
121
|
suggestions;
|
|
@@ -434,9 +439,9 @@ function substituteVariables(value) {
|
|
|
434
439
|
return process.env[varName] ?? "";
|
|
435
440
|
});
|
|
436
441
|
result = result.replace(filePattern, (_, filePath) => {
|
|
437
|
-
const expandedPath = filePath.startsWith("~") ?
|
|
442
|
+
const expandedPath = filePath.startsWith("~") ? path2.join(os.homedir(), filePath.slice(1)) : filePath;
|
|
438
443
|
try {
|
|
439
|
-
return
|
|
444
|
+
return fs2.readFileSync(expandedPath, "utf-8").trim();
|
|
440
445
|
} catch {
|
|
441
446
|
return "";
|
|
442
447
|
}
|
|
@@ -464,8 +469,8 @@ function substituteInObject(obj) {
|
|
|
464
469
|
}
|
|
465
470
|
return obj;
|
|
466
471
|
}
|
|
467
|
-
var AUTH_DIR =
|
|
468
|
-
var AUTH_FILE =
|
|
472
|
+
var AUTH_DIR = path2.join(os.homedir(), ".config", "releasekit");
|
|
473
|
+
var AUTH_FILE = path2.join(AUTH_DIR, "auth.json");
|
|
469
474
|
var CONFIG_FILE = "releasekit.config.json";
|
|
470
475
|
function loadConfigFile(configPath) {
|
|
471
476
|
if (!fs3.existsSync(configPath)) {
|
|
@@ -557,7 +562,7 @@ async function runRelease(inputOptions) {
|
|
|
557
562
|
return null;
|
|
558
563
|
}
|
|
559
564
|
if (!options.dryRun) {
|
|
560
|
-
const { flushPendingWrites } = await import("
|
|
565
|
+
const { flushPendingWrites } = await import("./dist-7RSHM4ZO.js");
|
|
561
566
|
flushPendingWrites();
|
|
562
567
|
}
|
|
563
568
|
info(`Found ${versionOutput.updates.length} package update(s)`);
|
|
@@ -586,7 +591,7 @@ async function runRelease(inputOptions) {
|
|
|
586
591
|
return { versionOutput, notesGenerated, packageNotes, releaseNotes, publishOutput };
|
|
587
592
|
}
|
|
588
593
|
async function runVersionStep(options) {
|
|
589
|
-
const { loadConfig: loadConfig2, VersionEngine, enableJsonOutput, getJsonData } = await import("
|
|
594
|
+
const { loadConfig: loadConfig2, VersionEngine, enableJsonOutput, getJsonData } = await import("./dist-7RSHM4ZO.js");
|
|
590
595
|
enableJsonOutput(options.dryRun);
|
|
591
596
|
const config = loadConfig2({ cwd: options.projectDir, configPath: options.config });
|
|
592
597
|
if (options.dryRun) config.dryRun = true;
|
|
@@ -619,14 +624,14 @@ async function runVersionStep(options) {
|
|
|
619
624
|
return getJsonData();
|
|
620
625
|
}
|
|
621
626
|
async function runNotesStep(versionOutput, options) {
|
|
622
|
-
const { parseVersionOutput, runPipeline, loadConfig: loadConfig2 } = await import("
|
|
627
|
+
const { parseVersionOutput, runPipeline, loadConfig: loadConfig2 } = await import("./dist-HVRDLODI.js");
|
|
623
628
|
const config = loadConfig2(options.projectDir, options.config);
|
|
624
629
|
const input = parseVersionOutput(JSON.stringify(versionOutput));
|
|
625
630
|
const result = await runPipeline(input, config, options.dryRun);
|
|
626
631
|
return { packageNotes: result.packageNotes, releaseNotes: result.releaseNotes, files: result.files };
|
|
627
632
|
}
|
|
628
633
|
async function runPublishStep(versionOutput, options, releaseNotes, additionalFiles) {
|
|
629
|
-
const { runPipeline, loadConfig: loadConfig2 } = await import("
|
|
634
|
+
const { runPipeline, loadConfig: loadConfig2 } = await import("./dist-4RETAAT2.js");
|
|
630
635
|
const config = loadConfig2({ configPath: options.config });
|
|
631
636
|
if (options.branch) {
|
|
632
637
|
config.git.branch = options.branch;
|
|
@@ -647,7 +652,11 @@ async function runPublishStep(versionOutput, options, releaseNotes, additionalFi
|
|
|
647
652
|
return runPipeline(versionOutput, config, publishOptions);
|
|
648
653
|
}
|
|
649
654
|
|
|
655
|
+
// src/preview.ts
|
|
656
|
+
init_esm_shims();
|
|
657
|
+
|
|
650
658
|
// src/preview-context.ts
|
|
659
|
+
init_esm_shims();
|
|
651
660
|
import * as fs4 from "fs";
|
|
652
661
|
function resolvePreviewContext(opts) {
|
|
653
662
|
const token = process.env.GITHUB_TOKEN;
|
|
@@ -691,6 +700,7 @@ function resolveRepo(cliValue) {
|
|
|
691
700
|
}
|
|
692
701
|
|
|
693
702
|
// src/preview-detect.ts
|
|
703
|
+
init_esm_shims();
|
|
694
704
|
import * as fs5 from "fs";
|
|
695
705
|
import * as path4 from "path";
|
|
696
706
|
function detectPrerelease(packagePaths, projectDir) {
|
|
@@ -716,6 +726,7 @@ function parsePrerelease(version) {
|
|
|
716
726
|
}
|
|
717
727
|
|
|
718
728
|
// src/preview-format.ts
|
|
729
|
+
init_esm_shims();
|
|
719
730
|
var MARKER = "<!-- releasekit-preview -->";
|
|
720
731
|
var FOOTER = "*Updated automatically by [ReleaseKit](https://github.com/goosewobbler/releasekit)*";
|
|
721
732
|
var TYPE_LABELS = {
|
|
@@ -886,6 +897,7 @@ function capitalize(str) {
|
|
|
886
897
|
}
|
|
887
898
|
|
|
888
899
|
// src/preview-github.ts
|
|
900
|
+
init_esm_shims();
|
|
889
901
|
import { Octokit } from "@octokit/rest";
|
|
890
902
|
function createOctokit(token) {
|
|
891
903
|
return new Octokit({ auth: token });
|
|
@@ -2,9 +2,13 @@ import {
|
|
|
2
2
|
EXIT_CODES,
|
|
3
3
|
runPreview,
|
|
4
4
|
runRelease
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-6UI4L62T.js";
|
|
6
|
+
import {
|
|
7
|
+
init_esm_shims
|
|
8
|
+
} from "./chunk-NOZSTVTV.js";
|
|
6
9
|
|
|
7
10
|
// src/preview-command.ts
|
|
11
|
+
init_esm_shims();
|
|
8
12
|
import { Command } from "commander";
|
|
9
13
|
function createPreviewCommand() {
|
|
10
14
|
return new Command("preview").description("Post a release preview comment on the current pull request").option("-c, --config <path>", "Path to config file").option("--project-dir <path>", "Project directory", process.cwd()).option("--pr <number>", "PR number (auto-detected from GitHub Actions)").option("--repo <owner/repo>", "Repository (auto-detected from GITHUB_REPOSITORY)").option("-p, --prerelease [identifier]", "Force prerelease preview (auto-detected by default)").option("--stable", "Force stable release preview (graduation from prerelease)", false).option(
|
|
@@ -30,6 +34,7 @@ function createPreviewCommand() {
|
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
// src/release-command.ts
|
|
37
|
+
init_esm_shims();
|
|
33
38
|
import { Command as Command2, Option } from "commander";
|
|
34
39
|
function createReleaseCommand() {
|
|
35
40
|
return new Command2("release").description("Run the full release pipeline").option("-c, --config <path>", "Path to config file").option("-d, --dry-run", "Preview all steps without side effects", false).option("-b, --bump <type>", "Force bump type (patch|minor|major)").option("-p, --prerelease [identifier]", "Create prerelease version").option("-s, --sync", "Use synchronized versioning across all packages", false).option("-t, --target <packages>", "Target specific packages (comma-separated)").option("--branch <name>", "Override the git branch used for push").addOption(new Option("--npm-auth <method>", "NPM auth method").choices(["auto", "oidc", "token"]).default("auto")).option("--skip-notes", "Skip changelog generation", false).option("--skip-publish", "Skip registry publishing and git operations", false).option("--skip-git", "Skip git commit/tag/push", false).option("--skip-github-release", "Skip GitHub release creation", false).option("--skip-verification", "Skip post-publish verification", false).option("-j, --json", "Output results as JSON", false).option("-v, --verbose", "Verbose logging", false).option("-q, --quiet", "Suppress non-error output", false).option("--project-dir <path>", "Project directory", process.cwd()).action(async (opts) => {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
13
|
+
var __esm = (fn, res) => function __init() {
|
|
14
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
15
|
+
};
|
|
16
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
17
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
+
};
|
|
19
|
+
var __copyProps = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
+
for (let key of __getOwnPropNames(from))
|
|
22
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
23
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
|
+
}
|
|
25
|
+
return to;
|
|
26
|
+
};
|
|
27
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
28
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
29
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
30
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
31
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
32
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
33
|
+
mod
|
|
34
|
+
));
|
|
35
|
+
|
|
36
|
+
// ../../node_modules/.pnpm/tsup@8.5.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.3/node_modules/tsup/assets/esm_shims.js
|
|
37
|
+
import path from "path";
|
|
38
|
+
import { fileURLToPath } from "url";
|
|
39
|
+
var getFilename, getDirname, __dirname;
|
|
40
|
+
var init_esm_shims = __esm({
|
|
41
|
+
"../../node_modules/.pnpm/tsup@8.5.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.3/node_modules/tsup/assets/esm_shims.js"() {
|
|
42
|
+
"use strict";
|
|
43
|
+
getFilename = () => fileURLToPath(import.meta.url);
|
|
44
|
+
getDirname = () => path.dirname(getFilename());
|
|
45
|
+
__dirname = /* @__PURE__ */ getDirname();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
__require,
|
|
51
|
+
__commonJS,
|
|
52
|
+
__toESM,
|
|
53
|
+
__dirname,
|
|
54
|
+
init_esm_shims
|
|
55
|
+
};
|