gitverse-release 3.4.0 → 3.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/README.md +197 -0
- package/dist/binaries.d.ts +74 -0
- package/dist/cli.js +1679 -492
- package/dist/cli.js.map +27 -28
- package/dist/config.d.ts +46 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1567 -484
- package/dist/index.js.map +26 -27
- package/dist/types.d.ts +208 -0
- package/dist/utils/binary-package-generator.d.ts +21 -0
- package/dist/utils/binary-platforms.d.ts +62 -0
- package/dist/utils/binary-publisher.d.ts +53 -0
- package/dist/utils/binary-wrapper-generator.d.ts +34 -0
- package/dist/utils/git.d.ts +9 -1
- package/package.json +4 -4
- package/schema.json +81 -0
package/dist/cli.js
CHANGED
|
@@ -19,12 +19,52 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
19
19
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
20
20
|
|
|
21
21
|
// src/index.ts
|
|
22
|
-
import { resolve as
|
|
22
|
+
import { resolve as resolve4 } from "node:path";
|
|
23
23
|
|
|
24
24
|
// src/config.ts
|
|
25
|
-
import { readFile } from "node:fs/promises";
|
|
25
|
+
import { access, readFile, writeFile } from "node:fs/promises";
|
|
26
26
|
import { resolve } from "node:path";
|
|
27
|
+
import { parse as parseJsonc } from "jsonc-parser";
|
|
28
|
+
var DEFAULT_CONFIG_FILE_NAME = ".gitversereleaserc.jsonc";
|
|
29
|
+
var CONFIG_FILE_NAMES = [".gitversereleaserc.jsonc", ".gitversereleaserc.json"];
|
|
30
|
+
async function fileExists(path) {
|
|
31
|
+
try {
|
|
32
|
+
await access(path);
|
|
33
|
+
return true;
|
|
34
|
+
} catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async function findConfigFile(directory) {
|
|
39
|
+
for (const fileName of CONFIG_FILE_NAMES) {
|
|
40
|
+
const fullPath = resolve(directory, fileName);
|
|
41
|
+
if (await fileExists(fullPath)) {
|
|
42
|
+
return fullPath;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
var DEFAULT_BINARY_PLATFORMS = [
|
|
48
|
+
"linux-x64",
|
|
49
|
+
"linux-arm64",
|
|
50
|
+
"darwin-x64",
|
|
51
|
+
"darwin-arm64",
|
|
52
|
+
"win32-x64"
|
|
53
|
+
];
|
|
54
|
+
var DEFAULT_BINARIES_CONFIG = {
|
|
55
|
+
continueOnError: false,
|
|
56
|
+
distDir: "./dist",
|
|
57
|
+
enabled: false,
|
|
58
|
+
mainPackage: "./package.json",
|
|
59
|
+
name: "",
|
|
60
|
+
outDir: "./npm",
|
|
61
|
+
platforms: DEFAULT_BINARY_PLATFORMS,
|
|
62
|
+
publishCommand: "npm publish --access public",
|
|
63
|
+
retryAttempts: 3,
|
|
64
|
+
scope: ""
|
|
65
|
+
};
|
|
27
66
|
var DEFAULT_CONFIG = {
|
|
67
|
+
binaries: DEFAULT_BINARIES_CONFIG,
|
|
28
68
|
changelog: {
|
|
29
69
|
showAuthor: true,
|
|
30
70
|
showHash: true,
|
|
@@ -88,11 +128,18 @@ var DEFAULT_CONFIG = {
|
|
|
88
128
|
}
|
|
89
129
|
};
|
|
90
130
|
async function loadConfig(configPath) {
|
|
91
|
-
|
|
92
|
-
|
|
131
|
+
let fullPath;
|
|
132
|
+
if (configPath) {
|
|
133
|
+
fullPath = resolve(process.cwd(), configPath);
|
|
134
|
+
} else {
|
|
135
|
+
fullPath = await findConfigFile(process.cwd());
|
|
136
|
+
}
|
|
137
|
+
if (!fullPath) {
|
|
138
|
+
return DEFAULT_CONFIG;
|
|
139
|
+
}
|
|
93
140
|
try {
|
|
94
141
|
const content = await readFile(fullPath, "utf-8");
|
|
95
|
-
const userConfig =
|
|
142
|
+
const userConfig = parseJsonc(content);
|
|
96
143
|
return mergeConfig(DEFAULT_CONFIG, userConfig);
|
|
97
144
|
} catch (error) {
|
|
98
145
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
@@ -103,6 +150,10 @@ async function loadConfig(configPath) {
|
|
|
103
150
|
}
|
|
104
151
|
function mergeConfig(defaults, user) {
|
|
105
152
|
return {
|
|
153
|
+
binaries: {
|
|
154
|
+
...defaults.binaries,
|
|
155
|
+
...user.binaries
|
|
156
|
+
},
|
|
106
157
|
changelog: {
|
|
107
158
|
...defaults.changelog,
|
|
108
159
|
...user.changelog,
|
|
@@ -147,163 +198,157 @@ function validateConfig(config) {
|
|
|
147
198
|
}
|
|
148
199
|
}
|
|
149
200
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
this.client = b;
|
|
156
|
-
}
|
|
157
|
-
async checkMembership(b, h, j) {
|
|
158
|
-
try {
|
|
159
|
-
return await this.client.get(`/orgs/${b}/members/${h}`, j), true;
|
|
160
|
-
} catch (d) {
|
|
161
|
-
if (d instanceof Error && d.message.includes("404"))
|
|
162
|
-
return false;
|
|
163
|
-
throw d;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// ../sdk/dist/api/commits.js
|
|
169
|
-
class j {
|
|
170
|
-
client;
|
|
171
|
-
constructor(b) {
|
|
172
|
-
this.client = b;
|
|
173
|
-
}
|
|
174
|
-
list(b, d, f) {
|
|
175
|
-
return this.client.get(`/repos/${b}/${d}/commits`, f);
|
|
176
|
-
}
|
|
177
|
-
get(b, d, f, g) {
|
|
178
|
-
return this.client.get(`/repos/${b}/${d}/commits/${f}`, g);
|
|
179
|
-
}
|
|
180
|
-
create(b, d, f, g) {
|
|
181
|
-
return this.client.post(`/repos/${b}/${d}/git/commits`, f, g);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// ../sdk/dist/api/actions.js
|
|
186
|
-
class x {
|
|
187
|
-
client;
|
|
188
|
-
constructor(b) {
|
|
189
|
-
this.client = b;
|
|
190
|
-
}
|
|
191
|
-
listOrgRunners(b, h) {
|
|
192
|
-
return this.client.get(`/orgs/${b}/actions/runners`, h);
|
|
193
|
-
}
|
|
194
|
-
createOrgRegistrationToken(b, h) {
|
|
195
|
-
return this.client.post(`/orgs/${b}/actions/runners/registration-token`, {}, h);
|
|
196
|
-
}
|
|
197
|
-
getOrgRunner(b, h, j2) {
|
|
198
|
-
return this.client.get(`/orgs/${b}/actions/runners/${h}`, j2);
|
|
199
|
-
}
|
|
200
|
-
deleteOrgRunner(b, h, j2) {
|
|
201
|
-
return this.client.delete(`/orgs/${b}/actions/runners/${h}`, undefined, j2);
|
|
202
|
-
}
|
|
203
|
-
listRepoRunners(b, h, j2) {
|
|
204
|
-
return this.client.get(`/repos/${b}/${h}/actions/runners`, j2);
|
|
205
|
-
}
|
|
206
|
-
createRepoRegistrationToken(b, h, j2) {
|
|
207
|
-
return this.client.post(`/repos/${b}/${h}/actions/runners/registration-token`, {}, j2);
|
|
208
|
-
}
|
|
209
|
-
getRepoRunner(b, h, j2, q) {
|
|
210
|
-
return this.client.get(`/repos/${b}/${h}/actions/runners/${j2}`, q);
|
|
211
|
-
}
|
|
212
|
-
deleteRepoRunner(b, h, j2, q) {
|
|
213
|
-
return this.client.delete(`/repos/${b}/${h}/actions/runners/${j2}`, undefined, q);
|
|
214
|
-
}
|
|
215
|
-
listOrgSecrets(b, h) {
|
|
216
|
-
return this.client.get(`/orgs/${b}/actions/secrets`, h);
|
|
217
|
-
}
|
|
218
|
-
getOrgSecret(b, h, j2) {
|
|
219
|
-
return this.client.get(`/orgs/${b}/actions/secrets/${h}`, j2);
|
|
220
|
-
}
|
|
221
|
-
createOrUpdateOrgSecret(b, h, j2, q) {
|
|
222
|
-
return this.client.put(`/orgs/${b}/actions/secrets/${h}`, j2, q);
|
|
223
|
-
}
|
|
224
|
-
deleteOrgSecret(b, h, j2) {
|
|
225
|
-
return this.client.delete(`/orgs/${b}/actions/secrets/${h}`, undefined, j2);
|
|
226
|
-
}
|
|
227
|
-
listRepoSecrets(b, h, j2) {
|
|
228
|
-
return this.client.get(`/repos/${b}/${h}/actions/secrets`, j2);
|
|
229
|
-
}
|
|
230
|
-
getRepoSecret(b, h, j2, q) {
|
|
231
|
-
return this.client.get(`/repos/${b}/${h}/actions/secrets/${j2}`, q);
|
|
232
|
-
}
|
|
233
|
-
createOrUpdateRepoSecret(b, h, j2, q, v) {
|
|
234
|
-
return this.client.put(`/repos/${b}/${h}/actions/secrets/${j2}`, q, v);
|
|
235
|
-
}
|
|
236
|
-
deleteRepoSecret(b, h, j2, q) {
|
|
237
|
-
return this.client.delete(`/repos/${b}/${h}/actions/secrets/${j2}`, undefined, q);
|
|
238
|
-
}
|
|
239
|
-
listOrgVariables(b, h) {
|
|
240
|
-
return this.client.get(`/orgs/${b}/actions/variables`, h);
|
|
241
|
-
}
|
|
242
|
-
createOrgVariable(b, h, j2) {
|
|
243
|
-
return this.client.post(`/orgs/${b}/actions/variables`, h, j2);
|
|
244
|
-
}
|
|
245
|
-
getOrgVariable(b, h, j2) {
|
|
246
|
-
return this.client.get(`/orgs/${b}/actions/variables/${h}`, j2);
|
|
247
|
-
}
|
|
248
|
-
deleteOrgVariable(b, h, j2) {
|
|
249
|
-
return this.client.delete(`/orgs/${b}/actions/variables/${h}`, undefined, j2);
|
|
250
|
-
}
|
|
251
|
-
updateOrgVariable(b, h, j2, q) {
|
|
252
|
-
return this.client.patch(`/orgs/${b}/actions/variables/${h}`, j2, q);
|
|
253
|
-
}
|
|
254
|
-
listRepoVariables(b, h, j2) {
|
|
255
|
-
return this.client.get(`/repos/${b}/${h}/actions/variables`, j2);
|
|
256
|
-
}
|
|
257
|
-
createRepoVariable(b, h, j2, q) {
|
|
258
|
-
return this.client.post(`/repos/${b}/${h}/actions/variables`, j2, q);
|
|
259
|
-
}
|
|
260
|
-
getRepoVariable(b, h, j2, q) {
|
|
261
|
-
return this.client.get(`/repos/${b}/${h}/actions/variables/${j2}`, q);
|
|
262
|
-
}
|
|
263
|
-
deleteRepoVariable(b, h, j2, q) {
|
|
264
|
-
return this.client.delete(`/repos/${b}/${h}/actions/variables/${j2}`, undefined, q);
|
|
201
|
+
var SAFE_NAME_REGEX = /^[a-zA-Z0-9_.-]+$/;
|
|
202
|
+
var SAFE_SCOPE_REGEX = /^@?[a-zA-Z0-9_-]+$/;
|
|
203
|
+
function validateBinariesConfig(config) {
|
|
204
|
+
if (!config.enabled) {
|
|
205
|
+
return;
|
|
265
206
|
}
|
|
266
|
-
|
|
267
|
-
|
|
207
|
+
if (!config.scope) {
|
|
208
|
+
throw new Error("Binaries config: scope is required when enabled");
|
|
268
209
|
}
|
|
269
|
-
|
|
270
|
-
|
|
210
|
+
if (!SAFE_SCOPE_REGEX.test(config.scope)) {
|
|
211
|
+
throw new Error(`Binaries config: scope "${config.scope}" contains invalid characters. ` + "Only letters, numbers, underscore, hyphen are allowed.");
|
|
271
212
|
}
|
|
272
|
-
|
|
273
|
-
|
|
213
|
+
if (!config.name) {
|
|
214
|
+
throw new Error("Binaries config: name is required when enabled");
|
|
274
215
|
}
|
|
275
|
-
|
|
276
|
-
|
|
216
|
+
if (!SAFE_NAME_REGEX.test(config.name)) {
|
|
217
|
+
throw new Error(`Binaries config: name "${config.name}" contains invalid characters. ` + "Only letters, numbers, underscore, hyphen, dot are allowed.");
|
|
277
218
|
}
|
|
278
|
-
|
|
279
|
-
|
|
219
|
+
if (!config.platforms || config.platforms.length === 0) {
|
|
220
|
+
throw new Error("Binaries config: at least one platform is required");
|
|
280
221
|
}
|
|
281
|
-
|
|
282
|
-
|
|
222
|
+
const validPlatforms = [
|
|
223
|
+
"linux-x64",
|
|
224
|
+
"linux-arm64",
|
|
225
|
+
"darwin-x64",
|
|
226
|
+
"darwin-arm64",
|
|
227
|
+
"win32-x64",
|
|
228
|
+
"win32-arm64"
|
|
229
|
+
];
|
|
230
|
+
for (const platform of config.platforms) {
|
|
231
|
+
if (!validPlatforms.includes(platform)) {
|
|
232
|
+
throw new Error(`Binaries config: invalid platform "${platform}". Valid: ${validPlatforms.join(", ")}`);
|
|
233
|
+
}
|
|
283
234
|
}
|
|
284
|
-
|
|
285
|
-
|
|
235
|
+
if (config.retryAttempts < 1 || config.retryAttempts > 10) {
|
|
236
|
+
throw new Error("Binaries config: retryAttempts must be between 1 and 10");
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function configExists() {
|
|
240
|
+
return findConfigFile(process.cwd());
|
|
241
|
+
}
|
|
242
|
+
function generateConfigContent(options = {}) {
|
|
243
|
+
const lines = [];
|
|
244
|
+
lines.push("{");
|
|
245
|
+
lines.push(" // JSON Schema для автодополнения и валидации в IDE");
|
|
246
|
+
lines.push(' "$schema": "node_modules/gitverse-release/schema.json",');
|
|
247
|
+
lines.push("");
|
|
248
|
+
lines.push(" // Настройки генерации CHANGELOG");
|
|
249
|
+
lines.push(' "changelog": {');
|
|
250
|
+
lines.push(' "showAuthor": true,');
|
|
251
|
+
lines.push(' "showHash": true,');
|
|
252
|
+
lines.push(' "types": {');
|
|
253
|
+
lines.push(' "feat": "✨ Features",');
|
|
254
|
+
lines.push(' "fix": "\uD83D\uDC1B Bug Fixes",');
|
|
255
|
+
lines.push(' "docs": "\uD83D\uDCDD Documentation",');
|
|
256
|
+
lines.push(' "style": "\uD83D\uDC84 Styles",');
|
|
257
|
+
lines.push(' "refactor": "♻️ Refactoring",');
|
|
258
|
+
lines.push(' "perf": "⚡ Performance",');
|
|
259
|
+
lines.push(' "test": "✅ Tests",');
|
|
260
|
+
lines.push(' "build": "\uD83C\uDFD7️ Build System",');
|
|
261
|
+
lines.push(' "ci": "\uD83D\uDC77 CI/CD",');
|
|
262
|
+
lines.push(' "chore": "\uD83D\uDD27 Chores",');
|
|
263
|
+
lines.push(' "revert": "⏪ Reverts"');
|
|
264
|
+
lines.push(" }");
|
|
265
|
+
lines.push(" },");
|
|
266
|
+
lines.push("");
|
|
267
|
+
const scopes = options.scopes ?? ["deps", "ci", "docs"];
|
|
268
|
+
lines.push(" // Настройки генерации commitlint конфига");
|
|
269
|
+
lines.push(' "commitlint": {');
|
|
270
|
+
lines.push(` "scopes": ${JSON.stringify(scopes)},`);
|
|
271
|
+
lines.push(' "scopeRequired": false,');
|
|
272
|
+
lines.push(' "headerMaxLength": 100');
|
|
273
|
+
lines.push(" },");
|
|
274
|
+
lines.push("");
|
|
275
|
+
lines.push(" // Настройки Git операций");
|
|
276
|
+
lines.push(' "git": {');
|
|
277
|
+
lines.push(' "commitChanges": true,');
|
|
278
|
+
lines.push(' "commitMessage": "chore(release): v{{version}} [skip ci]",');
|
|
279
|
+
lines.push(' "push": true,');
|
|
280
|
+
lines.push(' "tagMessage": "v{{version}}"');
|
|
281
|
+
lines.push(' // beforeCommit: "bun run format" // Раскомментируйте для форматирования перед коммитом');
|
|
282
|
+
lines.push(" },");
|
|
283
|
+
lines.push("");
|
|
284
|
+
lines.push(" // Настройки GitVerse Release API");
|
|
285
|
+
lines.push(" // Требует переменную окружения GITVERSE_TOKEN");
|
|
286
|
+
lines.push(' "gitverse": {');
|
|
287
|
+
lines.push(' "enabled": true,');
|
|
288
|
+
lines.push(' "checkExisting": true,');
|
|
289
|
+
lines.push(' "failOnError": true');
|
|
290
|
+
lines.push(" },");
|
|
291
|
+
lines.push("");
|
|
292
|
+
lines.push(" // Настройки монорепо");
|
|
293
|
+
lines.push(' "monorepo": {');
|
|
294
|
+
lines.push(` "enabled": ${options.monorepo ?? false}`);
|
|
295
|
+
if (options.monorepo) {
|
|
296
|
+
lines.pop();
|
|
297
|
+
lines.push(` "enabled": true,`);
|
|
298
|
+
lines.push(' "packages": [');
|
|
299
|
+
lines.push(" // Пример конфигурации пакета:");
|
|
300
|
+
lines.push(" // {");
|
|
301
|
+
lines.push(' // "name": "sdk",');
|
|
302
|
+
lines.push(' // "path": "packages/sdk",');
|
|
303
|
+
lines.push(' // "packageName": "my-sdk",');
|
|
304
|
+
lines.push(' // "tagPrefix": "v"');
|
|
305
|
+
lines.push(" // }");
|
|
306
|
+
lines.push(" ]");
|
|
307
|
+
}
|
|
308
|
+
lines.push(" },");
|
|
309
|
+
lines.push("");
|
|
310
|
+
lines.push(" // Настройки версионирования");
|
|
311
|
+
lines.push(' "versioning": {');
|
|
312
|
+
lines.push(' "tagPrefix": "v",');
|
|
313
|
+
lines.push(' "prereleasePrefix": "beta"');
|
|
314
|
+
lines.push(" }");
|
|
315
|
+
lines.push("}");
|
|
316
|
+
return lines.join(`
|
|
317
|
+
`);
|
|
318
|
+
}
|
|
319
|
+
async function initConfig(options = {}) {
|
|
320
|
+
const existingConfig = await configExists();
|
|
321
|
+
if (existingConfig) {
|
|
322
|
+
throw new Error(`Config file already exists: ${existingConfig}`);
|
|
286
323
|
}
|
|
287
|
-
|
|
288
|
-
|
|
324
|
+
const content = generateConfigContent(options);
|
|
325
|
+
const filePath = resolve(process.cwd(), DEFAULT_CONFIG_FILE_NAME);
|
|
326
|
+
if (options.dryRun) {
|
|
327
|
+
console.log(`
|
|
328
|
+
\uD83D\uDD0D Dry-run mode - Would create: ${filePath}
|
|
329
|
+
`);
|
|
330
|
+
console.log(content);
|
|
331
|
+
return filePath;
|
|
289
332
|
}
|
|
333
|
+
await writeFile(filePath, content, "utf-8");
|
|
334
|
+
return filePath;
|
|
290
335
|
}
|
|
291
336
|
|
|
292
337
|
// ../sdk/dist/errors.js
|
|
293
|
-
class
|
|
338
|
+
class j extends Error {
|
|
294
339
|
status;
|
|
295
340
|
metadata;
|
|
296
341
|
constructor(b, f, h) {
|
|
297
342
|
super(f);
|
|
298
|
-
this.name = "GitVerseApiError", this.status = b, this.metadata = h, Object.setPrototypeOf(this,
|
|
343
|
+
this.name = "GitVerseApiError", this.status = b, this.metadata = h, Object.setPrototypeOf(this, j.prototype);
|
|
299
344
|
}
|
|
300
345
|
}
|
|
301
346
|
|
|
302
|
-
class
|
|
347
|
+
class k extends j {
|
|
303
348
|
rateLimit;
|
|
304
349
|
constructor(b, f, h) {
|
|
305
350
|
super(429, b, h);
|
|
306
|
-
this.name = "RateLimitError", this.rateLimit = f, Object.setPrototypeOf(this,
|
|
351
|
+
this.name = "RateLimitError", this.rateLimit = f, Object.setPrototypeOf(this, k.prototype);
|
|
307
352
|
}
|
|
308
353
|
getRetryAfterSeconds() {
|
|
309
354
|
return this.rateLimit.retryAfter;
|
|
@@ -328,411 +373,746 @@ class q {
|
|
|
328
373
|
}
|
|
329
374
|
}
|
|
330
375
|
|
|
331
|
-
// ../sdk/dist/
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
376
|
+
// ../sdk/dist/client.js
|
|
377
|
+
var Z = { DELETE: "DELETE", GET: "GET", PATCH: "PATCH", POST: "POST", PUT: "PUT" };
|
|
378
|
+
|
|
379
|
+
class v {
|
|
380
|
+
baseUrl;
|
|
381
|
+
token;
|
|
382
|
+
apiVersion;
|
|
383
|
+
onApiVersionWarning;
|
|
384
|
+
constructor(j2 = {}) {
|
|
385
|
+
this.baseUrl = j2.baseUrl || "https://api.gitverse.ru", this.token = j2.token, this.apiVersion = j2.apiVersion || "1";
|
|
336
386
|
}
|
|
337
|
-
|
|
338
|
-
|
|
387
|
+
setToken(j2) {
|
|
388
|
+
this.token = j2;
|
|
339
389
|
}
|
|
340
|
-
|
|
341
|
-
|
|
390
|
+
extractRateLimitInfo(j2) {
|
|
391
|
+
let x = j2.get("GitVerse-RateLimit-Limit"), q2 = j2.get("GitVerse-RateLimit-User-Remaining") || j2.get("GitVerse-RateLimit-Remaining"), z = j2.get("GitVerse-RateLimit-Retry-After"), F = j2.get("Gitverse-Ratelimit-Reset");
|
|
392
|
+
if (!(x && z))
|
|
393
|
+
return;
|
|
394
|
+
let U = Number.parseInt(z, 10), J = F ? Number.parseInt(F, 10) : Math.floor(Date.now() / 1000) + U, K = q2 ? Number.parseInt(q2, 10) : 0;
|
|
395
|
+
return { limit: Number.parseInt(x, 10), remaining: K, reset: J, retryAfter: U };
|
|
342
396
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
397
|
+
extractApiVersionInfo(j2) {
|
|
398
|
+
let x = j2.get("Gitverse-Api-Version"), q2 = j2.get("Gitverse-Api-Latest-Version"), z = j2.get("Gitverse-Api-Deprecation") === "true", F = j2.get("Gitverse-Api-Decommissioning");
|
|
399
|
+
if (!(x && q2))
|
|
400
|
+
return;
|
|
401
|
+
return { decommissioning: F || undefined, deprecated: z, latestVersion: q2, version: x };
|
|
402
|
+
}
|
|
403
|
+
extractMetadata(j2) {
|
|
404
|
+
let x = this.extractRateLimitInfo(j2), q2 = this.extractApiVersionInfo(j2);
|
|
405
|
+
if (q2?.deprecated && this.onApiVersionWarning) {
|
|
406
|
+
let z = new q(q2.version, q2.latestVersion, q2.decommissioning);
|
|
407
|
+
this.onApiVersionWarning(z);
|
|
350
408
|
}
|
|
409
|
+
return { apiVersion: q2, rateLimit: x };
|
|
351
410
|
}
|
|
352
|
-
async
|
|
353
|
-
|
|
411
|
+
async request(j2, x, q2, z) {
|
|
412
|
+
let F = j2.startsWith("/") ? j2.slice(1) : j2, U = `${this.baseUrl}/${F}`, J = new Headers;
|
|
413
|
+
if (J.set("Content-Type", "application/json"), J.set("Accept", `application/vnd.gitverse.object+json; version=${this.apiVersion}`), this.token)
|
|
414
|
+
J.set("Authorization", `Bearer ${this.token}`);
|
|
415
|
+
let K = { body: q2 ? JSON.stringify(q2) : undefined, headers: J, method: x, signal: z?.signal }, C = await fetch(U, K), X = this.extractMetadata(C.headers), Y;
|
|
416
|
+
try {
|
|
417
|
+
Y = await C.json();
|
|
418
|
+
} catch {
|
|
419
|
+
Y = undefined;
|
|
420
|
+
}
|
|
421
|
+
if (!C.ok) {
|
|
422
|
+
let S = Y?.message || C.statusText;
|
|
423
|
+
if (C.status === 429 && X.rateLimit)
|
|
424
|
+
throw new k(S || "Превышен лимит запросов. Попробуйте позже.", X.rateLimit, X);
|
|
425
|
+
throw new j(C.status, S, X);
|
|
426
|
+
}
|
|
427
|
+
return Y;
|
|
354
428
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
// ../sdk/dist/api/issues.js
|
|
358
|
-
class B {
|
|
359
|
-
client;
|
|
360
|
-
constructor(c) {
|
|
361
|
-
this.client = c;
|
|
429
|
+
get(j2, x) {
|
|
430
|
+
return this.request(j2, Z.GET, undefined, x);
|
|
362
431
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
if (f)
|
|
366
|
-
k4.append("state", f);
|
|
367
|
-
let z = k4.toString(), A = `/repos/${c}/${h}/issues${z ? `?${z}` : ""}`;
|
|
368
|
-
return this.client.get(A, j3);
|
|
432
|
+
post(j2, x, q2) {
|
|
433
|
+
return this.request(j2, Z.POST, x, q2);
|
|
369
434
|
}
|
|
370
|
-
|
|
371
|
-
return this.
|
|
435
|
+
put(j2, x, q2) {
|
|
436
|
+
return this.request(j2, Z.PUT, x, q2);
|
|
372
437
|
}
|
|
373
|
-
|
|
374
|
-
return this.
|
|
438
|
+
delete(j2, x, q2) {
|
|
439
|
+
return this.request(j2, Z.DELETE, x, q2);
|
|
375
440
|
}
|
|
376
|
-
|
|
377
|
-
return this.
|
|
441
|
+
patch(j2, x, q2) {
|
|
442
|
+
return this.request(j2, Z.PATCH, x, q2);
|
|
378
443
|
}
|
|
379
|
-
|
|
380
|
-
|
|
444
|
+
async uploadFile(j2, x, q2, z, F) {
|
|
445
|
+
let U = j2.startsWith("/") ? j2.slice(1) : j2, J = `${this.baseUrl}/${U}`, K = new Headers;
|
|
446
|
+
if (K.set("Accept", `application/vnd.gitverse.object+json; version=${this.apiVersion}`), this.token)
|
|
447
|
+
K.set("Authorization", `Bearer ${this.token}`);
|
|
448
|
+
let C = new FormData, X = q2 instanceof ArrayBuffer ? new Blob([q2]) : q2;
|
|
449
|
+
C.append(x, X, z);
|
|
450
|
+
let Y = { body: C, headers: K, method: Z.POST, signal: F?.signal }, Q = await fetch(J, Y), S = this.extractMetadata(Q.headers), _;
|
|
451
|
+
try {
|
|
452
|
+
_ = await Q.json();
|
|
453
|
+
} catch {
|
|
454
|
+
_ = undefined;
|
|
455
|
+
}
|
|
456
|
+
if (!Q.ok) {
|
|
457
|
+
let W = _?.message || Q.statusText;
|
|
458
|
+
if (Q.status === 429 && S.rateLimit)
|
|
459
|
+
throw new k(W || "Превышен лимит запросов. Попробуйте позже.", S.rateLimit, S);
|
|
460
|
+
throw new j(Q.status, W, S);
|
|
461
|
+
}
|
|
462
|
+
return _;
|
|
381
463
|
}
|
|
382
|
-
|
|
383
|
-
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// ../sdk/dist/api/issues.js
|
|
467
|
+
class E {
|
|
468
|
+
client;
|
|
469
|
+
constructor(k2) {
|
|
470
|
+
this.client = k2;
|
|
471
|
+
}
|
|
472
|
+
list(k2, A, b, f) {
|
|
473
|
+
let j2 = new URLSearchParams;
|
|
474
|
+
if (b?.state !== undefined)
|
|
475
|
+
j2.append("state", b.state);
|
|
476
|
+
if (b?.q !== undefined)
|
|
477
|
+
j2.append("q", b.q);
|
|
478
|
+
if (b?.labels !== undefined)
|
|
479
|
+
j2.append("labels", b.labels);
|
|
480
|
+
if (b?.milestones !== undefined)
|
|
481
|
+
j2.append("milestones", b.milestones);
|
|
482
|
+
if (b?.created_by !== undefined)
|
|
483
|
+
j2.append("created_by", b.created_by);
|
|
484
|
+
if (b?.assigned_by !== undefined)
|
|
485
|
+
j2.append("assigned_by", b.assigned_by);
|
|
486
|
+
if (b?.mentioned_by !== undefined)
|
|
487
|
+
j2.append("mentioned_by", b.mentioned_by);
|
|
488
|
+
if (b?.type !== undefined)
|
|
489
|
+
j2.append("type", b.type);
|
|
490
|
+
if (b?.since !== undefined)
|
|
491
|
+
j2.append("since", b.since);
|
|
492
|
+
if (b?.before !== undefined)
|
|
493
|
+
j2.append("before", b.before);
|
|
494
|
+
if (b?.page !== undefined)
|
|
495
|
+
j2.append("page", String(b.page));
|
|
496
|
+
if (b?.per_page !== undefined)
|
|
497
|
+
j2.append("per_page", String(b.per_page));
|
|
498
|
+
let z = j2.toString(), B = `/repos/${k2}/${A}/issues${z ? `?${z}` : ""}`;
|
|
499
|
+
return this.client.get(B, f);
|
|
500
|
+
}
|
|
501
|
+
getComment(k2, A, b, f) {
|
|
502
|
+
return this.client.get(`/repos/${k2}/${A}/issues/comments/${b}`, f);
|
|
503
|
+
}
|
|
504
|
+
get(k2, A, b, f) {
|
|
505
|
+
return this.client.get(`/repos/${k2}/${A}/issues/${b}`, f);
|
|
506
|
+
}
|
|
507
|
+
listComments(k2, A, b, f, j2) {
|
|
508
|
+
let z = new URLSearchParams;
|
|
509
|
+
if (f?.since !== undefined)
|
|
510
|
+
z.append("since", f.since);
|
|
511
|
+
if (f?.before !== undefined)
|
|
512
|
+
z.append("before", f.before);
|
|
513
|
+
let B = z.toString(), D = `/repos/${k2}/${A}/issues/${b}/comments${B ? `?${B}` : ""}`;
|
|
514
|
+
return this.client.get(D, j2);
|
|
515
|
+
}
|
|
516
|
+
listLabels(k2, A, b, f) {
|
|
517
|
+
return this.client.get(`/repos/${k2}/${A}/issues/${b}/labels`, f);
|
|
518
|
+
}
|
|
519
|
+
listTimeline(k2, A, b, f, j2) {
|
|
520
|
+
let z = new URLSearchParams;
|
|
521
|
+
if (f?.page !== undefined)
|
|
522
|
+
z.append("page", String(f.page));
|
|
523
|
+
if (f?.per_page !== undefined)
|
|
524
|
+
z.append("per_page", String(f.per_page));
|
|
525
|
+
if (f?.since !== undefined)
|
|
526
|
+
z.append("since", f.since);
|
|
527
|
+
if (f?.before !== undefined)
|
|
528
|
+
z.append("before", f.before);
|
|
529
|
+
let B = z.toString(), D = `/repos/${k2}/${A}/issues/${b}/timeline${B ? `?${B}` : ""}`;
|
|
530
|
+
return this.client.get(D, j2);
|
|
384
531
|
}
|
|
385
532
|
}
|
|
386
533
|
|
|
387
|
-
// ../sdk/dist/api/
|
|
388
|
-
class
|
|
534
|
+
// ../sdk/dist/api/emails.js
|
|
535
|
+
class x {
|
|
389
536
|
client;
|
|
390
537
|
constructor(b) {
|
|
391
538
|
this.client = b;
|
|
392
539
|
}
|
|
393
|
-
list(b,
|
|
394
|
-
|
|
540
|
+
list(b, f) {
|
|
541
|
+
let j2 = new URLSearchParams;
|
|
542
|
+
if (b?.page !== undefined)
|
|
543
|
+
j2.append("page", String(b.page));
|
|
544
|
+
if (b?.per_page !== undefined)
|
|
545
|
+
j2.append("per_page", String(b.per_page));
|
|
546
|
+
let k2 = j2.toString(), w = `/user/emails${k2 ? `?${k2}` : ""}`;
|
|
547
|
+
return this.client.get(w, f);
|
|
395
548
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
if (!j3)
|
|
402
|
-
return j3;
|
|
403
|
-
let k4 = j3.match(z);
|
|
404
|
-
if (k4?.[1] && k4?.[2]) {
|
|
405
|
-
let q2 = k4[1], v = k4[2];
|
|
406
|
-
if (v.startsWith(q2))
|
|
407
|
-
return v;
|
|
549
|
+
create(b, f) {
|
|
550
|
+
return this.client.post("/user/emails", b, f);
|
|
551
|
+
}
|
|
552
|
+
delete(b, f) {
|
|
553
|
+
return this.client.delete("/user/emails", b, f);
|
|
408
554
|
}
|
|
409
|
-
return j3;
|
|
410
|
-
}
|
|
411
|
-
function J(j3) {
|
|
412
|
-
let k4 = ["clone_url", "html_url", "url", "git_url", "mirror_url"], q2 = { ...j3 };
|
|
413
|
-
for (let v of k4)
|
|
414
|
-
if (typeof q2[v] === "string")
|
|
415
|
-
q2[v] = E(q2[v]);
|
|
416
|
-
return q2;
|
|
417
555
|
}
|
|
418
556
|
|
|
419
557
|
// ../sdk/dist/api/repositories.js
|
|
420
|
-
class
|
|
558
|
+
class E2 {
|
|
421
559
|
client;
|
|
422
|
-
constructor(
|
|
423
|
-
this.client =
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
560
|
+
constructor(k2) {
|
|
561
|
+
this.client = k2;
|
|
562
|
+
}
|
|
563
|
+
get(k2, x2, j2) {
|
|
564
|
+
return this.client.get(`/repos/${k2}/${x2}`, j2);
|
|
565
|
+
}
|
|
566
|
+
update(k2, x2, j2, v2) {
|
|
567
|
+
return this.client.patch(`/repos/${k2}/${x2}`, j2, v2);
|
|
568
|
+
}
|
|
569
|
+
delete(k2, x2, j2) {
|
|
570
|
+
return this.client.delete(`/repos/${k2}/${x2}`, undefined, j2);
|
|
571
|
+
}
|
|
572
|
+
listRepoSecrets(k2, x2, j2, v2) {
|
|
573
|
+
let z = new URLSearchParams;
|
|
574
|
+
if (j2?.per_page !== undefined)
|
|
575
|
+
z.append("per_page", j2.per_page);
|
|
576
|
+
if (j2?.page !== undefined)
|
|
577
|
+
z.append("page", j2.page);
|
|
578
|
+
let A = z.toString(), B = `/repos/${k2}/${x2}/actions/secrets${A ? `?${A}` : ""}`;
|
|
579
|
+
return this.client.get(B, v2);
|
|
580
|
+
}
|
|
581
|
+
getRepoSecret(k2, x2, j2, v2) {
|
|
582
|
+
return this.client.get(`/repos/${k2}/${x2}/actions/secrets/${j2}`, v2);
|
|
583
|
+
}
|
|
584
|
+
createOrUpdateRepoSecret(k2, x2, j2, v2, z) {
|
|
585
|
+
let A = new URLSearchParams;
|
|
586
|
+
if (v2?.encrypted_value !== undefined)
|
|
587
|
+
A.append("encrypted_value", v2.encrypted_value);
|
|
588
|
+
let B = A.toString(), D = `/repos/${k2}/${x2}/actions/secrets/${j2}${B ? `?${B}` : ""}`;
|
|
589
|
+
return this.client.put(D, z);
|
|
590
|
+
}
|
|
591
|
+
deleteRepoSecret(k2, x2, j2, v2) {
|
|
592
|
+
return this.client.delete(`/repos/${k2}/${x2}/actions/secrets/${j2}`, undefined, v2);
|
|
593
|
+
}
|
|
594
|
+
listBranches(k2, x2, j2, v2) {
|
|
595
|
+
let z = new URLSearchParams;
|
|
596
|
+
if (j2?.page !== undefined)
|
|
597
|
+
z.append("page", String(j2.page));
|
|
598
|
+
if (j2?.per_page !== undefined)
|
|
599
|
+
z.append("per_page", String(j2.per_page));
|
|
600
|
+
if (j2?.q !== undefined)
|
|
601
|
+
z.append("q", j2.q);
|
|
602
|
+
let A = z.toString(), B = `/repos/${k2}/${x2}/branches${A ? `?${A}` : ""}`;
|
|
603
|
+
return this.client.get(B, v2);
|
|
604
|
+
}
|
|
605
|
+
listCollaborators(k2, x2, j2, v2) {
|
|
606
|
+
let z = new URLSearchParams;
|
|
607
|
+
if (j2?.affiliation !== undefined)
|
|
608
|
+
z.append("affiliation", j2.affiliation);
|
|
609
|
+
if (j2?.permission !== undefined)
|
|
610
|
+
z.append("permission", j2.permission);
|
|
611
|
+
if (j2?.page !== undefined)
|
|
612
|
+
z.append("page", String(j2.page));
|
|
613
|
+
if (j2?.per_page !== undefined)
|
|
614
|
+
z.append("per_page", String(j2.per_page));
|
|
615
|
+
let A = z.toString(), B = `/repos/${k2}/${x2}/collaborators${A ? `?${A}` : ""}`;
|
|
616
|
+
return this.client.get(B, v2);
|
|
617
|
+
}
|
|
618
|
+
addCollaborator(k2, x2, j2, v2, z) {
|
|
619
|
+
return this.client.put(`/repos/${k2}/${x2}/collaborators/${j2}`, v2, z);
|
|
620
|
+
}
|
|
621
|
+
listCommits(k2, x2, j2, v2) {
|
|
622
|
+
let z = new URLSearchParams;
|
|
623
|
+
if (j2?.page !== undefined)
|
|
624
|
+
z.append("page", String(j2.page));
|
|
625
|
+
if (j2?.per_page !== undefined)
|
|
626
|
+
z.append("per_page", String(j2.per_page));
|
|
627
|
+
if (j2?.sha !== undefined)
|
|
628
|
+
z.append("sha", j2.sha);
|
|
629
|
+
if (j2?.path !== undefined)
|
|
630
|
+
z.append("path", j2.path);
|
|
631
|
+
if (j2?.not !== undefined)
|
|
632
|
+
z.append("not", j2.not);
|
|
633
|
+
if (j2?.author !== undefined)
|
|
634
|
+
z.append("author", j2.author);
|
|
635
|
+
if (j2?.committer !== undefined)
|
|
636
|
+
z.append("committer", j2.committer);
|
|
637
|
+
if (j2?.since !== undefined)
|
|
638
|
+
z.append("since", j2.since);
|
|
639
|
+
if (j2?.until !== undefined)
|
|
640
|
+
z.append("until", j2.until);
|
|
641
|
+
let A = z.toString(), B = `/repos/${k2}/${x2}/commits${A ? `?${A}` : ""}`;
|
|
642
|
+
return this.client.get(B, v2);
|
|
643
|
+
}
|
|
644
|
+
getCommit(k2, x2, j2, v2) {
|
|
645
|
+
return this.client.get(`/repos/${k2}/${x2}/commits/${j2}`, v2);
|
|
646
|
+
}
|
|
647
|
+
compareCommits(k2, x2, j2, v2, z) {
|
|
648
|
+
let A = new URLSearchParams;
|
|
649
|
+
if (v2?.page !== undefined)
|
|
650
|
+
A.append("page", String(v2.page));
|
|
651
|
+
if (v2?.per_page !== undefined)
|
|
652
|
+
A.append("per_page", String(v2.per_page));
|
|
653
|
+
let B = A.toString(), D = `/repos/${k2}/${x2}/compare/${j2}${B ? `?${B}` : ""}`;
|
|
654
|
+
return this.client.get(D, z);
|
|
655
|
+
}
|
|
656
|
+
getContent(k2, x2, j2, v2, z) {
|
|
657
|
+
let A = new URLSearchParams;
|
|
658
|
+
if (v2?.ref !== undefined)
|
|
659
|
+
A.append("ref", v2.ref);
|
|
660
|
+
if (v2?.scope !== undefined)
|
|
661
|
+
A.append("scope", v2.scope);
|
|
662
|
+
let B = A.toString(), D = `/repos/${k2}/${x2}/contents/${j2}${B ? `?${B}` : ""}`;
|
|
663
|
+
return this.client.get(D, z);
|
|
664
|
+
}
|
|
665
|
+
createOrUpdateFile(k2, x2, j2, v2, z) {
|
|
666
|
+
return this.client.put(`/repos/${k2}/${x2}/contents/${j2}`, v2, z);
|
|
667
|
+
}
|
|
668
|
+
deleteFile(k2, x2, j2, v2, z) {
|
|
669
|
+
return this.client.delete(`/repos/${k2}/${x2}/contents/${j2}`, v2, z);
|
|
670
|
+
}
|
|
671
|
+
createFork(k2, x2, j2, v2) {
|
|
672
|
+
return this.client.post(`/repos/${k2}/${x2}/forks`, j2, v2);
|
|
673
|
+
}
|
|
674
|
+
createCommit(k2, x2, j2, v2) {
|
|
675
|
+
return this.client.post(`/repos/${k2}/${x2}/git/commits`, j2, v2);
|
|
676
|
+
}
|
|
677
|
+
createRef(k2, x2, j2, v2) {
|
|
678
|
+
return this.client.post(`/repos/${k2}/${x2}/git/refs`, j2, v2);
|
|
679
|
+
}
|
|
680
|
+
createTree(k2, x2, j2, v2) {
|
|
681
|
+
return this.client.post(`/repos/${k2}/${x2}/git/trees`, j2, v2);
|
|
682
|
+
}
|
|
683
|
+
getTree(k2, x2, j2, v2, z) {
|
|
684
|
+
let A = new URLSearchParams;
|
|
685
|
+
if (v2?.page !== undefined)
|
|
686
|
+
A.append("page", String(v2.page));
|
|
687
|
+
if (v2?.per_page !== undefined)
|
|
688
|
+
A.append("per_page", String(v2.per_page));
|
|
689
|
+
if (v2?.recursive !== undefined)
|
|
690
|
+
A.append("recursive", String(v2.recursive));
|
|
691
|
+
let B = A.toString(), D = `/repos/${k2}/${x2}/git/trees/${j2}${B ? `?${B}` : ""}`;
|
|
692
|
+
return this.client.get(D, z);
|
|
693
|
+
}
|
|
694
|
+
listLanguages(k2, x2, j2) {
|
|
695
|
+
return this.client.get(`/repos/${k2}/${x2}/languages`, j2);
|
|
696
|
+
}
|
|
697
|
+
listPulls(k2, x2, j2, v2) {
|
|
698
|
+
let z = new URLSearchParams;
|
|
699
|
+
if (j2?.state !== undefined)
|
|
700
|
+
z.append("state", j2.state);
|
|
701
|
+
if (j2?.head !== undefined)
|
|
702
|
+
z.append("head", j2.head);
|
|
703
|
+
if (j2?.base !== undefined)
|
|
704
|
+
z.append("base", j2.base);
|
|
705
|
+
if (j2?.sort !== undefined)
|
|
706
|
+
z.append("sort", j2.sort);
|
|
707
|
+
if (j2?.direction !== undefined)
|
|
708
|
+
z.append("direction", j2.direction);
|
|
709
|
+
if (j2?.page !== undefined)
|
|
710
|
+
z.append("page", String(j2.page));
|
|
711
|
+
if (j2?.per_page !== undefined)
|
|
712
|
+
z.append("per_page", String(j2.per_page));
|
|
713
|
+
let A = z.toString(), B = `/repos/${k2}/${x2}/pulls${A ? `?${A}` : ""}`;
|
|
714
|
+
return this.client.get(B, v2);
|
|
715
|
+
}
|
|
716
|
+
getPull(k2, x2, j2, v2) {
|
|
717
|
+
return this.client.get(`/repos/${k2}/${x2}/pulls/${j2}`, v2);
|
|
718
|
+
}
|
|
719
|
+
updatePull(k2, x2, j2, v2, z) {
|
|
720
|
+
return this.client.patch(`/repos/${k2}/${x2}/pulls/${j2}`, v2, z);
|
|
721
|
+
}
|
|
722
|
+
listForAuthenticatedUser(k2, x2) {
|
|
723
|
+
let j2 = new URLSearchParams;
|
|
724
|
+
if (k2?.page !== undefined)
|
|
725
|
+
j2.append("page", String(k2.page));
|
|
726
|
+
if (k2?.per_page !== undefined)
|
|
727
|
+
j2.append("per_page", String(k2.per_page));
|
|
728
|
+
let v2 = j2.toString(), z = `/user/repos${v2 ? `?${v2}` : ""}`;
|
|
729
|
+
return this.client.get(z, x2);
|
|
730
|
+
}
|
|
731
|
+
createForAuthenticatedUser(k2, x2) {
|
|
732
|
+
return this.client.post("/user/repos", k2, x2);
|
|
448
733
|
}
|
|
449
734
|
}
|
|
450
735
|
|
|
451
|
-
// ../sdk/dist/api/
|
|
452
|
-
class
|
|
736
|
+
// ../sdk/dist/api/teams.js
|
|
737
|
+
class E3 {
|
|
453
738
|
client;
|
|
454
|
-
constructor(
|
|
455
|
-
this.client =
|
|
456
|
-
}
|
|
457
|
-
list(
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
739
|
+
constructor(x2) {
|
|
740
|
+
this.client = x2;
|
|
741
|
+
}
|
|
742
|
+
list(x2, b, j2) {
|
|
743
|
+
let B = new URLSearchParams;
|
|
744
|
+
if (b?.page !== undefined)
|
|
745
|
+
B.append("page", String(b.page));
|
|
746
|
+
if (b?.per_page !== undefined)
|
|
747
|
+
B.append("per_page", String(b.per_page));
|
|
748
|
+
let k2 = B.toString(), C = `/orgs/${x2}/teams${k2 ? `?${k2}` : ""}`;
|
|
749
|
+
return this.client.get(C, j2);
|
|
750
|
+
}
|
|
751
|
+
listMembers(x2, b, j2, B) {
|
|
752
|
+
let k2 = new URLSearchParams;
|
|
753
|
+
if (j2?.page !== undefined)
|
|
754
|
+
k2.append("page", String(j2.page));
|
|
755
|
+
if (j2?.per_page !== undefined)
|
|
756
|
+
k2.append("per_page", String(j2.per_page));
|
|
757
|
+
let C = k2.toString(), D = `/orgs/${x2}/teams/${b}/members${C ? `?${C}` : ""}`;
|
|
758
|
+
return this.client.get(D, B);
|
|
759
|
+
}
|
|
760
|
+
updateRepo(x2, b, j2, B, k2, C) {
|
|
761
|
+
return this.client.put(`/orgs/${x2}/teams/${b}/repos/${j2}/${B}`, k2, C);
|
|
462
762
|
}
|
|
463
763
|
}
|
|
464
764
|
|
|
465
|
-
// ../sdk/dist/api/
|
|
466
|
-
class
|
|
765
|
+
// ../sdk/dist/api/releases.js
|
|
766
|
+
class G {
|
|
467
767
|
client;
|
|
468
|
-
constructor(
|
|
469
|
-
this.client =
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
768
|
+
constructor(k2) {
|
|
769
|
+
this.client = k2;
|
|
770
|
+
}
|
|
771
|
+
list(k2, A, b, j2) {
|
|
772
|
+
let B = new URLSearchParams;
|
|
773
|
+
if (b?.page !== undefined)
|
|
774
|
+
B.append("page", String(b.page));
|
|
775
|
+
if (b?.per_page !== undefined)
|
|
776
|
+
B.append("per_page", String(b.per_page));
|
|
777
|
+
if (b?.draft !== undefined)
|
|
778
|
+
B.append("draft", String(b.draft));
|
|
779
|
+
if (b?.pre_release !== undefined)
|
|
780
|
+
B.append("pre_release", String(b.pre_release));
|
|
781
|
+
let C = B.toString(), E4 = `/repos/${k2}/${A}/releases${C ? `?${C}` : ""}`;
|
|
782
|
+
return this.client.get(E4, j2);
|
|
783
|
+
}
|
|
784
|
+
create(k2, A, b, j2) {
|
|
785
|
+
return this.client.post(`/repos/${k2}/${A}/releases`, b, j2);
|
|
786
|
+
}
|
|
787
|
+
getByTag(k2, A, b, j2) {
|
|
788
|
+
return this.client.get(`/repos/${k2}/${A}/releases/tags/${b}`, j2);
|
|
789
|
+
}
|
|
790
|
+
deleteByTag(k2, A, b, j2) {
|
|
791
|
+
return this.client.delete(`/repos/${k2}/${A}/releases/tags/${b}`, undefined, j2);
|
|
792
|
+
}
|
|
793
|
+
get(k2, A, b, j2) {
|
|
794
|
+
return this.client.get(`/repos/${k2}/${A}/releases/${b}`, j2);
|
|
795
|
+
}
|
|
796
|
+
update(k2, A, b, j2, B) {
|
|
797
|
+
return this.client.patch(`/repos/${k2}/${A}/releases/${b}`, j2, B);
|
|
798
|
+
}
|
|
799
|
+
delete(k2, A, b, j2) {
|
|
800
|
+
return this.client.delete(`/repos/${k2}/${A}/releases/${b}`, undefined, j2);
|
|
801
|
+
}
|
|
802
|
+
listAssets(k2, A, b, j2, B) {
|
|
803
|
+
let C = new URLSearchParams;
|
|
804
|
+
if (j2?.page !== undefined)
|
|
805
|
+
C.append("page", String(j2.page));
|
|
806
|
+
if (j2?.per_page !== undefined)
|
|
807
|
+
C.append("per_page", String(j2.per_page));
|
|
808
|
+
let E4 = C.toString(), F = `/repos/${k2}/${A}/releases/${b}/assets${E4 ? `?${E4}` : ""}`;
|
|
809
|
+
return this.client.get(F, B);
|
|
810
|
+
}
|
|
811
|
+
uploadAsset(k2, A, b, j2, B) {
|
|
812
|
+
let C = new URLSearchParams;
|
|
813
|
+
if (j2?.name !== undefined)
|
|
814
|
+
C.append("name", j2.name);
|
|
815
|
+
let E4 = C.toString(), F = `/repos/${k2}/${A}/releases/${b}/assets${E4 ? `?${E4}` : ""}`;
|
|
816
|
+
return this.client.post(F, B);
|
|
817
|
+
}
|
|
818
|
+
deleteAsset(k2, A, b, j2, B) {
|
|
819
|
+
return this.client.delete(`/repos/${k2}/${A}/releases/${b}/assets/${j2}`, undefined, B);
|
|
482
820
|
}
|
|
483
821
|
}
|
|
484
822
|
|
|
485
|
-
// ../sdk/dist/api/
|
|
486
|
-
class
|
|
823
|
+
// ../sdk/dist/api/pulls.js
|
|
824
|
+
class I {
|
|
487
825
|
client;
|
|
488
|
-
constructor(
|
|
489
|
-
this.client =
|
|
490
|
-
}
|
|
491
|
-
list(b, d) {
|
|
492
|
-
return this.client.get(`/orgs/${b}/teams`, d);
|
|
493
|
-
}
|
|
494
|
-
getInvitations(b, d, f) {
|
|
495
|
-
return this.client.get(`/orgs/${b}/teams/${d}/invitations`, f);
|
|
826
|
+
constructor(k2) {
|
|
827
|
+
this.client = k2;
|
|
496
828
|
}
|
|
497
|
-
|
|
498
|
-
return this.client.
|
|
829
|
+
create(k2, v2, z, j2) {
|
|
830
|
+
return this.client.post(`/repos/${k2}/${v2}/pulls`, z, j2);
|
|
499
831
|
}
|
|
500
|
-
|
|
501
|
-
|
|
832
|
+
listCommits(k2, v2, z, j2, D) {
|
|
833
|
+
let C = new URLSearchParams;
|
|
834
|
+
if (j2?.page !== undefined)
|
|
835
|
+
C.append("page", String(j2.page));
|
|
836
|
+
if (j2?.per_page !== undefined)
|
|
837
|
+
C.append("per_page", String(j2.per_page));
|
|
838
|
+
let F = C.toString(), G2 = `/repos/${k2}/${v2}/pulls/${z}/commits${F ? `?${F}` : ""}`;
|
|
839
|
+
return this.client.get(G2, D);
|
|
502
840
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
createRef(b, d, f, g2) {
|
|
512
|
-
return this.client.post(`/repos/${b}/${d}/git/refs`, f, g2);
|
|
841
|
+
listFiles(k2, v2, z, j2, D) {
|
|
842
|
+
let C = new URLSearchParams;
|
|
843
|
+
if (j2?.page !== undefined)
|
|
844
|
+
C.append("page", String(j2.page));
|
|
845
|
+
if (j2?.per_page !== undefined)
|
|
846
|
+
C.append("per_page", String(j2.per_page));
|
|
847
|
+
let F = C.toString(), G2 = `/repos/${k2}/${v2}/pulls/${z}/files${F ? `?${F}` : ""}`;
|
|
848
|
+
return this.client.get(G2, D);
|
|
513
849
|
}
|
|
514
|
-
|
|
515
|
-
return this.client.
|
|
850
|
+
isMerged(k2, v2, z, j2) {
|
|
851
|
+
return this.client.get(`/repos/${k2}/${v2}/pulls/${z}/merge`, j2);
|
|
516
852
|
}
|
|
517
|
-
|
|
518
|
-
return this.client.
|
|
853
|
+
updateBranch(k2, v2, z, j2, D) {
|
|
854
|
+
return this.client.put(`/repos/${k2}/${v2}/pulls/${z}/update-branch`, j2, D);
|
|
519
855
|
}
|
|
520
856
|
}
|
|
521
857
|
|
|
522
|
-
// ../sdk/dist/api/
|
|
523
|
-
class
|
|
858
|
+
// ../sdk/dist/api/organizations.js
|
|
859
|
+
class F {
|
|
524
860
|
client;
|
|
525
|
-
constructor(
|
|
526
|
-
this.client =
|
|
527
|
-
}
|
|
528
|
-
list(b, f, h) {
|
|
529
|
-
return this.client.get(`/repos/${b}/${f}/releases`, h);
|
|
530
|
-
}
|
|
531
|
-
create(b, f, h, j5) {
|
|
532
|
-
return this.client.post(`/repos/${b}/${f}/releases`, h, j5);
|
|
861
|
+
constructor(w) {
|
|
862
|
+
this.client = w;
|
|
533
863
|
}
|
|
534
|
-
|
|
535
|
-
|
|
864
|
+
listOrgSecrets(w, j2, x2) {
|
|
865
|
+
let A = new URLSearchParams;
|
|
866
|
+
if (j2?.per_page !== undefined)
|
|
867
|
+
A.append("per_page", j2.per_page);
|
|
868
|
+
if (j2?.page !== undefined)
|
|
869
|
+
A.append("page", j2.page);
|
|
870
|
+
let B = A.toString(), D = `/orgs/${w}/actions/secrets${B ? `?${B}` : ""}`;
|
|
871
|
+
return this.client.get(D, x2);
|
|
536
872
|
}
|
|
537
|
-
|
|
538
|
-
return this.client.
|
|
873
|
+
getOrgSecret(w, j2, x2) {
|
|
874
|
+
return this.client.get(`/orgs/${w}/actions/secrets/${j2}`, x2);
|
|
539
875
|
}
|
|
540
|
-
|
|
541
|
-
|
|
876
|
+
createOrUpdateOrgSecret(w, j2, x2, A) {
|
|
877
|
+
let B = new URLSearchParams;
|
|
878
|
+
if (x2?.encrypted_value !== undefined)
|
|
879
|
+
B.append("encrypted_value", x2.encrypted_value);
|
|
880
|
+
let D = B.toString(), E4 = `/orgs/${w}/actions/secrets/${j2}${D ? `?${D}` : ""}`;
|
|
881
|
+
return this.client.put(E4, A);
|
|
542
882
|
}
|
|
543
|
-
|
|
544
|
-
return this.client.delete(`/
|
|
883
|
+
deleteOrgSecret(w, j2, x2) {
|
|
884
|
+
return this.client.delete(`/orgs/${w}/actions/secrets/${j2}`, undefined, x2);
|
|
545
885
|
}
|
|
546
|
-
|
|
547
|
-
return this.client.
|
|
548
|
-
}
|
|
549
|
-
getAssets(b, f, h, j5) {
|
|
550
|
-
return this.client.get(`/repos/${b}/${f}/releases/${h}/assets`, j5);
|
|
551
|
-
}
|
|
552
|
-
uploadAsset(b, f, h, j5, k6) {
|
|
553
|
-
return this.client.post(`/repos/${b}/${f}/releases/${h}/assets`, j5, k6);
|
|
554
|
-
}
|
|
555
|
-
deleteAsset(b, f, h, j5, k6) {
|
|
556
|
-
return this.client.delete(`/repos/${b}/${f}/releases/${h}/assets/${j5}`, undefined, k6);
|
|
886
|
+
isMember(w, j2, x2) {
|
|
887
|
+
return this.client.get(`/orgs/${w}/members/${j2}`, x2);
|
|
557
888
|
}
|
|
558
889
|
}
|
|
559
890
|
|
|
560
|
-
// ../sdk/dist/api/
|
|
561
|
-
class
|
|
891
|
+
// ../sdk/dist/api/actions.js
|
|
892
|
+
class F2 {
|
|
562
893
|
client;
|
|
563
|
-
constructor(
|
|
564
|
-
this.client =
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
894
|
+
constructor(x2) {
|
|
895
|
+
this.client = x2;
|
|
896
|
+
}
|
|
897
|
+
listOrgRunners(x2, j2, b) {
|
|
898
|
+
let z = new URLSearchParams;
|
|
899
|
+
if (j2?.page !== undefined)
|
|
900
|
+
z.append("page", String(j2.page));
|
|
901
|
+
if (j2?.per_page !== undefined)
|
|
902
|
+
z.append("per_page", String(j2.per_page));
|
|
903
|
+
let A = z.toString(), B = `/orgs/${x2}/actions/runners${A ? `?${A}` : ""}`;
|
|
904
|
+
return this.client.get(B, b);
|
|
905
|
+
}
|
|
906
|
+
createOrgRunnerRegistrationToken(x2, j2) {
|
|
907
|
+
return this.client.post(`/orgs/${x2}/actions/runners/registration-token`, j2);
|
|
908
|
+
}
|
|
909
|
+
getOrgRunner(x2, j2, b) {
|
|
910
|
+
return this.client.get(`/orgs/${x2}/actions/runners/${j2}`, b);
|
|
911
|
+
}
|
|
912
|
+
deleteOrgRunner(x2, j2, b) {
|
|
913
|
+
return this.client.delete(`/orgs/${x2}/actions/runners/${j2}`, undefined, b);
|
|
914
|
+
}
|
|
915
|
+
listOrgVariables(x2, j2, b) {
|
|
916
|
+
let z = new URLSearchParams;
|
|
917
|
+
if (j2?.per_page !== undefined)
|
|
918
|
+
z.append("per_page", String(j2.per_page));
|
|
919
|
+
if (j2?.page !== undefined)
|
|
920
|
+
z.append("page", String(j2.page));
|
|
921
|
+
let A = z.toString(), B = `/orgs/${x2}/actions/variables${A ? `?${A}` : ""}`;
|
|
922
|
+
return this.client.get(B, b);
|
|
923
|
+
}
|
|
924
|
+
createOrgVariable(x2, j2, b) {
|
|
925
|
+
return this.client.post(`/orgs/${x2}/actions/variables`, j2, b);
|
|
926
|
+
}
|
|
927
|
+
getOrgVariable(x2, j2, b) {
|
|
928
|
+
return this.client.get(`/orgs/${x2}/actions/variables/${j2}`, b);
|
|
929
|
+
}
|
|
930
|
+
updateOrgVariable(x2, j2, b, z) {
|
|
931
|
+
return this.client.patch(`/orgs/${x2}/actions/variables/${j2}`, b, z);
|
|
932
|
+
}
|
|
933
|
+
deleteOrgVariable(x2, j2, b) {
|
|
934
|
+
return this.client.delete(`/orgs/${x2}/actions/variables/${j2}`, undefined, b);
|
|
935
|
+
}
|
|
936
|
+
listArtifacts(x2, j2, b, z) {
|
|
937
|
+
let A = new URLSearchParams;
|
|
938
|
+
if (b?.page !== undefined)
|
|
939
|
+
A.append("page", String(b.page));
|
|
940
|
+
if (b?.per_page !== undefined)
|
|
941
|
+
A.append("per_page", String(b.per_page));
|
|
942
|
+
if (b?.name !== undefined)
|
|
943
|
+
A.append("name", b.name);
|
|
944
|
+
let B = A.toString(), C = `/repos/${x2}/${j2}/actions/artifacts${B ? `?${B}` : ""}`;
|
|
945
|
+
return this.client.get(C, z);
|
|
946
|
+
}
|
|
947
|
+
getArtifact(x2, j2, b, z) {
|
|
948
|
+
return this.client.get(`/repos/${x2}/${j2}/actions/artifacts/${b}`, z);
|
|
949
|
+
}
|
|
950
|
+
deleteArtifact(x2, j2, b, z) {
|
|
951
|
+
return this.client.delete(`/repos/${x2}/${j2}/actions/artifacts/${b}`, undefined, z);
|
|
952
|
+
}
|
|
953
|
+
downloadArtifact(x2, j2, b, z) {
|
|
954
|
+
return this.client.get(`/repos/${x2}/${j2}/actions/artifacts/${b}/zip`, z);
|
|
955
|
+
}
|
|
956
|
+
downloadArtifactRaw(x2, j2, b, z) {
|
|
957
|
+
return this.client.get(`/repos/${x2}/${j2}/actions/artifacts/${b}/zip/raw`, z);
|
|
958
|
+
}
|
|
959
|
+
createActionLink(x2, j2, b, z) {
|
|
960
|
+
return this.client.post(`/repos/${x2}/${j2}/actions/links`, b, z);
|
|
961
|
+
}
|
|
962
|
+
listRepoRunners(x2, j2, b, z) {
|
|
963
|
+
let A = new URLSearchParams;
|
|
964
|
+
if (b?.page !== undefined)
|
|
965
|
+
A.append("page", String(b.page));
|
|
966
|
+
if (b?.per_page !== undefined)
|
|
967
|
+
A.append("per_page", String(b.per_page));
|
|
968
|
+
let B = A.toString(), C = `/repos/${x2}/${j2}/actions/runners${B ? `?${B}` : ""}`;
|
|
969
|
+
return this.client.get(C, z);
|
|
970
|
+
}
|
|
971
|
+
createRepoRunnerRegistrationToken(x2, j2, b) {
|
|
972
|
+
return this.client.post(`/repos/${x2}/${j2}/actions/runners/registration-token`, b);
|
|
973
|
+
}
|
|
974
|
+
getRepoRunner(x2, j2, b, z) {
|
|
975
|
+
return this.client.get(`/repos/${x2}/${j2}/actions/runners/${b}`, z);
|
|
976
|
+
}
|
|
977
|
+
deleteRepoRunner(x2, j2, b, z) {
|
|
978
|
+
return this.client.delete(`/repos/${x2}/${j2}/actions/runners/${b}`, undefined, z);
|
|
979
|
+
}
|
|
980
|
+
listRepoVariables(x2, j2, b, z) {
|
|
981
|
+
let A = new URLSearchParams;
|
|
982
|
+
if (b?.per_page !== undefined)
|
|
983
|
+
A.append("per_page", String(b.per_page));
|
|
984
|
+
if (b?.page !== undefined)
|
|
985
|
+
A.append("page", String(b.page));
|
|
986
|
+
let B = A.toString(), C = `/repos/${x2}/${j2}/actions/variables${B ? `?${B}` : ""}`;
|
|
987
|
+
return this.client.get(C, z);
|
|
988
|
+
}
|
|
989
|
+
createRepoVariable(x2, j2, b, z) {
|
|
990
|
+
return this.client.post(`/repos/${x2}/${j2}/actions/variables`, b, z);
|
|
991
|
+
}
|
|
992
|
+
getRepoVariable(x2, j2, b, z) {
|
|
993
|
+
return this.client.get(`/repos/${x2}/${j2}/actions/variables/${b}`, z);
|
|
994
|
+
}
|
|
995
|
+
updateRepoVariable(x2, j2, b, z, A) {
|
|
996
|
+
return this.client.patch(`/repos/${x2}/${j2}/actions/variables/${b}`, z, A);
|
|
997
|
+
}
|
|
998
|
+
deleteRepoVariable(x2, j2, b, z) {
|
|
999
|
+
return this.client.delete(`/repos/${x2}/${j2}/actions/variables/${b}`, undefined, z);
|
|
1000
|
+
}
|
|
1001
|
+
getWorkflowDispatchInputs(x2, j2, b, z, A) {
|
|
1002
|
+
let B = new URLSearchParams;
|
|
1003
|
+
if (z?.branch !== undefined)
|
|
1004
|
+
B.append("branch", z.branch);
|
|
1005
|
+
if (z?.tag !== undefined)
|
|
1006
|
+
B.append("tag", z.tag);
|
|
1007
|
+
let C = B.toString(), D = `/repos/${x2}/${j2}/actions/workflows/${b}/dispatches${C ? `?${C}` : ""}`;
|
|
1008
|
+
return this.client.get(D, A);
|
|
1009
|
+
}
|
|
1010
|
+
dispatchWorkflow(x2, j2, b, z, A, B) {
|
|
1011
|
+
let C = new URLSearchParams;
|
|
1012
|
+
if (A?.branch !== undefined)
|
|
1013
|
+
C.append("branch", A.branch);
|
|
1014
|
+
if (A?.tag !== undefined)
|
|
1015
|
+
C.append("tag", A.tag);
|
|
1016
|
+
let D = C.toString(), E4 = `/repos/${x2}/${j2}/actions/workflows/${b}/dispatches${D ? `?${D}` : ""}`;
|
|
1017
|
+
return this.client.post(E4, z, B);
|
|
596
1018
|
}
|
|
597
1019
|
}
|
|
598
1020
|
|
|
599
|
-
// ../sdk/dist/api/
|
|
600
|
-
class
|
|
1021
|
+
// ../sdk/dist/api/stars.js
|
|
1022
|
+
class A {
|
|
601
1023
|
client;
|
|
602
1024
|
constructor(b) {
|
|
603
1025
|
this.client = b;
|
|
604
1026
|
}
|
|
605
|
-
|
|
606
|
-
let
|
|
607
|
-
|
|
1027
|
+
list(b, k2) {
|
|
1028
|
+
let j2 = new URLSearchParams;
|
|
1029
|
+
if (b?.page !== undefined)
|
|
1030
|
+
j2.append("page", String(b.page));
|
|
1031
|
+
if (b?.per_page !== undefined)
|
|
1032
|
+
j2.append("per_page", String(b.per_page));
|
|
1033
|
+
if (b?.sort !== undefined)
|
|
1034
|
+
j2.append("sort", b.sort);
|
|
1035
|
+
if (b?.direction !== undefined)
|
|
1036
|
+
j2.append("direction", b.direction);
|
|
1037
|
+
let x2 = j2.toString(), z = `/user/starred${x2 ? `?${x2}` : ""}`;
|
|
1038
|
+
return this.client.get(z, k2);
|
|
608
1039
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
// ../sdk/dist/client.js
|
|
612
|
-
var J2 = { DELETE: "DELETE", GET: "GET", PATCH: "PATCH", POST: "POST", PUT: "PUT" };
|
|
613
|
-
|
|
614
|
-
class $ {
|
|
615
|
-
baseUrl;
|
|
616
|
-
token;
|
|
617
|
-
apiVersion;
|
|
618
|
-
onApiVersionWarning;
|
|
619
|
-
constructor(j5 = {}) {
|
|
620
|
-
this.baseUrl = j5.baseUrl || "https://api.gitverse.ru", this.token = j5.token, this.apiVersion = j5.apiVersion || "1";
|
|
1040
|
+
isStarred(b, k2, j2) {
|
|
1041
|
+
return this.client.get(`/user/starred/${b}/${k2}`, j2);
|
|
621
1042
|
}
|
|
622
|
-
|
|
623
|
-
this.
|
|
1043
|
+
star(b, k2, j2) {
|
|
1044
|
+
return this.client.put(`/user/starred/${b}/${k2}`, j2);
|
|
624
1045
|
}
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
if (!(x2 && z2))
|
|
628
|
-
return;
|
|
629
|
-
let K = Number.parseInt(z2, 10), D = B2 ? Number.parseInt(B2, 10) : Math.floor(Date.now() / 1000) + K, U = q4 ? Number.parseInt(q4, 10) : 0;
|
|
630
|
-
return { limit: Number.parseInt(x2, 10), remaining: U, reset: D, retryAfter: K };
|
|
631
|
-
}
|
|
632
|
-
extractApiVersionInfo(j5) {
|
|
633
|
-
let x2 = j5.get("Gitverse-Api-Version"), q4 = j5.get("Gitverse-Api-Latest-Version"), z2 = j5.get("Gitverse-Api-Deprecation") === "true", B2 = j5.get("Gitverse-Api-Decommissioning");
|
|
634
|
-
if (!(x2 && q4))
|
|
635
|
-
return;
|
|
636
|
-
return { decommissioning: B2 || undefined, deprecated: z2, latestVersion: q4, version: x2 };
|
|
637
|
-
}
|
|
638
|
-
extractMetadata(j5) {
|
|
639
|
-
let x2 = this.extractRateLimitInfo(j5), q4 = this.extractApiVersionInfo(j5);
|
|
640
|
-
if (q4?.deprecated && this.onApiVersionWarning) {
|
|
641
|
-
let z2 = new q(q4.version, q4.latestVersion, q4.decommissioning);
|
|
642
|
-
this.onApiVersionWarning(z2);
|
|
643
|
-
}
|
|
644
|
-
return { apiVersion: q4, rateLimit: x2 };
|
|
645
|
-
}
|
|
646
|
-
async request(j5, x2, q4, z2) {
|
|
647
|
-
let B2 = j5.startsWith("/") ? j5.slice(1) : j5, K = `${this.baseUrl}/${B2}`, D = new Headers;
|
|
648
|
-
if (D.set("Content-Type", "application/json"), D.set("Accept", `application/vnd.gitverse.object+json; version=${this.apiVersion}`), this.token)
|
|
649
|
-
D.set("Authorization", `Bearer ${this.token}`);
|
|
650
|
-
let U = { body: q4 ? JSON.stringify(q4) : undefined, headers: D, method: x2, signal: z2?.signal }, F = await fetch(K, U), Q = this.extractMetadata(F.headers), S;
|
|
651
|
-
try {
|
|
652
|
-
S = await F.json();
|
|
653
|
-
} catch {
|
|
654
|
-
S = undefined;
|
|
655
|
-
}
|
|
656
|
-
if (!F.ok) {
|
|
657
|
-
let X = S?.message || F.statusText;
|
|
658
|
-
if (F.status === 429 && Q.rateLimit)
|
|
659
|
-
throw new k2(X || "Превышен лимит запросов. Попробуйте позже.", Q.rateLimit, Q);
|
|
660
|
-
throw new j2(F.status, X, Q);
|
|
661
|
-
}
|
|
662
|
-
return S;
|
|
663
|
-
}
|
|
664
|
-
get(j5, x2) {
|
|
665
|
-
return this.request(j5, J2.GET, undefined, x2);
|
|
666
|
-
}
|
|
667
|
-
post(j5, x2, q4) {
|
|
668
|
-
return this.request(j5, J2.POST, x2, q4);
|
|
669
|
-
}
|
|
670
|
-
put(j5, x2, q4) {
|
|
671
|
-
return this.request(j5, J2.PUT, x2, q4);
|
|
672
|
-
}
|
|
673
|
-
delete(j5, x2, q4) {
|
|
674
|
-
return this.request(j5, J2.DELETE, x2, q4);
|
|
675
|
-
}
|
|
676
|
-
patch(j5, x2, q4) {
|
|
677
|
-
return this.request(j5, J2.PATCH, x2, q4);
|
|
1046
|
+
unstar(b, k2, j2) {
|
|
1047
|
+
return this.client.delete(`/user/starred/${b}/${k2}`, undefined, j2);
|
|
678
1048
|
}
|
|
679
1049
|
}
|
|
680
1050
|
|
|
681
1051
|
// ../sdk/dist/api/users.js
|
|
682
|
-
class
|
|
1052
|
+
class z {
|
|
683
1053
|
client;
|
|
684
|
-
constructor(
|
|
685
|
-
this.client =
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
1054
|
+
constructor(j2) {
|
|
1055
|
+
this.client = j2;
|
|
1056
|
+
}
|
|
1057
|
+
list(j2, v2) {
|
|
1058
|
+
let k2 = new URLSearchParams;
|
|
1059
|
+
if (j2?.q !== undefined)
|
|
1060
|
+
k2.append("q", j2.q);
|
|
1061
|
+
if (j2?.sort !== undefined)
|
|
1062
|
+
k2.append("sort", j2.sort);
|
|
1063
|
+
if (j2?.order !== undefined)
|
|
1064
|
+
k2.append("order", j2.order);
|
|
1065
|
+
if (j2?.page !== undefined)
|
|
1066
|
+
k2.append("page", String(j2.page));
|
|
1067
|
+
if (j2?.per_page !== undefined)
|
|
1068
|
+
k2.append("per_page", String(j2.per_page));
|
|
1069
|
+
let w = k2.toString(), x2 = `/search/users${w ? `?${w}` : ""}`;
|
|
1070
|
+
return this.client.get(x2, v2);
|
|
1071
|
+
}
|
|
1072
|
+
getAuthenticated(j2) {
|
|
1073
|
+
return this.client.get("/user", j2);
|
|
1074
|
+
}
|
|
1075
|
+
get(j2, v2) {
|
|
1076
|
+
return this.client.get(`/user/${j2}`, v2);
|
|
1077
|
+
}
|
|
1078
|
+
getByUsername(j2, v2) {
|
|
1079
|
+
return this.client.get(`/users/${j2}`, v2);
|
|
692
1080
|
}
|
|
693
1081
|
}
|
|
694
1082
|
|
|
695
|
-
// ../sdk/dist/api/
|
|
696
|
-
class
|
|
1083
|
+
// ../sdk/dist/api/pages.js
|
|
1084
|
+
class A2 {
|
|
697
1085
|
client;
|
|
698
1086
|
constructor(b) {
|
|
699
1087
|
this.client = b;
|
|
700
1088
|
}
|
|
701
|
-
|
|
702
|
-
return this.client.
|
|
703
|
-
}
|
|
704
|
-
add(b, c) {
|
|
705
|
-
return this.client.post("/user/emails", b, c);
|
|
1089
|
+
createDeployment(b, j2, k2, v2) {
|
|
1090
|
+
return this.client.post(`/repos/${b}/${j2}/pages/deployments`, k2, v2);
|
|
706
1091
|
}
|
|
707
|
-
|
|
708
|
-
return this.client.
|
|
1092
|
+
getDeploymentStatus(b, j2, k2, v2) {
|
|
1093
|
+
return this.client.get(`/repos/${b}/${j2}/pages/deployments/${k2}`, v2);
|
|
709
1094
|
}
|
|
710
1095
|
}
|
|
711
1096
|
|
|
712
1097
|
// ../sdk/dist/index.js
|
|
713
|
-
class
|
|
1098
|
+
class K {
|
|
714
1099
|
client;
|
|
715
|
-
|
|
1100
|
+
actions;
|
|
1101
|
+
orgs;
|
|
1102
|
+
teams;
|
|
716
1103
|
repos;
|
|
717
|
-
|
|
1104
|
+
issues;
|
|
1105
|
+
pages;
|
|
718
1106
|
pulls;
|
|
719
|
-
|
|
1107
|
+
releases;
|
|
1108
|
+
users;
|
|
720
1109
|
emails;
|
|
721
|
-
issues;
|
|
722
1110
|
stars;
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
collaborators;
|
|
726
|
-
organizations;
|
|
727
|
-
teams;
|
|
728
|
-
releases;
|
|
729
|
-
git;
|
|
730
|
-
actions;
|
|
731
|
-
constructor(d2 = {}) {
|
|
732
|
-
this.client = new $(d2), this.users = new f(this.client), this.repos = new A(this.client), this.contents = new k4(this.client), this.pulls = new y(this.client), this.forks = new q3(this.client), this.emails = new d(this.client), this.issues = new B(this.client), this.stars = new k3(this.client), this.branches = new g(this.client), this.commits = new j(this.client), this.collaborators = new j3(this.client), this.organizations = new k(this.client), this.teams = new k5(this.client), this.releases = new q2(this.client), this.git = new j4(this.client), this.actions = new x(this.client);
|
|
1111
|
+
constructor(b = {}) {
|
|
1112
|
+
this.client = new v(b), this.actions = new F2(this.client), this.orgs = new F(this.client), this.teams = new E3(this.client), this.repos = new E2(this.client), this.issues = new E(this.client), this.pages = new A2(this.client), this.pulls = new I(this.client), this.releases = new G(this.client), this.users = new z(this.client), this.emails = new x(this.client), this.stars = new A(this.client);
|
|
733
1113
|
}
|
|
734
|
-
setToken(
|
|
735
|
-
return this.client.setToken(
|
|
1114
|
+
setToken(b) {
|
|
1115
|
+
return this.client.setToken(b), this;
|
|
736
1116
|
}
|
|
737
1117
|
}
|
|
738
1118
|
|
|
@@ -742,7 +1122,7 @@ class GitVerseReleaseClient {
|
|
|
742
1122
|
repoInfo;
|
|
743
1123
|
retryFn;
|
|
744
1124
|
constructor(token, repoInfo, retryFn) {
|
|
745
|
-
this.client = new
|
|
1125
|
+
this.client = new K({ token });
|
|
746
1126
|
this.repoInfo = repoInfo;
|
|
747
1127
|
this.retryFn = retryFn;
|
|
748
1128
|
}
|
|
@@ -790,7 +1170,7 @@ function createGitVerseClient(repoInfo, retryFn) {
|
|
|
790
1170
|
}
|
|
791
1171
|
|
|
792
1172
|
// src/utils/changelog.ts
|
|
793
|
-
import { readFile as readFile2, writeFile } from "node:fs/promises";
|
|
1173
|
+
import { readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
|
|
794
1174
|
|
|
795
1175
|
// src/utils/parser.ts
|
|
796
1176
|
var COMMIT_REGEX = /^(?<type>\w+)(?:\((?<scope>[^)]+)\))?(?<breaking>!)?: (?<subject>.+)$/;
|
|
@@ -952,7 +1332,7 @@ All notable changes to this project will be documented in this file.
|
|
|
952
1332
|
insertIndex = lines.length;
|
|
953
1333
|
}
|
|
954
1334
|
lines.splice(insertIndex, 0, newEntry);
|
|
955
|
-
await
|
|
1335
|
+
await writeFile2(changelogPath, lines.join(`
|
|
956
1336
|
`));
|
|
957
1337
|
}
|
|
958
1338
|
function generateReleaseNotes(commits, config, repoUrl, packageName) {
|
|
@@ -1012,7 +1392,8 @@ async function runBeforeCommitHook(command) {
|
|
|
1012
1392
|
}
|
|
1013
1393
|
var GITVERSE_URL_REGEX_1 = /gitverse\.ru[:/]([^/]+)\/([^/.]+)(\.git)?$/;
|
|
1014
1394
|
var GITVERSE_URL_REGEX_2 = /gitverse\.ru\/([^/]+)\/([^/.]+)(\.git)?$/;
|
|
1015
|
-
|
|
1395
|
+
var GITVERSE_URL_REGEX_3 = /gitverse\.ru:\d+\/([^/]+)\/([^/.]+)(\.git)?$/;
|
|
1396
|
+
async function gitCommand(command) {
|
|
1016
1397
|
const { stdout } = await execAsync(`git ${command}`);
|
|
1017
1398
|
return stdout.trim();
|
|
1018
1399
|
}
|
|
@@ -1033,14 +1414,14 @@ async function getRepoInfo() {
|
|
|
1033
1414
|
};
|
|
1034
1415
|
}
|
|
1035
1416
|
}
|
|
1036
|
-
const url = await
|
|
1037
|
-
const match = url.match(GITVERSE_URL_REGEX_1) || url.match(GITVERSE_URL_REGEX_2);
|
|
1417
|
+
const url = await gitCommand("remote get-url origin");
|
|
1418
|
+
const match = url.match(GITVERSE_URL_REGEX_1) || url.match(GITVERSE_URL_REGEX_2) || url.match(GITVERSE_URL_REGEX_3);
|
|
1038
1419
|
if (!(match?.[1] && match[2])) {
|
|
1039
1420
|
throw new Error(`Unable to parse GitVerse repository from URL: ${url}`);
|
|
1040
1421
|
}
|
|
1041
1422
|
const owner = match[1];
|
|
1042
1423
|
const repo = match[2];
|
|
1043
|
-
const branch = await
|
|
1424
|
+
const branch = await gitCommand("branch --show-current");
|
|
1044
1425
|
return {
|
|
1045
1426
|
branch,
|
|
1046
1427
|
fullName: `${owner}/${repo}`,
|
|
@@ -1051,7 +1432,7 @@ async function getRepoInfo() {
|
|
|
1051
1432
|
}
|
|
1052
1433
|
async function getLatestTag(prefix) {
|
|
1053
1434
|
try {
|
|
1054
|
-
const tags = await
|
|
1435
|
+
const tags = await gitCommand(`tag --sort=-v:refname --list "${prefix}*"`);
|
|
1055
1436
|
const tagList = tags.split(`
|
|
1056
1437
|
`).filter((tag) => tag.length > 0);
|
|
1057
1438
|
return tagList.length > 0 ? tagList[0] ?? null : null;
|
|
@@ -1069,7 +1450,7 @@ async function getCommitsSinceTag(tagPrefix, path) {
|
|
|
1069
1450
|
}
|
|
1070
1451
|
const format = "%H%n%h%n%an%n%ae%n%ai%n%B%n==END==";
|
|
1071
1452
|
const pathFilter = path ? `-- ${path}` : "";
|
|
1072
|
-
const log = await
|
|
1453
|
+
const log = await gitCommand(`log ${range} --format="${format}" ${pathFilter}`);
|
|
1073
1454
|
const commits = log.split(`
|
|
1074
1455
|
==END==`).map((commit) => commit.trim()).filter((commit) => commit.length > 0 && commit !== "==END==");
|
|
1075
1456
|
return commits;
|
|
@@ -1103,33 +1484,33 @@ async function getPackageInfo(packagePath) {
|
|
|
1103
1484
|
};
|
|
1104
1485
|
}
|
|
1105
1486
|
async function updatePackageVersion(packagePath, newVersion) {
|
|
1106
|
-
const { readFile: readFile3, writeFile:
|
|
1487
|
+
const { readFile: readFile3, writeFile: writeFile3 } = await import("node:fs/promises");
|
|
1107
1488
|
const { resolve: resolve2 } = await import("node:path");
|
|
1108
1489
|
const pkgJsonPath = resolve2(packagePath, "package.json");
|
|
1109
1490
|
const content = await readFile3(pkgJsonPath, "utf-8");
|
|
1110
1491
|
const pkgJson = JSON.parse(content);
|
|
1111
1492
|
pkgJson.version = newVersion;
|
|
1112
|
-
await
|
|
1493
|
+
await writeFile3(pkgJsonPath, `${JSON.stringify(pkgJson, null, 2)}
|
|
1113
1494
|
`);
|
|
1114
1495
|
}
|
|
1115
1496
|
async function createCommit(message, files) {
|
|
1116
1497
|
for (const file of files) {
|
|
1117
|
-
await
|
|
1498
|
+
await gitCommand(`add "${file}"`);
|
|
1118
1499
|
}
|
|
1119
|
-
await
|
|
1500
|
+
await gitCommand(`commit -m "${message}"`);
|
|
1120
1501
|
}
|
|
1121
1502
|
async function createTag(tag, message) {
|
|
1122
|
-
await
|
|
1503
|
+
await gitCommand(`tag -a "${tag}" -m "${message}"`);
|
|
1123
1504
|
}
|
|
1124
1505
|
async function pushChanges(tag) {
|
|
1125
|
-
await
|
|
1506
|
+
await gitCommand("push");
|
|
1126
1507
|
if (tag) {
|
|
1127
|
-
await
|
|
1508
|
+
await gitCommand(`push origin "${tag}"`);
|
|
1128
1509
|
}
|
|
1129
1510
|
}
|
|
1130
1511
|
async function isWorkingTreeClean() {
|
|
1131
1512
|
try {
|
|
1132
|
-
const status = await
|
|
1513
|
+
const status = await gitCommand("status --porcelain");
|
|
1133
1514
|
if (status.length === 0) {
|
|
1134
1515
|
return true;
|
|
1135
1516
|
}
|
|
@@ -1156,10 +1537,14 @@ async function isWorkingTreeClean() {
|
|
|
1156
1537
|
}
|
|
1157
1538
|
async function tagExists(tag) {
|
|
1158
1539
|
try {
|
|
1159
|
-
await
|
|
1540
|
+
await gitCommand(`rev-parse "${tag}"`);
|
|
1160
1541
|
return true;
|
|
1161
|
-
} catch {
|
|
1162
|
-
|
|
1542
|
+
} catch (error) {
|
|
1543
|
+
const errorMessage = error instanceof Error ? error.message.toLowerCase() : String(error).toLowerCase();
|
|
1544
|
+
if (errorMessage.includes("not a valid object name") || errorMessage.includes("unknown revision")) {
|
|
1545
|
+
return false;
|
|
1546
|
+
}
|
|
1547
|
+
throw new Error(`Failed to check tag "${tag}": ${error instanceof Error ? error.message : String(error)}`);
|
|
1163
1548
|
}
|
|
1164
1549
|
}
|
|
1165
1550
|
|
|
@@ -1232,8 +1617,8 @@ function createRetryFunction(config) {
|
|
|
1232
1617
|
var VERSION_REGEX = /^(\d+)\.(\d+)\.(\d+)(?:-(.+))?$/;
|
|
1233
1618
|
var PRERELEASE_INCREMENT_REGEX = /^(.+)\.(\d+)$/;
|
|
1234
1619
|
function parseVersion(version) {
|
|
1235
|
-
const
|
|
1236
|
-
const match =
|
|
1620
|
+
const v2 = version.startsWith("v") ? version.slice(1) : version;
|
|
1621
|
+
const match = v2.match(VERSION_REGEX);
|
|
1237
1622
|
if (!(match?.[1] && match[2] && match[3])) {
|
|
1238
1623
|
throw new Error(`Invalid version format: ${version}`);
|
|
1239
1624
|
}
|
|
@@ -1361,6 +1746,683 @@ function compareVersions(a, b) {
|
|
|
1361
1746
|
return 0;
|
|
1362
1747
|
}
|
|
1363
1748
|
|
|
1749
|
+
// src/binaries.ts
|
|
1750
|
+
import { mkdir as mkdir2, writeFile as writeFile5 } from "node:fs/promises";
|
|
1751
|
+
import { dirname, join as join3 } from "node:path";
|
|
1752
|
+
|
|
1753
|
+
// src/utils/binary-package-generator.ts
|
|
1754
|
+
import { copyFile, mkdir, writeFile as writeFile3 } from "node:fs/promises";
|
|
1755
|
+
import { join as join2 } from "node:path";
|
|
1756
|
+
|
|
1757
|
+
// src/utils/binary-platforms.ts
|
|
1758
|
+
import { access as access2 } from "node:fs/promises";
|
|
1759
|
+
import { join, resolve as resolve2 } from "node:path";
|
|
1760
|
+
var PLATFORM_MAPPINGS = {
|
|
1761
|
+
"darwin-arm64": { cpu: "arm64", extension: "", os: "darwin" },
|
|
1762
|
+
"darwin-x64": { cpu: "x64", extension: "", os: "darwin" },
|
|
1763
|
+
"linux-arm64": { cpu: "arm64", extension: "", os: "linux" },
|
|
1764
|
+
"linux-x64": { cpu: "x64", extension: "", os: "linux" },
|
|
1765
|
+
"win32-arm64": { cpu: "arm64", extension: ".exe", os: "win32" },
|
|
1766
|
+
"win32-x64": { cpu: "x64", extension: ".exe", os: "win32" }
|
|
1767
|
+
};
|
|
1768
|
+
var ALL_PLATFORMS = Object.keys(PLATFORM_MAPPINGS);
|
|
1769
|
+
function isValidPlatform(value) {
|
|
1770
|
+
return value in PLATFORM_MAPPINGS;
|
|
1771
|
+
}
|
|
1772
|
+
function parsePlatforms(value) {
|
|
1773
|
+
const platforms = value.split(",").map((p) => p.trim());
|
|
1774
|
+
const result = [];
|
|
1775
|
+
for (const platform of platforms) {
|
|
1776
|
+
if (!isValidPlatform(platform)) {
|
|
1777
|
+
throw new Error(`Invalid platform: ${platform}. Valid platforms: ${ALL_PLATFORMS.join(", ")}`);
|
|
1778
|
+
}
|
|
1779
|
+
result.push(platform);
|
|
1780
|
+
}
|
|
1781
|
+
return result;
|
|
1782
|
+
}
|
|
1783
|
+
function getBinaryPath(distDir, name, platform) {
|
|
1784
|
+
const mapping = PLATFORM_MAPPINGS[platform];
|
|
1785
|
+
const binaryName = `${name}${mapping.extension}`;
|
|
1786
|
+
const platformDir = `${name}-${platform}`;
|
|
1787
|
+
return resolve2(distDir, platformDir, binaryName);
|
|
1788
|
+
}
|
|
1789
|
+
function getPlatformDir(distDir, name, platform) {
|
|
1790
|
+
const platformDir = `${name}-${platform}`;
|
|
1791
|
+
return resolve2(distDir, platformDir);
|
|
1792
|
+
}
|
|
1793
|
+
async function validateBinaryExists(distDir, name, platform) {
|
|
1794
|
+
const binaryPath = getBinaryPath(distDir, name, platform);
|
|
1795
|
+
try {
|
|
1796
|
+
await access2(binaryPath);
|
|
1797
|
+
return true;
|
|
1798
|
+
} catch (error) {
|
|
1799
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
1800
|
+
return false;
|
|
1801
|
+
}
|
|
1802
|
+
throw new Error(`Failed to check binary at ${binaryPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
async function validateAllBinaries(distDir, name, platforms) {
|
|
1806
|
+
const missing = [];
|
|
1807
|
+
for (const platform of platforms) {
|
|
1808
|
+
const exists = await validateBinaryExists(distDir, name, platform);
|
|
1809
|
+
if (!exists) {
|
|
1810
|
+
missing.push(platform);
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
return missing;
|
|
1814
|
+
}
|
|
1815
|
+
function getPackageName(scope, name, platform) {
|
|
1816
|
+
const cleanScope = scope.startsWith("@") ? scope : `@${scope}`;
|
|
1817
|
+
return `${cleanScope}/${name}-${platform}`;
|
|
1818
|
+
}
|
|
1819
|
+
function getPackageOutputPath(outDir, scope, name, platform) {
|
|
1820
|
+
const cleanScope = scope.startsWith("@") ? scope.slice(1) : scope;
|
|
1821
|
+
return join(outDir, `@${cleanScope}`, `${name}-${platform}`);
|
|
1822
|
+
}
|
|
1823
|
+
function expandPlaceholders(template, values) {
|
|
1824
|
+
let result = template;
|
|
1825
|
+
if (values.packageDir !== undefined) {
|
|
1826
|
+
result = result.replace(/\{\{packageDir\}\}/g, values.packageDir);
|
|
1827
|
+
}
|
|
1828
|
+
if (values.version !== undefined) {
|
|
1829
|
+
result = result.replace(/\{\{version\}\}/g, values.version);
|
|
1830
|
+
}
|
|
1831
|
+
if (values.platform !== undefined) {
|
|
1832
|
+
result = result.replace(/\{\{platform\}\}/g, values.platform);
|
|
1833
|
+
}
|
|
1834
|
+
if (values.scope !== undefined) {
|
|
1835
|
+
result = result.replace(/\{\{scope\}\}/g, values.scope);
|
|
1836
|
+
}
|
|
1837
|
+
if (values.name !== undefined) {
|
|
1838
|
+
result = result.replace(/\{\{name\}\}/g, values.name);
|
|
1839
|
+
}
|
|
1840
|
+
return result;
|
|
1841
|
+
}
|
|
1842
|
+
function platformToNodeValues(platform) {
|
|
1843
|
+
const parts = platform.split("-");
|
|
1844
|
+
return { arch: parts[1] ?? "", platform: parts[0] ?? "" };
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
// src/utils/binary-package-generator.ts
|
|
1848
|
+
function generatePlatformPackageJson(config, platform, version) {
|
|
1849
|
+
const mapping = PLATFORM_MAPPINGS[platform];
|
|
1850
|
+
const packageName = getPackageName(config.scope, config.name, platform);
|
|
1851
|
+
const binName = config.binName ?? config.name;
|
|
1852
|
+
const binaryFileName = `${binName}${mapping.extension}`;
|
|
1853
|
+
const pkg = {
|
|
1854
|
+
bin: {
|
|
1855
|
+
[binName]: `bin/${binaryFileName}`
|
|
1856
|
+
},
|
|
1857
|
+
cpu: [mapping.cpu],
|
|
1858
|
+
description: `${config.name} binary for ${platform}`,
|
|
1859
|
+
files: ["bin"],
|
|
1860
|
+
license: "MIT",
|
|
1861
|
+
name: packageName,
|
|
1862
|
+
os: [mapping.os],
|
|
1863
|
+
preferUnplugged: true,
|
|
1864
|
+
version
|
|
1865
|
+
};
|
|
1866
|
+
return JSON.stringify(pkg, null, 2);
|
|
1867
|
+
}
|
|
1868
|
+
function generatePlatformReadme(config, platform, version) {
|
|
1869
|
+
const packageName = getPackageName(config.scope, config.name, platform);
|
|
1870
|
+
const mapping = PLATFORM_MAPPINGS[platform];
|
|
1871
|
+
const mainPackageName = `${config.scope.startsWith("@") ? config.scope : `@${config.scope}`}/${config.name}`;
|
|
1872
|
+
return `# ${packageName}
|
|
1873
|
+
|
|
1874
|
+
Platform-specific binary for \`${config.name}\` (${mapping.os} ${mapping.cpu}).
|
|
1875
|
+
|
|
1876
|
+
## Installation
|
|
1877
|
+
|
|
1878
|
+
This package is not meant to be installed directly. Install the main package instead:
|
|
1879
|
+
|
|
1880
|
+
\`\`\`bash
|
|
1881
|
+
npm install ${mainPackageName}
|
|
1882
|
+
\`\`\`
|
|
1883
|
+
|
|
1884
|
+
The main package will automatically install the correct platform-specific binary as an optional dependency.
|
|
1885
|
+
|
|
1886
|
+
## Version
|
|
1887
|
+
|
|
1888
|
+
${version}
|
|
1889
|
+
`;
|
|
1890
|
+
}
|
|
1891
|
+
async function generatePlatformPackage(config, platform, version, dryRun = false) {
|
|
1892
|
+
const packageName = getPackageName(config.scope, config.name, platform);
|
|
1893
|
+
const packageDir = getPackageOutputPath(config.outDir, config.scope, config.name, platform);
|
|
1894
|
+
const binName = config.binName ?? config.name;
|
|
1895
|
+
const mapping = PLATFORM_MAPPINGS[platform];
|
|
1896
|
+
const baseResult = {
|
|
1897
|
+
packageDir,
|
|
1898
|
+
packageName,
|
|
1899
|
+
platform
|
|
1900
|
+
};
|
|
1901
|
+
try {
|
|
1902
|
+
const binaryExists = await validateBinaryExists(config.distDir, config.name, platform);
|
|
1903
|
+
if (!binaryExists) {
|
|
1904
|
+
const expectedPath = getBinaryPath(config.distDir, config.name, platform);
|
|
1905
|
+
return { ...baseResult, error: `Binary not found: ${expectedPath}`, success: false };
|
|
1906
|
+
}
|
|
1907
|
+
if (dryRun) {
|
|
1908
|
+
return { ...baseResult, success: true };
|
|
1909
|
+
}
|
|
1910
|
+
const binDir = join2(packageDir, "bin");
|
|
1911
|
+
await mkdir(binDir, { recursive: true });
|
|
1912
|
+
const packageJson = generatePlatformPackageJson(config, platform, version);
|
|
1913
|
+
await writeFile3(join2(packageDir, "package.json"), packageJson);
|
|
1914
|
+
const readme = generatePlatformReadme(config, platform, version);
|
|
1915
|
+
await writeFile3(join2(packageDir, "README.md"), readme);
|
|
1916
|
+
const sourceBinaryPath = getBinaryPath(config.distDir, config.name, platform);
|
|
1917
|
+
const binaryFileName = `${binName}${mapping.extension}`;
|
|
1918
|
+
const targetBinaryPath = join2(binDir, binaryFileName);
|
|
1919
|
+
await copyFile(sourceBinaryPath, targetBinaryPath);
|
|
1920
|
+
return { ...baseResult, success: true };
|
|
1921
|
+
} catch (error) {
|
|
1922
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1923
|
+
console.error(`❌ Failed to generate package ${packageName} for ${platform}: ${errorMessage}`);
|
|
1924
|
+
return { ...baseResult, error: `Failed to generate ${packageName}: ${errorMessage}`, success: false };
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
async function generateAllPlatformPackages(config, version, platforms, dryRun = false) {
|
|
1928
|
+
const targetPlatforms = platforms ?? config.platforms;
|
|
1929
|
+
const results = [];
|
|
1930
|
+
for (const platform of targetPlatforms) {
|
|
1931
|
+
const result = await generatePlatformPackage(config, platform, version, dryRun);
|
|
1932
|
+
results.push(result);
|
|
1933
|
+
}
|
|
1934
|
+
return results;
|
|
1935
|
+
}
|
|
1936
|
+
function printGenerationDryRun(config, version, platforms) {
|
|
1937
|
+
console.log(`
|
|
1938
|
+
\uD83D\uDCE6 Binary Distribution:`);
|
|
1939
|
+
console.log(` Scope: ${config.scope}`);
|
|
1940
|
+
console.log(` Name: ${config.name}`);
|
|
1941
|
+
console.log(` Version: ${version}`);
|
|
1942
|
+
console.log(` Platforms: ${platforms.join(", ")}`);
|
|
1943
|
+
console.log(`
|
|
1944
|
+
\uD83D\uDCC1 Packages to generate:`);
|
|
1945
|
+
for (const platform of platforms) {
|
|
1946
|
+
const packageDir = getPackageOutputPath(config.outDir, config.scope, config.name, platform);
|
|
1947
|
+
console.log(` ${packageDir}/`);
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
// src/utils/binary-publisher.ts
|
|
1952
|
+
import { exec as exec2 } from "node:child_process";
|
|
1953
|
+
import { promisify as promisify2 } from "node:util";
|
|
1954
|
+
var execAsync2 = promisify2(exec2);
|
|
1955
|
+
function sleep2(ms) {
|
|
1956
|
+
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
1957
|
+
}
|
|
1958
|
+
function calculateDelay2(attempt, initialDelay = 2000, maxDelay = 30000) {
|
|
1959
|
+
const delay = initialDelay * 2 ** attempt;
|
|
1960
|
+
return Math.min(delay, maxDelay);
|
|
1961
|
+
}
|
|
1962
|
+
function isRetriableError2(error) {
|
|
1963
|
+
if (!(error instanceof Error)) {
|
|
1964
|
+
return false;
|
|
1965
|
+
}
|
|
1966
|
+
const message = error.message.toLowerCase();
|
|
1967
|
+
if (message.includes("network") || message.includes("timeout") || message.includes("econnreset")) {
|
|
1968
|
+
return true;
|
|
1969
|
+
}
|
|
1970
|
+
if (message.includes("503") || message.includes("429") || message.includes("rate")) {
|
|
1971
|
+
return true;
|
|
1972
|
+
}
|
|
1973
|
+
if (message.includes("registry") || message.includes("etarget")) {
|
|
1974
|
+
return true;
|
|
1975
|
+
}
|
|
1976
|
+
return false;
|
|
1977
|
+
}
|
|
1978
|
+
async function publishPlatformPackage(config, platform, version, dryRun = false) {
|
|
1979
|
+
const packageName = getPackageName(config.scope, config.name, platform);
|
|
1980
|
+
const packageDir = getPackageOutputPath(config.outDir, config.scope, config.name, platform);
|
|
1981
|
+
const baseResult = {
|
|
1982
|
+
packageName,
|
|
1983
|
+
platform
|
|
1984
|
+
};
|
|
1985
|
+
const publishCommand = expandPlaceholders(config.publishCommand, {
|
|
1986
|
+
name: config.name,
|
|
1987
|
+
packageDir,
|
|
1988
|
+
platform,
|
|
1989
|
+
scope: config.scope,
|
|
1990
|
+
version
|
|
1991
|
+
});
|
|
1992
|
+
if (dryRun) {
|
|
1993
|
+
return { ...baseResult, attempts: 1, success: true };
|
|
1994
|
+
}
|
|
1995
|
+
let lastError;
|
|
1996
|
+
let attempts = 0;
|
|
1997
|
+
for (let attempt = 0;attempt < config.retryAttempts; attempt++) {
|
|
1998
|
+
attempts = attempt + 1;
|
|
1999
|
+
try {
|
|
2000
|
+
await execAsync2(publishCommand, {
|
|
2001
|
+
cwd: packageDir,
|
|
2002
|
+
env: process.env
|
|
2003
|
+
});
|
|
2004
|
+
return { ...baseResult, attempts, success: true };
|
|
2005
|
+
} catch (error) {
|
|
2006
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
2007
|
+
const canRetry = isRetriableError2(error);
|
|
2008
|
+
if (attempt === config.retryAttempts - 1 || !canRetry) {
|
|
2009
|
+
break;
|
|
2010
|
+
}
|
|
2011
|
+
const delay = calculateDelay2(attempt);
|
|
2012
|
+
console.warn(`⚠️ Publish failed for ${packageName} (attempt ${attempt + 1}/${config.retryAttempts})`);
|
|
2013
|
+
console.warn(` ${lastError.message}`);
|
|
2014
|
+
console.warn(` Retrying in ${delay}ms...`);
|
|
2015
|
+
await sleep2(delay);
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
return {
|
|
2019
|
+
...baseResult,
|
|
2020
|
+
attempts,
|
|
2021
|
+
error: lastError?.message ?? "Unknown error",
|
|
2022
|
+
success: false
|
|
2023
|
+
};
|
|
2024
|
+
}
|
|
2025
|
+
async function publishAllPlatformPackages(config, version, generatedPackages, dryRun = false, verbose = false) {
|
|
2026
|
+
const results = [];
|
|
2027
|
+
const successfulPackages = generatedPackages.filter((p) => p.success);
|
|
2028
|
+
if (successfulPackages.length === 0) {
|
|
2029
|
+
return results;
|
|
2030
|
+
}
|
|
2031
|
+
const batchSize = 3;
|
|
2032
|
+
for (let i = 0;i < successfulPackages.length; i += batchSize) {
|
|
2033
|
+
const batch = successfulPackages.slice(i, i + batchSize);
|
|
2034
|
+
const batchPromises = batch.map(async (pkg) => {
|
|
2035
|
+
if (verbose) {
|
|
2036
|
+
console.log(`\uD83D\uDCE4 Publishing ${pkg.packageName}...`);
|
|
2037
|
+
}
|
|
2038
|
+
const result = await publishPlatformPackage(config, pkg.platform, version, dryRun);
|
|
2039
|
+
if (result.success) {
|
|
2040
|
+
if (verbose) {
|
|
2041
|
+
console.log(`✅ Published ${pkg.packageName}`);
|
|
2042
|
+
}
|
|
2043
|
+
} else {
|
|
2044
|
+
console.error(`❌ Failed to publish ${pkg.packageName}: ${result.error}`);
|
|
2045
|
+
}
|
|
2046
|
+
return result;
|
|
2047
|
+
});
|
|
2048
|
+
const batchResults = await Promise.all(batchPromises);
|
|
2049
|
+
results.push(...batchResults);
|
|
2050
|
+
if (i + batchSize < successfulPackages.length) {
|
|
2051
|
+
await sleep2(500);
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
return results;
|
|
2055
|
+
}
|
|
2056
|
+
function printPublishDryRun(config, generatedPackages) {
|
|
2057
|
+
const successfulPackages = generatedPackages.filter((p) => p.success);
|
|
2058
|
+
console.log(`
|
|
2059
|
+
\uD83D\uDE80 Packages to publish:`);
|
|
2060
|
+
for (const pkg of successfulPackages) {
|
|
2061
|
+
console.log(` ${pkg.packageName} (${pkg.packageDir})`);
|
|
2062
|
+
}
|
|
2063
|
+
console.log(`
|
|
2064
|
+
\uD83D\uDCE4 Publish command: ${config.publishCommand}`);
|
|
2065
|
+
}
|
|
2066
|
+
function printPublishSummary(results, _config) {
|
|
2067
|
+
const successful = results.filter((r) => r.success);
|
|
2068
|
+
const failed = results.filter((r) => !r.success);
|
|
2069
|
+
console.log(`
|
|
2070
|
+
\uD83D\uDCCA Publish Summary:`);
|
|
2071
|
+
console.log(` Total: ${results.length}`);
|
|
2072
|
+
console.log(` Successful: ${successful.length}`);
|
|
2073
|
+
console.log(` Failed: ${failed.length}`);
|
|
2074
|
+
if (failed.length > 0) {
|
|
2075
|
+
console.log(`
|
|
2076
|
+
❌ Failed packages:`);
|
|
2077
|
+
for (const result of failed) {
|
|
2078
|
+
console.log(` ${result.packageName}: ${result.error}`);
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
|
|
2083
|
+
// src/utils/binary-wrapper-generator.ts
|
|
2084
|
+
import { readFile as readFile3, writeFile as writeFile4 } from "node:fs/promises";
|
|
2085
|
+
import { resolve as resolve3 } from "node:path";
|
|
2086
|
+
function generateBinaryWrapper(config) {
|
|
2087
|
+
const binName = config.binName ?? config.name;
|
|
2088
|
+
const scope = config.scope.startsWith("@") ? config.scope : `@${config.scope}`;
|
|
2089
|
+
const platformEntries = config.platforms.map((platform) => {
|
|
2090
|
+
const packageName = getPackageName(config.scope, config.name, platform);
|
|
2091
|
+
const parts = platform.split("-");
|
|
2092
|
+
return ` "${parts[0]}-${parts[1]}": "${packageName}"`;
|
|
2093
|
+
});
|
|
2094
|
+
return `#!/usr/bin/env node
|
|
2095
|
+
"use strict";
|
|
2096
|
+
|
|
2097
|
+
const { platform, arch } = process;
|
|
2098
|
+
const { execFileSync } = require("child_process");
|
|
2099
|
+
const { join } = require("path");
|
|
2100
|
+
|
|
2101
|
+
const PLATFORMS = {
|
|
2102
|
+
${platformEntries.join(`,
|
|
2103
|
+
`)}
|
|
2104
|
+
};
|
|
2105
|
+
|
|
2106
|
+
const platformKey = \`\${platform}-\${arch}\`;
|
|
2107
|
+
const pkg = PLATFORMS[platformKey];
|
|
2108
|
+
|
|
2109
|
+
if (!pkg) {
|
|
2110
|
+
console.error(\`Unsupported platform: \${platformKey}\`);
|
|
2111
|
+
console.error(\`Supported platforms: \${Object.keys(PLATFORMS).join(", ")}\`);
|
|
2112
|
+
process.exit(1);
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
let binPath;
|
|
2116
|
+
try {
|
|
2117
|
+
// Try to resolve the platform-specific package
|
|
2118
|
+
const pkgPath = require.resolve(\`\${pkg}/package.json\`);
|
|
2119
|
+
const pkgDir = join(pkgPath, "..");
|
|
2120
|
+
const pkgJson = require(pkgPath);
|
|
2121
|
+
const binEntry = pkgJson.bin && pkgJson.bin["${binName}"];
|
|
2122
|
+
|
|
2123
|
+
if (!binEntry) {
|
|
2124
|
+
throw new Error(\`Binary entry not found in \${pkg}\`);
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
binPath = join(pkgDir, binEntry);
|
|
2128
|
+
} catch (resolveError) {
|
|
2129
|
+
console.error(\`Failed to find binary package: \${pkg}\`);
|
|
2130
|
+
console.error(\`Please install it: npm install \${pkg}\`);
|
|
2131
|
+
console.error(\`Or reinstall the main package: npm install ${scope}/${config.name}\`);
|
|
2132
|
+
process.exit(1);
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
try {
|
|
2136
|
+
const result = execFileSync(binPath, process.argv.slice(2), {
|
|
2137
|
+
stdio: "inherit",
|
|
2138
|
+
env: process.env
|
|
2139
|
+
});
|
|
2140
|
+
} catch (error) {
|
|
2141
|
+
// execFileSync throws on non-zero exit codes, pass through the exit code
|
|
2142
|
+
if (error.status !== undefined) {
|
|
2143
|
+
process.exit(error.status);
|
|
2144
|
+
}
|
|
2145
|
+
throw error;
|
|
2146
|
+
}
|
|
2147
|
+
`;
|
|
2148
|
+
}
|
|
2149
|
+
function generateOptionalDependencies(config, version, platforms) {
|
|
2150
|
+
const targetPlatforms = platforms ?? config.platforms;
|
|
2151
|
+
const deps = {};
|
|
2152
|
+
for (const platform of targetPlatforms) {
|
|
2153
|
+
const packageName = getPackageName(config.scope, config.name, platform);
|
|
2154
|
+
deps[packageName] = version;
|
|
2155
|
+
}
|
|
2156
|
+
return deps;
|
|
2157
|
+
}
|
|
2158
|
+
function generateMainPackageUpdates(config, version, platforms) {
|
|
2159
|
+
const binName = config.binName ?? config.name;
|
|
2160
|
+
return {
|
|
2161
|
+
bin: {
|
|
2162
|
+
[binName]: `bin/${binName}.js`
|
|
2163
|
+
},
|
|
2164
|
+
optionalDependencies: generateOptionalDependencies(config, version, platforms)
|
|
2165
|
+
};
|
|
2166
|
+
}
|
|
2167
|
+
async function updateMainPackageJson(packagePath, config, version, platforms, dryRun = false) {
|
|
2168
|
+
const fullPath = resolve3(packagePath);
|
|
2169
|
+
const content = await readFile3(fullPath, "utf-8");
|
|
2170
|
+
let pkg;
|
|
2171
|
+
try {
|
|
2172
|
+
pkg = JSON.parse(content);
|
|
2173
|
+
} catch (parseError) {
|
|
2174
|
+
throw new Error(`Failed to parse ${fullPath}: ${parseError instanceof Error ? parseError.message : "Invalid JSON"}`);
|
|
2175
|
+
}
|
|
2176
|
+
const updates = generateMainPackageUpdates(config, version, platforms);
|
|
2177
|
+
pkg.optionalDependencies = {
|
|
2178
|
+
...pkg.optionalDependencies || {},
|
|
2179
|
+
...updates.optionalDependencies
|
|
2180
|
+
};
|
|
2181
|
+
if (updates.bin) {
|
|
2182
|
+
pkg.bin = {
|
|
2183
|
+
...pkg.bin || {},
|
|
2184
|
+
...updates.bin
|
|
2185
|
+
};
|
|
2186
|
+
}
|
|
2187
|
+
if (dryRun) {
|
|
2188
|
+
return;
|
|
2189
|
+
}
|
|
2190
|
+
await writeFile4(fullPath, `${JSON.stringify(pkg, null, 2)}
|
|
2191
|
+
`);
|
|
2192
|
+
}
|
|
2193
|
+
function printMainPackageUpdatesDryRun(config, version, platforms) {
|
|
2194
|
+
const updates = generateMainPackageUpdates(config, version, platforms);
|
|
2195
|
+
console.log(`
|
|
2196
|
+
\uD83D\uDCDD Main package updates:`);
|
|
2197
|
+
console.log(" optionalDependencies:");
|
|
2198
|
+
for (const [name, ver] of Object.entries(updates.optionalDependencies)) {
|
|
2199
|
+
console.log(` "${name}": "${ver}"`);
|
|
2200
|
+
}
|
|
2201
|
+
if (updates.bin) {
|
|
2202
|
+
console.log(" bin:");
|
|
2203
|
+
for (const [name, path] of Object.entries(updates.bin)) {
|
|
2204
|
+
console.log(` "${name}": "${path}"`);
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
// src/binaries.ts
|
|
2210
|
+
async function generateBinaryPackages(options = {}) {
|
|
2211
|
+
const result = {
|
|
2212
|
+
errors: [],
|
|
2213
|
+
packages: [],
|
|
2214
|
+
published: [],
|
|
2215
|
+
success: false,
|
|
2216
|
+
version: "",
|
|
2217
|
+
warnings: []
|
|
2218
|
+
};
|
|
2219
|
+
try {
|
|
2220
|
+
const config = await loadConfig(options.config);
|
|
2221
|
+
if (!config.binaries?.enabled) {
|
|
2222
|
+
result.errors.push("Binary distribution is not enabled in config");
|
|
2223
|
+
return result;
|
|
2224
|
+
}
|
|
2225
|
+
validateBinariesConfig(config.binaries);
|
|
2226
|
+
const binariesConfig = config.binaries;
|
|
2227
|
+
const version = options.version ?? await getCurrentVersion(".");
|
|
2228
|
+
result.version = version;
|
|
2229
|
+
const platforms = options.platforms ?? binariesConfig.platforms;
|
|
2230
|
+
const missingBinaries = await validateAllBinaries(binariesConfig.distDir, binariesConfig.name, platforms);
|
|
2231
|
+
if (missingBinaries.length > 0) {
|
|
2232
|
+
for (const platform of missingBinaries) {
|
|
2233
|
+
console.warn(`⚠️ Binary not found for platform: ${platform}`);
|
|
2234
|
+
result.warnings.push(`Binary not found for platform: ${platform}`);
|
|
2235
|
+
}
|
|
2236
|
+
if (missingBinaries.length === platforms.length) {
|
|
2237
|
+
result.errors.push("No binaries found for any platform");
|
|
2238
|
+
return result;
|
|
2239
|
+
}
|
|
2240
|
+
const availableCount = platforms.length - missingBinaries.length;
|
|
2241
|
+
console.warn(`
|
|
2242
|
+
⚠️ Only ${availableCount} of ${platforms.length} platforms will be processed`);
|
|
2243
|
+
console.warn(` Missing: ${missingBinaries.join(", ")}`);
|
|
2244
|
+
console.warn(` Use --platforms flag to explicitly specify which platforms to publish
|
|
2245
|
+
`);
|
|
2246
|
+
}
|
|
2247
|
+
const availablePlatforms = platforms.filter((p) => !missingBinaries.includes(p));
|
|
2248
|
+
if (options.dryRun) {
|
|
2249
|
+
console.log(`
|
|
2250
|
+
\uD83D\uDD0D DRY RUN MODE
|
|
2251
|
+
`);
|
|
2252
|
+
printGenerationDryRun(binariesConfig, version, availablePlatforms);
|
|
2253
|
+
printMainPackageUpdatesDryRun(binariesConfig, version, availablePlatforms);
|
|
2254
|
+
result.packages = availablePlatforms.map((platform) => ({
|
|
2255
|
+
packageDir: "",
|
|
2256
|
+
packageName: "",
|
|
2257
|
+
platform,
|
|
2258
|
+
success: true
|
|
2259
|
+
}));
|
|
2260
|
+
result.success = true;
|
|
2261
|
+
return result;
|
|
2262
|
+
}
|
|
2263
|
+
console.log(`
|
|
2264
|
+
\uD83D\uDCE6 Generating binary packages...
|
|
2265
|
+
`);
|
|
2266
|
+
result.packages = await generateAllPlatformPackages(binariesConfig, version, availablePlatforms, false);
|
|
2267
|
+
const successfulPackages = result.packages.filter((p) => p.success);
|
|
2268
|
+
const failedPackages = result.packages.filter((p) => !p.success);
|
|
2269
|
+
console.log(`✅ Generated ${successfulPackages.length} packages`);
|
|
2270
|
+
if (failedPackages.length > 0) {
|
|
2271
|
+
for (const pkg of failedPackages) {
|
|
2272
|
+
result.warnings.push(`Failed to generate package for ${pkg.platform}: ${pkg.error}`);
|
|
2273
|
+
console.warn(`⚠️ Failed: ${pkg.platform} - ${pkg.error}`);
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2276
|
+
if (!options.skipMainPackage) {
|
|
2277
|
+
const wrapperScript = generateBinaryWrapper(binariesConfig);
|
|
2278
|
+
const binDir = join3(dirname(binariesConfig.mainPackage), "bin");
|
|
2279
|
+
const binName = binariesConfig.binName ?? binariesConfig.name;
|
|
2280
|
+
await mkdir2(binDir, { recursive: true });
|
|
2281
|
+
await writeFile5(join3(binDir, `${binName}.js`), wrapperScript);
|
|
2282
|
+
console.log(`✅ Generated wrapper: bin/${binName}.js`);
|
|
2283
|
+
}
|
|
2284
|
+
result.success = successfulPackages.length > 0;
|
|
2285
|
+
} catch (error) {
|
|
2286
|
+
result.errors.push(error instanceof Error ? error.message : String(error));
|
|
2287
|
+
console.error(`
|
|
2288
|
+
❌ Generation failed:`);
|
|
2289
|
+
console.error(error);
|
|
2290
|
+
}
|
|
2291
|
+
return result;
|
|
2292
|
+
}
|
|
2293
|
+
async function publishBinaries(options = {}) {
|
|
2294
|
+
const result = {
|
|
2295
|
+
errors: [],
|
|
2296
|
+
packages: [],
|
|
2297
|
+
published: [],
|
|
2298
|
+
success: false,
|
|
2299
|
+
version: "",
|
|
2300
|
+
warnings: []
|
|
2301
|
+
};
|
|
2302
|
+
try {
|
|
2303
|
+
const config = await loadConfig(options.config);
|
|
2304
|
+
if (!config.binaries?.enabled) {
|
|
2305
|
+
result.errors.push("Binary distribution is not enabled in config");
|
|
2306
|
+
return result;
|
|
2307
|
+
}
|
|
2308
|
+
validateBinariesConfig(config.binaries);
|
|
2309
|
+
const binariesConfig = config.binaries;
|
|
2310
|
+
const version = options.version ?? await getCurrentVersion(".");
|
|
2311
|
+
result.version = version;
|
|
2312
|
+
const platforms = options.platforms ?? binariesConfig.platforms;
|
|
2313
|
+
const missingBinaries = await validateAllBinaries(binariesConfig.distDir, binariesConfig.name, platforms);
|
|
2314
|
+
if (missingBinaries.length > 0) {
|
|
2315
|
+
for (const platform of missingBinaries) {
|
|
2316
|
+
console.warn(`⚠️ Binary not found for platform: ${platform}`);
|
|
2317
|
+
result.warnings.push(`Binary not found for platform: ${platform}`);
|
|
2318
|
+
}
|
|
2319
|
+
if (missingBinaries.length === platforms.length) {
|
|
2320
|
+
result.errors.push("No binaries found for any platform");
|
|
2321
|
+
return result;
|
|
2322
|
+
}
|
|
2323
|
+
const availableCount = platforms.length - missingBinaries.length;
|
|
2324
|
+
console.warn(`
|
|
2325
|
+
⚠️ Only ${availableCount} of ${platforms.length} platforms will be processed`);
|
|
2326
|
+
console.warn(` Missing: ${missingBinaries.join(", ")}`);
|
|
2327
|
+
console.warn(` Use --platforms flag to explicitly specify which platforms to publish
|
|
2328
|
+
`);
|
|
2329
|
+
}
|
|
2330
|
+
const availablePlatforms = platforms.filter((p) => !missingBinaries.includes(p));
|
|
2331
|
+
if (options.dryRun) {
|
|
2332
|
+
console.log(`
|
|
2333
|
+
\uD83D\uDD0D DRY RUN MODE
|
|
2334
|
+
`);
|
|
2335
|
+
printGenerationDryRun(binariesConfig, version, availablePlatforms);
|
|
2336
|
+
const dryRunPackages = availablePlatforms.map((platform) => ({
|
|
2337
|
+
packageDir: "",
|
|
2338
|
+
packageName: "",
|
|
2339
|
+
platform,
|
|
2340
|
+
success: true
|
|
2341
|
+
}));
|
|
2342
|
+
printPublishDryRun(binariesConfig, dryRunPackages);
|
|
2343
|
+
printMainPackageUpdatesDryRun(binariesConfig, version, availablePlatforms);
|
|
2344
|
+
result.packages = dryRunPackages;
|
|
2345
|
+
result.success = true;
|
|
2346
|
+
return result;
|
|
2347
|
+
}
|
|
2348
|
+
console.log(`
|
|
2349
|
+
\uD83D\uDCE6 Generating binary packages...
|
|
2350
|
+
`);
|
|
2351
|
+
result.packages = await generateAllPlatformPackages(binariesConfig, version, availablePlatforms, false);
|
|
2352
|
+
const successfulPackages = result.packages.filter((p) => p.success);
|
|
2353
|
+
const failedPackages = result.packages.filter((p) => !p.success);
|
|
2354
|
+
console.log(`✅ Generated ${successfulPackages.length} packages`);
|
|
2355
|
+
if (failedPackages.length > 0) {
|
|
2356
|
+
for (const pkg of failedPackages) {
|
|
2357
|
+
result.warnings.push(`Failed to generate package for ${pkg.platform}: ${pkg.error}`);
|
|
2358
|
+
console.warn(`⚠️ Failed: ${pkg.platform} - ${pkg.error}`);
|
|
2359
|
+
}
|
|
2360
|
+
if (!binariesConfig.continueOnError && failedPackages.length > 0) {
|
|
2361
|
+
result.errors.push("Some packages failed to generate");
|
|
2362
|
+
return result;
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
if (successfulPackages.length === 0) {
|
|
2366
|
+
result.errors.push("No packages generated successfully");
|
|
2367
|
+
return result;
|
|
2368
|
+
}
|
|
2369
|
+
if (options.generateOnly) {
|
|
2370
|
+
if (!options.skipMainPackage) {
|
|
2371
|
+
const wrapperScript = generateBinaryWrapper(binariesConfig);
|
|
2372
|
+
const binDir = join3(dirname(binariesConfig.mainPackage), "bin");
|
|
2373
|
+
const binName = binariesConfig.binName ?? binariesConfig.name;
|
|
2374
|
+
await mkdir2(binDir, { recursive: true });
|
|
2375
|
+
await writeFile5(join3(binDir, `${binName}.js`), wrapperScript);
|
|
2376
|
+
console.log(`✅ Generated wrapper: bin/${binName}.js`);
|
|
2377
|
+
}
|
|
2378
|
+
result.success = true;
|
|
2379
|
+
return result;
|
|
2380
|
+
}
|
|
2381
|
+
console.log(`
|
|
2382
|
+
\uD83D\uDE80 Publishing platform packages...
|
|
2383
|
+
`);
|
|
2384
|
+
result.published = await publishAllPlatformPackages(binariesConfig, version, result.packages, false, options.verbose);
|
|
2385
|
+
const successfulPublishes = result.published.filter((p) => p.success);
|
|
2386
|
+
const failedPublishes = result.published.filter((p) => !p.success);
|
|
2387
|
+
printPublishSummary(result.published, binariesConfig);
|
|
2388
|
+
if (failedPublishes.length > 0) {
|
|
2389
|
+
for (const pub of failedPublishes) {
|
|
2390
|
+
result.warnings.push(`Failed to publish ${pub.packageName}: ${pub.error}`);
|
|
2391
|
+
}
|
|
2392
|
+
if (!binariesConfig.continueOnError) {
|
|
2393
|
+
result.errors.push("Some packages failed to publish");
|
|
2394
|
+
return result;
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
if (!options.skipMainPackage) {
|
|
2398
|
+
console.log(`
|
|
2399
|
+
\uD83D\uDCDD Updating main package.json...
|
|
2400
|
+
`);
|
|
2401
|
+
const wrapperScript = generateBinaryWrapper(binariesConfig);
|
|
2402
|
+
const binDir = join3(dirname(binariesConfig.mainPackage), "bin");
|
|
2403
|
+
const binName = binariesConfig.binName ?? binariesConfig.name;
|
|
2404
|
+
await mkdir2(binDir, { recursive: true });
|
|
2405
|
+
await writeFile5(join3(binDir, `${binName}.js`), wrapperScript);
|
|
2406
|
+
const publishedPlatforms = successfulPublishes.map((p) => p.platform);
|
|
2407
|
+
await updateMainPackageJson(binariesConfig.mainPackage, binariesConfig, version, publishedPlatforms, false);
|
|
2408
|
+
console.log(`✅ Updated ${binariesConfig.mainPackage}`);
|
|
2409
|
+
console.log(`✅ Generated wrapper: bin/${binName}.js`);
|
|
2410
|
+
}
|
|
2411
|
+
result.success = successfulPublishes.length > 0;
|
|
2412
|
+
if (result.success) {
|
|
2413
|
+
console.log(`
|
|
2414
|
+
✅ Binary distribution completed successfully!
|
|
2415
|
+
`);
|
|
2416
|
+
}
|
|
2417
|
+
} catch (error) {
|
|
2418
|
+
result.errors.push(error instanceof Error ? error.message : String(error));
|
|
2419
|
+
console.error(`
|
|
2420
|
+
❌ Binary distribution failed:`);
|
|
2421
|
+
console.error(error);
|
|
2422
|
+
}
|
|
2423
|
+
return result;
|
|
2424
|
+
}
|
|
2425
|
+
|
|
1364
2426
|
// src/index.ts
|
|
1365
2427
|
function printDryRunInfo(pkg, currentVersion, versionBump, tag, commits, changelogEntry) {
|
|
1366
2428
|
console.log(`
|
|
@@ -1389,7 +2451,7 @@ function printSuccessInfo(pkg, currentVersion, newVersion, tag, releaseUrl) {
|
|
|
1389
2451
|
}
|
|
1390
2452
|
async function updatePackageFiles(pkg, newVersion, changelogEntry) {
|
|
1391
2453
|
await updatePackageVersion(pkg.path, newVersion);
|
|
1392
|
-
const changelogPath =
|
|
2454
|
+
const changelogPath = resolve4(pkg.path, pkg.changelog);
|
|
1393
2455
|
await updateChangelogFile(changelogPath, changelogEntry);
|
|
1394
2456
|
return changelogPath;
|
|
1395
2457
|
}
|
|
@@ -1442,7 +2504,7 @@ async function performGitOperations(config, options, pkg, newVersion, tag, chang
|
|
|
1442
2504
|
}
|
|
1443
2505
|
}
|
|
1444
2506
|
const commitMessage = config.git.commitMessage.replace("{{package}}", pkg.name).replace("{{version}}", newVersion);
|
|
1445
|
-
await createCommit(commitMessage, [
|
|
2507
|
+
await createCommit(commitMessage, [resolve4(pkg.path, "package.json"), changelogPath]);
|
|
1446
2508
|
}
|
|
1447
2509
|
if (!options.noTag) {
|
|
1448
2510
|
const tagMessage = config.git.tagMessage.replace("{{package}}", pkg.name).replace("{{version}}", newVersion);
|
|
@@ -1600,11 +2662,11 @@ async function createReleaseOnly(tag, packageName, configPath) {
|
|
|
1600
2662
|
import { parseArgs } from "node:util";
|
|
1601
2663
|
|
|
1602
2664
|
// src/utils/commitlint-generator.ts
|
|
1603
|
-
import { writeFile as
|
|
2665
|
+
import { writeFile as writeFile6 } from "node:fs/promises";
|
|
1604
2666
|
async function generateCommitlint(config, options = {}) {
|
|
1605
2667
|
const generatorOptions = parseGeneratorOptions(options);
|
|
1606
2668
|
const rules = buildCommitlintRules(config, options);
|
|
1607
|
-
const configContent =
|
|
2669
|
+
const configContent = generateConfigContent2(rules, generatorOptions.format, generatorOptions.comments);
|
|
1608
2670
|
if (generatorOptions.verbose) {
|
|
1609
2671
|
printVerboseOutput(rules, options);
|
|
1610
2672
|
}
|
|
@@ -1612,7 +2674,7 @@ async function generateCommitlint(config, options = {}) {
|
|
|
1612
2674
|
printDryRunOutput(configContent, generatorOptions.output);
|
|
1613
2675
|
return;
|
|
1614
2676
|
}
|
|
1615
|
-
await
|
|
2677
|
+
await writeFile6(generatorOptions.output, configContent);
|
|
1616
2678
|
console.log(`✅ Generated commitlint config: ${generatorOptions.output}`);
|
|
1617
2679
|
}
|
|
1618
2680
|
function parseGeneratorOptions(options) {
|
|
@@ -1785,7 +2847,11 @@ var RULE_ORDER = [
|
|
|
1785
2847
|
"footer-leading-blank",
|
|
1786
2848
|
"footer-max-line-length"
|
|
1787
2849
|
];
|
|
1788
|
-
function
|
|
2850
|
+
function generateParserPreset(comments) {
|
|
2851
|
+
const comment = comments ? " // Support for feat(scope)!, fix! breaking change syntax" : "";
|
|
2852
|
+
return ` parserPreset: "conventional-changelog-conventionalcommits",${comment}`;
|
|
2853
|
+
}
|
|
2854
|
+
function generateConfigContent2(rules, format, comments) {
|
|
1789
2855
|
const rulesObject = buildRulesObject(rules);
|
|
1790
2856
|
if (format === "json") {
|
|
1791
2857
|
return generateJSONConfig(rulesObject);
|
|
@@ -1808,9 +2874,12 @@ function generateConfigContent(rules, format, comments) {
|
|
|
1808
2874
|
const comment = comments ? generateRuleComment(ruleName, rules) : "";
|
|
1809
2875
|
rulesLines.push(` "${ruleName}": ${formatRuleValue(value)},${comment}`);
|
|
1810
2876
|
}
|
|
2877
|
+
const parserPreset = generateParserPreset(comments);
|
|
1811
2878
|
const content = `${header}${typeImport}${configDeclaration}{
|
|
1812
2879
|
extends: ["@commitlint/config-conventional"],
|
|
1813
2880
|
|
|
2881
|
+
${parserPreset}
|
|
2882
|
+
|
|
1814
2883
|
rules: {
|
|
1815
2884
|
${rulesLines.join(`
|
|
1816
2885
|
`)}
|
|
@@ -1824,6 +2893,7 @@ ${isTS ? "export default config;" : "module.exports = config;"}
|
|
|
1824
2893
|
function generateJSONConfig(rulesObject) {
|
|
1825
2894
|
const config = {
|
|
1826
2895
|
extends: ["@commitlint/config-conventional"],
|
|
2896
|
+
parserPreset: "conventional-changelog-conventionalcommits",
|
|
1827
2897
|
rules: rulesObject
|
|
1828
2898
|
};
|
|
1829
2899
|
return JSON.stringify(config, null, 2);
|
|
@@ -1835,17 +2905,23 @@ gitverse-release - Release automation tool for GitVerse
|
|
|
1835
2905
|
|
|
1836
2906
|
Usage:
|
|
1837
2907
|
gitverse-release [package-name] [options]
|
|
2908
|
+
gitverse-release init [options]
|
|
1838
2909
|
gitverse-release create-only --tag <tag> [options]
|
|
1839
2910
|
gitverse-release generate-commitlint [options]
|
|
2911
|
+
gitverse-release publish-binaries [options]
|
|
2912
|
+
gitverse-release generate-binary-packages [options]
|
|
1840
2913
|
|
|
1841
2914
|
Commands:
|
|
1842
|
-
(default)
|
|
1843
|
-
|
|
1844
|
-
|
|
2915
|
+
(default) Full release: update version, commit, tag, push, create release
|
|
2916
|
+
init Initialize .gitversereleaserc.jsonc config file
|
|
2917
|
+
create-only Create only GitVerse Release for existing tag (recovery mode)
|
|
2918
|
+
generate-commitlint Generate commitlint config from release config
|
|
2919
|
+
publish-binaries Generate and publish platform-specific binary packages
|
|
2920
|
+
generate-binary-packages Generate platform-specific binary packages (without publishing)
|
|
1845
2921
|
|
|
1846
2922
|
Options:
|
|
1847
2923
|
--dry-run Test run without making changes
|
|
1848
|
-
--config <path> Path to config file (default: .
|
|
2924
|
+
--config <path> Path to config file (default: .gitversereleaserc.jsonc)
|
|
1849
2925
|
--package <name> Package name to release (for monorepo)
|
|
1850
2926
|
--version <version> Force specific version instead of auto-calculation
|
|
1851
2927
|
--prerelease [tag] Create prerelease version (e.g., beta, alpha, rc)
|
|
@@ -1857,6 +2933,10 @@ Options:
|
|
|
1857
2933
|
--verbose Verbose output
|
|
1858
2934
|
--help Show this help message
|
|
1859
2935
|
|
|
2936
|
+
Init Options:
|
|
2937
|
+
--monorepo Initialize config for monorepo mode
|
|
2938
|
+
--scopes <scopes> Additional scopes for commitlint (comma-separated)
|
|
2939
|
+
|
|
1860
2940
|
Generate Commitlint Options:
|
|
1861
2941
|
--output <path> Output path for commitlint config (default: commitlint.config.ts)
|
|
1862
2942
|
--format <format> Output format: ts, js, json (default: ts)
|
|
@@ -1865,7 +2945,17 @@ Generate Commitlint Options:
|
|
|
1865
2945
|
--header-max-length <n> Maximum header length (default: 100)
|
|
1866
2946
|
--no-comments Disable comments in generated config
|
|
1867
2947
|
|
|
2948
|
+
Binary Distribution Options:
|
|
2949
|
+
--platforms <list> Platforms to build (comma-separated: linux-x64,darwin-arm64,...)
|
|
2950
|
+
--generate-only Only generate packages, do not publish
|
|
2951
|
+
--skip-main-package Do not update main package.json
|
|
2952
|
+
|
|
1868
2953
|
Examples:
|
|
2954
|
+
# Initialize config file
|
|
2955
|
+
gitverse-release init
|
|
2956
|
+
gitverse-release init --monorepo
|
|
2957
|
+
gitverse-release init --dry-run
|
|
2958
|
+
|
|
1869
2959
|
# Auto-detect version and create release
|
|
1870
2960
|
gitverse-release sdk
|
|
1871
2961
|
|
|
@@ -1879,7 +2969,7 @@ Examples:
|
|
|
1879
2969
|
gitverse-release sdk --dry-run
|
|
1880
2970
|
|
|
1881
2971
|
# Custom config
|
|
1882
|
-
gitverse-release sdk --config ./my-config.
|
|
2972
|
+
gitverse-release sdk --config ./my-config.jsonc
|
|
1883
2973
|
|
|
1884
2974
|
# Create only release for existing tag (recovery)
|
|
1885
2975
|
gitverse-release create-only --tag v1.2.3
|
|
@@ -1891,8 +2981,17 @@ Examples:
|
|
|
1891
2981
|
gitverse-release generate-commitlint --format js --output .commitlintrc.js
|
|
1892
2982
|
gitverse-release generate-commitlint --scopes deps,ci,docs --scope-required
|
|
1893
2983
|
|
|
2984
|
+
# Publish binary packages
|
|
2985
|
+
gitverse-release publish-binaries --dry-run
|
|
2986
|
+
gitverse-release publish-binaries --version 1.2.3
|
|
2987
|
+
gitverse-release publish-binaries --platforms linux-x64,darwin-arm64
|
|
2988
|
+
|
|
2989
|
+
# Generate binary packages only (without publishing)
|
|
2990
|
+
gitverse-release generate-binary-packages --dry-run
|
|
2991
|
+
gitverse-release generate-binary-packages --version 1.2.3
|
|
2992
|
+
|
|
1894
2993
|
Environment Variables:
|
|
1895
|
-
GITVERSE_TOKEN GitVerse API token (required)
|
|
2994
|
+
GITVERSE_TOKEN GitVerse API token (required for release creation)
|
|
1896
2995
|
|
|
1897
2996
|
Documentation:
|
|
1898
2997
|
https://gitverse.ru/rainypixel/gitverse-sdk
|
|
@@ -1905,8 +3004,10 @@ async function main() {
|
|
|
1905
3004
|
config: { type: "string" },
|
|
1906
3005
|
"dry-run": { type: "boolean" },
|
|
1907
3006
|
format: { type: "string" },
|
|
3007
|
+
"generate-only": { type: "boolean" },
|
|
1908
3008
|
"header-max-length": { type: "string" },
|
|
1909
3009
|
help: { type: "boolean" },
|
|
3010
|
+
monorepo: { type: "boolean" },
|
|
1910
3011
|
"no-comments": { type: "boolean" },
|
|
1911
3012
|
"no-commit": { type: "boolean" },
|
|
1912
3013
|
"no-push": { type: "boolean" },
|
|
@@ -1914,9 +3015,11 @@ async function main() {
|
|
|
1914
3015
|
"no-tag": { type: "boolean" },
|
|
1915
3016
|
output: { type: "string" },
|
|
1916
3017
|
package: { type: "string" },
|
|
3018
|
+
platforms: { type: "string" },
|
|
1917
3019
|
prerelease: { type: "string" },
|
|
1918
3020
|
"scope-required": { type: "boolean" },
|
|
1919
3021
|
scopes: { type: "string" },
|
|
3022
|
+
"skip-main-package": { type: "boolean" },
|
|
1920
3023
|
tag: { type: "string" },
|
|
1921
3024
|
verbose: { type: "boolean" },
|
|
1922
3025
|
version: { type: "string" }
|
|
@@ -1927,6 +3030,32 @@ async function main() {
|
|
|
1927
3030
|
process.exit(0);
|
|
1928
3031
|
}
|
|
1929
3032
|
const command = positionals[0];
|
|
3033
|
+
if (command === "init") {
|
|
3034
|
+
const scopes = values.scopes ? values.scopes.split(",").map((s) => s.trim()) : undefined;
|
|
3035
|
+
try {
|
|
3036
|
+
const filePath = await initConfig({
|
|
3037
|
+
dryRun: values["dry-run"],
|
|
3038
|
+
monorepo: values.monorepo,
|
|
3039
|
+
scopes
|
|
3040
|
+
});
|
|
3041
|
+
if (!values["dry-run"]) {
|
|
3042
|
+
console.log(`
|
|
3043
|
+
✅ Created config file: ${filePath}
|
|
3044
|
+
`);
|
|
3045
|
+
console.log("Next steps:");
|
|
3046
|
+
console.log(" 1. Review and customize the config file");
|
|
3047
|
+
console.log(" 2. Run: gitverse-release generate-commitlint");
|
|
3048
|
+
console.log(` 3. Run: gitverse-release --dry-run
|
|
3049
|
+
`);
|
|
3050
|
+
}
|
|
3051
|
+
process.exit(0);
|
|
3052
|
+
} catch (error) {
|
|
3053
|
+
console.error(`
|
|
3054
|
+
❌ ${error instanceof Error ? error.message : String(error)}
|
|
3055
|
+
`);
|
|
3056
|
+
process.exit(1);
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
1930
3059
|
if (command === "generate-commitlint") {
|
|
1931
3060
|
const config = await loadConfig(values.config);
|
|
1932
3061
|
const scopesList = values.scopes ? values.scopes.split(",").map((s) => s.trim()) : config.commitlint.scopes;
|
|
@@ -1943,6 +3072,64 @@ async function main() {
|
|
|
1943
3072
|
});
|
|
1944
3073
|
process.exit(0);
|
|
1945
3074
|
}
|
|
3075
|
+
if (command === "publish-binaries") {
|
|
3076
|
+
const binaryOptions = {
|
|
3077
|
+
config: values.config,
|
|
3078
|
+
dryRun: values["dry-run"],
|
|
3079
|
+
generateOnly: values["generate-only"],
|
|
3080
|
+
platforms: values.platforms ? parsePlatforms(values.platforms) : undefined,
|
|
3081
|
+
skipMainPackage: values["skip-main-package"],
|
|
3082
|
+
verbose: values.verbose,
|
|
3083
|
+
version: values.version
|
|
3084
|
+
};
|
|
3085
|
+
const result2 = await publishBinaries(binaryOptions);
|
|
3086
|
+
if (values.verbose) {
|
|
3087
|
+
console.log(`
|
|
3088
|
+
\uD83D\uDCCA Result:`);
|
|
3089
|
+
console.log(JSON.stringify(result2, null, 2));
|
|
3090
|
+
}
|
|
3091
|
+
if (result2.errors.length > 0) {
|
|
3092
|
+
console.error(`
|
|
3093
|
+
❌ Errors:`);
|
|
3094
|
+
for (const error of result2.errors) {
|
|
3095
|
+
console.error(` - ${error}`);
|
|
3096
|
+
}
|
|
3097
|
+
process.exit(1);
|
|
3098
|
+
}
|
|
3099
|
+
if (!result2.success) {
|
|
3100
|
+
process.exit(1);
|
|
3101
|
+
}
|
|
3102
|
+
process.exit(0);
|
|
3103
|
+
}
|
|
3104
|
+
if (command === "generate-binary-packages") {
|
|
3105
|
+
const binaryOptions = {
|
|
3106
|
+
config: values.config,
|
|
3107
|
+
dryRun: values["dry-run"],
|
|
3108
|
+
generateOnly: true,
|
|
3109
|
+
platforms: values.platforms ? parsePlatforms(values.platforms) : undefined,
|
|
3110
|
+
skipMainPackage: values["skip-main-package"],
|
|
3111
|
+
verbose: values.verbose,
|
|
3112
|
+
version: values.version
|
|
3113
|
+
};
|
|
3114
|
+
const result2 = await generateBinaryPackages(binaryOptions);
|
|
3115
|
+
if (values.verbose) {
|
|
3116
|
+
console.log(`
|
|
3117
|
+
\uD83D\uDCCA Result:`);
|
|
3118
|
+
console.log(JSON.stringify(result2, null, 2));
|
|
3119
|
+
}
|
|
3120
|
+
if (result2.errors.length > 0) {
|
|
3121
|
+
console.error(`
|
|
3122
|
+
❌ Errors:`);
|
|
3123
|
+
for (const error of result2.errors) {
|
|
3124
|
+
console.error(` - ${error}`);
|
|
3125
|
+
}
|
|
3126
|
+
process.exit(1);
|
|
3127
|
+
}
|
|
3128
|
+
if (!result2.success) {
|
|
3129
|
+
process.exit(1);
|
|
3130
|
+
}
|
|
3131
|
+
process.exit(0);
|
|
3132
|
+
}
|
|
1946
3133
|
if (command === "create-only") {
|
|
1947
3134
|
if (!values.tag) {
|
|
1948
3135
|
console.error("❌ Error: --tag is required for create-only command");
|
|
@@ -2016,4 +3203,4 @@ Usage: gitverse-release create-only --tag <tag> [--package <name>]`);
|
|
|
2016
3203
|
}
|
|
2017
3204
|
main();
|
|
2018
3205
|
|
|
2019
|
-
//# debugId=
|
|
3206
|
+
//# debugId=B4127DBA941A3A7264756E2164756E21
|