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.
@@ -1,40 +1,27 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.resolveTargetPackageName = resolveTargetPackageName;
7
- exports.extractReleaseNotes = extractReleaseNotes;
8
- exports.extractClosingReferencesFromNotes = extractClosingReferencesFromNotes;
9
- exports.resolveTargetChangelogFile = resolveTargetChangelogFile;
10
- exports.runRelease = runRelease;
11
- exports.runReleaseDetailed = runReleaseDetailed;
12
- exports.runSimpleRelease = runSimpleRelease;
13
- exports.runSimpleReleaseDetailed = runSimpleReleaseDetailed;
14
- const node_child_process_1 = require("node:child_process");
15
- const node_fs_1 = __importDefault(require("node:fs"));
16
- const node_path_1 = __importDefault(require("node:path"));
17
- const load_config_js_1 = require("../config/load-config.js");
18
- const client_js_1 = require("../scm/client.js");
19
- const package_context_js_1 = require("../strategy/package-context.js");
20
- const resolve_js_1 = require("../strategy/resolve.js");
21
- const plan_js_1 = require("./plan.js");
22
- const pr_js_1 = require("./pr.js");
23
- const recovery_js_1 = require("./recovery.js");
24
- const state_js_1 = require("./state.js");
1
+ import { execFileSync } from "node:child_process";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { loadConfig } from "../config/load-config.js";
5
+ import { getScmClient } from "../scm/client.js";
6
+ import { resolvePackageStrategyContext, resolveReleaseName, } from "../strategy/package-context.js";
7
+ import { resolveVersionStrategy } from "../strategy/resolve.js";
8
+ import { getChangelogDefaults } from "./plan.js";
9
+ import { isReleaseCommitMessage } from "./pr.js";
10
+ import { executeIdempotentReleaseTarget } from "./recovery.js";
11
+ import { readReleaseTargets } from "./state.js";
25
12
  function escapeRegExp(input) {
26
13
  return input.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
27
14
  }
