versionary 1.4.1 → 1.5.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.
@@ -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>>;
@@ -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(),
@@ -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;
@@ -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 === "." ? "true" : "false",
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) ?? packagePath;
8
+ return (strategy.readPackageName?.(cwd, strategyConfig) ??
9
+ (packagePath === "." ? path.basename(cwd) : packagePath));
9
10
  }
10
11
  function withVersionFile(config, versionFile) {
11
12
  return {
@@ -758,20 +758,16 @@ export const rustVersionStrategy = {
758
758
  },
759
759
  readPackageName(cwd, config) {
760
760
  const versionFile = this.getVersionFile(config);
761
- const manifests = collectRustTargetManifests(cwd, versionFile, !config.packages);
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 ${selectedManifest} to exist.`);
763
+ throw new Error(`Versionary requires ${versionFile} to exist.`);
769
764
  }
770
765
  const cargoTomlRaw = fs.readFileSync(versionPath, "utf8");
771
- if (!isCrateManifest(selectedManifest, cargoTomlRaw)) {
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, selectedManifest);
770
+ return readCargoPackageName(cargoTomlRaw, versionFile);
775
771
  },
776
772
  isPublishable(cwd, pkg) {
777
773
  const manifest = normalizeSlashPath(pkg.versionFile);
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "versionary",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Automatic release framework based on conventional commits and semantic versioning",
5
5
  "keywords": [
6
6
  "releasing",