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/node.js
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.nodeVersionStrategy = void 0;
|
|
7
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
9
3
|
function readJsonFile(targetPath) {
|
|
10
|
-
return JSON.parse(
|
|
4
|
+
return JSON.parse(fs.readFileSync(targetPath, "utf8"));
|
|
11
5
|
}
|
|
12
6
|
function writeJsonFile(targetPath, value) {
|
|
13
|
-
|
|
7
|
+
fs.writeFileSync(targetPath, `${JSON.stringify(value, null, 2)}\n`, "utf8");
|
|
14
8
|
}
|
|
15
9
|
function updateNodeLockfileVersion(cwd, version) {
|
|
16
10
|
const updated = [];
|
|
17
11
|
for (const lockfile of ["package-lock.json", "npm-shrinkwrap.json"]) {
|
|
18
|
-
const lockfilePath =
|
|
19
|
-
if (!
|
|
12
|
+
const lockfilePath = path.join(cwd, lockfile);
|
|
13
|
+
if (!fs.existsSync(lockfilePath)) {
|
|
20
14
|
continue;
|
|
21
15
|
}
|
|
22
16
|
const parsed = readJsonFile(lockfilePath);
|
|
@@ -29,15 +23,15 @@ function updateNodeLockfileVersion(cwd, version) {
|
|
|
29
23
|
}
|
|
30
24
|
return updated;
|
|
31
25
|
}
|
|
32
|
-
|
|
26
|
+
export const nodeVersionStrategy = {
|
|
33
27
|
name: "node",
|
|
34
28
|
getVersionFile(config) {
|
|
35
29
|
return config["version-file"] ?? "package.json";
|
|
36
30
|
},
|
|
37
31
|
readVersion(cwd, config) {
|
|
38
32
|
const versionFile = this.getVersionFile(config);
|
|
39
|
-
const versionPath =
|
|
40
|
-
if (!
|
|
33
|
+
const versionPath = path.join(cwd, versionFile);
|
|
34
|
+
if (!fs.existsSync(versionPath)) {
|
|
41
35
|
throw new Error(`Versionary requires ${versionFile} to exist.`);
|
|
42
36
|
}
|
|
43
37
|
const packageJson = readJsonFile(versionPath);
|
|
@@ -48,8 +42,8 @@ exports.nodeVersionStrategy = {
|
|
|
48
42
|
},
|
|
49
43
|
writeVersion(cwd, config, version) {
|
|
50
44
|
const versionFile = this.getVersionFile(config);
|
|
51
|
-
const versionPath =
|
|
52
|
-
if (!
|
|
45
|
+
const versionPath = path.join(cwd, versionFile);
|
|
46
|
+
if (!fs.existsSync(versionPath)) {
|
|
53
47
|
throw new Error(`Versionary requires ${versionFile} to exist.`);
|
|
54
48
|
}
|
|
55
49
|
const packageJson = readJsonFile(versionPath);
|
|
@@ -66,8 +60,8 @@ exports.nodeVersionStrategy = {
|
|
|
66
60
|
},
|
|
67
61
|
readPackageName(cwd, config) {
|
|
68
62
|
const versionFile = this.getVersionFile(config);
|
|
69
|
-
const versionPath =
|
|
70
|
-
if (!
|
|
63
|
+
const versionPath = path.join(cwd, versionFile);
|
|
64
|
+
if (!fs.existsSync(versionPath)) {
|
|
71
65
|
throw new Error(`Versionary requires ${versionFile} to exist.`);
|
|
72
66
|
}
|
|
73
67
|
const packageJson = readJsonFile(versionPath);
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.resolveReleaseName = resolveReleaseName;
|
|
7
|
-
exports.resolvePackageStrategyContext = resolvePackageStrategyContext;
|
|
8
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const resolve_js_1 = require("./resolve.js");
|
|
10
|
-
function resolveReleaseName(cwd, packagePath, packageConfig, strategy, strategyConfig) {
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { resolveVersionStrategy } from "./resolve.js";
|
|
3
|
+
export function resolveReleaseName(cwd, packagePath, packageConfig, strategy, strategyConfig) {
|
|
11
4
|
const configuredName = packageConfig["package-name"]?.trim();
|
|
12
5
|
if (configuredName) {
|
|
13
6
|
return configuredName;
|
|
@@ -20,7 +13,7 @@ function withVersionFile(config, versionFile) {
|
|
|
20
13
|
"version-file": versionFile,
|
|
21
14
|
};
|
|
22
15
|
}
|
|
23
|
-
function resolvePackageStrategyContext(rootConfig, packagePath, packageConfig) {
|
|
16
|
+
export function resolvePackageStrategyContext(rootConfig, packagePath, packageConfig) {
|
|
24
17
|
const packageReleaseType = packageConfig["release-type"];
|
|
25
18
|
const baseConfig = packageReleaseType
|
|
26
19
|
? {
|
|
@@ -28,7 +21,7 @@ function resolvePackageStrategyContext(rootConfig, packagePath, packageConfig) {
|
|
|
28
21
|
"release-type": packageReleaseType,
|
|
29
22
|
}
|
|
30
23
|
: { ...rootConfig };
|
|
31
|
-
const baseStrategy =
|
|
24
|
+
const baseStrategy = resolveVersionStrategy(baseConfig);
|
|
32
25
|
if (!packageReleaseType) {
|
|
33
26
|
const versionFile = packagePath === "."
|
|
34
27
|
? (baseConfig["version-file"] ??
|
|
@@ -36,7 +29,7 @@ function resolvePackageStrategyContext(rootConfig, packagePath, packageConfig) {
|
|
|
36
29
|
: baseStrategy.name === "simple"
|
|
37
30
|
? (baseConfig["version-file"] ??
|
|
38
31
|
baseStrategy.getVersionFile(baseConfig))
|
|
39
|
-
:
|
|
32
|
+
: path.posix.join(packagePath, baseStrategy.getVersionFile({
|
|
40
33
|
...baseConfig,
|
|
41
34
|
"version-file": undefined,
|
|
42
35
|
}));
|
|
@@ -52,7 +45,7 @@ function resolvePackageStrategyContext(rootConfig, packagePath, packageConfig) {
|
|
|
52
45
|
}
|
|
53
46
|
const packageVersionFile = packagePath === "."
|
|
54
47
|
? (baseConfig["version-file"] ?? baseStrategy.getVersionFile(baseConfig))
|
|
55
|
-
:
|
|
48
|
+
: path.posix.join(packagePath, baseStrategy.getVersionFile({
|
|
56
49
|
...baseConfig,
|
|
57
50
|
"version-file": undefined,
|
|
58
51
|
}));
|
|
@@ -60,7 +53,7 @@ function resolvePackageStrategyContext(rootConfig, packagePath, packageConfig) {
|
|
|
60
53
|
...baseConfig,
|
|
61
54
|
packages: packagePath === "." ? baseConfig.packages : undefined,
|
|
62
55
|
}, packageVersionFile);
|
|
63
|
-
const strategy =
|
|
56
|
+
const strategy = resolveVersionStrategy(config);
|
|
64
57
|
return {
|
|
65
58
|
strategy,
|
|
66
59
|
config,
|
package/dist/strategy/python.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.pythonVersionStrategy = void 0;
|
|
7
|
-
const node_child_process_1 = require("node:child_process");
|
|
8
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
-
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";
|
|
11
5
|
const SOURCE_FILE_VERSION_PATTERN = /^(\s*__version__\s*=\s*)(["'])([^"']+)(\2)(\s*(?:#.*)?)?$/mu;
|
|
12
6
|
function isSourceFileMode(versionFile) {
|
|
13
7
|
return versionFile.toLowerCase().endsWith(".py");
|
|
@@ -15,7 +9,7 @@ function isSourceFileMode(versionFile) {
|
|
|
15
9
|
function parsePyProject(content, versionFile) {
|
|
16
10
|
let parsed;
|
|
17
11
|
try {
|
|
18
|
-
parsed =
|
|
12
|
+
parsed = parseToml(content);
|
|
19
13
|
}
|
|
20
14
|
catch (error) {
|
|
21
15
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -148,7 +142,7 @@ const LOCKFILE_SPECS = [
|
|
|
148
142
|
];
|
|
149
143
|
function refreshLockfile(cwd, spec) {
|
|
150
144
|
try {
|
|
151
|
-
|
|
145
|
+
execFileSync(spec.command, [...spec.args], {
|
|
152
146
|
cwd,
|
|
153
147
|
stdio: ["ignore", "pipe", "pipe"],
|
|
154
148
|
});
|
|
@@ -159,11 +153,11 @@ function refreshLockfile(cwd, spec) {
|
|
|
159
153
|
}
|
|
160
154
|
}
|
|
161
155
|
function readPyProjectFromCwd(cwd) {
|
|
162
|
-
const target =
|
|
163
|
-
if (!
|
|
156
|
+
const target = path.join(cwd, "pyproject.toml");
|
|
157
|
+
if (!fs.existsSync(target)) {
|
|
164
158
|
return null;
|
|
165
159
|
}
|
|
166
|
-
const content =
|
|
160
|
+
const content = fs.readFileSync(target, "utf8");
|
|
167
161
|
return { parsed: parsePyProject(content, "pyproject.toml"), rawPath: target };
|
|
168
162
|
}
|
|
169
163
|
function packageNameFromParsed(parsed) {
|
|
@@ -187,15 +181,15 @@ function findAuxiliaryInitPy(cwd, parsed) {
|
|
|
187
181
|
}
|
|
188
182
|
const moduleName = normalizeModuleName(packageName);
|
|
189
183
|
const candidates = [
|
|
190
|
-
|
|
191
|
-
|
|
184
|
+
path.join("src", moduleName, "__init__.py"),
|
|
185
|
+
path.join(moduleName, "__init__.py"),
|
|
192
186
|
];
|
|
193
187
|
for (const candidate of candidates) {
|
|
194
|
-
const absolute =
|
|
195
|
-
if (!
|
|
188
|
+
const absolute = path.join(cwd, candidate);
|
|
189
|
+
if (!fs.existsSync(absolute)) {
|
|
196
190
|
continue;
|
|
197
191
|
}
|
|
198
|
-
const content =
|
|
192
|
+
const content = fs.readFileSync(absolute, "utf8");
|
|
199
193
|
if (SOURCE_FILE_VERSION_PATTERN.test(content)) {
|
|
200
194
|
return candidate;
|
|
201
195
|
}
|
|
@@ -203,43 +197,43 @@ function findAuxiliaryInitPy(cwd, parsed) {
|
|
|
203
197
|
return null;
|
|
204
198
|
}
|
|
205
199
|
function tryUpdateInitPyVersion(cwd, relativePath, version) {
|
|
206
|
-
const absolute =
|
|
207
|
-
const existing =
|
|
200
|
+
const absolute = path.join(cwd, relativePath);
|
|
201
|
+
const existing = fs.readFileSync(absolute, "utf8");
|
|
208
202
|
if (!SOURCE_FILE_VERSION_PATTERN.test(existing)) {
|
|
209
203
|
return false;
|
|
210
204
|
}
|
|
211
205
|
const updated = writeSourceFileVersion(existing, relativePath, version);
|
|
212
|
-
|
|
206
|
+
fs.writeFileSync(absolute, updated, "utf8");
|
|
213
207
|
return true;
|
|
214
208
|
}
|
|
215
209
|
function tryUpdatePyProjectVersion(cwd, version) {
|
|
216
|
-
const target =
|
|
217
|
-
if (!
|
|
210
|
+
const target = path.join(cwd, "pyproject.toml");
|
|
211
|
+
if (!fs.existsSync(target)) {
|
|
218
212
|
return null;
|
|
219
213
|
}
|
|
220
|
-
const content =
|
|
214
|
+
const content = fs.readFileSync(target, "utf8");
|
|
221
215
|
const parsed = parsePyProject(content, "pyproject.toml");
|
|
222
216
|
const { projectVersion, poetryVersion } = lookupPyProjectVersions(parsed);
|
|
223
217
|
if (!projectVersion && !poetryVersion) {
|
|
224
218
|
return null;
|
|
225
219
|
}
|
|
226
220
|
const updated = writePyProjectVersion(content, "pyproject.toml", version);
|
|
227
|
-
|
|
221
|
+
fs.writeFileSync(target, updated, "utf8");
|
|
228
222
|
return "pyproject.toml";
|
|
229
223
|
}
|
|
230
|
-
|
|
224
|
+
export const pythonVersionStrategy = {
|
|
231
225
|
name: "python",
|
|
232
226
|
getVersionFile(config) {
|
|
233
227
|
return config["version-file"] ?? "pyproject.toml";
|
|
234
228
|
},
|
|
235
229
|
validateProject(cwd, config) {
|
|
236
230
|
const versionFile = this.getVersionFile(config);
|
|
237
|
-
const versionPath =
|
|
238
|
-
if (!
|
|
231
|
+
const versionPath = path.join(cwd, versionFile);
|
|
232
|
+
if (!fs.existsSync(versionPath)) {
|
|
239
233
|
return null;
|
|
240
234
|
}
|
|
241
235
|
try {
|
|
242
|
-
const content =
|
|
236
|
+
const content = fs.readFileSync(versionPath, "utf8");
|
|
243
237
|
if (isSourceFileMode(versionFile)) {
|
|
244
238
|
readSourceFileVersion(content, versionFile);
|
|
245
239
|
}
|
|
@@ -254,26 +248,26 @@ exports.pythonVersionStrategy = {
|
|
|
254
248
|
},
|
|
255
249
|
readVersion(cwd, config) {
|
|
256
250
|
const versionFile = this.getVersionFile(config);
|
|
257
|
-
const versionPath =
|
|
258
|
-
if (!
|
|
251
|
+
const versionPath = path.join(cwd, versionFile);
|
|
252
|
+
if (!fs.existsSync(versionPath)) {
|
|
259
253
|
throw new Error(`Versionary requires ${versionFile} to exist.`);
|
|
260
254
|
}
|
|
261
|
-
const content =
|
|
255
|
+
const content = fs.readFileSync(versionPath, "utf8");
|
|
262
256
|
return isSourceFileMode(versionFile)
|
|
263
257
|
? readSourceFileVersion(content, versionFile)
|
|
264
258
|
: readPyProjectVersion(content, versionFile);
|
|
265
259
|
},
|
|
266
260
|
writeVersion(cwd, config, version) {
|
|
267
261
|
const versionFile = this.getVersionFile(config);
|
|
268
|
-
const versionPath =
|
|
269
|
-
if (!
|
|
262
|
+
const versionPath = path.join(cwd, versionFile);
|
|
263
|
+
if (!fs.existsSync(versionPath)) {
|
|
270
264
|
throw new Error(`Versionary requires ${versionFile} to exist.`);
|
|
271
265
|
}
|
|
272
|
-
const existing =
|
|
266
|
+
const existing = fs.readFileSync(versionPath, "utf8");
|
|
273
267
|
const written = [];
|
|
274
268
|
if (isSourceFileMode(versionFile)) {
|
|
275
269
|
const updated = writeSourceFileVersion(existing, versionFile, version);
|
|
276
|
-
|
|
270
|
+
fs.writeFileSync(versionPath, updated, "utf8");
|
|
277
271
|
written.push(versionFile);
|
|
278
272
|
const auxiliary = tryUpdatePyProjectVersion(cwd, version);
|
|
279
273
|
if (auxiliary && auxiliary !== versionFile) {
|
|
@@ -282,7 +276,7 @@ exports.pythonVersionStrategy = {
|
|
|
282
276
|
}
|
|
283
277
|
else {
|
|
284
278
|
const updated = writePyProjectVersion(existing, versionFile, version);
|
|
285
|
-
|
|
279
|
+
fs.writeFileSync(versionPath, updated, "utf8");
|
|
286
280
|
written.push(versionFile);
|
|
287
281
|
const parsed = parsePyProject(updated, versionFile);
|
|
288
282
|
const initPy = findAuxiliaryInitPy(cwd, parsed);
|
|
@@ -310,8 +304,8 @@ exports.pythonVersionStrategy = {
|
|
|
310
304
|
finalizeVersionWrites(cwd, _writes, _context) {
|
|
311
305
|
const refreshed = [];
|
|
312
306
|
for (const spec of LOCKFILE_SPECS) {
|
|
313
|
-
const lockPath =
|
|
314
|
-
if (!
|
|
307
|
+
const lockPath = path.join(cwd, spec.lockfile);
|
|
308
|
+
if (!fs.existsSync(lockPath)) {
|
|
315
309
|
continue;
|
|
316
310
|
}
|
|
317
311
|
refreshLockfile(cwd, spec);
|
package/dist/strategy/r.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.rVersionStrategy = void 0;
|
|
7
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
9
3
|
function readDescriptionVersion(content, versionFile) {
|
|
10
4
|
const match = content.match(/^Version:\s*(.+)\s*$/mu);
|
|
11
5
|
if (!match?.[1]) {
|
|
@@ -19,7 +13,7 @@ function writeDescriptionVersion(content, versionFile, version) {
|
|
|
19
13
|
}
|
|
20
14
|
return content.replace(/^Version:\s*.*$/mu, `Version: ${version}`);
|
|
21
15
|
}
|
|
22
|
-
|
|
16
|
+
export const rVersionStrategy = {
|
|
23
17
|
name: "r",
|
|
24
18
|
getDefaultChangelogFormat() {
|
|
25
19
|
return "r-news";
|
|
@@ -29,12 +23,12 @@ exports.rVersionStrategy = {
|
|
|
29
23
|
},
|
|
30
24
|
validateProject(cwd, config) {
|
|
31
25
|
const versionFile = this.getVersionFile(config);
|
|
32
|
-
const versionPath =
|
|
33
|
-
if (!
|
|
26
|
+
const versionPath = path.join(cwd, versionFile);
|
|
27
|
+
if (!fs.existsSync(versionPath)) {
|
|
34
28
|
return null;
|
|
35
29
|
}
|
|
36
30
|
try {
|
|
37
|
-
readDescriptionVersion(
|
|
31
|
+
readDescriptionVersion(fs.readFileSync(versionPath, "utf8"), versionFile);
|
|
38
32
|
return null;
|
|
39
33
|
}
|
|
40
34
|
catch (error) {
|
|
@@ -43,30 +37,30 @@ exports.rVersionStrategy = {
|
|
|
43
37
|
},
|
|
44
38
|
readVersion(cwd, config) {
|
|
45
39
|
const versionFile = this.getVersionFile(config);
|
|
46
|
-
const versionPath =
|
|
47
|
-
if (!
|
|
40
|
+
const versionPath = path.join(cwd, versionFile);
|
|
41
|
+
if (!fs.existsSync(versionPath)) {
|
|
48
42
|
throw new Error(`Versionary requires ${versionFile} to exist.`);
|
|
49
43
|
}
|
|
50
|
-
return readDescriptionVersion(
|
|
44
|
+
return readDescriptionVersion(fs.readFileSync(versionPath, "utf8"), versionFile);
|
|
51
45
|
},
|
|
52
46
|
writeVersion(cwd, config, version) {
|
|
53
47
|
const versionFile = this.getVersionFile(config);
|
|
54
|
-
const versionPath =
|
|
55
|
-
if (!
|
|
48
|
+
const versionPath = path.join(cwd, versionFile);
|
|
49
|
+
if (!fs.existsSync(versionPath)) {
|
|
56
50
|
throw new Error(`Versionary requires ${versionFile} to exist.`);
|
|
57
51
|
}
|
|
58
|
-
const existing =
|
|
52
|
+
const existing = fs.readFileSync(versionPath, "utf8");
|
|
59
53
|
const updated = writeDescriptionVersion(existing, versionFile, version);
|
|
60
|
-
|
|
54
|
+
fs.writeFileSync(versionPath, updated, "utf8");
|
|
61
55
|
return [versionFile];
|
|
62
56
|
},
|
|
63
57
|
readPackageName(cwd, config) {
|
|
64
58
|
const versionFile = this.getVersionFile(config);
|
|
65
|
-
const versionPath =
|
|
66
|
-
if (!
|
|
59
|
+
const versionPath = path.join(cwd, versionFile);
|
|
60
|
+
if (!fs.existsSync(versionPath)) {
|
|
67
61
|
throw new Error(`Versionary requires ${versionFile} to exist.`);
|
|
68
62
|
}
|
|
69
|
-
const content =
|
|
63
|
+
const content = fs.readFileSync(versionPath, "utf8");
|
|
70
64
|
const match = content.match(/^Package:\s*(.+)\s*$/mu);
|
|
71
65
|
if (!match?.[1]) {
|
|
72
66
|
return null;
|
package/dist/strategy/resolve.js
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const python_js_1 = require("./python.js");
|
|
9
|
-
const r_js_1 = require("./r.js");
|
|
10
|
-
const rust_js_1 = require("./rust.js");
|
|
11
|
-
const simple_js_1 = require("./simple.js");
|
|
1
|
+
import { compositeVersionStrategy } from "./composite.js";
|
|
2
|
+
import { latexVersionStrategy } from "./latex.js";
|
|
3
|
+
import { nodeVersionStrategy } from "./node.js";
|
|
4
|
+
import { pythonVersionStrategy } from "./python.js";
|
|
5
|
+
import { rVersionStrategy } from "./r.js";
|
|
6
|
+
import { rustVersionStrategy } from "./rust.js";
|
|
7
|
+
import { simpleVersionStrategy } from "./simple.js";
|
|
12
8
|
const strategyRegistry = {
|
|
13
|
-
latex:
|
|
14
|
-
simple:
|
|
15
|
-
node:
|
|
16
|
-
rust:
|
|
17
|
-
r:
|
|
18
|
-
python:
|
|
9
|
+
latex: latexVersionStrategy,
|
|
10
|
+
simple: simpleVersionStrategy,
|
|
11
|
+
node: nodeVersionStrategy,
|
|
12
|
+
rust: rustVersionStrategy,
|
|
13
|
+
r: rVersionStrategy,
|
|
14
|
+
python: pythonVersionStrategy,
|
|
19
15
|
};
|
|
20
|
-
function listKnownReleaseTypes() {
|
|
16
|
+
export function listKnownReleaseTypes() {
|
|
21
17
|
return Object.keys(strategyRegistry).sort((a, b) => a.localeCompare(b));
|
|
22
18
|
}
|
|
23
19
|
function resolveSingle(name) {
|
|
@@ -28,7 +24,7 @@ function resolveSingle(name) {
|
|
|
28
24
|
}
|
|
29
25
|
return strategy;
|
|
30
26
|
}
|
|
31
|
-
function resolveVersionStrategy(config) {
|
|
27
|
+
export function resolveVersionStrategy(config) {
|
|
32
28
|
const releaseType = config["release-type"] ?? "simple";
|
|
33
29
|
if (Array.isArray(releaseType)) {
|
|
34
30
|
if (releaseType.length === 0) {
|
|
@@ -43,7 +39,7 @@ function resolveVersionStrategy(config) {
|
|
|
43
39
|
seen.add(name);
|
|
44
40
|
strategies.push(resolveSingle(name));
|
|
45
41
|
}
|
|
46
|
-
return
|
|
42
|
+
return compositeVersionStrategy(strategies);
|
|
47
43
|
}
|
|
48
44
|
return resolveSingle(releaseType);
|
|
49
45
|
}
|