versionary 0.28.0 → 0.28.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.
- package/dist/action/index.js +7 -9
- package/dist/cli/index.js +32 -34
- package/dist/config/load-config.js +16 -23
- package/dist/config/schema.js +45 -48
- package/dist/git/commits.js +23 -42
- package/dist/git/identity.js +7 -11
- package/dist/git/repo-url.js +3 -6
- package/dist/index.js +6 -16
- package/dist/release/artifact-rules.js +15 -21
- package/dist/release/changelog.js +23 -34
- package/dist/release/plan.js +34 -43
- package/dist/release/pr.js +75 -92
- package/dist/release/recovery.js +9 -12
- package/dist/release/release.js +37 -50
- package/dist/release/semver.js +5 -12
- package/dist/release/state.js +22 -31
- package/dist/release/verify-project.js +14 -20
- package/dist/scm/capabilities.js +2 -6
- package/dist/scm/client.js +3 -6
- package/dist/scm/github-plugin.js +6 -9
- package/dist/scm/types.js +1 -2
- package/dist/strategy/composite.js +1 -4
- package/dist/strategy/latex.js +18 -24
- package/dist/strategy/node.js +13 -19
- package/dist/strategy/package-context.js +8 -15
- package/dist/strategy/python.js +35 -41
- package/dist/strategy/r.js +16 -22
- package/dist/strategy/resolve.js +16 -20
- package/dist/strategy/rust.js +80 -89
- package/dist/strategy/simple.js +8 -14
- package/dist/strategy/types.js +1 -2
- package/dist/types/config.js +1 -2
- package/dist/types/plugins.js +1 -2
- package/package.json +3 -3
package/dist/strategy/rust.js
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.rustVersionStrategy = void 0;
|
|
7
|
-
exports.applyRustWorkspaceDependencyUpdates = applyRustWorkspaceDependencyUpdates;
|
|
8
|
-
exports.detectRustDependencyImpact = detectRustDependencyImpact;
|
|
9
|
-
exports.toCargoManifestPath = toCargoManifestPath;
|
|
10
|
-
const node_child_process_1 = require("node:child_process");
|
|
11
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
12
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
13
|
-
const toml_1 = __importDefault(require("@iarna/toml"));
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { parse as parseToml } from "smol-toml";
|
|
14
5
|
const ROOT_DEPENDENCY_SECTIONS = new Set([
|
|
15
6
|
"dependencies",
|
|
16
7
|
"dev-dependencies",
|
|
@@ -57,12 +48,12 @@ function findCargoManifestDirectories(rootDir) {
|
|
|
57
48
|
if (!currentDir) {
|
|
58
49
|
continue;
|
|
59
50
|
}
|
|
60
|
-
const entries =
|
|
51
|
+
const entries = fs.readdirSync(currentDir, {
|
|
61
52
|
withFileTypes: true,
|
|
62
53
|
});
|
|
63
54
|
let hasCargoManifest = false;
|
|
64
55
|
for (const entry of entries) {
|
|
65
|
-
const fullPath =
|
|
56
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
66
57
|
if (entry.isFile() && entry.name === "Cargo.toml") {
|
|
67
58
|
hasCargoManifest = true;
|
|
68
59
|
continue;
|
|
@@ -72,7 +63,7 @@ function findCargoManifestDirectories(rootDir) {
|
|
|
72
63
|
}
|
|
73
64
|
}
|
|
74
65
|
if (hasCargoManifest) {
|
|
75
|
-
const rel = normalizeSlashPath(
|
|
66
|
+
const rel = normalizeSlashPath(path.relative(rootDir, currentDir));
|
|
76
67
|
results.add(rel === "" ? "." : rel);
|
|
77
68
|
}
|
|
78
69
|
}
|
|
@@ -84,12 +75,12 @@ function collectAllCrateManifests(cwd) {
|
|
|
84
75
|
for (const dir of cargoDirs) {
|
|
85
76
|
const manifest = dir === "."
|
|
86
77
|
? "Cargo.toml"
|
|
87
|
-
: normalizeSlashPath(
|
|
88
|
-
const manifestPath =
|
|
89
|
-
if (!
|
|
78
|
+
: normalizeSlashPath(path.posix.join(dir, "Cargo.toml"));
|
|
79
|
+
const manifestPath = path.join(cwd, manifest);
|
|
80
|
+
if (!fs.existsSync(manifestPath)) {
|
|
90
81
|
continue;
|
|
91
82
|
}
|
|
92
|
-
const cargoTomlRaw =
|
|
83
|
+
const cargoTomlRaw = fs.readFileSync(manifestPath, "utf8");
|
|
93
84
|
if (!isCrateManifest(manifest, cargoTomlRaw)) {
|
|
94
85
|
continue;
|
|
95
86
|
}
|
|
@@ -105,12 +96,12 @@ function listCargoLockFiles(cwd) {
|
|
|
105
96
|
if (!currentDir) {
|
|
106
97
|
continue;
|
|
107
98
|
}
|
|
108
|
-
const entries =
|
|
99
|
+
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
109
100
|
for (const entry of entries) {
|
|
110
101
|
if (entry.name === ".git") {
|
|
111
102
|
continue;
|
|
112
103
|
}
|
|
113
|
-
const fullPath =
|
|
104
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
114
105
|
if (entry.isDirectory()) {
|
|
115
106
|
queue.push(fullPath);
|
|
116
107
|
continue;
|
|
@@ -118,7 +109,7 @@ function listCargoLockFiles(cwd) {
|
|
|
118
109
|
if (!entry.isFile() || entry.name !== "Cargo.lock") {
|
|
119
110
|
continue;
|
|
120
111
|
}
|
|
121
|
-
lockfiles.push(normalizeSlashPath(
|
|
112
|
+
lockfiles.push(normalizeSlashPath(path.relative(cwd, fullPath)));
|
|
122
113
|
}
|
|
123
114
|
}
|
|
124
115
|
return lockfiles.sort((a, b) => a.localeCompare(b));
|
|
@@ -130,11 +121,11 @@ function ensureCargoLockUpToDate(cwd) {
|
|
|
130
121
|
}
|
|
131
122
|
const updatedLockfiles = [];
|
|
132
123
|
for (const lockfile of lockfiles) {
|
|
133
|
-
const lockfilePath =
|
|
134
|
-
const before =
|
|
124
|
+
const lockfilePath = path.join(cwd, lockfile);
|
|
125
|
+
const before = fs.readFileSync(lockfilePath, "utf8");
|
|
135
126
|
try {
|
|
136
|
-
|
|
137
|
-
cwd:
|
|
127
|
+
execFileSync("cargo", ["generate-lockfile"], {
|
|
128
|
+
cwd: path.dirname(lockfilePath),
|
|
138
129
|
stdio: ["ignore", "pipe", "pipe"],
|
|
139
130
|
});
|
|
140
131
|
}
|
|
@@ -142,7 +133,7 @@ function ensureCargoLockUpToDate(cwd) {
|
|
|
142
133
|
const message = error instanceof Error ? error.message : String(error);
|
|
143
134
|
throw new Error(`Failed to refresh ${lockfile} via "cargo generate-lockfile". Ensure cargo is installed and available in PATH. Details: ${message}`);
|
|
144
135
|
}
|
|
145
|
-
const after =
|
|
136
|
+
const after = fs.readFileSync(lockfilePath, "utf8");
|
|
146
137
|
if (after !== before) {
|
|
147
138
|
updatedLockfiles.push(lockfile);
|
|
148
139
|
}
|
|
@@ -152,7 +143,7 @@ function ensureCargoLockUpToDate(cwd) {
|
|
|
152
143
|
function parseCargoManifest(versionFile, cargoTomlRaw) {
|
|
153
144
|
let parsed;
|
|
154
145
|
try {
|
|
155
|
-
parsed =
|
|
146
|
+
parsed = parseToml(cargoTomlRaw);
|
|
156
147
|
}
|
|
157
148
|
catch (error) {
|
|
158
149
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -211,7 +202,7 @@ function resolveWorkspaceMemberManifests(rootDir, workspaceTable) {
|
|
|
211
202
|
const regex = globToRegex(pattern);
|
|
212
203
|
for (const dir of cargoDirs) {
|
|
213
204
|
if (regex.test(dir)) {
|
|
214
|
-
manifests.add(normalizeSlashPath(
|
|
205
|
+
manifests.add(normalizeSlashPath(path.posix.join(dir, "Cargo.toml")));
|
|
215
206
|
}
|
|
216
207
|
}
|
|
217
208
|
continue;
|
|
@@ -220,34 +211,34 @@ function resolveWorkspaceMemberManifests(rootDir, workspaceTable) {
|
|
|
220
211
|
if (excludeRegexes.some((regex) => regex.test(candidateDir))) {
|
|
221
212
|
continue;
|
|
222
213
|
}
|
|
223
|
-
const cargoPath =
|
|
224
|
-
if (
|
|
225
|
-
manifests.add(normalizeSlashPath(
|
|
214
|
+
const cargoPath = path.join(rootDir, candidateDir, "Cargo.toml");
|
|
215
|
+
if (fs.existsSync(cargoPath)) {
|
|
216
|
+
manifests.add(normalizeSlashPath(path.posix.join(candidateDir, "Cargo.toml")));
|
|
226
217
|
}
|
|
227
218
|
}
|
|
228
219
|
const filtered = [...manifests].filter((manifestPath) => {
|
|
229
|
-
const dir = normalizeSlashPath(
|
|
220
|
+
const dir = normalizeSlashPath(path.posix.dirname(manifestPath));
|
|
230
221
|
return !excludeRegexes.some((regex) => regex.test(dir));
|
|
231
222
|
});
|
|
232
223
|
return filtered.sort((a, b) => a.localeCompare(b));
|
|
233
224
|
}
|
|
234
225
|
function collectRustTargetManifests(cwd, versionFile, includeWorkspaceMembers) {
|
|
235
|
-
if (
|
|
226
|
+
if (path.basename(versionFile) !== "Cargo.toml") {
|
|
236
227
|
throw new Error(`Rust strategy requires "version-file" to point to a Cargo.toml manifest (received "${versionFile}").`);
|
|
237
228
|
}
|
|
238
|
-
const rootManifestPath =
|
|
239
|
-
if (!
|
|
229
|
+
const rootManifestPath = path.join(cwd, versionFile);
|
|
230
|
+
if (!fs.existsSync(rootManifestPath)) {
|
|
240
231
|
throw new Error(`Versionary requires ${versionFile} to exist.`);
|
|
241
232
|
}
|
|
242
|
-
const rootRaw =
|
|
233
|
+
const rootRaw = fs.readFileSync(rootManifestPath, "utf8");
|
|
243
234
|
const parsedRoot = parseCargoManifest(versionFile, rootRaw);
|
|
244
235
|
const rootIsCrate = parsedRoot.packageTable !== null;
|
|
245
|
-
const rootDir =
|
|
236
|
+
const rootDir = path.dirname(rootManifestPath);
|
|
246
237
|
const augmentingMembers = includeWorkspaceMembers
|
|
247
238
|
? resolveWorkspaceMemberManifests(rootDir, parsedRoot.workspaceTable)
|
|
248
239
|
: [];
|
|
249
240
|
if (rootIsCrate) {
|
|
250
|
-
const relRoot = normalizeSlashPath(
|
|
241
|
+
const relRoot = normalizeSlashPath(path.relative(cwd, rootManifestPath));
|
|
251
242
|
return [...new Set([relRoot, ...augmentingMembers])].sort((a, b) => a.localeCompare(b));
|
|
252
243
|
}
|
|
253
244
|
const fallbackMembers = includeWorkspaceMembers
|
|
@@ -284,17 +275,17 @@ function readWorkspacePackageVersion(cargoTomlRaw, versionFile) {
|
|
|
284
275
|
return rawVersion.trim();
|
|
285
276
|
}
|
|
286
277
|
function findWorkspaceManifestForMember(cwd, memberManifest) {
|
|
287
|
-
const cwdAbs =
|
|
288
|
-
let currentDir =
|
|
278
|
+
const cwdAbs = path.resolve(cwd);
|
|
279
|
+
let currentDir = path.resolve(cwd, path.dirname(memberManifest));
|
|
289
280
|
while (true) {
|
|
290
|
-
const relativeDir =
|
|
281
|
+
const relativeDir = path.relative(cwdAbs, currentDir);
|
|
291
282
|
if (relativeDir.startsWith("..")) {
|
|
292
283
|
break;
|
|
293
284
|
}
|
|
294
|
-
const candidatePath =
|
|
295
|
-
if (
|
|
296
|
-
const relativeManifest = normalizeSlashPath(
|
|
297
|
-
const cargoTomlRaw =
|
|
285
|
+
const candidatePath = path.join(currentDir, "Cargo.toml");
|
|
286
|
+
if (fs.existsSync(candidatePath)) {
|
|
287
|
+
const relativeManifest = normalizeSlashPath(path.relative(cwdAbs, candidatePath));
|
|
288
|
+
const cargoTomlRaw = fs.readFileSync(candidatePath, "utf8");
|
|
298
289
|
const parsed = parseCargoManifest(relativeManifest, cargoTomlRaw);
|
|
299
290
|
if (parsed.workspaceTable) {
|
|
300
291
|
return relativeManifest;
|
|
@@ -303,7 +294,7 @@ function findWorkspaceManifestForMember(cwd, memberManifest) {
|
|
|
303
294
|
if (currentDir === cwdAbs) {
|
|
304
295
|
break;
|
|
305
296
|
}
|
|
306
|
-
const parentDir =
|
|
297
|
+
const parentDir = path.dirname(currentDir);
|
|
307
298
|
if (parentDir === currentDir) {
|
|
308
299
|
break;
|
|
309
300
|
}
|
|
@@ -327,7 +318,7 @@ function readResolvedCargoVersion(cwd, manifest, cargoTomlRaw) {
|
|
|
327
318
|
throw new Error(`${manifest} has invalid [package].version. Expected a non-empty SemVer string or version.workspace = true.`);
|
|
328
319
|
}
|
|
329
320
|
const workspaceManifest = findWorkspaceManifestForMember(cwd, manifest);
|
|
330
|
-
const workspaceRaw =
|
|
321
|
+
const workspaceRaw = fs.readFileSync(path.join(cwd, workspaceManifest), "utf8");
|
|
331
322
|
return readWorkspacePackageVersion(workspaceRaw, workspaceManifest);
|
|
332
323
|
}
|
|
333
324
|
function readCargoPackageName(cargoTomlRaw, versionFile) {
|
|
@@ -529,8 +520,8 @@ function writeMappedDependencyVersions(cargoTomlRaw, versionByDependency) {
|
|
|
529
520
|
return updated;
|
|
530
521
|
}
|
|
531
522
|
function readPackageNameForManifest(cwd, manifest) {
|
|
532
|
-
const manifestPath =
|
|
533
|
-
const cargoTomlRaw =
|
|
523
|
+
const manifestPath = path.join(cwd, manifest);
|
|
524
|
+
const cargoTomlRaw = fs.readFileSync(manifestPath, "utf8");
|
|
534
525
|
if (!isCrateManifest(manifest, cargoTomlRaw)) {
|
|
535
526
|
throw new Error(`Configured rust target "${manifest}" is not a Rust crate manifest to update.`);
|
|
536
527
|
}
|
|
@@ -539,34 +530,34 @@ function readPackageNameForManifest(cwd, manifest) {
|
|
|
539
530
|
function expandWorkspaceOnlyManifests(cwd, manifestToVersion) {
|
|
540
531
|
const expanded = {};
|
|
541
532
|
for (const [manifest, version] of Object.entries(manifestToVersion)) {
|
|
542
|
-
const manifestPath =
|
|
543
|
-
if (!
|
|
533
|
+
const manifestPath = path.join(cwd, manifest);
|
|
534
|
+
if (!fs.existsSync(manifestPath)) {
|
|
544
535
|
expanded[manifest] = version;
|
|
545
536
|
continue;
|
|
546
537
|
}
|
|
547
|
-
const cargoTomlRaw =
|
|
538
|
+
const cargoTomlRaw = fs.readFileSync(manifestPath, "utf8");
|
|
548
539
|
const parsed = parseCargoManifest(manifest, cargoTomlRaw);
|
|
549
540
|
if (parsed.packageTable !== null || parsed.workspaceTable === null) {
|
|
550
541
|
expanded[manifest] = version;
|
|
551
542
|
continue;
|
|
552
543
|
}
|
|
553
|
-
const rootDir =
|
|
544
|
+
const rootDir = path.dirname(manifestPath);
|
|
554
545
|
const memberManifests = resolveWorkspaceMemberManifests(rootDir, parsed.workspaceTable);
|
|
555
546
|
if (memberManifests.length === 0) {
|
|
556
547
|
expanded[manifest] = version;
|
|
557
548
|
continue;
|
|
558
549
|
}
|
|
559
|
-
const manifestDir = normalizeSlashPath(
|
|
550
|
+
const manifestDir = normalizeSlashPath(path.posix.dirname(manifest));
|
|
560
551
|
for (const memberManifest of memberManifests) {
|
|
561
552
|
const joined = manifestDir === "." || manifestDir === ""
|
|
562
553
|
? memberManifest
|
|
563
|
-
: normalizeSlashPath(
|
|
554
|
+
: normalizeSlashPath(path.posix.join(manifestDir, memberManifest));
|
|
564
555
|
expanded[joined] = version;
|
|
565
556
|
}
|
|
566
557
|
}
|
|
567
558
|
return expanded;
|
|
568
559
|
}
|
|
569
|
-
function applyRustWorkspaceDependencyUpdates(cwd, manifestToVersion) {
|
|
560
|
+
export function applyRustWorkspaceDependencyUpdates(cwd, manifestToVersion) {
|
|
570
561
|
const expandedManifestToVersion = expandWorkspaceOnlyManifests(cwd, manifestToVersion);
|
|
571
562
|
const versionByDependency = new Map();
|
|
572
563
|
for (const [manifest, version] of Object.entries(expandedManifestToVersion)) {
|
|
@@ -582,23 +573,23 @@ function applyRustWorkspaceDependencyUpdates(cwd, manifestToVersion) {
|
|
|
582
573
|
const updatedFiles = [];
|
|
583
574
|
const manifests = collectAllCrateManifests(cwd);
|
|
584
575
|
for (const manifest of manifests) {
|
|
585
|
-
const manifestPath =
|
|
586
|
-
if (!
|
|
576
|
+
const manifestPath = path.join(cwd, manifest);
|
|
577
|
+
if (!fs.existsSync(manifestPath)) {
|
|
587
578
|
continue;
|
|
588
579
|
}
|
|
589
|
-
const cargoTomlRaw =
|
|
580
|
+
const cargoTomlRaw = fs.readFileSync(manifestPath, "utf8");
|
|
590
581
|
if (!isCrateManifest(manifest, cargoTomlRaw)) {
|
|
591
582
|
continue;
|
|
592
583
|
}
|
|
593
584
|
const next = writeMappedDependencyVersions(cargoTomlRaw, versionByDependency);
|
|
594
585
|
if (next !== cargoTomlRaw) {
|
|
595
|
-
|
|
586
|
+
fs.writeFileSync(manifestPath, next, "utf8");
|
|
596
587
|
updatedFiles.push(manifest);
|
|
597
588
|
}
|
|
598
589
|
}
|
|
599
590
|
return updatedFiles;
|
|
600
591
|
}
|
|
601
|
-
function detectRustDependencyImpact(cwd, manifestToVersion, candidateManifests) {
|
|
592
|
+
export function detectRustDependencyImpact(cwd, manifestToVersion, candidateManifests) {
|
|
602
593
|
const expandedManifestToVersion = expandWorkspaceOnlyManifests(cwd, manifestToVersion);
|
|
603
594
|
const versionByDependency = new Map();
|
|
604
595
|
for (const [manifest, version] of Object.entries(expandedManifestToVersion)) {
|
|
@@ -613,11 +604,11 @@ function detectRustDependencyImpact(cwd, manifestToVersion, candidateManifests)
|
|
|
613
604
|
}
|
|
614
605
|
const impacted = [];
|
|
615
606
|
for (const manifest of [...new Set(candidateManifests)].sort((a, b) => a.localeCompare(b))) {
|
|
616
|
-
const manifestPath =
|
|
617
|
-
if (!
|
|
607
|
+
const manifestPath = path.join(cwd, manifest);
|
|
608
|
+
if (!fs.existsSync(manifestPath)) {
|
|
618
609
|
continue;
|
|
619
610
|
}
|
|
620
|
-
const cargoTomlRaw =
|
|
611
|
+
const cargoTomlRaw = fs.readFileSync(manifestPath, "utf8");
|
|
621
612
|
if (!isCrateManifest(manifest, cargoTomlRaw)) {
|
|
622
613
|
continue;
|
|
623
614
|
}
|
|
@@ -628,12 +619,12 @@ function detectRustDependencyImpact(cwd, manifestToVersion, candidateManifests)
|
|
|
628
619
|
}
|
|
629
620
|
return impacted;
|
|
630
621
|
}
|
|
631
|
-
function toCargoManifestPath(packagePath) {
|
|
622
|
+
export function toCargoManifestPath(packagePath) {
|
|
632
623
|
return packagePath === "."
|
|
633
624
|
? "Cargo.toml"
|
|
634
|
-
: normalizeSlashPath(
|
|
625
|
+
: normalizeSlashPath(path.posix.join(packagePath, "Cargo.toml"));
|
|
635
626
|
}
|
|
636
|
-
|
|
627
|
+
export const rustVersionStrategy = {
|
|
637
628
|
name: "rust",
|
|
638
629
|
getVersionFile(config) {
|
|
639
630
|
return config["version-file"] ?? "Cargo.toml";
|
|
@@ -645,7 +636,7 @@ exports.rustVersionStrategy = {
|
|
|
645
636
|
if (!selectedManifest) {
|
|
646
637
|
throw new Error(`Configured rust target "${versionFile}" did not resolve to a Rust crate manifest.`);
|
|
647
638
|
}
|
|
648
|
-
const cargoTomlRaw =
|
|
639
|
+
const cargoTomlRaw = fs.readFileSync(path.join(cwd, selectedManifest), "utf8");
|
|
649
640
|
return readResolvedCargoVersion(cwd, selectedManifest, cargoTomlRaw);
|
|
650
641
|
},
|
|
651
642
|
validateProject(cwd, config) {
|
|
@@ -656,11 +647,11 @@ exports.rustVersionStrategy = {
|
|
|
656
647
|
if (!selectedManifest) {
|
|
657
648
|
return null;
|
|
658
649
|
}
|
|
659
|
-
const versionPath =
|
|
660
|
-
if (!
|
|
650
|
+
const versionPath = path.join(cwd, selectedManifest);
|
|
651
|
+
if (!fs.existsSync(versionPath)) {
|
|
661
652
|
return null;
|
|
662
653
|
}
|
|
663
|
-
const cargoTomlRaw =
|
|
654
|
+
const cargoTomlRaw = fs.readFileSync(versionPath, "utf8");
|
|
664
655
|
readResolvedCargoVersion(cwd, selectedManifest, cargoTomlRaw);
|
|
665
656
|
return null;
|
|
666
657
|
}
|
|
@@ -675,11 +666,11 @@ exports.rustVersionStrategy = {
|
|
|
675
666
|
const internalCrates = new Set();
|
|
676
667
|
const workspaceManifestsToUpdate = new Set();
|
|
677
668
|
for (const manifest of manifests) {
|
|
678
|
-
const versionPath =
|
|
679
|
-
if (!
|
|
669
|
+
const versionPath = path.join(cwd, manifest);
|
|
670
|
+
if (!fs.existsSync(versionPath)) {
|
|
680
671
|
continue;
|
|
681
672
|
}
|
|
682
|
-
const cargoTomlRaw =
|
|
673
|
+
const cargoTomlRaw = fs.readFileSync(versionPath, "utf8");
|
|
683
674
|
if (!isCrateManifest(manifest, cargoTomlRaw)) {
|
|
684
675
|
continue;
|
|
685
676
|
}
|
|
@@ -687,11 +678,11 @@ exports.rustVersionStrategy = {
|
|
|
687
678
|
readResolvedCargoVersion(cwd, manifest, cargoTomlRaw);
|
|
688
679
|
}
|
|
689
680
|
for (const manifest of manifests) {
|
|
690
|
-
const versionPath =
|
|
691
|
-
if (!
|
|
681
|
+
const versionPath = path.join(cwd, manifest);
|
|
682
|
+
if (!fs.existsSync(versionPath)) {
|
|
692
683
|
continue;
|
|
693
684
|
}
|
|
694
|
-
const cargoTomlRaw =
|
|
685
|
+
const cargoTomlRaw = fs.readFileSync(versionPath, "utf8");
|
|
695
686
|
if (!isCrateManifest(manifest, cargoTomlRaw)) {
|
|
696
687
|
continue;
|
|
697
688
|
}
|
|
@@ -704,19 +695,19 @@ exports.rustVersionStrategy = {
|
|
|
704
695
|
}
|
|
705
696
|
updatedCargoToml = writeInternalDependencyVersions(updatedCargoToml, internalCrates, version);
|
|
706
697
|
if (updatedCargoToml !== cargoTomlRaw) {
|
|
707
|
-
|
|
698
|
+
fs.writeFileSync(versionPath, updatedCargoToml, "utf8");
|
|
708
699
|
updatedFiles.push(manifest);
|
|
709
700
|
}
|
|
710
701
|
}
|
|
711
702
|
for (const workspaceManifest of workspaceManifestsToUpdate) {
|
|
712
|
-
const workspacePath =
|
|
713
|
-
if (!
|
|
703
|
+
const workspacePath = path.join(cwd, workspaceManifest);
|
|
704
|
+
if (!fs.existsSync(workspacePath)) {
|
|
714
705
|
continue;
|
|
715
706
|
}
|
|
716
|
-
const workspaceRaw =
|
|
707
|
+
const workspaceRaw = fs.readFileSync(workspacePath, "utf8");
|
|
717
708
|
const updatedWorkspaceToml = writeInternalDependencyVersions(writeWorkspacePackageVersion(workspaceRaw, workspaceManifest, version), internalCrates, version);
|
|
718
709
|
if (updatedWorkspaceToml !== workspaceRaw) {
|
|
719
|
-
|
|
710
|
+
fs.writeFileSync(workspacePath, updatedWorkspaceToml, "utf8");
|
|
720
711
|
updatedFiles.push(workspaceManifest);
|
|
721
712
|
}
|
|
722
713
|
}
|
|
@@ -732,11 +723,11 @@ exports.rustVersionStrategy = {
|
|
|
732
723
|
if (!selectedManifest) {
|
|
733
724
|
throw new Error(`Configured rust target "${versionFile}" did not resolve to a Rust crate manifest.`);
|
|
734
725
|
}
|
|
735
|
-
const versionPath =
|
|
736
|
-
if (!
|
|
726
|
+
const versionPath = path.join(cwd, selectedManifest);
|
|
727
|
+
if (!fs.existsSync(versionPath)) {
|
|
737
728
|
throw new Error(`Versionary requires ${selectedManifest} to exist.`);
|
|
738
729
|
}
|
|
739
|
-
const cargoTomlRaw =
|
|
730
|
+
const cargoTomlRaw = fs.readFileSync(versionPath, "utf8");
|
|
740
731
|
if (!isCrateManifest(selectedManifest, cargoTomlRaw)) {
|
|
741
732
|
return null;
|
|
742
733
|
}
|
|
@@ -748,7 +739,7 @@ exports.rustVersionStrategy = {
|
|
|
748
739
|
const manifestToPath = new Map();
|
|
749
740
|
for (const pkg of packages) {
|
|
750
741
|
const manifest = pkg.versionFile;
|
|
751
|
-
if (
|
|
742
|
+
if (path.posix.basename(normalizeSlashPath(manifest)) !== "Cargo.toml") {
|
|
752
743
|
continue;
|
|
753
744
|
}
|
|
754
745
|
candidateManifests.push(manifest);
|
|
@@ -766,7 +757,7 @@ exports.rustVersionStrategy = {
|
|
|
766
757
|
finalizeVersionWrites(cwd, writes, _context) {
|
|
767
758
|
const manifestToVersion = {};
|
|
768
759
|
for (const write of writes) {
|
|
769
|
-
if (
|
|
760
|
+
if (path.posix.basename(normalizeSlashPath(write.versionFile)) !==
|
|
770
761
|
"Cargo.toml") {
|
|
771
762
|
continue;
|
|
772
763
|
}
|
package/dist/strategy/simple.js
CHANGED
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.simpleVersionStrategy = void 0;
|
|
7
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
exports.simpleVersionStrategy = {
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
export const simpleVersionStrategy = {
|
|
10
4
|
name: "simple",
|
|
11
5
|
getVersionFile(config) {
|
|
12
6
|
return config["version-file"] ?? "version.txt";
|
|
13
7
|
},
|
|
14
8
|
readVersion(cwd, config) {
|
|
15
9
|
const versionFile = this.getVersionFile(config);
|
|
16
|
-
const versionPath =
|
|
17
|
-
if (!
|
|
10
|
+
const versionPath = path.join(cwd, versionFile);
|
|
11
|
+
if (!fs.existsSync(versionPath)) {
|
|
18
12
|
throw new Error(`Versionary requires ${versionFile} to exist.`);
|
|
19
13
|
}
|
|
20
|
-
return
|
|
14
|
+
return fs.readFileSync(versionPath, "utf8").trim();
|
|
21
15
|
},
|
|
22
16
|
writeVersion(cwd, config, version) {
|
|
23
17
|
const versionFile = this.getVersionFile(config);
|
|
24
|
-
const versionPath =
|
|
25
|
-
|
|
18
|
+
const versionPath = path.join(cwd, versionFile);
|
|
19
|
+
fs.writeFileSync(versionPath, `${version}\n`, "utf8");
|
|
26
20
|
return [versionFile];
|
|
27
21
|
},
|
|
28
22
|
};
|
package/dist/strategy/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/types/config.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/types/plugins.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "versionary",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.2",
|
|
4
4
|
"description": "Automatic release framework based on conventional commits and semantic versioning",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"releasing",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"author": "Johan Larsson",
|
|
20
|
-
"type": "
|
|
20
|
+
"type": "module",
|
|
21
21
|
"bin": {
|
|
22
22
|
"versionary": "dist/cli/index.js"
|
|
23
23
|
},
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"main": "dist/index.js",
|
|
28
28
|
"types": "dist/index.d.ts",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"
|
|
30
|
+
"smol-toml": "^1.4.2",
|
|
31
31
|
"@octokit/rest": "^22.0.0",
|
|
32
32
|
"jsonc-parser": "^3.3.1",
|
|
33
33
|
"yaml": "^2.8.3",
|