versionary 1.4.1 → 1.6.0
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/config/schema.d.ts +2 -0
- package/dist/config/schema.js +2 -0
- package/dist/git/redact.d.ts +1 -0
- package/dist/git/redact.js +14 -0
- package/dist/release/changelog.js +7 -7
- package/dist/release/pr.js +13 -4
- package/dist/release/release.d.ts +1 -0
- package/dist/release/release.js +8 -1
- package/dist/strategy/package-context.js +2 -1
- package/dist/strategy/rust.js +5 -9
- package/dist/types/config.d.ts +2 -0
- package/package.json +1 -1
package/dist/config/schema.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const configSchema: z.ZodObject<{
|
|
|
13
13
|
"r-news": "r-news";
|
|
14
14
|
}>>;
|
|
15
15
|
"release-draft": z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
"release-latest": z.ZodOptional<z.ZodBoolean>;
|
|
16
17
|
"release-reference-comments": z.ZodOptional<z.ZodEnum<{
|
|
17
18
|
"best-effort": "best-effort";
|
|
18
19
|
off: "off";
|
|
@@ -40,6 +41,7 @@ export declare const configSchema: z.ZodObject<{
|
|
|
40
41
|
"r-news": "r-news";
|
|
41
42
|
}>>;
|
|
42
43
|
"release-draft": z.ZodOptional<z.ZodBoolean>;
|
|
44
|
+
"release-latest": z.ZodOptional<z.ZodBoolean>;
|
|
43
45
|
"bump-minor-pre-major": z.ZodOptional<z.ZodBoolean>;
|
|
44
46
|
"allow-stable-major": z.ZodOptional<z.ZodBoolean>;
|
|
45
47
|
"exclude-paths": z.ZodOptional<z.ZodArray<z.ZodString>>;
|
package/dist/config/schema.js
CHANGED
|
@@ -69,6 +69,7 @@ const packageSchema = z
|
|
|
69
69
|
"changelog-file": z.string().optional(),
|
|
70
70
|
"changelog-format": z.enum(["markdown-changelog", "r-news"]).optional(),
|
|
71
71
|
"release-draft": z.boolean().optional(),
|
|
72
|
+
"release-latest": z.boolean().optional(),
|
|
72
73
|
"bump-minor-pre-major": deprecatedBumpMinorPreMajorSchema,
|
|
73
74
|
"allow-stable-major": z.boolean().optional(),
|
|
74
75
|
"exclude-paths": z.array(z.string()).optional(),
|
|
@@ -95,6 +96,7 @@ export const configSchema = z
|
|
|
95
96
|
"changelog-file": z.string().optional(),
|
|
96
97
|
"changelog-format": z.enum(["markdown-changelog", "r-news"]).optional(),
|
|
97
98
|
"release-draft": z.boolean().optional(),
|
|
99
|
+
"release-latest": z.boolean().optional(),
|
|
98
100
|
"release-reference-comments": z
|
|
99
101
|
.enum(["off", "best-effort", "strict"])
|
|
100
102
|
.optional(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function redactCredentials(message: string): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function redactCredentials(message) {
|
|
2
|
+
let redacted = message.replace(/([a-z][a-z\d+.-]*:\/\/)[^\s/]*@/giu, "$1[REDACTED]@");
|
|
3
|
+
const tokens = [
|
|
4
|
+
process.env.VERSIONARY_PR_TOKEN,
|
|
5
|
+
process.env.GH_TOKEN,
|
|
6
|
+
process.env.GITHUB_TOKEN,
|
|
7
|
+
].filter((token) => Boolean(token));
|
|
8
|
+
const secrets = new Set(tokens.flatMap((token) => [token, encodeURIComponent(token)]));
|
|
9
|
+
// Replace longer secrets first so an overlapping token cannot leave a suffix.
|
|
10
|
+
for (const secret of [...secrets].sort((a, b) => b.length - a.length)) {
|
|
11
|
+
redacted = redacted.replaceAll(secret, "[REDACTED]");
|
|
12
|
+
}
|
|
13
|
+
return redacted;
|
|
14
|
+
}
|
|
@@ -162,25 +162,25 @@ export function renderReleaseNotesSection(input, options = {}) {
|
|
|
162
162
|
sections.push(trimmedHighlights, "");
|
|
163
163
|
}
|
|
164
164
|
if (grouped.breaking.length > 0) {
|
|
165
|
-
sections.push("### Breaking changes", ...grouped.breaking, "");
|
|
165
|
+
sections.push("### Breaking changes", "", ...grouped.breaking, "");
|
|
166
166
|
}
|
|
167
167
|
if (grouped.features.length > 0) {
|
|
168
|
-
sections.push("### Features", ...grouped.features, "");
|
|
168
|
+
sections.push("### Features", "", ...grouped.features, "");
|
|
169
169
|
}
|
|
170
170
|
if (grouped.fixes.length > 0) {
|
|
171
|
-
sections.push("### Bug Fixes", ...grouped.fixes, "");
|
|
171
|
+
sections.push("### Bug Fixes", "", ...grouped.fixes, "");
|
|
172
172
|
}
|
|
173
173
|
if (grouped.performance.length > 0) {
|
|
174
|
-
sections.push("### Performance Improvements", ...grouped.performance, "");
|
|
174
|
+
sections.push("### Performance Improvements", "", ...grouped.performance, "");
|
|
175
175
|
}
|
|
176
176
|
if (grouped.reverts.length > 0) {
|
|
177
|
-
sections.push("### Reverts", ...grouped.reverts, "");
|
|
177
|
+
sections.push("### Reverts", "", ...grouped.reverts, "");
|
|
178
178
|
}
|
|
179
179
|
if (input.dependencies && input.dependencies.length > 0) {
|
|
180
|
-
sections.push("### Dependencies", ...input.dependencies.map((dependency) => `- updated ${dependency.name} to v${dependency.version}`), "");
|
|
180
|
+
sections.push("### Dependencies", "", ...input.dependencies.map((dependency) => `- updated ${dependency.name} to v${dependency.version}`), "");
|
|
181
181
|
}
|
|
182
182
|
if (needsOtherChangesFallback(grouped, trimmedHighlights.length > 0, input.dependencies?.length ?? 0)) {
|
|
183
|
-
sections.push("### Other changes", ...grouped.other, "");
|
|
183
|
+
sections.push("### Other changes", "", ...grouped.other, "");
|
|
184
184
|
}
|
|
185
185
|
const body = [header, "", ...sections].join("\n").trimEnd();
|
|
186
186
|
if (options.includeFooter) {
|
package/dist/release/pr.js
CHANGED
|
@@ -4,6 +4,7 @@ import os from "node:os";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { loadConfig } from "../config/load-config.js";
|
|
6
6
|
import { ensureGitIdentity } from "../git/identity.js";
|
|
7
|
+
import { redactCredentials } from "../git/redact.js";
|
|
7
8
|
import { getScmClient } from "../scm/client.js";
|
|
8
9
|
import { resolvePackageStrategyContext, resolveReleaseName, } from "../strategy/package-context.js";
|
|
9
10
|
import { applyConfiguredArtifactRules } from "./artifact-rules.js";
|
|
@@ -985,10 +986,18 @@ export async function closeStaleReviewRequestIfExists(cwd = process.cwd(), optio
|
|
|
985
986
|
return result;
|
|
986
987
|
}
|
|
987
988
|
export function pushReleaseBranch(cwd, branch) {
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
989
|
+
try {
|
|
990
|
+
execFileSync("git", ["push", "--force-with-lease", "origin", branch], {
|
|
991
|
+
cwd,
|
|
992
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
catch (error) {
|
|
996
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
997
|
+
// Captured stderr is included in the message. Do not retain the original
|
|
998
|
+
// error as a cause: its output buffers may contain credentials.
|
|
999
|
+
throw new Error(redactCredentials(message));
|
|
1000
|
+
}
|
|
992
1001
|
}
|
|
993
1002
|
export function isReleaseCommitMessage(commitMessage) {
|
|
994
1003
|
if (/^Versionary-Release:\s*true$/imu.test(commitMessage)) {
|
|
@@ -2,6 +2,7 @@ import type { VersionaryConfig } from "../types/config.js";
|
|
|
2
2
|
import type { VersionaryPluginContext } from "../types/plugins.js";
|
|
3
3
|
export declare function resolveTargetPackageName(cwd: string, config: VersionaryConfig, targetPath: string): string | undefined;
|
|
4
4
|
export declare function resolveTargetReleaseDraft(config: VersionaryConfig, targetPath: string): boolean;
|
|
5
|
+
export declare function resolveTargetReleaseLatest(config: VersionaryConfig, targetPath: string): boolean;
|
|
5
6
|
export declare function extractReleaseNotes(content: string, version: string, changelogFormat: "markdown-changelog" | "r-news"): string;
|
|
6
7
|
export declare function extractClosingReferencesFromNotes(notes: string): number[];
|
|
7
8
|
export declare function resolveTargetChangelogFile(config: VersionaryConfig, rootChangelogFile: string, targetPath: string): string;
|
package/dist/release/release.js
CHANGED
|
@@ -27,6 +27,11 @@ export function resolveTargetReleaseDraft(config, targetPath) {
|
|
|
27
27
|
config["release-draft"] ??
|
|
28
28
|
false);
|
|
29
29
|
}
|
|
30
|
+
export function resolveTargetReleaseLatest(config, targetPath) {
|
|
31
|
+
return (config.packages?.[targetPath]?.["release-latest"] ??
|
|
32
|
+
config["release-latest"] ??
|
|
33
|
+
targetPath === ".");
|
|
34
|
+
}
|
|
30
35
|
export function extractReleaseNotes(content, version, changelogFormat) {
|
|
31
36
|
const lines = content.split("\n");
|
|
32
37
|
const shortVersion = version.replace(/\.\d+$/u, "");
|
|
@@ -204,7 +209,9 @@ export async function runReleaseDetailed(cwd = process.cwd(), options = {}) {
|
|
|
204
209
|
version: target.version,
|
|
205
210
|
notes: releaseNotes,
|
|
206
211
|
draft: resolveTargetReleaseDraft(loaded.config, target.path),
|
|
207
|
-
makeLatest: target.path
|
|
212
|
+
makeLatest: resolveTargetReleaseLatest(loaded.config, target.path)
|
|
213
|
+
? "true"
|
|
214
|
+
: "false",
|
|
208
215
|
}, {
|
|
209
216
|
createReleaseMetadata: (input) => scmClient.createReleaseMetadata(input, {
|
|
210
217
|
cwd,
|
|
@@ -5,7 +5,8 @@ export function resolveReleaseName(cwd, packagePath, packageConfig, strategy, st
|
|
|
5
5
|
if (configuredName) {
|
|
6
6
|
return configuredName;
|
|
7
7
|
}
|
|
8
|
-
return strategy.readPackageName?.(cwd, strategyConfig) ??
|
|
8
|
+
return (strategy.readPackageName?.(cwd, strategyConfig) ??
|
|
9
|
+
(packagePath === "." ? path.basename(cwd) : packagePath));
|
|
9
10
|
}
|
|
10
11
|
function withVersionFile(config, versionFile) {
|
|
11
12
|
return {
|
package/dist/strategy/rust.js
CHANGED
|
@@ -758,20 +758,16 @@ export const rustVersionStrategy = {
|
|
|
758
758
|
},
|
|
759
759
|
readPackageName(cwd, config) {
|
|
760
760
|
const versionFile = this.getVersionFile(config);
|
|
761
|
-
const
|
|
762
|
-
const selectedManifest = manifests[0];
|
|
763
|
-
if (!selectedManifest) {
|
|
764
|
-
throw new Error(`Configured rust target "${versionFile}" did not resolve to a Rust crate manifest.`);
|
|
765
|
-
}
|
|
766
|
-
const versionPath = path.join(cwd, selectedManifest);
|
|
761
|
+
const versionPath = path.join(cwd, versionFile);
|
|
767
762
|
if (!fs.existsSync(versionPath)) {
|
|
768
|
-
throw new Error(`Versionary requires ${
|
|
763
|
+
throw new Error(`Versionary requires ${versionFile} to exist.`);
|
|
769
764
|
}
|
|
770
765
|
const cargoTomlRaw = fs.readFileSync(versionPath, "utf8");
|
|
771
|
-
|
|
766
|
+
// A virtual workspace has no package name of its own to return.
|
|
767
|
+
if (!isCrateManifest(versionFile, cargoTomlRaw)) {
|
|
772
768
|
return null;
|
|
773
769
|
}
|
|
774
|
-
return readCargoPackageName(cargoTomlRaw,
|
|
770
|
+
return readCargoPackageName(cargoTomlRaw, versionFile);
|
|
775
771
|
},
|
|
776
772
|
isPublishable(cwd, pkg) {
|
|
777
773
|
const manifest = normalizeSlashPath(pkg.versionFile);
|
package/dist/types/config.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface VersionaryPackage {
|
|
|
15
15
|
"changelog-file"?: string;
|
|
16
16
|
"changelog-format"?: VersionaryChangelogFormat;
|
|
17
17
|
"release-draft"?: boolean;
|
|
18
|
+
"release-latest"?: boolean;
|
|
18
19
|
/** @deprecated Use `allow-stable-major` with the inverse value. */
|
|
19
20
|
"bump-minor-pre-major"?: boolean;
|
|
20
21
|
"allow-stable-major"?: boolean;
|
|
@@ -29,6 +30,7 @@ export interface VersionaryConfig {
|
|
|
29
30
|
"changelog-file"?: string;
|
|
30
31
|
"changelog-format"?: VersionaryChangelogFormat;
|
|
31
32
|
"release-draft"?: boolean;
|
|
33
|
+
"release-latest"?: boolean;
|
|
32
34
|
"release-reference-comments"?: ReleaseReferenceCommentsMode;
|
|
33
35
|
"release-branch"?: string;
|
|
34
36
|
"separate-release-prs"?: boolean;
|