28
- function resolveTargetPackageName(cwd, config, targetPath) {
15
+ export function resolveTargetPackageName(cwd, config, targetPath) {
29
16
  const packageConfig = config.packages?.[targetPath] ?? {};
30
- const { strategy, config: strategyConfig } = (0, package_context_js_1.resolvePackageStrategyContext)(config, targetPath, packageConfig);
31
- const resolved = (0, package_context_js_1.resolveReleaseName)(cwd, targetPath, packageConfig, strategy, strategyConfig);
17
+ const { strategy, config: strategyConfig } = resolvePackageStrategyContext(config, targetPath, packageConfig);
18
+ const resolved = resolveReleaseName(cwd, targetPath, packageConfig, strategy, strategyConfig);
32
19
  if (!resolved || resolved === targetPath) {
33
20
  return undefined;
34
21
  }
35
22
  return resolved;
36
23
  }
37
- function extractReleaseNotes(content, version, changelogFormat) {
24
+ export function extractReleaseNotes(content, version, changelogFormat) {
38
25
  const lines = content.split("\n");
39
26
  const shortVersion = version.replace(/\.\d+$/u, "");
40
27
  const start = changelogFormat === "r-news"
@@ -72,22 +59,22 @@ function extractReleaseNotes(content, version, changelogFormat) {
72
59
  .trim();
73
60
  }
74
61
  function getHeadCommitMessage(cwd) {
75
- return (0, node_child_process_1.execFileSync)("git", ["log", "-1", "--pretty=%B"], {
62
+ return execFileSync("git", ["log", "-1", "--pretty=%B"], {
76
63
  cwd,
77
64
  encoding: "utf8",
78
65
  stdio: ["ignore", "pipe", "ignore"],
79
66
  }).trim();
80
67
  }
81
68
  function readReleaseNotes(cwd, version, changelogFile, changelogFormat) {
82
- const changelogPath = node_path_1.default.join(cwd, changelogFile);
83
- if (!node_fs_1.default.existsSync(changelogPath)) {
69
+ const changelogPath = path.join(cwd, changelogFile);
70
+ if (!fs.existsSync(changelogPath)) {
84
71
  return `Automated release for v${version}`;
85
72
  }
86
- const content = node_fs_1.default.readFileSync(changelogPath, "utf8");
73
+ const content = fs.readFileSync(changelogPath, "utf8");
87
74
  const notes = extractReleaseNotes(content, version, changelogFormat);
88
75
  return notes.length > 0 ? notes : `Automated release for v${version}`;
89
76
  }
90
- function extractClosingReferencesFromNotes(notes) {
77
+ export function extractClosingReferencesFromNotes(notes) {
91
78
  const refs = new Set();
92
79
  const linkedPattern = /\b(close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved)\b\s+\[#(\d+)\]\([^)]+\)/giu;
93
80
  for (const match of notes.matchAll(linkedPattern)) {
@@ -105,30 +92,30 @@ function extractClosingReferencesFromNotes(notes) {
105
92
  }
106
93
  return [...refs].sort((a, b) => a - b);
107
94
  }
108
- function resolveTargetChangelogFile(config, rootChangelogFile, targetPath) {
95
+ export function resolveTargetChangelogFile(config, rootChangelogFile, targetPath) {
109
96
  if (targetPath === ".") {
110
97
  return rootChangelogFile;
111
98
  }
112
99
  const packageConfig = config.packages?.[targetPath];
113
- const packageStrategy = (0, resolve_js_1.resolveVersionStrategy)({
100
+ const packageStrategy = resolveVersionStrategy({
114
101
  ...config,
115
102
  "release-type": packageConfig?.["release-type"] ?? config["release-type"],
116
103
  });
117
- const { changelogFile: packageChangelogFile } = (0, plan_js_1.getChangelogDefaults)({
104
+ const { changelogFile: packageChangelogFile } = getChangelogDefaults({
118
105
  "release-type": packageConfig?.["release-type"] ?? config["release-type"],
119
106
  "changelog-file": packageConfig?.["changelog-file"] ?? config["changelog-file"],
120
107
  "changelog-format": packageConfig?.["changelog-format"] ?? config["changelog-format"],
121
108
  defaultChangelogFormat: packageStrategy.getDefaultChangelogFormat?.(),
122
109
  });
123
- return node_path_1.default.posix.join(targetPath, packageChangelogFile);
110
+ return path.posix.join(targetPath, packageChangelogFile);
124
111
  }
125
112
  function resolveTargetChangelogFormat(config, targetPath) {
126
113
  const packageConfig = config.packages?.[targetPath];
127
- const packageStrategy = (0, resolve_js_1.resolveVersionStrategy)({
114
+ const packageStrategy = resolveVersionStrategy({
128
115
  ...config,
129
116
  "release-type": packageConfig?.["release-type"] ?? config["release-type"],
130
117
  });
131
- const { changelogFormat } = (0, plan_js_1.getChangelogDefaults)({
118
+ const { changelogFormat } = getChangelogDefaults({
132
119
  "release-type": packageConfig?.["release-type"] ?? config["release-type"],
133
120
  "changelog-file": packageConfig?.["changelog-file"] ?? config["changelog-file"],
134
121
  "changelog-format": packageConfig?.["changelog-format"] ?? config["changelog-format"],
@@ -136,31 +123,31 @@ function resolveTargetChangelogFormat(config, targetPath) {
136
123
  });
137
124
  return changelogFormat;
138
125
  }
139
- async function runRelease(cwd = process.cwd()) {
126
+ export async function runRelease(cwd = process.cwd()) {
140
127
  const result = await runReleaseDetailed(cwd, { logger: console });
141
128
  if (result.action === "release-skipped") {
142
129
  return result.reason;
143
130
  }
144
131
  return result.message;
145
132
  }
146
- async function runReleaseDetailed(cwd = process.cwd(), options = {}) {
133
+ export async function runReleaseDetailed(cwd = process.cwd(), options = {}) {
147
134
  const commitMessage = getHeadCommitMessage(cwd);
148
- if (!(0, pr_js_1.isReleaseCommitMessage)(commitMessage)) {
135
+ if (!isReleaseCommitMessage(commitMessage)) {
149
136
  return {
150
137
  action: "release-skipped",
151
138
  reason: "No release commit context detected; skipping release stage.",
152
139
  };
153
140
  }
154
- const loaded = (0, load_config_js_1.loadConfig)(cwd);
155
- const strategy = (0, resolve_js_1.resolveVersionStrategy)(loaded.config);
156
- const { changelogFile } = (0, plan_js_1.getChangelogDefaults)({
141
+ const loaded = loadConfig(cwd);
142
+ const strategy = resolveVersionStrategy(loaded.config);
143
+ const { changelogFile } = getChangelogDefaults({
157
144
  ...loaded.config,
158
145
  defaultChangelogFormat: strategy.getDefaultChangelogFormat?.(),
159
146
  });
160
147
  const referenceCommentMode = loaded.config["release-reference-comments"] ?? "off";
161
148
  const version = strategy.readVersion(cwd, loaded.config);
162
149
  const defaultTag = `v${version}`;
163
- const releaseTargets = (0, state_js_1.readReleaseTargets)(cwd);
150
+ const releaseTargets = readReleaseTargets(cwd);
164
151
  const targets = releaseTargets.length > 0
165
152
  ? releaseTargets
166
153
  : [
@@ -181,7 +168,7 @@ async function runReleaseDetailed(cwd = process.cwd(), options = {}) {
181
168
  message: `Dry run: would publish releases ${targetList.join(", ")}`,
182
169
  };
183
170
  }
184
- const scmClient = (0, client_js_1.getScmClient)();
171
+ const scmClient = getScmClient();
185
172
  const releases = [];
186
173
  const referenceReleases = [];
187
174
  for (const target of targets) {
@@ -189,7 +176,7 @@ async function runReleaseDetailed(cwd = process.cwd(), options = {}) {
189
176
  const targetChangelogFormat = resolveTargetChangelogFormat(loaded.config, target.path);
190
177
  const releaseNotes = readReleaseNotes(cwd, target.version, targetChangelogFile, targetChangelogFormat);
191
178
  const references = extractClosingReferencesFromNotes(releaseNotes);
192
- const outcome = await (0, recovery_js_1.executeIdempotentReleaseTarget)(cwd, {
179
+ const outcome = await executeIdempotentReleaseTarget(cwd, {
193
180
  tag: target.tag,
194
181
  version: target.version,
195
182
  notes: releaseNotes,
@@ -237,10 +224,10 @@ async function runReleaseDetailed(cwd = process.cwd(), options = {}) {
237
224
  };
238
225
  }
239
226
  /** @deprecated Use runRelease. */
240
- async function runSimpleRelease(cwd = process.cwd()) {
227
+ export async function runSimpleRelease(cwd = process.cwd()) {
241
228
  return runRelease(cwd);
242
229
  }
243
230
  /** @deprecated Use runReleaseDetailed. */
244
- async function runSimpleReleaseDetailed(cwd = process.cwd(), options = {}) {
231
+ export async function runSimpleReleaseDetailed(cwd = process.cwd(), options = {}) {
245
232
  return runReleaseDetailed(cwd, options);
246
233
  }
@@ -1,11 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.maxReleaseType = maxReleaseType;
4
- exports.parseVersion = parseVersion;
5
- exports.isValidVersion = isValidVersion;
6
- exports.compareVersions = compareVersions;
7
- exports.bumpVersion = bumpVersion;
8
- function maxReleaseType(types) {
1
+ export function maxReleaseType(types) {
9
2
  if (types.includes("major")) {
10
3
  return "major";
11
4
  }
@@ -28,7 +21,7 @@ function normalizeVersionInput(version) {
28
21
  const [, major, minor, patch, prerelease] = compatMatch;
29
22
  return `${major}.${minor}.${patch}-${prerelease}`;
30
23
  }
31
- function parseVersion(version) {
24
+ export function parseVersion(version) {
32
25
  const normalized = normalizeVersionInput(version);
33
26
  const match = normalized.match(SEMVER_PATTERN);
34
27
  if (!match) {
@@ -42,7 +35,7 @@ function parseVersion(version) {
42
35
  build: match[5] ? match[5].split(".") : [],
43
36
  };
44
37
  }
45
- function isValidVersion(version) {
38
+ export function isValidVersion(version) {
46
39
  return SEMVER_PATTERN.test(normalizeVersionInput(version));
47
40
  }
48
41
  function isNumericIdentifier(identifier) {
@@ -76,7 +69,7 @@ function comparePreReleaseIdentifiers(left, right) {
76
69
  }
77
70
  return 0;
78
71
  }
79
- function compareVersions(leftRaw, rightRaw) {
72
+ export function compareVersions(leftRaw, rightRaw) {
80
73
  const left = parseVersion(leftRaw);
81
74
  const right = parseVersion(rightRaw);
82
75
  if (left.major !== right.major) {
@@ -116,7 +109,7 @@ function compareVersions(leftRaw, rightRaw) {
116
109
  }
117
110
  return 0;
118
111
  }
119
- function bumpVersion(current, releaseType, options = {}) {
112
+ export function bumpVersion(current, releaseType, options = {}) {
120
113
  const parsed = parseVersion(current);
121
114
  const allowStableMajor = options.allowStableMajor ?? false;
122
115
  if (releaseType === "major") {
@@ -1,16 +1,7 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getBaselineStatePath = getBaselineStatePath;
7
- exports.readBaselineSha = readBaselineSha;
8
- exports.readReleaseTargets = readReleaseTargets;
9
- exports.writeBaselineSha = writeBaselineSha;
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 load_config_js_1 = require("../config/load-config.js");
1
+ import { execFileSync } from "node:child_process";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { loadConfig } from "../config/load-config.js";
14
5
  const MANIFEST_VERSION_KEY = "manifest-version";
15
6
  const BASELINE_SHA_KEY = "baseline-sha";
16
7
  const RELEASE_TARGETS_KEY = "release-targets";
@@ -47,48 +38,48 @@ function parseStateFile(raw, filePath) {
47
38
  }
48
39
  return manifest;
49
40
  }
50
- function getBaselineStatePath(cwd) {
51
- const loaded = (0, load_config_js_1.loadConfig)(cwd);
41
+ export function getBaselineStatePath(cwd) {
42
+ const loaded = loadConfig(cwd);
52
43
  const configured = loaded.config["baseline-file"];
53
44
  if (configured) {
54
- return node_path_1.default.join(cwd, configured);
45
+ return path.join(cwd, configured);
55
46
  }
56
- const preferred = node_path_1.default.join(cwd, ".versionary-manifest.json");
57
- if (node_fs_1.default.existsSync(preferred)) {
47
+ const preferred = path.join(cwd, ".versionary-manifest.json");
48
+ if (fs.existsSync(preferred)) {
58
49
  return preferred;
59
50
  }
60
- const legacy = node_path_1.default.join(cwd, "versionary.versions.json");
61
- if (node_fs_1.default.existsSync(legacy)) {
51
+ const legacy = path.join(cwd, "versionary.versions.json");
52
+ if (fs.existsSync(legacy)) {
62
53
  return legacy;
63
54
  }
64
55
  return preferred;
65
56
  }
66
- function readBaselineSha(cwd = process.cwd()) {
57
+ export function readBaselineSha(cwd = process.cwd()) {
67
58
  const filePath = getBaselineStatePath(cwd);
68
- if (!node_fs_1.default.existsSync(filePath)) {
59
+ if (!fs.existsSync(filePath)) {
69
60
  return null;
70
61
  }
71
- const parsed = parseStateFile(node_fs_1.default.readFileSync(filePath, "utf8"), filePath);
62
+ const parsed = parseStateFile(fs.readFileSync(filePath, "utf8"), filePath);
72
63
  return parsed[BASELINE_SHA_KEY] ?? null;
73
64
  }
74
- function readReleaseTargets(cwd = process.cwd()) {
65
+ export function readReleaseTargets(cwd = process.cwd()) {
75
66
  const filePath = getBaselineStatePath(cwd);
76
- if (!node_fs_1.default.existsSync(filePath)) {
67
+ if (!fs.existsSync(filePath)) {
77
68
  return [];
78
69
  }
79
- const parsed = parseStateFile(node_fs_1.default.readFileSync(filePath, "utf8"), filePath);
70
+ const parsed = parseStateFile(fs.readFileSync(filePath, "utf8"), filePath);
80
71
  return parsed[RELEASE_TARGETS_KEY] ?? [];
81
72
  }
82
- function writeBaselineSha(cwd = process.cwd(), sha, releaseTargets) {
73
+ export function writeBaselineSha(cwd = process.cwd(), sha, releaseTargets) {
83
74
  const baselineShaValue = sha ??
84
- (0, node_child_process_1.execFileSync)("git", ["rev-parse", "HEAD"], {
75
+ execFileSync("git", ["rev-parse", "HEAD"], {
85
76
  cwd,
86
77
  encoding: "utf8",
87
78
  stdio: ["ignore", "pipe", "ignore"],
88
79
  }).trim();
89
80
  const filePath = getBaselineStatePath(cwd);
90
- const existing = node_fs_1.default.existsSync(filePath)
91
- ? parseStateFile(node_fs_1.default.readFileSync(filePath, "utf8"), filePath)
81
+ const existing = fs.existsSync(filePath)
82
+ ? parseStateFile(fs.readFileSync(filePath, "utf8"), filePath)
92
83
  : {};
93
84
  const existingTargets = existing[RELEASE_TARGETS_KEY] ?? [];
94
85
  const nextTargets = releaseTargets === undefined
@@ -104,5 +95,5 @@ function writeBaselineSha(cwd = process.cwd(), sha, releaseTargets) {
104
95
  [BASELINE_SHA_KEY]: baselineShaValue,
105
96
  [RELEASE_TARGETS_KEY]: nextTargets,
106
97
  };
107
- node_fs_1.default.writeFileSync(filePath, `${JSON.stringify(next, null, 2)}\n`, "utf8");
98
+ fs.writeFileSync(filePath, `${JSON.stringify(next, null, 2)}\n`, "utf8");
108
99
  }
@@ -1,26 +1,20 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.verifyProject = verifyProject;
7
- const node_fs_1 = __importDefault(require("node:fs"));
8
- const node_path_1 = __importDefault(require("node:path"));
9
- const load_config_js_1 = require("../config/load-config.js");
10
- const package_context_js_1 = require("../strategy/package-context.js");
11
- const resolve_js_1 = require("../strategy/resolve.js");
12
- function verifyProject(cwd = process.cwd()) {
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { loadConfig } from "../config/load-config.js";
4
+ import { resolvePackageStrategyContext } from "../strategy/package-context.js";
5
+ import { resolveVersionStrategy } from "../strategy/resolve.js";
6
+ export function verifyProject(cwd = process.cwd()) {
13
7
  const checks = [];
14
- const config = (0, load_config_js_1.loadConfig)(cwd);
8
+ const config = loadConfig(cwd);
15
9
  checks.push({
16
10
  name: "config-load",
17
11
  ok: true,
18
- details: `Loaded ${node_path_1.default.basename(config.path)} (${config.format})`,
12
+ details: `Loaded ${path.basename(config.path)} (${config.format})`,
19
13
  category: "config",
20
14
  });
21
- const strategy = (0, resolve_js_1.resolveVersionStrategy)(config.config);
15
+ const strategy = resolveVersionStrategy(config.config);
22
16
  const versionFile = strategy.getVersionFile(config.config);
23
- const exists = node_fs_1.default.existsSync(node_path_1.default.join(cwd, versionFile));
17
+ const exists = fs.existsSync(path.join(cwd, versionFile));
24
18
  checks.push({
25
19
  name: `version-file:${versionFile}`,
26
20
  ok: exists,
@@ -44,8 +38,8 @@ function verifyProject(cwd = process.cwd()) {
44
38
  }
45
39
  if (config.config.packages) {
46
40
  for (const [pkgPathRaw, packageConfig] of Object.entries(config.config.packages)) {
47
- const pkgPath = node_path_1.default.join(cwd, pkgPathRaw);
48
- const exists = node_fs_1.default.existsSync(pkgPath);
41
+ const pkgPath = path.join(cwd, pkgPathRaw);
42
+ const exists = fs.existsSync(pkgPath);
49
43
  checks.push({
50
44
  name: `package-path:${pkgPathRaw}`,
51
45
  ok: exists,
@@ -56,9 +50,9 @@ function verifyProject(cwd = process.cwd()) {
56
50
  : `Create ${pkgPathRaw} or remove/rename this entry under "packages" in versionary config.`,
57
51
  });
58
52
  if (exists) {
59
- const packageContext = (0, package_context_js_1.resolvePackageStrategyContext)(config.config, pkgPathRaw, packageConfig);
53
+ const packageContext = resolvePackageStrategyContext(config.config, pkgPathRaw, packageConfig);
60
54
  const packageVersionFile = packageContext.versionFile;
61
- const packageVersionExists = node_fs_1.default.existsSync(node_path_1.default.join(cwd, packageVersionFile));
55
+ const packageVersionExists = fs.existsSync(path.join(cwd, packageVersionFile));
62
56
  checks.push({
63
57
  name: `version-file:${packageVersionFile}`,
64
58
  ok: packageVersionExists,
@@ -1,10 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pluginHasCapability = pluginHasCapability;
4
- exports.findPluginsByCapability = findPluginsByCapability;
5
- function pluginHasCapability(plugin, capability) {
1
+ export function pluginHasCapability(plugin, capability) {
6
2
  return plugin.capabilities.includes(capability);
7
3
  }
8
- function findPluginsByCapability(plugins, capability) {
4
+ export function findPluginsByCapability(plugins, capability) {
9
5
  return plugins.filter((plugin) => pluginHasCapability(plugin, capability));
10
6
  }
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getScmClient = getScmClient;
4
- const github_plugin_js_1 = require("./github-plugin.js");
5
- function getScmClient() {
6
- return (0, github_plugin_js_1.createGitHubPlugin)();
1
+ import { createGitHubPlugin } from "./github-plugin.js";
2
+ export function getScmClient() {
3
+ return createGitHubPlugin();
7
4
  }
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createGitHubPlugin = createGitHubPlugin;
4
- const rest_1 = require("@octokit/rest");
1
+ import { Octokit } from "@octokit/rest";
5
2
  function parseRepoSlug(input) {
6
3
  const [owner, repo] = input.split("/");
7
4
  if (!owner || !repo) {
@@ -122,7 +119,7 @@ function renderReleaseReferenceCommentBody(releases) {
122
119
  .join("\n");
123
120
  return `This is included in the following releases: :tada:\n\n${bullets}\n\n${footer}`;
124
121
  }
125
- function createGitHubPlugin() {
122
+ export function createGitHubPlugin() {
126
123
  return {
127
124
  name: "github",
128
125
  capabilities: [
@@ -133,7 +130,7 @@ function createGitHubPlugin() {
133
130
  provider: "github",
134
131
  async createOrUpdateReviewRequest(input, _context) {
135
132
  const repo = getRepoFromEnv();
136
- const octokit = new rest_1.Octokit({ auth: getGitHubToken() });
133
+ const octokit = new Octokit({ auth: getGitHubToken() });
137
134
  const listHead = resolveHeadForList(repo, input.headBranch);
138
135
  let existing;
139
136
  try {
@@ -212,7 +209,7 @@ function createGitHubPlugin() {
212
209
  },
213
210
  async closeReviewRequestIfExists(input, _context) {
214
211
  const repo = getRepoFromEnv();
215
- const octokit = new rest_1.Octokit({ auth: getGitHubToken() });
212
+ const octokit = new Octokit({ auth: getGitHubToken() });
216
213
  const listHead = resolveHeadForList(repo, input.headBranch);
217
214
  let existing;
218
215
  try {
@@ -274,7 +271,7 @@ function createGitHubPlugin() {
274
271
  },
275
272
  async createReleaseMetadata(input, _context) {
276
273
  const repo = getRepoFromEnv();
277
- const octokit = new rest_1.Octokit({ auth: getGitHubToken() });
274
+ const octokit = new Octokit({ auth: getGitHubToken() });
278
275
  try {
279
276
  const existing = await octokit.repos.getReleaseByTag({
280
277
  owner: repo.owner,
@@ -310,7 +307,7 @@ function createGitHubPlugin() {
310
307
  },
311
308
  async createReleaseReferenceComments(input, context) {
312
309
  const repo = getRepoFromEnv();
313
- const octokit = new rest_1.Octokit({ auth: getGitHubToken() });
310
+ const octokit = new Octokit({ auth: getGitHubToken() });
314
311
  const mode = input.mode ?? "best-effort";
315
312
  const releasesByIssue = groupReleasesByIssue(input.releases);
316
313
  const commented = [];
package/dist/scm/types.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.compositeVersionStrategy = compositeVersionStrategy;
4
1
  function configForSecondary(config) {
5
2
  if (config["version-file"] === undefined) {
6
3
  return config;
@@ -11,7 +8,7 @@ function configForSecondary(config) {
11
8
  function dedupedSorted(values) {
12
9
  return [...new Set(values)].sort((a, b) => a.localeCompare(b));
13
10
  }
14
- function compositeVersionStrategy(strategies) {
11
+ export function compositeVersionStrategy(strategies) {
15
12
  if (strategies.length === 0) {
16
13
  throw new Error("compositeVersionStrategy requires at least one strategy.");
17
14
  }
@@ -1,25 +1,19 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.latexVersionStrategy = 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
  const BUILD_LUA_VERSION_PATTERN = /^(\s*version\s*=\s*")([^"]+)(")/mu;
10
4
  const PROVIDES_PACKAGE_PATTERN = /\\ProvidesPackage\{([^}]+)\}\[\d{4}-\d{2}-\d{2} v([0-9]+\.[0-9]+\.[0-9]+) ([^\]]+)\]/gu;
11
5
  const PROVIDES_EXPL_PACKAGE_PATTERN = /\\ProvidesExplPackage\{([^}]+)\}\{\d{4}-\d{2}-\d{2}\}\{[^}]+\}\{([^}]*)\}/gu;
12
6
  function normalizeRelative(base, target) {
13
- return node_path_1.default.relative(base, target).replaceAll("\\", "/");
7
+ return path.relative(base, target).replaceAll("\\", "/");
14
8
  }
15
9
  function collectDtxFiles(dir) {
16
- if (!node_fs_1.default.existsSync(dir)) {
10
+ if (!fs.existsSync(dir)) {
17
11
  return [];
18
12
  }
19
- const entries = node_fs_1.default.readdirSync(dir, { withFileTypes: true });
13
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
20
14
  const files = [];
21
15
  for (const entry of entries) {
22
- const target = node_path_1.default.join(dir, entry.name);
16
+ const target = path.join(dir, entry.name);
23
17
  if (entry.isDirectory()) {
24
18
  files.push(...collectDtxFiles(target));
25
19
  continue;
@@ -51,18 +45,18 @@ function replaceProvidesPackageMetadata(content, version, releaseDate, relativeP
51
45
  }
52
46
  return content.replace(PROVIDES_PACKAGE_PATTERN, (_full, pkg, _prevVersion, desc) => `\\ProvidesPackage{${pkg}}[${releaseDate} v${version} ${desc}]`);
53
47
  }
54
- exports.latexVersionStrategy = {
48
+ export const latexVersionStrategy = {
55
49
  name: "latex",
56
50
  getVersionFile(config) {
57
51
  return config["version-file"] ?? "build.lua";
58
52
  },
59
53
  readVersion(cwd, config) {
60
54
  const versionFile = this.getVersionFile(config);
61
- const versionPath = node_path_1.default.join(cwd, versionFile);
62
- if (!node_fs_1.default.existsSync(versionPath)) {
55
+ const versionPath = path.join(cwd, versionFile);
56
+ if (!fs.existsSync(versionPath)) {
63
57
  throw new Error(`Versionary requires ${versionFile} to exist.`);
64
58
  }
65
- const content = node_fs_1.default.readFileSync(versionPath, "utf8");
59
+ const content = fs.readFileSync(versionPath, "utf8");
66
60
  const match = content.match(BUILD_LUA_VERSION_PATTERN);
67
61
  if (!match?.[2]) {
68
62
  throw new Error(`${versionFile} is missing a valid version field required by release-type "latex".`);
@@ -71,31 +65,31 @@ exports.latexVersionStrategy = {
71
65
  },
72
66
  writeVersion(cwd, config, version) {
73
67
  const versionFile = this.getVersionFile(config);
74
- const versionPath = node_path_1.default.join(cwd, versionFile);
75
- if (!node_fs_1.default.existsSync(versionPath)) {
68
+ const versionPath = path.join(cwd, versionFile);
69
+ if (!fs.existsSync(versionPath)) {
76
70
  throw new Error(`Versionary requires ${versionFile} to exist.`);
77
71
  }
78
- const next = replaceBuildLuaVersion(node_fs_1.default.readFileSync(versionPath, "utf8"), version, versionFile);
79
- node_fs_1.default.writeFileSync(versionPath, next, "utf8");
72
+ const next = replaceBuildLuaVersion(fs.readFileSync(versionPath, "utf8"), version, versionFile);
73
+ fs.writeFileSync(versionPath, next, "utf8");
80
74
  return [versionFile];
81
75
  },
82
76
  finalizeVersionWrites(cwd, writes, context) {
83
77
  const updated = new Set();
84
78
  for (const write of writes) {
85
- const packageRoot = write.packagePath === "." ? cwd : node_path_1.default.join(cwd, write.packagePath);
86
- const srcDir = node_path_1.default.join(packageRoot, "src");
79
+ const packageRoot = write.packagePath === "." ? cwd : path.join(cwd, write.packagePath);
80
+ const srcDir = path.join(packageRoot, "src");
87
81
  const dtxFiles = collectDtxFiles(srcDir);
88
82
  if (dtxFiles.length === 0) {
89
83
  throw new Error(`release-type "latex" requires at least one .dtx file under ${normalizeRelative(cwd, srcDir)}.`);
90
84
  }
91
85
  for (const dtxPath of dtxFiles) {
92
86
  const relativePath = normalizeRelative(cwd, dtxPath);
93
- const existing = node_fs_1.default.readFileSync(dtxPath, "utf8");
87
+ const existing = fs.readFileSync(dtxPath, "utf8");
94
88
  const next = replaceProvidesPackageMetadata(existing, write.version, context.releaseDate, relativePath);
95
89
  if (next === existing) {
96
90
  continue;
97
91
  }
98
- node_fs_1.default.writeFileSync(dtxPath, next, "utf8");
92
+ fs.writeFileSync(dtxPath, next, "utf8");
99
93
  updated.add(relativePath);
100
94
  }
101
95
  }