gitverse-release 3.5.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/dist/index.js CHANGED
@@ -18,12 +18,52 @@ var __toESM = (mod, isNodeMode, target) => {
18
18
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
19
19
 
20
20
  // src/index.ts
21
- import { resolve as resolve2 } from "node:path";
21
+ import { resolve as resolve4 } from "node:path";
22
22
 
23
23
  // src/config.ts
24
- import { readFile } from "node:fs/promises";
24
+ import { access, readFile, writeFile } from "node:fs/promises";
25
25
  import { resolve } from "node:path";
26
+ import { parse as parseJsonc } from "jsonc-parser";
27
+ var DEFAULT_CONFIG_FILE_NAME = ".gitversereleaserc.jsonc";
28
+ var CONFIG_FILE_NAMES = [".gitversereleaserc.jsonc", ".gitversereleaserc.json"];
29
+ async function fileExists(path) {
30
+ try {
31
+ await access(path);
32
+ return true;
33
+ } catch {
34
+ return false;
35
+ }
36
+ }
37
+ async function findConfigFile(directory) {
38
+ for (const fileName of CONFIG_FILE_NAMES) {
39
+ const fullPath = resolve(directory, fileName);
40
+ if (await fileExists(fullPath)) {
41
+ return fullPath;
42
+ }
43
+ }
44
+ return null;
45
+ }
46
+ var DEFAULT_BINARY_PLATFORMS = [
47
+ "linux-x64",
48
+ "linux-arm64",
49
+ "darwin-x64",
50
+ "darwin-arm64",
51
+ "win32-x64"
52
+ ];
53
+ var DEFAULT_BINARIES_CONFIG = {
54
+ continueOnError: false,
55
+ distDir: "./dist",
56
+ enabled: false,
57
+ mainPackage: "./package.json",
58
+ name: "",
59
+ outDir: "./npm",
60
+ platforms: DEFAULT_BINARY_PLATFORMS,
61
+ publishCommand: "npm publish --access public",
62
+ retryAttempts: 3,
63
+ scope: ""
64
+ };
26
65
  var DEFAULT_CONFIG = {
66
+ binaries: DEFAULT_BINARIES_CONFIG,
27
67
  changelog: {
28
68
  showAuthor: true,
29
69
  showHash: true,
@@ -87,11 +127,18 @@ var DEFAULT_CONFIG = {
87
127
  }
88
128
  };
89
129
  async function loadConfig(configPath) {
90
- const path = configPath || ".gitversereleaserc.json";
91
- const fullPath = resolve(process.cwd(), path);
130
+ let fullPath;
131
+ if (configPath) {
132
+ fullPath = resolve(process.cwd(), configPath);
133
+ } else {
134
+ fullPath = await findConfigFile(process.cwd());
135
+ }
136
+ if (!fullPath) {
137
+ return DEFAULT_CONFIG;
138
+ }
92
139
  try {
93
140
  const content = await readFile(fullPath, "utf-8");
94
- const userConfig = JSON.parse(content);
141
+ const userConfig = parseJsonc(content);
95
142
  return mergeConfig(DEFAULT_CONFIG, userConfig);
96
143
  } catch (error) {
97
144
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
@@ -102,6 +149,10 @@ async function loadConfig(configPath) {
102
149
  }
103
150
  function mergeConfig(defaults, user) {
104
151
  return {
152
+ binaries: {
153
+ ...defaults.binaries,
154
+ ...user.binaries
155
+ },
105
156
  changelog: {
106
157
  ...defaults.changelog,
107
158
  ...user.changelog,
@@ -146,6 +197,141 @@ function validateConfig(config) {
146
197
  }
147
198
  }
148
199
  }
200
+ var SAFE_NAME_REGEX = /^[a-zA-Z0-9_.-]+$/;
201
+ var SAFE_SCOPE_REGEX = /^@?[a-zA-Z0-9_-]+$/;
202
+ function validateBinariesConfig(config) {
203
+ if (!config.enabled) {
204
+ return;
205
+ }
206
+ if (!config.scope) {
207
+ throw new Error("Binaries config: scope is required when enabled");
208
+ }
209
+ if (!SAFE_SCOPE_REGEX.test(config.scope)) {
210
+ throw new Error(`Binaries config: scope "${config.scope}" contains invalid characters. ` + "Only letters, numbers, underscore, hyphen are allowed.");
211
+ }
212
+ if (!config.name) {
213
+ throw new Error("Binaries config: name is required when enabled");
214
+ }
215
+ if (!SAFE_NAME_REGEX.test(config.name)) {
216
+ throw new Error(`Binaries config: name "${config.name}" contains invalid characters. ` + "Only letters, numbers, underscore, hyphen, dot are allowed.");
217
+ }
218
+ if (!config.platforms || config.platforms.length === 0) {
219
+ throw new Error("Binaries config: at least one platform is required");
220
+ }
221
+ const validPlatforms = [
222
+ "linux-x64",
223
+ "linux-arm64",
224
+ "darwin-x64",
225
+ "darwin-arm64",
226
+ "win32-x64",
227
+ "win32-arm64"
228
+ ];
229
+ for (const platform of config.platforms) {
230
+ if (!validPlatforms.includes(platform)) {
231
+ throw new Error(`Binaries config: invalid platform "${platform}". Valid: ${validPlatforms.join(", ")}`);
232
+ }
233
+ }
234
+ if (config.retryAttempts < 1 || config.retryAttempts > 10) {
235
+ throw new Error("Binaries config: retryAttempts must be between 1 and 10");
236
+ }
237
+ }
238
+ function configExists() {
239
+ return findConfigFile(process.cwd());
240
+ }
241
+ function generateConfigContent(options = {}) {
242
+ const lines = [];
243
+ lines.push("{");
244
+ lines.push(" // JSON Schema для автодополнения и валидации в IDE");
245
+ lines.push(' "$schema": "node_modules/gitverse-release/schema.json",');
246
+ lines.push("");
247
+ lines.push(" // Настройки генерации CHANGELOG");
248
+ lines.push(' "changelog": {');
249
+ lines.push(' "showAuthor": true,');
250
+ lines.push(' "showHash": true,');
251
+ lines.push(' "types": {');
252
+ lines.push(' "feat": "✨ Features",');
253
+ lines.push(' "fix": "\uD83D\uDC1B Bug Fixes",');
254
+ lines.push(' "docs": "\uD83D\uDCDD Documentation",');
255
+ lines.push(' "style": "\uD83D\uDC84 Styles",');
256
+ lines.push(' "refactor": "♻️ Refactoring",');
257
+ lines.push(' "perf": "⚡ Performance",');
258
+ lines.push(' "test": "✅ Tests",');
259
+ lines.push(' "build": "\uD83C\uDFD7️ Build System",');
260
+ lines.push(' "ci": "\uD83D\uDC77 CI/CD",');
261
+ lines.push(' "chore": "\uD83D\uDD27 Chores",');
262
+ lines.push(' "revert": "⏪ Reverts"');
263
+ lines.push(" }");
264
+ lines.push(" },");
265
+ lines.push("");
266
+ const scopes = options.scopes ?? ["deps", "ci", "docs"];
267
+ lines.push(" // Настройки генерации commitlint конфига");
268
+ lines.push(' "commitlint": {');
269
+ lines.push(` "scopes": ${JSON.stringify(scopes)},`);
270
+ lines.push(' "scopeRequired": false,');
271
+ lines.push(' "headerMaxLength": 100');
272
+ lines.push(" },");
273
+ lines.push("");
274
+ lines.push(" // Настройки Git операций");
275
+ lines.push(' "git": {');
276
+ lines.push(' "commitChanges": true,');
277
+ lines.push(' "commitMessage": "chore(release): v{{version}} [skip ci]",');
278
+ lines.push(' "push": true,');
279
+ lines.push(' "tagMessage": "v{{version}}"');
280
+ lines.push(' // beforeCommit: "bun run format" // Раскомментируйте для форматирования перед коммитом');
281
+ lines.push(" },");
282
+ lines.push("");
283
+ lines.push(" // Настройки GitVerse Release API");
284
+ lines.push(" // Требует переменную окружения GITVERSE_TOKEN");
285
+ lines.push(' "gitverse": {');
286
+ lines.push(' "enabled": true,');
287
+ lines.push(' "checkExisting": true,');
288
+ lines.push(' "failOnError": true');
289
+ lines.push(" },");
290
+ lines.push("");
291
+ lines.push(" // Настройки монорепо");
292
+ lines.push(' "monorepo": {');
293
+ lines.push(` "enabled": ${options.monorepo ?? false}`);
294
+ if (options.monorepo) {
295
+ lines.pop();
296
+ lines.push(` "enabled": true,`);
297
+ lines.push(' "packages": [');
298
+ lines.push(" // Пример конфигурации пакета:");
299
+ lines.push(" // {");
300
+ lines.push(' // "name": "sdk",');
301
+ lines.push(' // "path": "packages/sdk",');
302
+ lines.push(' // "packageName": "my-sdk",');
303
+ lines.push(' // "tagPrefix": "v"');
304
+ lines.push(" // }");
305
+ lines.push(" ]");
306
+ }
307
+ lines.push(" },");
308
+ lines.push("");
309
+ lines.push(" // Настройки версионирования");
310
+ lines.push(' "versioning": {');
311
+ lines.push(' "tagPrefix": "v",');
312
+ lines.push(' "prereleasePrefix": "beta"');
313
+ lines.push(" }");
314
+ lines.push("}");
315
+ return lines.join(`
316
+ `);
317
+ }
318
+ async function initConfig(options = {}) {
319
+ const existingConfig = await configExists();
320
+ if (existingConfig) {
321
+ throw new Error(`Config file already exists: ${existingConfig}`);
322
+ }
323
+ const content = generateConfigContent(options);
324
+ const filePath = resolve(process.cwd(), DEFAULT_CONFIG_FILE_NAME);
325
+ if (options.dryRun) {
326
+ console.log(`
327
+ \uD83D\uDD0D Dry-run mode - Would create: ${filePath}
328
+ `);
329
+ console.log(content);
330
+ return filePath;
331
+ }
332
+ await writeFile(filePath, content, "utf-8");
333
+ return filePath;
334
+ }
149
335
 
150
336
  // ../sdk/dist/errors.js
151
337
  class j extends Error {
@@ -276,44 +462,135 @@ class v {
276
462
  }
277
463
  }
278
464
 
279
- // ../sdk/dist/api/repositories.js
465
+ // ../sdk/dist/api/issues.js
280
466
  class E {
281
467
  client;
282
468
  constructor(k2) {
283
469
  this.client = k2;
284
470
  }
285
- get(k2, x, j2) {
286
- return this.client.get(`/repos/${k2}/${x}`, j2);
471
+ list(k2, A, b, f) {
472
+ let j2 = new URLSearchParams;
473
+ if (b?.state !== undefined)
474
+ j2.append("state", b.state);
475
+ if (b?.q !== undefined)
476
+ j2.append("q", b.q);
477
+ if (b?.labels !== undefined)
478
+ j2.append("labels", b.labels);
479
+ if (b?.milestones !== undefined)
480
+ j2.append("milestones", b.milestones);
481
+ if (b?.created_by !== undefined)
482
+ j2.append("created_by", b.created_by);
483
+ if (b?.assigned_by !== undefined)
484
+ j2.append("assigned_by", b.assigned_by);
485
+ if (b?.mentioned_by !== undefined)
486
+ j2.append("mentioned_by", b.mentioned_by);
487
+ if (b?.type !== undefined)
488
+ j2.append("type", b.type);
489
+ if (b?.since !== undefined)
490
+ j2.append("since", b.since);
491
+ if (b?.before !== undefined)
492
+ j2.append("before", b.before);
493
+ if (b?.page !== undefined)
494
+ j2.append("page", String(b.page));
495
+ if (b?.per_page !== undefined)
496
+ j2.append("per_page", String(b.per_page));
497
+ let z = j2.toString(), B = `/repos/${k2}/${A}/issues${z ? `?${z}` : ""}`;
498
+ return this.client.get(B, f);
499
+ }
500
+ getComment(k2, A, b, f) {
501
+ return this.client.get(`/repos/${k2}/${A}/issues/comments/${b}`, f);
502
+ }
503
+ get(k2, A, b, f) {
504
+ return this.client.get(`/repos/${k2}/${A}/issues/${b}`, f);
505
+ }
506
+ listComments(k2, A, b, f, j2) {
507
+ let z = new URLSearchParams;
508
+ if (f?.since !== undefined)
509
+ z.append("since", f.since);
510
+ if (f?.before !== undefined)
511
+ z.append("before", f.before);
512
+ let B = z.toString(), D = `/repos/${k2}/${A}/issues/${b}/comments${B ? `?${B}` : ""}`;
513
+ return this.client.get(D, j2);
514
+ }
515
+ listLabels(k2, A, b, f) {
516
+ return this.client.get(`/repos/${k2}/${A}/issues/${b}/labels`, f);
517
+ }
518
+ listTimeline(k2, A, b, f, j2) {
519
+ let z = new URLSearchParams;
520
+ if (f?.page !== undefined)
521
+ z.append("page", String(f.page));
522
+ if (f?.per_page !== undefined)
523
+ z.append("per_page", String(f.per_page));
524
+ if (f?.since !== undefined)
525
+ z.append("since", f.since);
526
+ if (f?.before !== undefined)
527
+ z.append("before", f.before);
528
+ let B = z.toString(), D = `/repos/${k2}/${A}/issues/${b}/timeline${B ? `?${B}` : ""}`;
529
+ return this.client.get(D, j2);
530
+ }
531
+ }
532
+
533
+ // ../sdk/dist/api/emails.js
534
+ class x {
535
+ client;
536
+ constructor(b) {
537
+ this.client = b;
538
+ }
539
+ list(b, f) {
540
+ let j2 = new URLSearchParams;
541
+ if (b?.page !== undefined)
542
+ j2.append("page", String(b.page));
543
+ if (b?.per_page !== undefined)
544
+ j2.append("per_page", String(b.per_page));
545
+ let k2 = j2.toString(), w = `/user/emails${k2 ? `?${k2}` : ""}`;
546
+ return this.client.get(w, f);
547
+ }
548
+ create(b, f) {
549
+ return this.client.post("/user/emails", b, f);
550
+ }
551
+ delete(b, f) {
552
+ return this.client.delete("/user/emails", b, f);
553
+ }
554
+ }
555
+
556
+ // ../sdk/dist/api/repositories.js
557
+ class E2 {
558
+ client;
559
+ constructor(k2) {
560
+ this.client = k2;
561
+ }
562
+ get(k2, x2, j2) {
563
+ return this.client.get(`/repos/${k2}/${x2}`, j2);
287
564
  }
288
- update(k2, x, j2, v2) {
289
- return this.client.patch(`/repos/${k2}/${x}`, j2, v2);
565
+ update(k2, x2, j2, v2) {
566
+ return this.client.patch(`/repos/${k2}/${x2}`, j2, v2);
290
567
  }
291
- delete(k2, x, j2) {
292
- return this.client.delete(`/repos/${k2}/${x}`, undefined, j2);
568
+ delete(k2, x2, j2) {
569
+ return this.client.delete(`/repos/${k2}/${x2}`, undefined, j2);
293
570
  }
294
- listRepoSecrets(k2, x, j2, v2) {
571
+ listRepoSecrets(k2, x2, j2, v2) {
295
572
  let z = new URLSearchParams;
296
573
  if (j2?.per_page !== undefined)
297
574
  z.append("per_page", j2.per_page);
298
575
  if (j2?.page !== undefined)
299
576
  z.append("page", j2.page);
300
- let A = z.toString(), B = `/repos/${k2}/${x}/actions/secrets${A ? `?${A}` : ""}`;
577
+ let A = z.toString(), B = `/repos/${k2}/${x2}/actions/secrets${A ? `?${A}` : ""}`;
301
578
  return this.client.get(B, v2);
302
579
  }
303
- getRepoSecret(k2, x, j2, v2) {
304
- return this.client.get(`/repos/${k2}/${x}/actions/secrets/${j2}`, v2);
580
+ getRepoSecret(k2, x2, j2, v2) {
581
+ return this.client.get(`/repos/${k2}/${x2}/actions/secrets/${j2}`, v2);
305
582
  }
306
- createOrUpdateRepoSecret(k2, x, j2, v2, z) {
583
+ createOrUpdateRepoSecret(k2, x2, j2, v2, z) {
307
584
  let A = new URLSearchParams;
308
585
  if (v2?.encrypted_value !== undefined)
309
586
  A.append("encrypted_value", v2.encrypted_value);
310
- let B = A.toString(), D = `/repos/${k2}/${x}/actions/secrets/${j2}${B ? `?${B}` : ""}`;
587
+ let B = A.toString(), D = `/repos/${k2}/${x2}/actions/secrets/${j2}${B ? `?${B}` : ""}`;
311
588
  return this.client.put(D, z);
312
589
  }
313
- deleteRepoSecret(k2, x, j2, v2) {
314
- return this.client.delete(`/repos/${k2}/${x}/actions/secrets/${j2}`, undefined, v2);
590
+ deleteRepoSecret(k2, x2, j2, v2) {
591
+ return this.client.delete(`/repos/${k2}/${x2}/actions/secrets/${j2}`, undefined, v2);
315
592
  }
316
- listBranches(k2, x, j2, v2) {
593
+ listBranches(k2, x2, j2, v2) {
317
594
  let z = new URLSearchParams;
318
595
  if (j2?.page !== undefined)
319
596
  z.append("page", String(j2.page));
@@ -321,10 +598,10 @@ class E {
321
598
  z.append("per_page", String(j2.per_page));
322
599
  if (j2?.q !== undefined)
323
600
  z.append("q", j2.q);
324
- let A = z.toString(), B = `/repos/${k2}/${x}/branches${A ? `?${A}` : ""}`;
601
+ let A = z.toString(), B = `/repos/${k2}/${x2}/branches${A ? `?${A}` : ""}`;
325
602
  return this.client.get(B, v2);
326
603
  }
327
- listCollaborators(k2, x, j2, v2) {
604
+ listCollaborators(k2, x2, j2, v2) {
328
605
  let z = new URLSearchParams;
329
606
  if (j2?.affiliation !== undefined)
330
607
  z.append("affiliation", j2.affiliation);
@@ -334,13 +611,13 @@ class E {
334
611
  z.append("page", String(j2.page));
335
612
  if (j2?.per_page !== undefined)
336
613
  z.append("per_page", String(j2.per_page));
337
- let A = z.toString(), B = `/repos/${k2}/${x}/collaborators${A ? `?${A}` : ""}`;
614
+ let A = z.toString(), B = `/repos/${k2}/${x2}/collaborators${A ? `?${A}` : ""}`;
338
615
  return this.client.get(B, v2);
339
616
  }
340
- addCollaborator(k2, x, j2, v2, z) {
341
- return this.client.put(`/repos/${k2}/${x}/collaborators/${j2}`, v2, z);
617
+ addCollaborator(k2, x2, j2, v2, z) {
618
+ return this.client.put(`/repos/${k2}/${x2}/collaborators/${j2}`, v2, z);
342
619
  }
343
- listCommits(k2, x, j2, v2) {
620
+ listCommits(k2, x2, j2, v2) {
344
621
  let z = new URLSearchParams;
345
622
  if (j2?.page !== undefined)
346
623
  z.append("page", String(j2.page));
@@ -360,49 +637,49 @@ class E {
360
637
  z.append("since", j2.since);
361
638
  if (j2?.until !== undefined)
362
639
  z.append("until", j2.until);
363
- let A = z.toString(), B = `/repos/${k2}/${x}/commits${A ? `?${A}` : ""}`;
640
+ let A = z.toString(), B = `/repos/${k2}/${x2}/commits${A ? `?${A}` : ""}`;
364
641
  return this.client.get(B, v2);
365
642
  }
366
- getCommit(k2, x, j2, v2) {
367
- return this.client.get(`/repos/${k2}/${x}/commits/${j2}`, v2);
643
+ getCommit(k2, x2, j2, v2) {
644
+ return this.client.get(`/repos/${k2}/${x2}/commits/${j2}`, v2);
368
645
  }
369
- compareCommits(k2, x, j2, v2, z) {
646
+ compareCommits(k2, x2, j2, v2, z) {
370
647
  let A = new URLSearchParams;
371
648
  if (v2?.page !== undefined)
372
649
  A.append("page", String(v2.page));
373
650
  if (v2?.per_page !== undefined)
374
651
  A.append("per_page", String(v2.per_page));
375
- let B = A.toString(), D = `/repos/${k2}/${x}/compare/${j2}${B ? `?${B}` : ""}`;
652
+ let B = A.toString(), D = `/repos/${k2}/${x2}/compare/${j2}${B ? `?${B}` : ""}`;
376
653
  return this.client.get(D, z);
377
654
  }
378
- getContent(k2, x, j2, v2, z) {
655
+ getContent(k2, x2, j2, v2, z) {
379
656
  let A = new URLSearchParams;
380
657
  if (v2?.ref !== undefined)
381
658
  A.append("ref", v2.ref);
382
659
  if (v2?.scope !== undefined)
383
660
  A.append("scope", v2.scope);
384
- let B = A.toString(), D = `/repos/${k2}/${x}/contents/${j2}${B ? `?${B}` : ""}`;
661
+ let B = A.toString(), D = `/repos/${k2}/${x2}/contents/${j2}${B ? `?${B}` : ""}`;
385
662
  return this.client.get(D, z);
386
663
  }
387
- createOrUpdateFile(k2, x, j2, v2, z) {
388
- return this.client.put(`/repos/${k2}/${x}/contents/${j2}`, v2, z);
664
+ createOrUpdateFile(k2, x2, j2, v2, z) {
665
+ return this.client.put(`/repos/${k2}/${x2}/contents/${j2}`, v2, z);
389
666
  }
390
- deleteFile(k2, x, j2, v2, z) {
391
- return this.client.delete(`/repos/${k2}/${x}/contents/${j2}`, v2, z);
667
+ deleteFile(k2, x2, j2, v2, z) {
668
+ return this.client.delete(`/repos/${k2}/${x2}/contents/${j2}`, v2, z);
392
669
  }
393
- createFork(k2, x, j2, v2) {
394
- return this.client.post(`/repos/${k2}/${x}/forks`, j2, v2);
670
+ createFork(k2, x2, j2, v2) {
671
+ return this.client.post(`/repos/${k2}/${x2}/forks`, j2, v2);
395
672
  }
396
- createCommit(k2, x, j2, v2) {
397
- return this.client.post(`/repos/${k2}/${x}/git/commits`, j2, v2);
673
+ createCommit(k2, x2, j2, v2) {
674
+ return this.client.post(`/repos/${k2}/${x2}/git/commits`, j2, v2);
398
675
  }
399
- createRef(k2, x, j2, v2) {
400
- return this.client.post(`/repos/${k2}/${x}/git/refs`, j2, v2);
676
+ createRef(k2, x2, j2, v2) {
677
+ return this.client.post(`/repos/${k2}/${x2}/git/refs`, j2, v2);
401
678
  }
402
- createTree(k2, x, j2, v2) {
403
- return this.client.post(`/repos/${k2}/${x}/git/trees`, j2, v2);
679
+ createTree(k2, x2, j2, v2) {
680
+ return this.client.post(`/repos/${k2}/${x2}/git/trees`, j2, v2);
404
681
  }
405
- getTree(k2, x, j2, v2, z) {
682
+ getTree(k2, x2, j2, v2, z) {
406
683
  let A = new URLSearchParams;
407
684
  if (v2?.page !== undefined)
408
685
  A.append("page", String(v2.page));
@@ -410,13 +687,13 @@ class E {
410
687
  A.append("per_page", String(v2.per_page));
411
688
  if (v2?.recursive !== undefined)
412
689
  A.append("recursive", String(v2.recursive));
413
- let B = A.toString(), D = `/repos/${k2}/${x}/git/trees/${j2}${B ? `?${B}` : ""}`;
690
+ let B = A.toString(), D = `/repos/${k2}/${x2}/git/trees/${j2}${B ? `?${B}` : ""}`;
414
691
  return this.client.get(D, z);
415
692
  }
416
- listLanguages(k2, x, j2) {
417
- return this.client.get(`/repos/${k2}/${x}/languages`, j2);
693
+ listLanguages(k2, x2, j2) {
694
+ return this.client.get(`/repos/${k2}/${x2}/languages`, j2);
418
695
  }
419
- listPulls(k2, x, j2, v2) {
696
+ listPulls(k2, x2, j2, v2) {
420
697
  let z = new URLSearchParams;
421
698
  if (j2?.state !== undefined)
422
699
  z.append("state", j2.state);
@@ -432,55 +709,55 @@ class E {
432
709
  z.append("page", String(j2.page));
433
710
  if (j2?.per_page !== undefined)
434
711
  z.append("per_page", String(j2.per_page));
435
- let A = z.toString(), B = `/repos/${k2}/${x}/pulls${A ? `?${A}` : ""}`;
712
+ let A = z.toString(), B = `/repos/${k2}/${x2}/pulls${A ? `?${A}` : ""}`;
436
713
  return this.client.get(B, v2);
437
714
  }
438
- getPull(k2, x, j2, v2) {
439
- return this.client.get(`/repos/${k2}/${x}/pulls/${j2}`, v2);
715
+ getPull(k2, x2, j2, v2) {
716
+ return this.client.get(`/repos/${k2}/${x2}/pulls/${j2}`, v2);
440
717
  }
441
- updatePull(k2, x, j2, v2, z) {
442
- return this.client.patch(`/repos/${k2}/${x}/pulls/${j2}`, v2, z);
718
+ updatePull(k2, x2, j2, v2, z) {
719
+ return this.client.patch(`/repos/${k2}/${x2}/pulls/${j2}`, v2, z);
443
720
  }
444
- listForAuthenticatedUser(k2, x) {
721
+ listForAuthenticatedUser(k2, x2) {
445
722
  let j2 = new URLSearchParams;
446
723
  if (k2?.page !== undefined)
447
724
  j2.append("page", String(k2.page));
448
725
  if (k2?.per_page !== undefined)
449
726
  j2.append("per_page", String(k2.per_page));
450
727
  let v2 = j2.toString(), z = `/user/repos${v2 ? `?${v2}` : ""}`;
451
- return this.client.get(z, x);
728
+ return this.client.get(z, x2);
452
729
  }
453
- createForAuthenticatedUser(k2, x) {
454
- return this.client.post("/user/repos", k2, x);
730
+ createForAuthenticatedUser(k2, x2) {
731
+ return this.client.post("/user/repos", k2, x2);
455
732
  }
456
733
  }
457
734
 
458
735
  // ../sdk/dist/api/teams.js
459
- class E2 {
736
+ class E3 {
460
737
  client;
461
- constructor(x) {
462
- this.client = x;
738
+ constructor(x2) {
739
+ this.client = x2;
463
740
  }
464
- list(x, b, j2) {
741
+ list(x2, b, j2) {
465
742
  let B = new URLSearchParams;
466
743
  if (b?.page !== undefined)
467
744
  B.append("page", String(b.page));
468
745
  if (b?.per_page !== undefined)
469
746
  B.append("per_page", String(b.per_page));
470
- let k2 = B.toString(), C = `/orgs/${x}/teams${k2 ? `?${k2}` : ""}`;
747
+ let k2 = B.toString(), C = `/orgs/${x2}/teams${k2 ? `?${k2}` : ""}`;
471
748
  return this.client.get(C, j2);
472
749
  }
473
- listMembers(x, b, j2, B) {
750
+ listMembers(x2, b, j2, B) {
474
751
  let k2 = new URLSearchParams;
475
752
  if (j2?.page !== undefined)
476
753
  k2.append("page", String(j2.page));
477
754
  if (j2?.per_page !== undefined)
478
755
  k2.append("per_page", String(j2.per_page));
479
- let C = k2.toString(), D = `/orgs/${x}/teams/${b}/members${C ? `?${C}` : ""}`;
756
+ let C = k2.toString(), D = `/orgs/${x2}/teams/${b}/members${C ? `?${C}` : ""}`;
480
757
  return this.client.get(D, B);
481
758
  }
482
- updateRepo(x, b, j2, B, k2, C) {
483
- return this.client.put(`/orgs/${x}/teams/${b}/repos/${j2}/${B}`, k2, C);
759
+ updateRepo(x2, b, j2, B, k2, C) {
760
+ return this.client.put(`/orgs/${x2}/teams/${b}/repos/${j2}/${B}`, k2, C);
484
761
  }
485
762
  }
486
763
 
@@ -500,8 +777,8 @@ class G {
500
777
  B.append("draft", String(b.draft));
501
778
  if (b?.pre_release !== undefined)
502
779
  B.append("pre_release", String(b.pre_release));
503
- let C = B.toString(), E3 = `/repos/${k2}/${A}/releases${C ? `?${C}` : ""}`;
504
- return this.client.get(E3, j2);
780
+ let C = B.toString(), E4 = `/repos/${k2}/${A}/releases${C ? `?${C}` : ""}`;
781
+ return this.client.get(E4, j2);
505
782
  }
506
783
  create(k2, A, b, j2) {
507
784
  return this.client.post(`/repos/${k2}/${A}/releases`, b, j2);
@@ -527,14 +804,14 @@ class G {
527
804
  C.append("page", String(j2.page));
528
805
  if (j2?.per_page !== undefined)
529
806
  C.append("per_page", String(j2.per_page));
530
- let E3 = C.toString(), F = `/repos/${k2}/${A}/releases/${b}/assets${E3 ? `?${E3}` : ""}`;
807
+ let E4 = C.toString(), F = `/repos/${k2}/${A}/releases/${b}/assets${E4 ? `?${E4}` : ""}`;
531
808
  return this.client.get(F, B);
532
809
  }
533
810
  uploadAsset(k2, A, b, j2, B) {
534
811
  let C = new URLSearchParams;
535
812
  if (j2?.name !== undefined)
536
813
  C.append("name", j2.name);
537
- let E3 = C.toString(), F = `/repos/${k2}/${A}/releases/${b}/assets${E3 ? `?${E3}` : ""}`;
814
+ let E4 = C.toString(), F = `/repos/${k2}/${A}/releases/${b}/assets${E4 ? `?${E4}` : ""}`;
538
815
  return this.client.post(F, B);
539
816
  }
540
817
  deleteAsset(k2, A, b, j2, B) {
@@ -583,79 +860,79 @@ class F {
583
860
  constructor(w) {
584
861
  this.client = w;
585
862
  }
586
- listOrgSecrets(w, j2, x) {
863
+ listOrgSecrets(w, j2, x2) {
587
864
  let A = new URLSearchParams;
588
865
  if (j2?.per_page !== undefined)
589
866
  A.append("per_page", j2.per_page);
590
867
  if (j2?.page !== undefined)
591
868
  A.append("page", j2.page);
592
869
  let B = A.toString(), D = `/orgs/${w}/actions/secrets${B ? `?${B}` : ""}`;
593
- return this.client.get(D, x);
870
+ return this.client.get(D, x2);
594
871
  }
595
- getOrgSecret(w, j2, x) {
596
- return this.client.get(`/orgs/${w}/actions/secrets/${j2}`, x);
872
+ getOrgSecret(w, j2, x2) {
873
+ return this.client.get(`/orgs/${w}/actions/secrets/${j2}`, x2);
597
874
  }
598
- createOrUpdateOrgSecret(w, j2, x, A) {
875
+ createOrUpdateOrgSecret(w, j2, x2, A) {
599
876
  let B = new URLSearchParams;
600
- if (x?.encrypted_value !== undefined)
601
- B.append("encrypted_value", x.encrypted_value);
602
- let D = B.toString(), E3 = `/orgs/${w}/actions/secrets/${j2}${D ? `?${D}` : ""}`;
603
- return this.client.put(E3, A);
877
+ if (x2?.encrypted_value !== undefined)
878
+ B.append("encrypted_value", x2.encrypted_value);
879
+ let D = B.toString(), E4 = `/orgs/${w}/actions/secrets/${j2}${D ? `?${D}` : ""}`;
880
+ return this.client.put(E4, A);
604
881
  }
605
- deleteOrgSecret(w, j2, x) {
606
- return this.client.delete(`/orgs/${w}/actions/secrets/${j2}`, undefined, x);
882
+ deleteOrgSecret(w, j2, x2) {
883
+ return this.client.delete(`/orgs/${w}/actions/secrets/${j2}`, undefined, x2);
607
884
  }
608
- isMember(w, j2, x) {
609
- return this.client.get(`/orgs/${w}/members/${j2}`, x);
885
+ isMember(w, j2, x2) {
886
+ return this.client.get(`/orgs/${w}/members/${j2}`, x2);
610
887
  }
611
888
  }
612
889
 
613
890
  // ../sdk/dist/api/actions.js
614
891
  class F2 {
615
892
  client;
616
- constructor(x) {
617
- this.client = x;
893
+ constructor(x2) {
894
+ this.client = x2;
618
895
  }
619
- listOrgRunners(x, j2, b) {
896
+ listOrgRunners(x2, j2, b) {
620
897
  let z = new URLSearchParams;
621
898
  if (j2?.page !== undefined)
622
899
  z.append("page", String(j2.page));
623
900
  if (j2?.per_page !== undefined)
624
901
  z.append("per_page", String(j2.per_page));
625
- let A = z.toString(), B = `/orgs/${x}/actions/runners${A ? `?${A}` : ""}`;
902
+ let A = z.toString(), B = `/orgs/${x2}/actions/runners${A ? `?${A}` : ""}`;
626
903
  return this.client.get(B, b);
627
904
  }
628
- createOrgRunnerRegistrationToken(x, j2) {
629
- return this.client.post(`/orgs/${x}/actions/runners/registration-token`, j2);
905
+ createOrgRunnerRegistrationToken(x2, j2) {
906
+ return this.client.post(`/orgs/${x2}/actions/runners/registration-token`, j2);
630
907
  }
631
- getOrgRunner(x, j2, b) {
632
- return this.client.get(`/orgs/${x}/actions/runners/${j2}`, b);
908
+ getOrgRunner(x2, j2, b) {
909
+ return this.client.get(`/orgs/${x2}/actions/runners/${j2}`, b);
633
910
  }
634
- deleteOrgRunner(x, j2, b) {
635
- return this.client.delete(`/orgs/${x}/actions/runners/${j2}`, undefined, b);
911
+ deleteOrgRunner(x2, j2, b) {
912
+ return this.client.delete(`/orgs/${x2}/actions/runners/${j2}`, undefined, b);
636
913
  }
637
- listOrgVariables(x, j2, b) {
914
+ listOrgVariables(x2, j2, b) {
638
915
  let z = new URLSearchParams;
639
916
  if (j2?.per_page !== undefined)
640
917
  z.append("per_page", String(j2.per_page));
641
918
  if (j2?.page !== undefined)
642
919
  z.append("page", String(j2.page));
643
- let A = z.toString(), B = `/orgs/${x}/actions/variables${A ? `?${A}` : ""}`;
920
+ let A = z.toString(), B = `/orgs/${x2}/actions/variables${A ? `?${A}` : ""}`;
644
921
  return this.client.get(B, b);
645
922
  }
646
- createOrgVariable(x, j2, b) {
647
- return this.client.post(`/orgs/${x}/actions/variables`, j2, b);
923
+ createOrgVariable(x2, j2, b) {
924
+ return this.client.post(`/orgs/${x2}/actions/variables`, j2, b);
648
925
  }
649
- getOrgVariable(x, j2, b) {
650
- return this.client.get(`/orgs/${x}/actions/variables/${j2}`, b);
926
+ getOrgVariable(x2, j2, b) {
927
+ return this.client.get(`/orgs/${x2}/actions/variables/${j2}`, b);
651
928
  }
652
- updateOrgVariable(x, j2, b, z) {
653
- return this.client.patch(`/orgs/${x}/actions/variables/${j2}`, b, z);
929
+ updateOrgVariable(x2, j2, b, z) {
930
+ return this.client.patch(`/orgs/${x2}/actions/variables/${j2}`, b, z);
654
931
  }
655
- deleteOrgVariable(x, j2, b) {
656
- return this.client.delete(`/orgs/${x}/actions/variables/${j2}`, undefined, b);
932
+ deleteOrgVariable(x2, j2, b) {
933
+ return this.client.delete(`/orgs/${x2}/actions/variables/${j2}`, undefined, b);
657
934
  }
658
- listArtifacts(x, j2, b, z) {
935
+ listArtifacts(x2, j2, b, z) {
659
936
  let A = new URLSearchParams;
660
937
  if (b?.page !== undefined)
661
938
  A.append("page", String(b.page));
@@ -663,77 +940,80 @@ class F2 {
663
940
  A.append("per_page", String(b.per_page));
664
941
  if (b?.name !== undefined)
665
942
  A.append("name", b.name);
666
- let B = A.toString(), C = `/repos/${x}/${j2}/actions/artifacts${B ? `?${B}` : ""}`;
943
+ let B = A.toString(), C = `/repos/${x2}/${j2}/actions/artifacts${B ? `?${B}` : ""}`;
667
944
  return this.client.get(C, z);
668
945
  }
669
- getArtifact(x, j2, b, z) {
670
- return this.client.get(`/repos/${x}/${j2}/actions/artifacts/${b}`, z);
946
+ getArtifact(x2, j2, b, z) {
947
+ return this.client.get(`/repos/${x2}/${j2}/actions/artifacts/${b}`, z);
671
948
  }
672
- deleteArtifact(x, j2, b, z) {
673
- return this.client.delete(`/repos/${x}/${j2}/actions/artifacts/${b}`, undefined, z);
949
+ deleteArtifact(x2, j2, b, z) {
950
+ return this.client.delete(`/repos/${x2}/${j2}/actions/artifacts/${b}`, undefined, z);
674
951
  }
675
- downloadArtifact(x, j2, b, z) {
676
- return this.client.get(`/repos/${x}/${j2}/actions/artifacts/${b}/zip`, z);
952
+ downloadArtifact(x2, j2, b, z) {
953
+ return this.client.get(`/repos/${x2}/${j2}/actions/artifacts/${b}/zip`, z);
677
954
  }
678
- downloadArtifactRaw(x, j2, b, z) {
679
- return this.client.get(`/repos/${x}/${j2}/actions/artifacts/${b}/zip/raw`, z);
955
+ downloadArtifactRaw(x2, j2, b, z) {
956
+ return this.client.get(`/repos/${x2}/${j2}/actions/artifacts/${b}/zip/raw`, z);
680
957
  }
681
- listRepoRunners(x, j2, b, z) {
958
+ createActionLink(x2, j2, b, z) {
959
+ return this.client.post(`/repos/${x2}/${j2}/actions/links`, b, z);
960
+ }
961
+ listRepoRunners(x2, j2, b, z) {
682
962
  let A = new URLSearchParams;
683
963
  if (b?.page !== undefined)
684
964
  A.append("page", String(b.page));
685
965
  if (b?.per_page !== undefined)
686
966
  A.append("per_page", String(b.per_page));
687
- let B = A.toString(), C = `/repos/${x}/${j2}/actions/runners${B ? `?${B}` : ""}`;
967
+ let B = A.toString(), C = `/repos/${x2}/${j2}/actions/runners${B ? `?${B}` : ""}`;
688
968
  return this.client.get(C, z);
689
969
  }
690
- createRepoRunnerRegistrationToken(x, j2, b) {
691
- return this.client.post(`/repos/${x}/${j2}/actions/runners/registration-token`, b);
970
+ createRepoRunnerRegistrationToken(x2, j2, b) {
971
+ return this.client.post(`/repos/${x2}/${j2}/actions/runners/registration-token`, b);
692
972
  }
693
- getRepoRunner(x, j2, b, z) {
694
- return this.client.get(`/repos/${x}/${j2}/actions/runners/${b}`, z);
973
+ getRepoRunner(x2, j2, b, z) {
974
+ return this.client.get(`/repos/${x2}/${j2}/actions/runners/${b}`, z);
695
975
  }
696
- deleteRepoRunner(x, j2, b, z) {
697
- return this.client.delete(`/repos/${x}/${j2}/actions/runners/${b}`, undefined, z);
976
+ deleteRepoRunner(x2, j2, b, z) {
977
+ return this.client.delete(`/repos/${x2}/${j2}/actions/runners/${b}`, undefined, z);
698
978
  }
699
- listRepoVariables(x, j2, b, z) {
979
+ listRepoVariables(x2, j2, b, z) {
700
980
  let A = new URLSearchParams;
701
981
  if (b?.per_page !== undefined)
702
982
  A.append("per_page", String(b.per_page));
703
983
  if (b?.page !== undefined)
704
984
  A.append("page", String(b.page));
705
- let B = A.toString(), C = `/repos/${x}/${j2}/actions/variables${B ? `?${B}` : ""}`;
985
+ let B = A.toString(), C = `/repos/${x2}/${j2}/actions/variables${B ? `?${B}` : ""}`;
706
986
  return this.client.get(C, z);
707
987
  }
708
- createRepoVariable(x, j2, b, z) {
709
- return this.client.post(`/repos/${x}/${j2}/actions/variables`, b, z);
988
+ createRepoVariable(x2, j2, b, z) {
989
+ return this.client.post(`/repos/${x2}/${j2}/actions/variables`, b, z);
710
990
  }
711
- getRepoVariable(x, j2, b, z) {
712
- return this.client.get(`/repos/${x}/${j2}/actions/variables/${b}`, z);
991
+ getRepoVariable(x2, j2, b, z) {
992
+ return this.client.get(`/repos/${x2}/${j2}/actions/variables/${b}`, z);
713
993
  }
714
- updateRepoVariable(x, j2, b, z, A) {
715
- return this.client.patch(`/repos/${x}/${j2}/actions/variables/${b}`, z, A);
994
+ updateRepoVariable(x2, j2, b, z, A) {
995
+ return this.client.patch(`/repos/${x2}/${j2}/actions/variables/${b}`, z, A);
716
996
  }
717
- deleteRepoVariable(x, j2, b, z) {
718
- return this.client.delete(`/repos/${x}/${j2}/actions/variables/${b}`, undefined, z);
997
+ deleteRepoVariable(x2, j2, b, z) {
998
+ return this.client.delete(`/repos/${x2}/${j2}/actions/variables/${b}`, undefined, z);
719
999
  }
720
- getWorkflowDispatchInputs(x, j2, b, z, A) {
1000
+ getWorkflowDispatchInputs(x2, j2, b, z, A) {
721
1001
  let B = new URLSearchParams;
722
1002
  if (z?.branch !== undefined)
723
1003
  B.append("branch", z.branch);
724
1004
  if (z?.tag !== undefined)
725
1005
  B.append("tag", z.tag);
726
- let C = B.toString(), D = `/repos/${x}/${j2}/actions/workflows/${b}/dispatches${C ? `?${C}` : ""}`;
1006
+ let C = B.toString(), D = `/repos/${x2}/${j2}/actions/workflows/${b}/dispatches${C ? `?${C}` : ""}`;
727
1007
  return this.client.get(D, A);
728
1008
  }
729
- dispatchWorkflow(x, j2, b, z, A, B) {
1009
+ dispatchWorkflow(x2, j2, b, z, A, B) {
730
1010
  let C = new URLSearchParams;
731
1011
  if (A?.branch !== undefined)
732
1012
  C.append("branch", A.branch);
733
1013
  if (A?.tag !== undefined)
734
1014
  C.append("tag", A.tag);
735
- let D = C.toString(), E3 = `/repos/${x}/${j2}/actions/workflows/${b}/dispatches${D ? `?${D}` : ""}`;
736
- return this.client.post(E3, z, B);
1015
+ let D = C.toString(), E4 = `/repos/${x2}/${j2}/actions/workflows/${b}/dispatches${D ? `?${D}` : ""}`;
1016
+ return this.client.post(E4, z, B);
737
1017
  }
738
1018
  }
739
1019
 
@@ -753,7 +1033,7 @@ class A {
753
1033
  j2.append("sort", b.sort);
754
1034
  if (b?.direction !== undefined)
755
1035
  j2.append("direction", b.direction);
756
- let x = j2.toString(), z = `/user/starred${x ? `?${x}` : ""}`;
1036
+ let x2 = j2.toString(), z = `/user/starred${x2 ? `?${x2}` : ""}`;
757
1037
  return this.client.get(z, k2);
758
1038
  }
759
1039
  isStarred(b, k2, j2) {
@@ -767,74 +1047,6 @@ class A {
767
1047
  }
768
1048
  }
769
1049
 
770
- // ../sdk/dist/api/issues.js
771
- class E3 {
772
- client;
773
- constructor(k2) {
774
- this.client = k2;
775
- }
776
- list(k2, A2, b, f) {
777
- let j2 = new URLSearchParams;
778
- if (b?.state !== undefined)
779
- j2.append("state", b.state);
780
- if (b?.q !== undefined)
781
- j2.append("q", b.q);
782
- if (b?.labels !== undefined)
783
- j2.append("labels", b.labels);
784
- if (b?.milestones !== undefined)
785
- j2.append("milestones", b.milestones);
786
- if (b?.created_by !== undefined)
787
- j2.append("created_by", b.created_by);
788
- if (b?.assigned_by !== undefined)
789
- j2.append("assigned_by", b.assigned_by);
790
- if (b?.mentioned_by !== undefined)
791
- j2.append("mentioned_by", b.mentioned_by);
792
- if (b?.type !== undefined)
793
- j2.append("type", b.type);
794
- if (b?.since !== undefined)
795
- j2.append("since", b.since);
796
- if (b?.before !== undefined)
797
- j2.append("before", b.before);
798
- if (b?.page !== undefined)
799
- j2.append("page", String(b.page));
800
- if (b?.per_page !== undefined)
801
- j2.append("per_page", String(b.per_page));
802
- let z = j2.toString(), B = `/repos/${k2}/${A2}/issues${z ? `?${z}` : ""}`;
803
- return this.client.get(B, f);
804
- }
805
- getComment(k2, A2, b, f) {
806
- return this.client.get(`/repos/${k2}/${A2}/issues/comments/${b}`, f);
807
- }
808
- get(k2, A2, b, f) {
809
- return this.client.get(`/repos/${k2}/${A2}/issues/${b}`, f);
810
- }
811
- listComments(k2, A2, b, f, j2) {
812
- let z = new URLSearchParams;
813
- if (f?.since !== undefined)
814
- z.append("since", f.since);
815
- if (f?.before !== undefined)
816
- z.append("before", f.before);
817
- let B = z.toString(), D = `/repos/${k2}/${A2}/issues/${b}/comments${B ? `?${B}` : ""}`;
818
- return this.client.get(D, j2);
819
- }
820
- listLabels(k2, A2, b, f) {
821
- return this.client.get(`/repos/${k2}/${A2}/issues/${b}/labels`, f);
822
- }
823
- listTimeline(k2, A2, b, f, j2) {
824
- let z = new URLSearchParams;
825
- if (f?.page !== undefined)
826
- z.append("page", String(f.page));
827
- if (f?.per_page !== undefined)
828
- z.append("per_page", String(f.per_page));
829
- if (f?.since !== undefined)
830
- z.append("since", f.since);
831
- if (f?.before !== undefined)
832
- z.append("before", f.before);
833
- let B = z.toString(), D = `/repos/${k2}/${A2}/issues/${b}/timeline${B ? `?${B}` : ""}`;
834
- return this.client.get(D, j2);
835
- }
836
- }
837
-
838
1050
  // ../sdk/dist/api/users.js
839
1051
  class z {
840
1052
  client;
@@ -853,8 +1065,8 @@ class z {
853
1065
  k2.append("page", String(j2.page));
854
1066
  if (j2?.per_page !== undefined)
855
1067
  k2.append("per_page", String(j2.per_page));
856
- let w = k2.toString(), x = `/search/users${w ? `?${w}` : ""}`;
857
- return this.client.get(x, v2);
1068
+ let w = k2.toString(), x2 = `/search/users${w ? `?${w}` : ""}`;
1069
+ return this.client.get(x2, v2);
858
1070
  }
859
1071
  getAuthenticated(j2) {
860
1072
  return this.client.get("/user", j2);
@@ -867,44 +1079,36 @@ class z {
867
1079
  }
868
1080
  }
869
1081
 
870
- // ../sdk/dist/api/emails.js
871
- class x {
1082
+ // ../sdk/dist/api/pages.js
1083
+ class A2 {
872
1084
  client;
873
1085
  constructor(b) {
874
1086
  this.client = b;
875
1087
  }
876
- list(b, f) {
877
- let j2 = new URLSearchParams;
878
- if (b?.page !== undefined)
879
- j2.append("page", String(b.page));
880
- if (b?.per_page !== undefined)
881
- j2.append("per_page", String(b.per_page));
882
- let k2 = j2.toString(), w = `/user/emails${k2 ? `?${k2}` : ""}`;
883
- return this.client.get(w, f);
884
- }
885
- create(b, f) {
886
- return this.client.post("/user/emails", b, f);
1088
+ createDeployment(b, j2, k2, v2) {
1089
+ return this.client.post(`/repos/${b}/${j2}/pages/deployments`, k2, v2);
887
1090
  }
888
- delete(b, f) {
889
- return this.client.delete("/user/emails", b, f);
1091
+ getDeploymentStatus(b, j2, k2, v2) {
1092
+ return this.client.get(`/repos/${b}/${j2}/pages/deployments/${k2}`, v2);
890
1093
  }
891
1094
  }
892
1095
 
893
1096
  // ../sdk/dist/index.js
894
- class J {
1097
+ class K {
895
1098
  client;
896
1099
  actions;
897
1100
  orgs;
898
1101
  teams;
899
1102
  repos;
900
1103
  issues;
1104
+ pages;
901
1105
  pulls;
902
1106
  releases;
903
1107
  users;
904
1108
  emails;
905
1109
  stars;
906
1110
  constructor(b = {}) {
907
- this.client = new v(b), this.actions = new F2(this.client), this.orgs = new F(this.client), this.teams = new E2(this.client), this.repos = new E(this.client), this.issues = new E3(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);
1111
+ 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);
908
1112
  }
909
1113
  setToken(b) {
910
1114
  return this.client.setToken(b), this;
@@ -917,7 +1121,7 @@ class GitVerseReleaseClient {
917
1121
  repoInfo;
918
1122
  retryFn;
919
1123
  constructor(token, repoInfo, retryFn) {
920
- this.client = new J({ token });
1124
+ this.client = new K({ token });
921
1125
  this.repoInfo = repoInfo;
922
1126
  this.retryFn = retryFn;
923
1127
  }
@@ -965,7 +1169,7 @@ function createGitVerseClient(repoInfo, retryFn) {
965
1169
  }
966
1170
 
967
1171
  // src/utils/changelog.ts
968
- import { readFile as readFile2, writeFile } from "node:fs/promises";
1172
+ import { readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
969
1173
 
970
1174
  // src/utils/parser.ts
971
1175
  var COMMIT_REGEX = /^(?<type>\w+)(?:\((?<scope>[^)]+)\))?(?<breaking>!)?: (?<subject>.+)$/;
@@ -1127,7 +1331,7 @@ All notable changes to this project will be documented in this file.
1127
1331
  insertIndex = lines.length;
1128
1332
  }
1129
1333
  lines.splice(insertIndex, 0, newEntry);
1130
- await writeFile(changelogPath, lines.join(`
1334
+ await writeFile2(changelogPath, lines.join(`
1131
1335
  `));
1132
1336
  }
1133
1337
  function generateReleaseNotes(commits, config, repoUrl, packageName) {
@@ -1187,7 +1391,8 @@ async function runBeforeCommitHook(command) {
1187
1391
  }
1188
1392
  var GITVERSE_URL_REGEX_1 = /gitverse\.ru[:/]([^/]+)\/([^/.]+)(\.git)?$/;
1189
1393
  var GITVERSE_URL_REGEX_2 = /gitverse\.ru\/([^/]+)\/([^/.]+)(\.git)?$/;
1190
- async function git(command) {
1394
+ var GITVERSE_URL_REGEX_3 = /gitverse\.ru:\d+\/([^/]+)\/([^/.]+)(\.git)?$/;
1395
+ async function gitCommand(command) {
1191
1396
  const { stdout } = await execAsync(`git ${command}`);
1192
1397
  return stdout.trim();
1193
1398
  }
@@ -1208,14 +1413,14 @@ async function getRepoInfo() {
1208
1413
  };
1209
1414
  }
1210
1415
  }
1211
- const url = await git("remote get-url origin");
1212
- const match = url.match(GITVERSE_URL_REGEX_1) || url.match(GITVERSE_URL_REGEX_2);
1416
+ const url = await gitCommand("remote get-url origin");
1417
+ const match = url.match(GITVERSE_URL_REGEX_1) || url.match(GITVERSE_URL_REGEX_2) || url.match(GITVERSE_URL_REGEX_3);
1213
1418
  if (!(match?.[1] && match[2])) {
1214
1419
  throw new Error(`Unable to parse GitVerse repository from URL: ${url}`);
1215
1420
  }
1216
1421
  const owner = match[1];
1217
1422
  const repo = match[2];
1218
- const branch = await git("branch --show-current");
1423
+ const branch = await gitCommand("branch --show-current");
1219
1424
  return {
1220
1425
  branch,
1221
1426
  fullName: `${owner}/${repo}`,
@@ -1226,7 +1431,7 @@ async function getRepoInfo() {
1226
1431
  }
1227
1432
  async function getLatestTag(prefix) {
1228
1433
  try {
1229
- const tags = await git(`tag --sort=-v:refname --list "${prefix}*"`);
1434
+ const tags = await gitCommand(`tag --sort=-v:refname --list "${prefix}*"`);
1230
1435
  const tagList = tags.split(`
1231
1436
  `).filter((tag) => tag.length > 0);
1232
1437
  return tagList.length > 0 ? tagList[0] ?? null : null;
@@ -1244,7 +1449,7 @@ async function getCommitsSinceTag(tagPrefix, path) {
1244
1449
  }
1245
1450
  const format = "%H%n%h%n%an%n%ae%n%ai%n%B%n==END==";
1246
1451
  const pathFilter = path ? `-- ${path}` : "";
1247
- const log = await git(`log ${range} --format="${format}" ${pathFilter}`);
1452
+ const log = await gitCommand(`log ${range} --format="${format}" ${pathFilter}`);
1248
1453
  const commits = log.split(`
1249
1454
  ==END==`).map((commit) => commit.trim()).filter((commit) => commit.length > 0 && commit !== "==END==");
1250
1455
  return commits;
@@ -1278,33 +1483,33 @@ async function getPackageInfo(packagePath) {
1278
1483
  };
1279
1484
  }
1280
1485
  async function updatePackageVersion(packagePath, newVersion) {
1281
- const { readFile: readFile3, writeFile: writeFile2 } = await import("node:fs/promises");
1486
+ const { readFile: readFile3, writeFile: writeFile3 } = await import("node:fs/promises");
1282
1487
  const { resolve: resolve2 } = await import("node:path");
1283
1488
  const pkgJsonPath = resolve2(packagePath, "package.json");
1284
1489
  const content = await readFile3(pkgJsonPath, "utf-8");
1285
1490
  const pkgJson = JSON.parse(content);
1286
1491
  pkgJson.version = newVersion;
1287
- await writeFile2(pkgJsonPath, `${JSON.stringify(pkgJson, null, 2)}
1492
+ await writeFile3(pkgJsonPath, `${JSON.stringify(pkgJson, null, 2)}
1288
1493
  `);
1289
1494
  }
1290
1495
  async function createCommit(message, files) {
1291
1496
  for (const file of files) {
1292
- await git(`add "${file}"`);
1497
+ await gitCommand(`add "${file}"`);
1293
1498
  }
1294
- await git(`commit -m "${message}"`);
1499
+ await gitCommand(`commit -m "${message}"`);
1295
1500
  }
1296
1501
  async function createTag(tag, message) {
1297
- await git(`tag -a "${tag}" -m "${message}"`);
1502
+ await gitCommand(`tag -a "${tag}" -m "${message}"`);
1298
1503
  }
1299
1504
  async function pushChanges(tag) {
1300
- await git("push");
1505
+ await gitCommand("push");
1301
1506
  if (tag) {
1302
- await git(`push origin "${tag}"`);
1507
+ await gitCommand(`push origin "${tag}"`);
1303
1508
  }
1304
1509
  }
1305
1510
  async function isWorkingTreeClean() {
1306
1511
  try {
1307
- const status = await git("status --porcelain");
1512
+ const status = await gitCommand("status --porcelain");
1308
1513
  if (status.length === 0) {
1309
1514
  return true;
1310
1515
  }
@@ -1331,10 +1536,14 @@ async function isWorkingTreeClean() {
1331
1536
  }
1332
1537
  async function tagExists(tag) {
1333
1538
  try {
1334
- await git(`rev-parse "${tag}"`);
1539
+ await gitCommand(`rev-parse "${tag}"`);
1335
1540
  return true;
1336
- } catch {
1337
- return false;
1541
+ } catch (error) {
1542
+ const errorMessage = error instanceof Error ? error.message.toLowerCase() : String(error).toLowerCase();
1543
+ if (errorMessage.includes("not a valid object name") || errorMessage.includes("unknown revision")) {
1544
+ return false;
1545
+ }
1546
+ throw new Error(`Failed to check tag "${tag}": ${error instanceof Error ? error.message : String(error)}`);
1338
1547
  }
1339
1548
  }
1340
1549
 
@@ -1536,6 +1745,683 @@ function compareVersions(a, b) {
1536
1745
  return 0;
1537
1746
  }
1538
1747
 
1748
+ // src/binaries.ts
1749
+ import { mkdir as mkdir2, writeFile as writeFile5 } from "node:fs/promises";
1750
+ import { dirname, join as join3 } from "node:path";
1751
+
1752
+ // src/utils/binary-package-generator.ts
1753
+ import { copyFile, mkdir, writeFile as writeFile3 } from "node:fs/promises";
1754
+ import { join as join2 } from "node:path";
1755
+
1756
+ // src/utils/binary-platforms.ts
1757
+ import { access as access2 } from "node:fs/promises";
1758
+ import { join, resolve as resolve2 } from "node:path";
1759
+ var PLATFORM_MAPPINGS = {
1760
+ "darwin-arm64": { cpu: "arm64", extension: "", os: "darwin" },
1761
+ "darwin-x64": { cpu: "x64", extension: "", os: "darwin" },
1762
+ "linux-arm64": { cpu: "arm64", extension: "", os: "linux" },
1763
+ "linux-x64": { cpu: "x64", extension: "", os: "linux" },
1764
+ "win32-arm64": { cpu: "arm64", extension: ".exe", os: "win32" },
1765
+ "win32-x64": { cpu: "x64", extension: ".exe", os: "win32" }
1766
+ };
1767
+ var ALL_PLATFORMS = Object.keys(PLATFORM_MAPPINGS);
1768
+ function isValidPlatform(value) {
1769
+ return value in PLATFORM_MAPPINGS;
1770
+ }
1771
+ function parsePlatforms(value) {
1772
+ const platforms = value.split(",").map((p) => p.trim());
1773
+ const result = [];
1774
+ for (const platform of platforms) {
1775
+ if (!isValidPlatform(platform)) {
1776
+ throw new Error(`Invalid platform: ${platform}. Valid platforms: ${ALL_PLATFORMS.join(", ")}`);
1777
+ }
1778
+ result.push(platform);
1779
+ }
1780
+ return result;
1781
+ }
1782
+ function getBinaryPath(distDir, name, platform) {
1783
+ const mapping = PLATFORM_MAPPINGS[platform];
1784
+ const binaryName = `${name}${mapping.extension}`;
1785
+ const platformDir = `${name}-${platform}`;
1786
+ return resolve2(distDir, platformDir, binaryName);
1787
+ }
1788
+ function getPlatformDir(distDir, name, platform) {
1789
+ const platformDir = `${name}-${platform}`;
1790
+ return resolve2(distDir, platformDir);
1791
+ }
1792
+ async function validateBinaryExists(distDir, name, platform) {
1793
+ const binaryPath = getBinaryPath(distDir, name, platform);
1794
+ try {
1795
+ await access2(binaryPath);
1796
+ return true;
1797
+ } catch (error) {
1798
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") {
1799
+ return false;
1800
+ }
1801
+ throw new Error(`Failed to check binary at ${binaryPath}: ${error instanceof Error ? error.message : String(error)}`);
1802
+ }
1803
+ }
1804
+ async function validateAllBinaries(distDir, name, platforms) {
1805
+ const missing = [];
1806
+ for (const platform of platforms) {
1807
+ const exists = await validateBinaryExists(distDir, name, platform);
1808
+ if (!exists) {
1809
+ missing.push(platform);
1810
+ }
1811
+ }
1812
+ return missing;
1813
+ }
1814
+ function getPackageName(scope, name, platform) {
1815
+ const cleanScope = scope.startsWith("@") ? scope : `@${scope}`;
1816
+ return `${cleanScope}/${name}-${platform}`;
1817
+ }
1818
+ function getPackageOutputPath(outDir, scope, name, platform) {
1819
+ const cleanScope = scope.startsWith("@") ? scope.slice(1) : scope;
1820
+ return join(outDir, `@${cleanScope}`, `${name}-${platform}`);
1821
+ }
1822
+ function expandPlaceholders(template, values) {
1823
+ let result = template;
1824
+ if (values.packageDir !== undefined) {
1825
+ result = result.replace(/\{\{packageDir\}\}/g, values.packageDir);
1826
+ }
1827
+ if (values.version !== undefined) {
1828
+ result = result.replace(/\{\{version\}\}/g, values.version);
1829
+ }
1830
+ if (values.platform !== undefined) {
1831
+ result = result.replace(/\{\{platform\}\}/g, values.platform);
1832
+ }
1833
+ if (values.scope !== undefined) {
1834
+ result = result.replace(/\{\{scope\}\}/g, values.scope);
1835
+ }
1836
+ if (values.name !== undefined) {
1837
+ result = result.replace(/\{\{name\}\}/g, values.name);
1838
+ }
1839
+ return result;
1840
+ }
1841
+ function platformToNodeValues(platform) {
1842
+ const parts = platform.split("-");
1843
+ return { arch: parts[1] ?? "", platform: parts[0] ?? "" };
1844
+ }
1845
+
1846
+ // src/utils/binary-package-generator.ts
1847
+ function generatePlatformPackageJson(config, platform, version) {
1848
+ const mapping = PLATFORM_MAPPINGS[platform];
1849
+ const packageName = getPackageName(config.scope, config.name, platform);
1850
+ const binName = config.binName ?? config.name;
1851
+ const binaryFileName = `${binName}${mapping.extension}`;
1852
+ const pkg = {
1853
+ bin: {
1854
+ [binName]: `bin/${binaryFileName}`
1855
+ },
1856
+ cpu: [mapping.cpu],
1857
+ description: `${config.name} binary for ${platform}`,
1858
+ files: ["bin"],
1859
+ license: "MIT",
1860
+ name: packageName,
1861
+ os: [mapping.os],
1862
+ preferUnplugged: true,
1863
+ version
1864
+ };
1865
+ return JSON.stringify(pkg, null, 2);
1866
+ }
1867
+ function generatePlatformReadme(config, platform, version) {
1868
+ const packageName = getPackageName(config.scope, config.name, platform);
1869
+ const mapping = PLATFORM_MAPPINGS[platform];
1870
+ const mainPackageName = `${config.scope.startsWith("@") ? config.scope : `@${config.scope}`}/${config.name}`;
1871
+ return `# ${packageName}
1872
+
1873
+ Platform-specific binary for \`${config.name}\` (${mapping.os} ${mapping.cpu}).
1874
+
1875
+ ## Installation
1876
+
1877
+ This package is not meant to be installed directly. Install the main package instead:
1878
+
1879
+ \`\`\`bash
1880
+ npm install ${mainPackageName}
1881
+ \`\`\`
1882
+
1883
+ The main package will automatically install the correct platform-specific binary as an optional dependency.
1884
+
1885
+ ## Version
1886
+
1887
+ ${version}
1888
+ `;
1889
+ }
1890
+ async function generatePlatformPackage(config, platform, version, dryRun = false) {
1891
+ const packageName = getPackageName(config.scope, config.name, platform);
1892
+ const packageDir = getPackageOutputPath(config.outDir, config.scope, config.name, platform);
1893
+ const binName = config.binName ?? config.name;
1894
+ const mapping = PLATFORM_MAPPINGS[platform];
1895
+ const baseResult = {
1896
+ packageDir,
1897
+ packageName,
1898
+ platform
1899
+ };
1900
+ try {
1901
+ const binaryExists = await validateBinaryExists(config.distDir, config.name, platform);
1902
+ if (!binaryExists) {
1903
+ const expectedPath = getBinaryPath(config.distDir, config.name, platform);
1904
+ return { ...baseResult, error: `Binary not found: ${expectedPath}`, success: false };
1905
+ }
1906
+ if (dryRun) {
1907
+ return { ...baseResult, success: true };
1908
+ }
1909
+ const binDir = join2(packageDir, "bin");
1910
+ await mkdir(binDir, { recursive: true });
1911
+ const packageJson = generatePlatformPackageJson(config, platform, version);
1912
+ await writeFile3(join2(packageDir, "package.json"), packageJson);
1913
+ const readme = generatePlatformReadme(config, platform, version);
1914
+ await writeFile3(join2(packageDir, "README.md"), readme);
1915
+ const sourceBinaryPath = getBinaryPath(config.distDir, config.name, platform);
1916
+ const binaryFileName = `${binName}${mapping.extension}`;
1917
+ const targetBinaryPath = join2(binDir, binaryFileName);
1918
+ await copyFile(sourceBinaryPath, targetBinaryPath);
1919
+ return { ...baseResult, success: true };
1920
+ } catch (error) {
1921
+ const errorMessage = error instanceof Error ? error.message : String(error);
1922
+ console.error(`❌ Failed to generate package ${packageName} for ${platform}: ${errorMessage}`);
1923
+ return { ...baseResult, error: `Failed to generate ${packageName}: ${errorMessage}`, success: false };
1924
+ }
1925
+ }
1926
+ async function generateAllPlatformPackages(config, version, platforms, dryRun = false) {
1927
+ const targetPlatforms = platforms ?? config.platforms;
1928
+ const results = [];
1929
+ for (const platform of targetPlatforms) {
1930
+ const result = await generatePlatformPackage(config, platform, version, dryRun);
1931
+ results.push(result);
1932
+ }
1933
+ return results;
1934
+ }
1935
+ function printGenerationDryRun(config, version, platforms) {
1936
+ console.log(`
1937
+ \uD83D\uDCE6 Binary Distribution:`);
1938
+ console.log(` Scope: ${config.scope}`);
1939
+ console.log(` Name: ${config.name}`);
1940
+ console.log(` Version: ${version}`);
1941
+ console.log(` Platforms: ${platforms.join(", ")}`);
1942
+ console.log(`
1943
+ \uD83D\uDCC1 Packages to generate:`);
1944
+ for (const platform of platforms) {
1945
+ const packageDir = getPackageOutputPath(config.outDir, config.scope, config.name, platform);
1946
+ console.log(` ${packageDir}/`);
1947
+ }
1948
+ }
1949
+
1950
+ // src/utils/binary-publisher.ts
1951
+ import { exec as exec2 } from "node:child_process";
1952
+ import { promisify as promisify2 } from "node:util";
1953
+ var execAsync2 = promisify2(exec2);
1954
+ function sleep2(ms) {
1955
+ return new Promise((resolve3) => setTimeout(resolve3, ms));
1956
+ }
1957
+ function calculateDelay2(attempt, initialDelay = 2000, maxDelay = 30000) {
1958
+ const delay = initialDelay * 2 ** attempt;
1959
+ return Math.min(delay, maxDelay);
1960
+ }
1961
+ function isRetriableError2(error) {
1962
+ if (!(error instanceof Error)) {
1963
+ return false;
1964
+ }
1965
+ const message = error.message.toLowerCase();
1966
+ if (message.includes("network") || message.includes("timeout") || message.includes("econnreset")) {
1967
+ return true;
1968
+ }
1969
+ if (message.includes("503") || message.includes("429") || message.includes("rate")) {
1970
+ return true;
1971
+ }
1972
+ if (message.includes("registry") || message.includes("etarget")) {
1973
+ return true;
1974
+ }
1975
+ return false;
1976
+ }
1977
+ async function publishPlatformPackage(config, platform, version, dryRun = false) {
1978
+ const packageName = getPackageName(config.scope, config.name, platform);
1979
+ const packageDir = getPackageOutputPath(config.outDir, config.scope, config.name, platform);
1980
+ const baseResult = {
1981
+ packageName,
1982
+ platform
1983
+ };
1984
+ const publishCommand = expandPlaceholders(config.publishCommand, {
1985
+ name: config.name,
1986
+ packageDir,
1987
+ platform,
1988
+ scope: config.scope,
1989
+ version
1990
+ });
1991
+ if (dryRun) {
1992
+ return { ...baseResult, attempts: 1, success: true };
1993
+ }
1994
+ let lastError;
1995
+ let attempts = 0;
1996
+ for (let attempt = 0;attempt < config.retryAttempts; attempt++) {
1997
+ attempts = attempt + 1;
1998
+ try {
1999
+ await execAsync2(publishCommand, {
2000
+ cwd: packageDir,
2001
+ env: process.env
2002
+ });
2003
+ return { ...baseResult, attempts, success: true };
2004
+ } catch (error) {
2005
+ lastError = error instanceof Error ? error : new Error(String(error));
2006
+ const canRetry = isRetriableError2(error);
2007
+ if (attempt === config.retryAttempts - 1 || !canRetry) {
2008
+ break;
2009
+ }
2010
+ const delay = calculateDelay2(attempt);
2011
+ console.warn(`⚠️ Publish failed for ${packageName} (attempt ${attempt + 1}/${config.retryAttempts})`);
2012
+ console.warn(` ${lastError.message}`);
2013
+ console.warn(` Retrying in ${delay}ms...`);
2014
+ await sleep2(delay);
2015
+ }
2016
+ }
2017
+ return {
2018
+ ...baseResult,
2019
+ attempts,
2020
+ error: lastError?.message ?? "Unknown error",
2021
+ success: false
2022
+ };
2023
+ }
2024
+ async function publishAllPlatformPackages(config, version, generatedPackages, dryRun = false, verbose = false) {
2025
+ const results = [];
2026
+ const successfulPackages = generatedPackages.filter((p) => p.success);
2027
+ if (successfulPackages.length === 0) {
2028
+ return results;
2029
+ }
2030
+ const batchSize = 3;
2031
+ for (let i = 0;i < successfulPackages.length; i += batchSize) {
2032
+ const batch = successfulPackages.slice(i, i + batchSize);
2033
+ const batchPromises = batch.map(async (pkg) => {
2034
+ if (verbose) {
2035
+ console.log(`\uD83D\uDCE4 Publishing ${pkg.packageName}...`);
2036
+ }
2037
+ const result = await publishPlatformPackage(config, pkg.platform, version, dryRun);
2038
+ if (result.success) {
2039
+ if (verbose) {
2040
+ console.log(`✅ Published ${pkg.packageName}`);
2041
+ }
2042
+ } else {
2043
+ console.error(`❌ Failed to publish ${pkg.packageName}: ${result.error}`);
2044
+ }
2045
+ return result;
2046
+ });
2047
+ const batchResults = await Promise.all(batchPromises);
2048
+ results.push(...batchResults);
2049
+ if (i + batchSize < successfulPackages.length) {
2050
+ await sleep2(500);
2051
+ }
2052
+ }
2053
+ return results;
2054
+ }
2055
+ function printPublishDryRun(config, generatedPackages) {
2056
+ const successfulPackages = generatedPackages.filter((p) => p.success);
2057
+ console.log(`
2058
+ \uD83D\uDE80 Packages to publish:`);
2059
+ for (const pkg of successfulPackages) {
2060
+ console.log(` ${pkg.packageName} (${pkg.packageDir})`);
2061
+ }
2062
+ console.log(`
2063
+ \uD83D\uDCE4 Publish command: ${config.publishCommand}`);
2064
+ }
2065
+ function printPublishSummary(results, _config) {
2066
+ const successful = results.filter((r) => r.success);
2067
+ const failed = results.filter((r) => !r.success);
2068
+ console.log(`
2069
+ \uD83D\uDCCA Publish Summary:`);
2070
+ console.log(` Total: ${results.length}`);
2071
+ console.log(` Successful: ${successful.length}`);
2072
+ console.log(` Failed: ${failed.length}`);
2073
+ if (failed.length > 0) {
2074
+ console.log(`
2075
+ ❌ Failed packages:`);
2076
+ for (const result of failed) {
2077
+ console.log(` ${result.packageName}: ${result.error}`);
2078
+ }
2079
+ }
2080
+ }
2081
+
2082
+ // src/utils/binary-wrapper-generator.ts
2083
+ import { readFile as readFile3, writeFile as writeFile4 } from "node:fs/promises";
2084
+ import { resolve as resolve3 } from "node:path";
2085
+ function generateBinaryWrapper(config) {
2086
+ const binName = config.binName ?? config.name;
2087
+ const scope = config.scope.startsWith("@") ? config.scope : `@${config.scope}`;
2088
+ const platformEntries = config.platforms.map((platform) => {
2089
+ const packageName = getPackageName(config.scope, config.name, platform);
2090
+ const parts = platform.split("-");
2091
+ return ` "${parts[0]}-${parts[1]}": "${packageName}"`;
2092
+ });
2093
+ return `#!/usr/bin/env node
2094
+ "use strict";
2095
+
2096
+ const { platform, arch } = process;
2097
+ const { execFileSync } = require("child_process");
2098
+ const { join } = require("path");
2099
+
2100
+ const PLATFORMS = {
2101
+ ${platformEntries.join(`,
2102
+ `)}
2103
+ };
2104
+
2105
+ const platformKey = \`\${platform}-\${arch}\`;
2106
+ const pkg = PLATFORMS[platformKey];
2107
+
2108
+ if (!pkg) {
2109
+ console.error(\`Unsupported platform: \${platformKey}\`);
2110
+ console.error(\`Supported platforms: \${Object.keys(PLATFORMS).join(", ")}\`);
2111
+ process.exit(1);
2112
+ }
2113
+
2114
+ let binPath;
2115
+ try {
2116
+ // Try to resolve the platform-specific package
2117
+ const pkgPath = require.resolve(\`\${pkg}/package.json\`);
2118
+ const pkgDir = join(pkgPath, "..");
2119
+ const pkgJson = require(pkgPath);
2120
+ const binEntry = pkgJson.bin && pkgJson.bin["${binName}"];
2121
+
2122
+ if (!binEntry) {
2123
+ throw new Error(\`Binary entry not found in \${pkg}\`);
2124
+ }
2125
+
2126
+ binPath = join(pkgDir, binEntry);
2127
+ } catch (resolveError) {
2128
+ console.error(\`Failed to find binary package: \${pkg}\`);
2129
+ console.error(\`Please install it: npm install \${pkg}\`);
2130
+ console.error(\`Or reinstall the main package: npm install ${scope}/${config.name}\`);
2131
+ process.exit(1);
2132
+ }
2133
+
2134
+ try {
2135
+ const result = execFileSync(binPath, process.argv.slice(2), {
2136
+ stdio: "inherit",
2137
+ env: process.env
2138
+ });
2139
+ } catch (error) {
2140
+ // execFileSync throws on non-zero exit codes, pass through the exit code
2141
+ if (error.status !== undefined) {
2142
+ process.exit(error.status);
2143
+ }
2144
+ throw error;
2145
+ }
2146
+ `;
2147
+ }
2148
+ function generateOptionalDependencies(config, version, platforms) {
2149
+ const targetPlatforms = platforms ?? config.platforms;
2150
+ const deps = {};
2151
+ for (const platform of targetPlatforms) {
2152
+ const packageName = getPackageName(config.scope, config.name, platform);
2153
+ deps[packageName] = version;
2154
+ }
2155
+ return deps;
2156
+ }
2157
+ function generateMainPackageUpdates(config, version, platforms) {
2158
+ const binName = config.binName ?? config.name;
2159
+ return {
2160
+ bin: {
2161
+ [binName]: `bin/${binName}.js`
2162
+ },
2163
+ optionalDependencies: generateOptionalDependencies(config, version, platforms)
2164
+ };
2165
+ }
2166
+ async function updateMainPackageJson(packagePath, config, version, platforms, dryRun = false) {
2167
+ const fullPath = resolve3(packagePath);
2168
+ const content = await readFile3(fullPath, "utf-8");
2169
+ let pkg;
2170
+ try {
2171
+ pkg = JSON.parse(content);
2172
+ } catch (parseError) {
2173
+ throw new Error(`Failed to parse ${fullPath}: ${parseError instanceof Error ? parseError.message : "Invalid JSON"}`);
2174
+ }
2175
+ const updates = generateMainPackageUpdates(config, version, platforms);
2176
+ pkg.optionalDependencies = {
2177
+ ...pkg.optionalDependencies || {},
2178
+ ...updates.optionalDependencies
2179
+ };
2180
+ if (updates.bin) {
2181
+ pkg.bin = {
2182
+ ...pkg.bin || {},
2183
+ ...updates.bin
2184
+ };
2185
+ }
2186
+ if (dryRun) {
2187
+ return;
2188
+ }
2189
+ await writeFile4(fullPath, `${JSON.stringify(pkg, null, 2)}
2190
+ `);
2191
+ }
2192
+ function printMainPackageUpdatesDryRun(config, version, platforms) {
2193
+ const updates = generateMainPackageUpdates(config, version, platforms);
2194
+ console.log(`
2195
+ \uD83D\uDCDD Main package updates:`);
2196
+ console.log(" optionalDependencies:");
2197
+ for (const [name, ver] of Object.entries(updates.optionalDependencies)) {
2198
+ console.log(` "${name}": "${ver}"`);
2199
+ }
2200
+ if (updates.bin) {
2201
+ console.log(" bin:");
2202
+ for (const [name, path] of Object.entries(updates.bin)) {
2203
+ console.log(` "${name}": "${path}"`);
2204
+ }
2205
+ }
2206
+ }
2207
+
2208
+ // src/binaries.ts
2209
+ async function generateBinaryPackages(options = {}) {
2210
+ const result = {
2211
+ errors: [],
2212
+ packages: [],
2213
+ published: [],
2214
+ success: false,
2215
+ version: "",
2216
+ warnings: []
2217
+ };
2218
+ try {
2219
+ const config = await loadConfig(options.config);
2220
+ if (!config.binaries?.enabled) {
2221
+ result.errors.push("Binary distribution is not enabled in config");
2222
+ return result;
2223
+ }
2224
+ validateBinariesConfig(config.binaries);
2225
+ const binariesConfig = config.binaries;
2226
+ const version = options.version ?? await getCurrentVersion(".");
2227
+ result.version = version;
2228
+ const platforms = options.platforms ?? binariesConfig.platforms;
2229
+ const missingBinaries = await validateAllBinaries(binariesConfig.distDir, binariesConfig.name, platforms);
2230
+ if (missingBinaries.length > 0) {
2231
+ for (const platform of missingBinaries) {
2232
+ console.warn(`⚠️ Binary not found for platform: ${platform}`);
2233
+ result.warnings.push(`Binary not found for platform: ${platform}`);
2234
+ }
2235
+ if (missingBinaries.length === platforms.length) {
2236
+ result.errors.push("No binaries found for any platform");
2237
+ return result;
2238
+ }
2239
+ const availableCount = platforms.length - missingBinaries.length;
2240
+ console.warn(`
2241
+ ⚠️ Only ${availableCount} of ${platforms.length} platforms will be processed`);
2242
+ console.warn(` Missing: ${missingBinaries.join(", ")}`);
2243
+ console.warn(` Use --platforms flag to explicitly specify which platforms to publish
2244
+ `);
2245
+ }
2246
+ const availablePlatforms = platforms.filter((p) => !missingBinaries.includes(p));
2247
+ if (options.dryRun) {
2248
+ console.log(`
2249
+ \uD83D\uDD0D DRY RUN MODE
2250
+ `);
2251
+ printGenerationDryRun(binariesConfig, version, availablePlatforms);
2252
+ printMainPackageUpdatesDryRun(binariesConfig, version, availablePlatforms);
2253
+ result.packages = availablePlatforms.map((platform) => ({
2254
+ packageDir: "",
2255
+ packageName: "",
2256
+ platform,
2257
+ success: true
2258
+ }));
2259
+ result.success = true;
2260
+ return result;
2261
+ }
2262
+ console.log(`
2263
+ \uD83D\uDCE6 Generating binary packages...
2264
+ `);
2265
+ result.packages = await generateAllPlatformPackages(binariesConfig, version, availablePlatforms, false);
2266
+ const successfulPackages = result.packages.filter((p) => p.success);
2267
+ const failedPackages = result.packages.filter((p) => !p.success);
2268
+ console.log(`✅ Generated ${successfulPackages.length} packages`);
2269
+ if (failedPackages.length > 0) {
2270
+ for (const pkg of failedPackages) {
2271
+ result.warnings.push(`Failed to generate package for ${pkg.platform}: ${pkg.error}`);
2272
+ console.warn(`⚠️ Failed: ${pkg.platform} - ${pkg.error}`);
2273
+ }
2274
+ }
2275
+ if (!options.skipMainPackage) {
2276
+ const wrapperScript = generateBinaryWrapper(binariesConfig);
2277
+ const binDir = join3(dirname(binariesConfig.mainPackage), "bin");
2278
+ const binName = binariesConfig.binName ?? binariesConfig.name;
2279
+ await mkdir2(binDir, { recursive: true });
2280
+ await writeFile5(join3(binDir, `${binName}.js`), wrapperScript);
2281
+ console.log(`✅ Generated wrapper: bin/${binName}.js`);
2282
+ }
2283
+ result.success = successfulPackages.length > 0;
2284
+ } catch (error) {
2285
+ result.errors.push(error instanceof Error ? error.message : String(error));
2286
+ console.error(`
2287
+ ❌ Generation failed:`);
2288
+ console.error(error);
2289
+ }
2290
+ return result;
2291
+ }
2292
+ async function publishBinaries(options = {}) {
2293
+ const result = {
2294
+ errors: [],
2295
+ packages: [],
2296
+ published: [],
2297
+ success: false,
2298
+ version: "",
2299
+ warnings: []
2300
+ };
2301
+ try {
2302
+ const config = await loadConfig(options.config);
2303
+ if (!config.binaries?.enabled) {
2304
+ result.errors.push("Binary distribution is not enabled in config");
2305
+ return result;
2306
+ }
2307
+ validateBinariesConfig(config.binaries);
2308
+ const binariesConfig = config.binaries;
2309
+ const version = options.version ?? await getCurrentVersion(".");
2310
+ result.version = version;
2311
+ const platforms = options.platforms ?? binariesConfig.platforms;
2312
+ const missingBinaries = await validateAllBinaries(binariesConfig.distDir, binariesConfig.name, platforms);
2313
+ if (missingBinaries.length > 0) {
2314
+ for (const platform of missingBinaries) {
2315
+ console.warn(`⚠️ Binary not found for platform: ${platform}`);
2316
+ result.warnings.push(`Binary not found for platform: ${platform}`);
2317
+ }
2318
+ if (missingBinaries.length === platforms.length) {
2319
+ result.errors.push("No binaries found for any platform");
2320
+ return result;
2321
+ }
2322
+ const availableCount = platforms.length - missingBinaries.length;
2323
+ console.warn(`
2324
+ ⚠️ Only ${availableCount} of ${platforms.length} platforms will be processed`);
2325
+ console.warn(` Missing: ${missingBinaries.join(", ")}`);
2326
+ console.warn(` Use --platforms flag to explicitly specify which platforms to publish
2327
+ `);
2328
+ }
2329
+ const availablePlatforms = platforms.filter((p) => !missingBinaries.includes(p));
2330
+ if (options.dryRun) {
2331
+ console.log(`
2332
+ \uD83D\uDD0D DRY RUN MODE
2333
+ `);
2334
+ printGenerationDryRun(binariesConfig, version, availablePlatforms);
2335
+ const dryRunPackages = availablePlatforms.map((platform) => ({
2336
+ packageDir: "",
2337
+ packageName: "",
2338
+ platform,
2339
+ success: true
2340
+ }));
2341
+ printPublishDryRun(binariesConfig, dryRunPackages);
2342
+ printMainPackageUpdatesDryRun(binariesConfig, version, availablePlatforms);
2343
+ result.packages = dryRunPackages;
2344
+ result.success = true;
2345
+ return result;
2346
+ }
2347
+ console.log(`
2348
+ \uD83D\uDCE6 Generating binary packages...
2349
+ `);
2350
+ result.packages = await generateAllPlatformPackages(binariesConfig, version, availablePlatforms, false);
2351
+ const successfulPackages = result.packages.filter((p) => p.success);
2352
+ const failedPackages = result.packages.filter((p) => !p.success);
2353
+ console.log(`✅ Generated ${successfulPackages.length} packages`);
2354
+ if (failedPackages.length > 0) {
2355
+ for (const pkg of failedPackages) {
2356
+ result.warnings.push(`Failed to generate package for ${pkg.platform}: ${pkg.error}`);
2357
+ console.warn(`⚠️ Failed: ${pkg.platform} - ${pkg.error}`);
2358
+ }
2359
+ if (!binariesConfig.continueOnError && failedPackages.length > 0) {
2360
+ result.errors.push("Some packages failed to generate");
2361
+ return result;
2362
+ }
2363
+ }
2364
+ if (successfulPackages.length === 0) {
2365
+ result.errors.push("No packages generated successfully");
2366
+ return result;
2367
+ }
2368
+ if (options.generateOnly) {
2369
+ if (!options.skipMainPackage) {
2370
+ const wrapperScript = generateBinaryWrapper(binariesConfig);
2371
+ const binDir = join3(dirname(binariesConfig.mainPackage), "bin");
2372
+ const binName = binariesConfig.binName ?? binariesConfig.name;
2373
+ await mkdir2(binDir, { recursive: true });
2374
+ await writeFile5(join3(binDir, `${binName}.js`), wrapperScript);
2375
+ console.log(`✅ Generated wrapper: bin/${binName}.js`);
2376
+ }
2377
+ result.success = true;
2378
+ return result;
2379
+ }
2380
+ console.log(`
2381
+ \uD83D\uDE80 Publishing platform packages...
2382
+ `);
2383
+ result.published = await publishAllPlatformPackages(binariesConfig, version, result.packages, false, options.verbose);
2384
+ const successfulPublishes = result.published.filter((p) => p.success);
2385
+ const failedPublishes = result.published.filter((p) => !p.success);
2386
+ printPublishSummary(result.published, binariesConfig);
2387
+ if (failedPublishes.length > 0) {
2388
+ for (const pub of failedPublishes) {
2389
+ result.warnings.push(`Failed to publish ${pub.packageName}: ${pub.error}`);
2390
+ }
2391
+ if (!binariesConfig.continueOnError) {
2392
+ result.errors.push("Some packages failed to publish");
2393
+ return result;
2394
+ }
2395
+ }
2396
+ if (!options.skipMainPackage) {
2397
+ console.log(`
2398
+ \uD83D\uDCDD Updating main package.json...
2399
+ `);
2400
+ const wrapperScript = generateBinaryWrapper(binariesConfig);
2401
+ const binDir = join3(dirname(binariesConfig.mainPackage), "bin");
2402
+ const binName = binariesConfig.binName ?? binariesConfig.name;
2403
+ await mkdir2(binDir, { recursive: true });
2404
+ await writeFile5(join3(binDir, `${binName}.js`), wrapperScript);
2405
+ const publishedPlatforms = successfulPublishes.map((p) => p.platform);
2406
+ await updateMainPackageJson(binariesConfig.mainPackage, binariesConfig, version, publishedPlatforms, false);
2407
+ console.log(`✅ Updated ${binariesConfig.mainPackage}`);
2408
+ console.log(`✅ Generated wrapper: bin/${binName}.js`);
2409
+ }
2410
+ result.success = successfulPublishes.length > 0;
2411
+ if (result.success) {
2412
+ console.log(`
2413
+ ✅ Binary distribution completed successfully!
2414
+ `);
2415
+ }
2416
+ } catch (error) {
2417
+ result.errors.push(error instanceof Error ? error.message : String(error));
2418
+ console.error(`
2419
+ ❌ Binary distribution failed:`);
2420
+ console.error(error);
2421
+ }
2422
+ return result;
2423
+ }
2424
+
1539
2425
  // src/index.ts
1540
2426
  function printDryRunInfo(pkg, currentVersion, versionBump, tag, commits, changelogEntry) {
1541
2427
  console.log(`
@@ -1564,7 +2450,7 @@ function printSuccessInfo(pkg, currentVersion, newVersion, tag, releaseUrl) {
1564
2450
  }
1565
2451
  async function updatePackageFiles(pkg, newVersion, changelogEntry) {
1566
2452
  await updatePackageVersion(pkg.path, newVersion);
1567
- const changelogPath = resolve2(pkg.path, pkg.changelog);
2453
+ const changelogPath = resolve4(pkg.path, pkg.changelog);
1568
2454
  await updateChangelogFile(changelogPath, changelogEntry);
1569
2455
  return changelogPath;
1570
2456
  }
@@ -1617,7 +2503,7 @@ async function performGitOperations(config, options, pkg, newVersion, tag, chang
1617
2503
  }
1618
2504
  }
1619
2505
  const commitMessage = config.git.commitMessage.replace("{{package}}", pkg.name).replace("{{version}}", newVersion);
1620
- await createCommit(commitMessage, [resolve2(pkg.path, "package.json"), changelogPath]);
2506
+ await createCommit(commitMessage, [resolve4(pkg.path, "package.json"), changelogPath]);
1621
2507
  }
1622
2508
  if (!options.noTag) {
1623
2509
  const tagMessage = config.git.tagMessage.replace("{{package}}", pkg.name).replace("{{version}}", newVersion);
@@ -1772,10 +2658,31 @@ async function createReleaseOnly(tag, packageName, configPath) {
1772
2658
  }
1773
2659
  export {
1774
2660
  validateConfig,
2661
+ validateBinaryExists,
2662
+ validateBinariesConfig,
2663
+ validateAllBinaries,
1775
2664
  release,
2665
+ publishBinaries,
2666
+ platformToNodeValues,
2667
+ parsePlatforms,
1776
2668
  loadConfig,
2669
+ isValidPlatform,
2670
+ initConfig,
2671
+ getPlatformDir,
2672
+ getPackageOutputPath,
2673
+ getPackageName,
2674
+ getBinaryPath,
2675
+ generateConfigContent,
2676
+ generateBinaryPackages,
2677
+ expandPlaceholders,
1777
2678
  createReleaseOnly,
1778
- createGitVerseClient
2679
+ createGitVerseClient,
2680
+ configExists,
2681
+ PLATFORM_MAPPINGS,
2682
+ DEFAULT_CONFIG_FILE_NAME,
2683
+ DEFAULT_BINARY_PLATFORMS,
2684
+ DEFAULT_BINARIES_CONFIG,
2685
+ ALL_PLATFORMS
1779
2686
  };
1780
2687
 
1781
- //# debugId=056CFD71B279C22664756E2164756E21
2688
+ //# debugId=0CEBBBAE18C384F864756E2164756E21