gitverse-release 3.1.0 → 3.3.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 +39 -2
- package/dist/cli.js +787 -318
- package/dist/cli.js.map +32 -30
- package/dist/gitverse.d.ts +7 -2
- package/dist/index.d.ts +5 -0
- package/dist/index.js +599 -317
- package/dist/index.js.map +30 -29
- package/dist/types.d.ts +167 -0
- package/dist/utils/changelog.d.ts +2 -2
- package/dist/utils/commitlint-generator.d.ts +5 -0
- package/dist/utils/git.d.ts +22 -0
- package/dist/utils/retry.d.ts +35 -0
- package/dist/utils/version.d.ts +2 -2
- package/package.json +4 -3
- package/schema.json +289 -0
package/dist/index.js
CHANGED
|
@@ -41,18 +41,39 @@ var DEFAULT_CONFIG = {
|
|
|
41
41
|
test: "✅ Tests"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
|
+
commitlint: {
|
|
45
|
+
comments: true,
|
|
46
|
+
format: "ts",
|
|
47
|
+
headerMaxLength: 100,
|
|
48
|
+
output: "commitlint.config.ts",
|
|
49
|
+
scopeRequired: false,
|
|
50
|
+
scopes: ["deps", "ci", "docs"]
|
|
51
|
+
},
|
|
44
52
|
git: {
|
|
45
53
|
commitChanges: true,
|
|
46
54
|
commitMessage: "chore(release): {{package}} v{{version}} [skip ci]",
|
|
47
55
|
push: true,
|
|
48
56
|
tagMessage: "Release {{package}} v{{version}}"
|
|
49
57
|
},
|
|
58
|
+
gitverse: {
|
|
59
|
+
checkExisting: true,
|
|
60
|
+
enabled: true,
|
|
61
|
+
failOnError: true
|
|
62
|
+
},
|
|
50
63
|
monorepo: {
|
|
51
64
|
enabled: false,
|
|
52
65
|
packages: []
|
|
53
66
|
},
|
|
67
|
+
retry: {
|
|
68
|
+
enabled: true,
|
|
69
|
+
initialDelay: 2000,
|
|
70
|
+
maxAttempts: 5,
|
|
71
|
+
maxDelay: 30000,
|
|
72
|
+
operations: ["push", "createRelease"]
|
|
73
|
+
},
|
|
54
74
|
versioning: {
|
|
55
75
|
allowPrerelease: false,
|
|
76
|
+
preMajorMode: "auto",
|
|
56
77
|
prereleasePrefix: "beta",
|
|
57
78
|
tagPrefix: "v"
|
|
58
79
|
}
|
|
@@ -81,14 +102,26 @@ function mergeConfig(defaults, user) {
|
|
|
81
102
|
...user.changelog?.types
|
|
82
103
|
}
|
|
83
104
|
},
|
|
105
|
+
commitlint: {
|
|
106
|
+
...defaults.commitlint,
|
|
107
|
+
...user.commitlint
|
|
108
|
+
},
|
|
84
109
|
git: {
|
|
85
110
|
...defaults.git,
|
|
86
111
|
...user.git
|
|
87
112
|
},
|
|
113
|
+
gitverse: {
|
|
114
|
+
...defaults.gitverse,
|
|
115
|
+
...user.gitverse
|
|
116
|
+
},
|
|
88
117
|
monorepo: {
|
|
89
118
|
...defaults.monorepo,
|
|
90
119
|
...user.monorepo
|
|
91
120
|
},
|
|
121
|
+
retry: {
|
|
122
|
+
...defaults.retry,
|
|
123
|
+
...user.retry
|
|
124
|
+
},
|
|
92
125
|
versioning: {
|
|
93
126
|
...defaults.versioning,
|
|
94
127
|
...user.versioning
|
|
@@ -107,14 +140,14 @@ function validateConfig(config) {
|
|
|
107
140
|
}
|
|
108
141
|
|
|
109
142
|
// ../sdk/dist/api/organizations.js
|
|
110
|
-
class
|
|
143
|
+
class k {
|
|
111
144
|
client;
|
|
112
145
|
constructor(b) {
|
|
113
146
|
this.client = b;
|
|
114
147
|
}
|
|
115
|
-
async checkMembership(b, h) {
|
|
148
|
+
async checkMembership(b, h, j) {
|
|
116
149
|
try {
|
|
117
|
-
return await this.client.get(`/orgs/${b}/members/${h}
|
|
150
|
+
return await this.client.get(`/orgs/${b}/members/${h}`, j), true;
|
|
118
151
|
} catch (d) {
|
|
119
152
|
if (d instanceof Error && d.message.includes("404"))
|
|
120
153
|
return false;
|
|
@@ -124,126 +157,126 @@ class j {
|
|
|
124
157
|
}
|
|
125
158
|
|
|
126
159
|
// ../sdk/dist/api/commits.js
|
|
127
|
-
class
|
|
160
|
+
class j {
|
|
128
161
|
client;
|
|
129
162
|
constructor(b) {
|
|
130
163
|
this.client = b;
|
|
131
164
|
}
|
|
132
|
-
list(b, d) {
|
|
133
|
-
return this.client.get(`/repos/${b}/${d}/commits
|
|
165
|
+
list(b, d, f) {
|
|
166
|
+
return this.client.get(`/repos/${b}/${d}/commits`, f);
|
|
134
167
|
}
|
|
135
|
-
get(b, d, f) {
|
|
136
|
-
return this.client.get(`/repos/${b}/${d}/commits/${f}
|
|
168
|
+
get(b, d, f, g) {
|
|
169
|
+
return this.client.get(`/repos/${b}/${d}/commits/${f}`, g);
|
|
137
170
|
}
|
|
138
|
-
create(b, d, f) {
|
|
139
|
-
return this.client.post(`/repos/${b}/${d}/git/commits`, f);
|
|
171
|
+
create(b, d, f, g) {
|
|
172
|
+
return this.client.post(`/repos/${b}/${d}/git/commits`, f, g);
|
|
140
173
|
}
|
|
141
174
|
}
|
|
142
175
|
|
|
143
176
|
// ../sdk/dist/api/actions.js
|
|
144
|
-
class
|
|
177
|
+
class x {
|
|
145
178
|
client;
|
|
146
179
|
constructor(b) {
|
|
147
180
|
this.client = b;
|
|
148
181
|
}
|
|
149
|
-
listOrgRunners(b) {
|
|
150
|
-
return this.client.get(`/orgs/${b}/actions/runners
|
|
182
|
+
listOrgRunners(b, h) {
|
|
183
|
+
return this.client.get(`/orgs/${b}/actions/runners`, h);
|
|
151
184
|
}
|
|
152
|
-
createOrgRegistrationToken(b) {
|
|
153
|
-
return this.client.post(`/orgs/${b}/actions/runners/registration-token`, {});
|
|
185
|
+
createOrgRegistrationToken(b, h) {
|
|
186
|
+
return this.client.post(`/orgs/${b}/actions/runners/registration-token`, {}, h);
|
|
154
187
|
}
|
|
155
|
-
getOrgRunner(b, h) {
|
|
156
|
-
return this.client.get(`/orgs/${b}/actions/runners/${h}
|
|
188
|
+
getOrgRunner(b, h, j2) {
|
|
189
|
+
return this.client.get(`/orgs/${b}/actions/runners/${h}`, j2);
|
|
157
190
|
}
|
|
158
|
-
deleteOrgRunner(b, h) {
|
|
159
|
-
return this.client.delete(`/orgs/${b}/actions/runners/${h}
|
|
191
|
+
deleteOrgRunner(b, h, j2) {
|
|
192
|
+
return this.client.delete(`/orgs/${b}/actions/runners/${h}`, undefined, j2);
|
|
160
193
|
}
|
|
161
|
-
listRepoRunners(b, h) {
|
|
162
|
-
return this.client.get(`/repos/${b}/${h}/actions/runners
|
|
194
|
+
listRepoRunners(b, h, j2) {
|
|
195
|
+
return this.client.get(`/repos/${b}/${h}/actions/runners`, j2);
|
|
163
196
|
}
|
|
164
|
-
createRepoRegistrationToken(b, h) {
|
|
165
|
-
return this.client.post(`/repos/${b}/${h}/actions/runners/registration-token`, {});
|
|
197
|
+
createRepoRegistrationToken(b, h, j2) {
|
|
198
|
+
return this.client.post(`/repos/${b}/${h}/actions/runners/registration-token`, {}, j2);
|
|
166
199
|
}
|
|
167
|
-
getRepoRunner(b, h, j2) {
|
|
168
|
-
return this.client.get(`/repos/${b}/${h}/actions/runners/${j2}
|
|
200
|
+
getRepoRunner(b, h, j2, q) {
|
|
201
|
+
return this.client.get(`/repos/${b}/${h}/actions/runners/${j2}`, q);
|
|
169
202
|
}
|
|
170
|
-
deleteRepoRunner(b, h, j2) {
|
|
171
|
-
return this.client.delete(`/repos/${b}/${h}/actions/runners/${j2}
|
|
203
|
+
deleteRepoRunner(b, h, j2, q) {
|
|
204
|
+
return this.client.delete(`/repos/${b}/${h}/actions/runners/${j2}`, undefined, q);
|
|
172
205
|
}
|
|
173
|
-
listOrgSecrets(b) {
|
|
174
|
-
return this.client.get(`/orgs/${b}/actions/secrets
|
|
206
|
+
listOrgSecrets(b, h) {
|
|
207
|
+
return this.client.get(`/orgs/${b}/actions/secrets`, h);
|
|
175
208
|
}
|
|
176
|
-
getOrgSecret(b, h) {
|
|
177
|
-
return this.client.get(`/orgs/${b}/actions/secrets/${h}
|
|
209
|
+
getOrgSecret(b, h, j2) {
|
|
210
|
+
return this.client.get(`/orgs/${b}/actions/secrets/${h}`, j2);
|
|
178
211
|
}
|
|
179
|
-
createOrUpdateOrgSecret(b, h, j2) {
|
|
180
|
-
return this.client.put(`/orgs/${b}/actions/secrets/${h}`, j2);
|
|
212
|
+
createOrUpdateOrgSecret(b, h, j2, q) {
|
|
213
|
+
return this.client.put(`/orgs/${b}/actions/secrets/${h}`, j2, q);
|
|
181
214
|
}
|
|
182
|
-
deleteOrgSecret(b, h) {
|
|
183
|
-
return this.client.delete(`/orgs/${b}/actions/secrets/${h}
|
|
215
|
+
deleteOrgSecret(b, h, j2) {
|
|
216
|
+
return this.client.delete(`/orgs/${b}/actions/secrets/${h}`, undefined, j2);
|
|
184
217
|
}
|
|
185
|
-
listRepoSecrets(b, h) {
|
|
186
|
-
return this.client.get(`/repos/${b}/${h}/actions/secrets
|
|
218
|
+
listRepoSecrets(b, h, j2) {
|
|
219
|
+
return this.client.get(`/repos/${b}/${h}/actions/secrets`, j2);
|
|
187
220
|
}
|
|
188
|
-
getRepoSecret(b, h, j2) {
|
|
189
|
-
return this.client.get(`/repos/${b}/${h}/actions/secrets/${j2}
|
|
221
|
+
getRepoSecret(b, h, j2, q) {
|
|
222
|
+
return this.client.get(`/repos/${b}/${h}/actions/secrets/${j2}`, q);
|
|
190
223
|
}
|
|
191
|
-
createOrUpdateRepoSecret(b, h, j2, q) {
|
|
192
|
-
return this.client.put(`/repos/${b}/${h}/actions/secrets/${j2}`, q);
|
|
224
|
+
createOrUpdateRepoSecret(b, h, j2, q, v) {
|
|
225
|
+
return this.client.put(`/repos/${b}/${h}/actions/secrets/${j2}`, q, v);
|
|
193
226
|
}
|
|
194
|
-
deleteRepoSecret(b, h, j2) {
|
|
195
|
-
return this.client.delete(`/repos/${b}/${h}/actions/secrets/${j2}
|
|
227
|
+
deleteRepoSecret(b, h, j2, q) {
|
|
228
|
+
return this.client.delete(`/repos/${b}/${h}/actions/secrets/${j2}`, undefined, q);
|
|
196
229
|
}
|
|
197
|
-
listOrgVariables(b) {
|
|
198
|
-
return this.client.get(`/orgs/${b}/actions/variables
|
|
230
|
+
listOrgVariables(b, h) {
|
|
231
|
+
return this.client.get(`/orgs/${b}/actions/variables`, h);
|
|
199
232
|
}
|
|
200
|
-
createOrgVariable(b, h) {
|
|
201
|
-
return this.client.post(`/orgs/${b}/actions/variables`, h);
|
|
233
|
+
createOrgVariable(b, h, j2) {
|
|
234
|
+
return this.client.post(`/orgs/${b}/actions/variables`, h, j2);
|
|
202
235
|
}
|
|
203
|
-
getOrgVariable(b, h) {
|
|
204
|
-
return this.client.get(`/orgs/${b}/actions/variables/${h}
|
|
236
|
+
getOrgVariable(b, h, j2) {
|
|
237
|
+
return this.client.get(`/orgs/${b}/actions/variables/${h}`, j2);
|
|
205
238
|
}
|
|
206
|
-
deleteOrgVariable(b, h) {
|
|
207
|
-
return this.client.delete(`/orgs/${b}/actions/variables/${h}
|
|
239
|
+
deleteOrgVariable(b, h, j2) {
|
|
240
|
+
return this.client.delete(`/orgs/${b}/actions/variables/${h}`, undefined, j2);
|
|
208
241
|
}
|
|
209
|
-
updateOrgVariable(b, h, j2) {
|
|
210
|
-
return this.client.patch(`/orgs/${b}/actions/variables/${h}`, j2);
|
|
242
|
+
updateOrgVariable(b, h, j2, q) {
|
|
243
|
+
return this.client.patch(`/orgs/${b}/actions/variables/${h}`, j2, q);
|
|
211
244
|
}
|
|
212
|
-
listRepoVariables(b, h) {
|
|
213
|
-
return this.client.get(`/repos/${b}/${h}/actions/variables
|
|
245
|
+
listRepoVariables(b, h, j2) {
|
|
246
|
+
return this.client.get(`/repos/${b}/${h}/actions/variables`, j2);
|
|
214
247
|
}
|
|
215
|
-
createRepoVariable(b, h, j2) {
|
|
216
|
-
return this.client.post(`/repos/${b}/${h}/actions/variables`, j2);
|
|
248
|
+
createRepoVariable(b, h, j2, q) {
|
|
249
|
+
return this.client.post(`/repos/${b}/${h}/actions/variables`, j2, q);
|
|
217
250
|
}
|
|
218
|
-
getRepoVariable(b, h, j2) {
|
|
219
|
-
return this.client.get(`/repos/${b}/${h}/actions/variables/${j2}
|
|
251
|
+
getRepoVariable(b, h, j2, q) {
|
|
252
|
+
return this.client.get(`/repos/${b}/${h}/actions/variables/${j2}`, q);
|
|
220
253
|
}
|
|
221
|
-
deleteRepoVariable(b, h, j2) {
|
|
222
|
-
return this.client.delete(`/repos/${b}/${h}/actions/variables/${j2}
|
|
254
|
+
deleteRepoVariable(b, h, j2, q) {
|
|
255
|
+
return this.client.delete(`/repos/${b}/${h}/actions/variables/${j2}`, undefined, q);
|
|
223
256
|
}
|
|
224
|
-
updateRepoVariable(b, h, j2, q) {
|
|
225
|
-
return this.client.patch(`/repos/${b}/${h}/actions/variables/${j2}`, q);
|
|
257
|
+
updateRepoVariable(b, h, j2, q, v) {
|
|
258
|
+
return this.client.patch(`/repos/${b}/${h}/actions/variables/${j2}`, q, v);
|
|
226
259
|
}
|
|
227
|
-
listArtifacts(b, h) {
|
|
228
|
-
return this.client.get(`/repos/${b}/${h}/actions/artifacts
|
|
260
|
+
listArtifacts(b, h, j2) {
|
|
261
|
+
return this.client.get(`/repos/${b}/${h}/actions/artifacts`, j2);
|
|
229
262
|
}
|
|
230
|
-
getArtifact(b, h, j2) {
|
|
231
|
-
return this.client.get(`/repos/${b}/${h}/actions/artifacts/${j2}
|
|
263
|
+
getArtifact(b, h, j2, q) {
|
|
264
|
+
return this.client.get(`/repos/${b}/${h}/actions/artifacts/${j2}`, q);
|
|
232
265
|
}
|
|
233
|
-
deleteArtifact(b, h, j2) {
|
|
234
|
-
return this.client.delete(`/repos/${b}/${h}/actions/artifacts/${j2}
|
|
266
|
+
deleteArtifact(b, h, j2, q) {
|
|
267
|
+
return this.client.delete(`/repos/${b}/${h}/actions/artifacts/${j2}`, undefined, q);
|
|
235
268
|
}
|
|
236
|
-
downloadArtifact(b, h, j2) {
|
|
237
|
-
return this.client.get(`/repos/${b}/${h}/actions/artifacts/${j2}/zip
|
|
269
|
+
downloadArtifact(b, h, j2, q) {
|
|
270
|
+
return this.client.get(`/repos/${b}/${h}/actions/artifacts/${j2}/zip`, q);
|
|
238
271
|
}
|
|
239
|
-
downloadArtifactRaw(b, h, j2) {
|
|
240
|
-
return this.client.get(`/repos/${b}/${h}/actions/artifacts/${j2}/zip/raw
|
|
272
|
+
downloadArtifactRaw(b, h, j2, q) {
|
|
273
|
+
return this.client.get(`/repos/${b}/${h}/actions/artifacts/${j2}/zip/raw`, q);
|
|
241
274
|
}
|
|
242
|
-
getWorkflowDispatchInputs(b, h, j2) {
|
|
243
|
-
return this.client.get(`/repos/${b}/${h}/actions/workflows/${j2}/dispatches
|
|
275
|
+
getWorkflowDispatchInputs(b, h, j2, q) {
|
|
276
|
+
return this.client.get(`/repos/${b}/${h}/actions/workflows/${j2}/dispatches`, q);
|
|
244
277
|
}
|
|
245
|
-
dispatchWorkflow(b, h, j2, q) {
|
|
246
|
-
return this.client.post(`/repos/${b}/${h}/actions/workflows/${j2}/dispatches`, q);
|
|
278
|
+
dispatchWorkflow(b, h, j2, q, v) {
|
|
279
|
+
return this.client.post(`/repos/${b}/${h}/actions/workflows/${j2}/dispatches`, q, v);
|
|
247
280
|
}
|
|
248
281
|
}
|
|
249
282
|
|
|
@@ -257,11 +290,11 @@ class j2 extends Error {
|
|
|
257
290
|
}
|
|
258
291
|
}
|
|
259
292
|
|
|
260
|
-
class
|
|
293
|
+
class k2 extends j2 {
|
|
261
294
|
rateLimit;
|
|
262
295
|
constructor(b, f, h) {
|
|
263
296
|
super(429, b, h);
|
|
264
|
-
this.name = "RateLimitError", this.rateLimit = f, Object.setPrototypeOf(this,
|
|
297
|
+
this.name = "RateLimitError", this.rateLimit = f, Object.setPrototypeOf(this, k2.prototype);
|
|
265
298
|
}
|
|
266
299
|
getRetryAfterSeconds() {
|
|
267
300
|
return this.rateLimit.retryAfter;
|
|
@@ -287,380 +320,387 @@ class q {
|
|
|
287
320
|
}
|
|
288
321
|
|
|
289
322
|
// ../sdk/dist/api/stars.js
|
|
290
|
-
class
|
|
323
|
+
class k3 {
|
|
291
324
|
client;
|
|
292
325
|
constructor(b) {
|
|
293
326
|
this.client = b;
|
|
294
327
|
}
|
|
295
|
-
list() {
|
|
296
|
-
return this.client.get("/user/starred");
|
|
328
|
+
list(b) {
|
|
329
|
+
return this.client.get("/user/starred", b);
|
|
297
330
|
}
|
|
298
|
-
async add(b, c) {
|
|
299
|
-
await this.client.put(`/user/starred/${b}/${c}
|
|
331
|
+
async add(b, c, f) {
|
|
332
|
+
await this.client.put(`/user/starred/${b}/${c}`, undefined, f);
|
|
300
333
|
}
|
|
301
|
-
async check(b, c) {
|
|
334
|
+
async check(b, c, f) {
|
|
302
335
|
try {
|
|
303
|
-
return await this.client.get(`/user/starred/${b}/${c}
|
|
304
|
-
} catch (
|
|
305
|
-
if (
|
|
336
|
+
return await this.client.get(`/user/starred/${b}/${c}`, f), true;
|
|
337
|
+
} catch (h) {
|
|
338
|
+
if (h instanceof j2 && h.status === 404)
|
|
306
339
|
return false;
|
|
307
|
-
throw
|
|
340
|
+
throw h;
|
|
308
341
|
}
|
|
309
342
|
}
|
|
310
|
-
async remove(b, c) {
|
|
311
|
-
await this.client.delete(`/user/starred/${b}/${c}
|
|
343
|
+
async remove(b, c, f) {
|
|
344
|
+
await this.client.delete(`/user/starred/${b}/${c}`, undefined, f);
|
|
312
345
|
}
|
|
313
346
|
}
|
|
314
347
|
|
|
315
348
|
// ../sdk/dist/api/issues.js
|
|
316
|
-
class
|
|
349
|
+
class B {
|
|
317
350
|
client;
|
|
318
351
|
constructor(c) {
|
|
319
352
|
this.client = c;
|
|
320
353
|
}
|
|
321
|
-
list(c, h, f) {
|
|
322
|
-
let
|
|
354
|
+
list(c, h, f, j3) {
|
|
355
|
+
let k4 = new URLSearchParams;
|
|
323
356
|
if (f)
|
|
324
|
-
|
|
325
|
-
let
|
|
326
|
-
return this.client.get(
|
|
357
|
+
k4.append("state", f);
|
|
358
|
+
let z = k4.toString(), A = `/repos/${c}/${h}/issues${z ? `?${z}` : ""}`;
|
|
359
|
+
return this.client.get(A, j3);
|
|
327
360
|
}
|
|
328
|
-
get(c, h, f) {
|
|
329
|
-
return this.client.get(`/repos/${c}/${h}/issues/${f}
|
|
361
|
+
get(c, h, f, j3) {
|
|
362
|
+
return this.client.get(`/repos/${c}/${h}/issues/${f}`, j3);
|
|
330
363
|
}
|
|
331
|
-
getComment(c, h, f) {
|
|
332
|
-
return this.client.get(`/repos/${c}/${h}/issues/comments/${f}
|
|
364
|
+
getComment(c, h, f, j3) {
|
|
365
|
+
return this.client.get(`/repos/${c}/${h}/issues/comments/${f}`, j3);
|
|
333
366
|
}
|
|
334
|
-
getComments(c, h, f) {
|
|
335
|
-
return this.client.get(`/repos/${c}/${h}/issues/${f}/comments
|
|
367
|
+
getComments(c, h, f, j3) {
|
|
368
|
+
return this.client.get(`/repos/${c}/${h}/issues/${f}/comments`, j3);
|
|
336
369
|
}
|
|
337
|
-
getLabels(c, h, f) {
|
|
338
|
-
return this.client.get(`/repos/${c}/${h}/issues/${f}/labels
|
|
370
|
+
getLabels(c, h, f, j3) {
|
|
371
|
+
return this.client.get(`/repos/${c}/${h}/issues/${f}/labels`, j3);
|
|
339
372
|
}
|
|
340
|
-
getTimeline(c, h, f) {
|
|
341
|
-
return this.client.get(`/repos/${c}/${h}/issues/${f}/timeline
|
|
373
|
+
getTimeline(c, h, f, j3) {
|
|
374
|
+
return this.client.get(`/repos/${c}/${h}/issues/${f}/timeline`, j3);
|
|
342
375
|
}
|
|
343
376
|
}
|
|
344
377
|
|
|
345
378
|
// ../sdk/dist/api/branches.js
|
|
346
|
-
class
|
|
379
|
+
class g {
|
|
347
380
|
client;
|
|
348
381
|
constructor(b) {
|
|
349
382
|
this.client = b;
|
|
350
383
|
}
|
|
351
|
-
list(b, d) {
|
|
352
|
-
return this.client.get(`/repos/${b}/${d}/branches
|
|
384
|
+
list(b, d, f) {
|
|
385
|
+
return this.client.get(`/repos/${b}/${d}/branches`, f);
|
|
353
386
|
}
|
|
354
387
|
}
|
|
355
388
|
|
|
356
389
|
// ../sdk/dist/utils.js
|
|
357
390
|
var z = /^([a-z][a-z0-9+.-]*:\/\/[^/]+)\/([a-z][a-z0-9+.-]*:\/\/.+)$/i;
|
|
358
|
-
function E(
|
|
359
|
-
if (!
|
|
360
|
-
return
|
|
361
|
-
let
|
|
362
|
-
if (
|
|
363
|
-
let q2 =
|
|
364
|
-
if (
|
|
365
|
-
return
|
|
366
|
-
}
|
|
367
|
-
return
|
|
368
|
-
}
|
|
369
|
-
function J(
|
|
370
|
-
let
|
|
371
|
-
for (let
|
|
372
|
-
if (typeof q2[
|
|
373
|
-
q2[
|
|
391
|
+
function E(j3) {
|
|
392
|
+
if (!j3)
|
|
393
|
+
return j3;
|
|
394
|
+
let k4 = j3.match(z);
|
|
395
|
+
if (k4?.[1] && k4?.[2]) {
|
|
396
|
+
let q2 = k4[1], v = k4[2];
|
|
397
|
+
if (v.startsWith(q2))
|
|
398
|
+
return v;
|
|
399
|
+
}
|
|
400
|
+
return j3;
|
|
401
|
+
}
|
|
402
|
+
function J(j3) {
|
|
403
|
+
let k4 = ["clone_url", "html_url", "url", "git_url", "mirror_url"], q2 = { ...j3 };
|
|
404
|
+
for (let v of k4)
|
|
405
|
+
if (typeof q2[v] === "string")
|
|
406
|
+
q2[v] = E(q2[v]);
|
|
374
407
|
return q2;
|
|
375
408
|
}
|
|
376
409
|
|
|
377
410
|
// ../sdk/dist/api/repositories.js
|
|
378
|
-
class
|
|
411
|
+
class A {
|
|
379
412
|
client;
|
|
380
413
|
constructor(g2) {
|
|
381
414
|
this.client = g2;
|
|
382
415
|
}
|
|
383
|
-
async get(g2,
|
|
384
|
-
let
|
|
385
|
-
return J(
|
|
416
|
+
async get(g2, k4, j3) {
|
|
417
|
+
let q2 = await this.client.get(`/repos/${g2}/${k4}`, j3);
|
|
418
|
+
return J(q2);
|
|
386
419
|
}
|
|
387
|
-
delete(g2,
|
|
388
|
-
return this.client.delete(`/repos/${g2}/${
|
|
420
|
+
delete(g2, k4, j3) {
|
|
421
|
+
return this.client.delete(`/repos/${g2}/${k4}`, undefined, j3);
|
|
389
422
|
}
|
|
390
|
-
async update(g2,
|
|
391
|
-
let
|
|
392
|
-
return J(
|
|
423
|
+
async update(g2, k4, j3, q2) {
|
|
424
|
+
let z2 = await this.client.patch(`/repos/${g2}/${k4}`, j3, q2);
|
|
425
|
+
return J(z2);
|
|
393
426
|
}
|
|
394
|
-
compare(g2,
|
|
395
|
-
return this.client.get(`/repos/${g2}/${
|
|
427
|
+
compare(g2, k4, j3, q2) {
|
|
428
|
+
return this.client.get(`/repos/${g2}/${k4}/compare/${j3}`, q2);
|
|
396
429
|
}
|
|
397
|
-
getLanguages(g2,
|
|
398
|
-
return this.client.get(`/repos/${g2}/${
|
|
430
|
+
getLanguages(g2, k4, j3) {
|
|
431
|
+
return this.client.get(`/repos/${g2}/${k4}/languages`, j3);
|
|
399
432
|
}
|
|
400
|
-
async listForAuthenticatedUser() {
|
|
401
|
-
return (await this.client.get("/user/repos")).map((
|
|
433
|
+
async listForAuthenticatedUser(g2) {
|
|
434
|
+
return (await this.client.get("/user/repos", g2)).map((j3) => J(j3));
|
|
402
435
|
}
|
|
403
|
-
async create(g2) {
|
|
404
|
-
let
|
|
405
|
-
return J(
|
|
436
|
+
async create(g2, k4) {
|
|
437
|
+
let j3 = await this.client.post("/user/repos", g2, k4);
|
|
438
|
+
return J(j3);
|
|
406
439
|
}
|
|
407
440
|
}
|
|
408
441
|
|
|
409
442
|
// ../sdk/dist/api/collaborators.js
|
|
410
|
-
class
|
|
443
|
+
class j3 {
|
|
411
444
|
client;
|
|
412
445
|
constructor(d) {
|
|
413
446
|
this.client = d;
|
|
414
447
|
}
|
|
415
|
-
list(d,
|
|
416
|
-
return this.client.get(`/repos/${d}/${
|
|
448
|
+
list(d, f, g2) {
|
|
449
|
+
return this.client.get(`/repos/${d}/${f}/collaborators`, g2);
|
|
417
450
|
}
|
|
418
|
-
add(d,
|
|
419
|
-
return this.client.put(`/repos/${d}/${
|
|
451
|
+
add(d, f, g2, h) {
|
|
452
|
+
return this.client.put(`/repos/${d}/${f}/collaborators/${g2}`, {}, h);
|
|
420
453
|
}
|
|
421
454
|
}
|
|
422
455
|
|
|
423
456
|
// ../sdk/dist/api/contents.js
|
|
424
|
-
class
|
|
457
|
+
class k4 {
|
|
425
458
|
client;
|
|
426
459
|
constructor(b) {
|
|
427
460
|
this.client = b;
|
|
428
461
|
}
|
|
429
|
-
get(b, d,
|
|
430
|
-
return this.client.get(`/repos/${b}/${d}/contents/${
|
|
462
|
+
get(b, d, f, g2) {
|
|
463
|
+
return this.client.get(`/repos/${b}/${d}/contents/${f}`, g2);
|
|
431
464
|
}
|
|
432
|
-
createFile(b, d,
|
|
433
|
-
return this.client.put(`/repos/${b}/${d}/contents/${
|
|
465
|
+
createFile(b, d, f, g2, j4) {
|
|
466
|
+
return this.client.put(`/repos/${b}/${d}/contents/${f}`, g2, j4);
|
|
434
467
|
}
|
|
435
|
-
updateFile(b, d,
|
|
436
|
-
return this.client.put(`/repos/${b}/${d}/contents/${
|
|
468
|
+
updateFile(b, d, f, g2, j4) {
|
|
469
|
+
return this.client.put(`/repos/${b}/${d}/contents/${f}`, g2, j4);
|
|
437
470
|
}
|
|
438
|
-
deleteFile(b, d,
|
|
439
|
-
return this.client.delete(`/repos/${b}/${d}/contents/${
|
|
471
|
+
deleteFile(b, d, f, g2, j4) {
|
|
472
|
+
return this.client.delete(`/repos/${b}/${d}/contents/${f}`, g2, j4);
|
|
440
473
|
}
|
|
441
474
|
}
|
|
442
475
|
|
|
443
476
|
// ../sdk/dist/api/teams.js
|
|
444
|
-
class
|
|
477
|
+
class k5 {
|
|
445
478
|
client;
|
|
446
479
|
constructor(b) {
|
|
447
480
|
this.client = b;
|
|
448
481
|
}
|
|
449
|
-
list(b) {
|
|
450
|
-
return this.client.get(`/orgs/${b}/teams
|
|
482
|
+
list(b, d) {
|
|
483
|
+
return this.client.get(`/orgs/${b}/teams`, d);
|
|
451
484
|
}
|
|
452
|
-
getInvitations(b, d) {
|
|
453
|
-
return this.client.get(`/orgs/${b}/teams/${d}/invitations
|
|
485
|
+
getInvitations(b, d, f) {
|
|
486
|
+
return this.client.get(`/orgs/${b}/teams/${d}/invitations`, f);
|
|
454
487
|
}
|
|
455
|
-
getMembers(b, d) {
|
|
456
|
-
return this.client.get(`/orgs/${b}/teams/${d}/members
|
|
488
|
+
getMembers(b, d, f) {
|
|
489
|
+
return this.client.get(`/orgs/${b}/teams/${d}/members`, f);
|
|
457
490
|
}
|
|
458
|
-
addRepository(b, d,
|
|
459
|
-
return this.client.put(`/orgs/${b}/teams/${d}/repos/${
|
|
491
|
+
addRepository(b, d, f, h, j4) {
|
|
492
|
+
return this.client.put(`/orgs/${b}/teams/${d}/repos/${f}/${h}`, {}, j4);
|
|
460
493
|
}
|
|
461
494
|
}
|
|
462
495
|
|
|
463
496
|
// ../sdk/dist/api/git.js
|
|
464
|
-
class
|
|
497
|
+
class j4 {
|
|
465
498
|
client;
|
|
466
499
|
constructor(b) {
|
|
467
500
|
this.client = b;
|
|
468
501
|
}
|
|
469
|
-
createRef(b, d,
|
|
470
|
-
return this.client.post(`/repos/${b}/${d}/git/refs`,
|
|
502
|
+
createRef(b, d, f, g2) {
|
|
503
|
+
return this.client.post(`/repos/${b}/${d}/git/refs`, f, g2);
|
|
471
504
|
}
|
|
472
|
-
createTree(b, d,
|
|
473
|
-
return this.client.post(`/repos/${b}/${d}/git/trees`,
|
|
505
|
+
createTree(b, d, f, g2) {
|
|
506
|
+
return this.client.post(`/repos/${b}/${d}/git/trees`, f, g2);
|
|
474
507
|
}
|
|
475
|
-
getTree(b, d,
|
|
476
|
-
return this.client.get(`/repos/${b}/${d}/git/trees/${
|
|
508
|
+
getTree(b, d, f, g2) {
|
|
509
|
+
return this.client.get(`/repos/${b}/${d}/git/trees/${f}`, g2);
|
|
477
510
|
}
|
|
478
511
|
}
|
|
479
512
|
|
|
480
513
|
// ../sdk/dist/api/releases.js
|
|
481
|
-
class
|
|
514
|
+
class q2 {
|
|
482
515
|
client;
|
|
483
516
|
constructor(b) {
|
|
484
517
|
this.client = b;
|
|
485
518
|
}
|
|
486
|
-
list(b,
|
|
487
|
-
return this.client.get(`/repos/${b}/${
|
|
519
|
+
list(b, f, h) {
|
|
520
|
+
return this.client.get(`/repos/${b}/${f}/releases`, h);
|
|
488
521
|
}
|
|
489
|
-
create(b,
|
|
490
|
-
return this.client.post(`/repos/${b}/${
|
|
522
|
+
create(b, f, h, j5) {
|
|
523
|
+
return this.client.post(`/repos/${b}/${f}/releases`, h, j5);
|
|
491
524
|
}
|
|
492
|
-
getByTag(b,
|
|
493
|
-
return this.client.get(`/repos/${b}/${
|
|
525
|
+
getByTag(b, f, h, j5) {
|
|
526
|
+
return this.client.get(`/repos/${b}/${f}/releases/tags/${h}`, j5);
|
|
494
527
|
}
|
|
495
|
-
deleteByTag(b,
|
|
496
|
-
return this.client.delete(`/repos/${b}/${
|
|
528
|
+
deleteByTag(b, f, h, j5) {
|
|
529
|
+
return this.client.delete(`/repos/${b}/${f}/releases/tags/${h}`, undefined, j5);
|
|
497
530
|
}
|
|
498
|
-
get(b,
|
|
499
|
-
return this.client.get(`/repos/${b}/${
|
|
531
|
+
get(b, f, h, j5) {
|
|
532
|
+
return this.client.get(`/repos/${b}/${f}/releases/${h}`, j5);
|
|
500
533
|
}
|
|
501
|
-
delete(b,
|
|
502
|
-
return this.client.delete(`/repos/${b}/${
|
|
534
|
+
delete(b, f, h, j5) {
|
|
535
|
+
return this.client.delete(`/repos/${b}/${f}/releases/${h}`, undefined, j5);
|
|
503
536
|
}
|
|
504
|
-
update(b,
|
|
505
|
-
return this.client.patch(`/repos/${b}/${
|
|
537
|
+
update(b, f, h, j5, k6) {
|
|
538
|
+
return this.client.patch(`/repos/${b}/${f}/releases/${h}`, j5, k6);
|
|
506
539
|
}
|
|
507
|
-
getAssets(b,
|
|
508
|
-
return this.client.get(`/repos/${b}/${
|
|
540
|
+
getAssets(b, f, h, j5) {
|
|
541
|
+
return this.client.get(`/repos/${b}/${f}/releases/${h}/assets`, j5);
|
|
509
542
|
}
|
|
510
|
-
uploadAsset(b,
|
|
511
|
-
return this.client.post(`/repos/${b}/${
|
|
543
|
+
uploadAsset(b, f, h, j5, k6) {
|
|
544
|
+
return this.client.post(`/repos/${b}/${f}/releases/${h}/assets`, j5, k6);
|
|
512
545
|
}
|
|
513
|
-
deleteAsset(b,
|
|
514
|
-
return this.client.delete(`/repos/${b}/${
|
|
546
|
+
deleteAsset(b, f, h, j5, k6) {
|
|
547
|
+
return this.client.delete(`/repos/${b}/${f}/releases/${h}/assets/${j5}`, undefined, k6);
|
|
515
548
|
}
|
|
516
549
|
}
|
|
517
550
|
|
|
518
551
|
// ../sdk/dist/api/pulls.js
|
|
519
|
-
class
|
|
552
|
+
class y {
|
|
520
553
|
client;
|
|
521
554
|
constructor(d) {
|
|
522
555
|
this.client = d;
|
|
523
556
|
}
|
|
524
|
-
create(d,
|
|
525
|
-
return this.client.post(`/repos/${d}/${
|
|
557
|
+
create(d, f, g2, j5) {
|
|
558
|
+
return this.client.post(`/repos/${d}/${f}/pulls`, g2, j5);
|
|
526
559
|
}
|
|
527
|
-
get(d,
|
|
528
|
-
return this.client.get(`/repos/${d}/${
|
|
560
|
+
get(d, f, g2, j5) {
|
|
561
|
+
return this.client.get(`/repos/${d}/${f}/pulls/${g2}`, j5);
|
|
529
562
|
}
|
|
530
|
-
list(d,
|
|
531
|
-
let
|
|
532
|
-
|
|
533
|
-
k3.searchParams.set("state", f2);
|
|
534
|
-
return this.client.get(k3.href.replace("http://localhost", ""));
|
|
563
|
+
list(d, f, g2, j5) {
|
|
564
|
+
let x2 = new URLSearchParams(Object.entries(g2 ?? {})), q3 = new URL(`/repos/${d}/${f}/pulls`, "http://localhost");
|
|
565
|
+
return q3.search = x2.toString(), this.client.get(q3.href.replace("http://localhost", ""), j5);
|
|
535
566
|
}
|
|
536
|
-
update(d,
|
|
537
|
-
return this.client.patch(`/repos/${d}/${
|
|
567
|
+
update(d, f, g2, j5, k6) {
|
|
568
|
+
return this.client.patch(`/repos/${d}/${f}/pulls/${g2}`, j5, k6);
|
|
538
569
|
}
|
|
539
|
-
getFiles(d,
|
|
540
|
-
return this.client.get(`/repos/${d}/${
|
|
570
|
+
getFiles(d, f, g2, j5) {
|
|
571
|
+
return this.client.get(`/repos/${d}/${f}/pulls/${g2}/files`, j5);
|
|
541
572
|
}
|
|
542
|
-
updateBranch(d,
|
|
543
|
-
return this.client.put(`/repos/${d}/${
|
|
573
|
+
updateBranch(d, f, g2, j5) {
|
|
574
|
+
return this.client.put(`/repos/${d}/${f}/pulls/${g2}/update-branch`, {}, j5);
|
|
544
575
|
}
|
|
545
|
-
getCommits(d,
|
|
546
|
-
return this.client.get(`/repos/${d}/${
|
|
576
|
+
getCommits(d, f, g2, j5) {
|
|
577
|
+
return this.client.get(`/repos/${d}/${f}/pulls/${g2}/commits`, j5);
|
|
578
|
+
}
|
|
579
|
+
async checkIfMerged(d, f, g2, j5) {
|
|
580
|
+
try {
|
|
581
|
+
return await this.client.get(`/repos/${d}/${f}/pulls/${g2}/merge`, j5), true;
|
|
582
|
+
} catch (k6) {
|
|
583
|
+
if (k6 instanceof j2 && k6.status === 404)
|
|
584
|
+
return false;
|
|
585
|
+
throw k6;
|
|
586
|
+
}
|
|
547
587
|
}
|
|
548
588
|
}
|
|
549
589
|
|
|
550
590
|
// ../sdk/dist/api/forks.js
|
|
551
|
-
class
|
|
591
|
+
class q3 {
|
|
552
592
|
client;
|
|
553
593
|
constructor(b) {
|
|
554
594
|
this.client = b;
|
|
555
595
|
}
|
|
556
|
-
async create(b,
|
|
557
|
-
let
|
|
558
|
-
return J(
|
|
596
|
+
async create(b, g2, h, j5) {
|
|
597
|
+
let k6 = await this.client.post(`/repos/${b}/${g2}/forks`, h, j5);
|
|
598
|
+
return J(k6);
|
|
559
599
|
}
|
|
560
600
|
}
|
|
561
601
|
|
|
562
602
|
// ../sdk/dist/client.js
|
|
563
603
|
var F = { DELETE: "DELETE", GET: "GET", PATCH: "PATCH", POST: "POST", PUT: "PUT" };
|
|
564
604
|
|
|
565
|
-
class
|
|
605
|
+
class _ {
|
|
566
606
|
baseUrl;
|
|
567
607
|
token;
|
|
568
608
|
apiVersion;
|
|
569
609
|
onApiVersionWarning;
|
|
570
|
-
constructor(
|
|
571
|
-
this.baseUrl =
|
|
610
|
+
constructor(j5 = {}) {
|
|
611
|
+
this.baseUrl = j5.baseUrl || "https://api.gitverse.ru", this.token = j5.token, this.apiVersion = j5.apiVersion || "1";
|
|
572
612
|
}
|
|
573
|
-
setToken(
|
|
574
|
-
this.token =
|
|
613
|
+
setToken(j5) {
|
|
614
|
+
this.token = j5;
|
|
575
615
|
}
|
|
576
|
-
extractRateLimitInfo(
|
|
577
|
-
let
|
|
578
|
-
if (!(
|
|
616
|
+
extractRateLimitInfo(j5) {
|
|
617
|
+
let x2 = j5.get("GitVerse-RateLimit-Limit"), q4 = j5.get("GitVerse-RateLimit-Remaining"), z2 = j5.get("GitVerse-RateLimit-Retry-After"), B2 = j5.get("Gitverse-Ratelimit-Reset");
|
|
618
|
+
if (!(x2 && q4 && z2 && B2))
|
|
579
619
|
return;
|
|
580
|
-
return { limit: Number.parseInt(
|
|
620
|
+
return { limit: Number.parseInt(x2, 10), remaining: Number.parseInt(q4, 10), reset: Number.parseInt(B2, 10), retryAfter: Number.parseInt(z2, 10) };
|
|
581
621
|
}
|
|
582
|
-
extractApiVersionInfo(
|
|
583
|
-
let
|
|
584
|
-
if (!(
|
|
622
|
+
extractApiVersionInfo(j5) {
|
|
623
|
+
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");
|
|
624
|
+
if (!(x2 && q4))
|
|
585
625
|
return;
|
|
586
|
-
return { decommissioning:
|
|
626
|
+
return { decommissioning: B2 || undefined, deprecated: z2, latestVersion: q4, version: x2 };
|
|
587
627
|
}
|
|
588
|
-
extractMetadata(
|
|
589
|
-
let
|
|
590
|
-
if (
|
|
591
|
-
let
|
|
592
|
-
this.onApiVersionWarning(
|
|
628
|
+
extractMetadata(j5) {
|
|
629
|
+
let x2 = this.extractRateLimitInfo(j5), q4 = this.extractApiVersionInfo(j5);
|
|
630
|
+
if (q4?.deprecated && this.onApiVersionWarning) {
|
|
631
|
+
let z2 = new q(q4.version, q4.latestVersion, q4.decommissioning);
|
|
632
|
+
this.onApiVersionWarning(z2);
|
|
593
633
|
}
|
|
594
|
-
return { apiVersion:
|
|
634
|
+
return { apiVersion: q4, rateLimit: x2 };
|
|
595
635
|
}
|
|
596
|
-
async request(
|
|
597
|
-
let
|
|
636
|
+
async request(j5, x2, q4, z2) {
|
|
637
|
+
let B2 = j5.startsWith("/") ? j5.slice(1) : j5, Y = `${this.baseUrl}/${B2}`, J2 = new Headers;
|
|
598
638
|
if (J2.set("Content-Type", "application/json"), J2.set("Accept", `application/vnd.gitverse.object+json; version=${this.apiVersion}`), this.token)
|
|
599
639
|
J2.set("Authorization", `Bearer ${this.token}`);
|
|
600
|
-
let
|
|
640
|
+
let Z = { body: q4 ? JSON.stringify(q4) : undefined, headers: J2, method: x2, signal: z2?.signal }, D = await fetch(Y, Z), K = this.extractMetadata(D.headers), N;
|
|
601
641
|
try {
|
|
602
642
|
N = await D.json();
|
|
603
643
|
} catch {
|
|
604
644
|
N = undefined;
|
|
605
645
|
}
|
|
606
646
|
if (!D.ok) {
|
|
607
|
-
let
|
|
647
|
+
let Q = N?.message || D.statusText;
|
|
608
648
|
if (D.status === 429 && K.rateLimit)
|
|
609
|
-
throw new
|
|
610
|
-
throw new j2(D.status,
|
|
649
|
+
throw new k2(Q || "Превышен лимит запросов. Попробуйте позже.", K.rateLimit, K);
|
|
650
|
+
throw new j2(D.status, Q, K);
|
|
611
651
|
}
|
|
612
652
|
return N;
|
|
613
653
|
}
|
|
614
|
-
get(
|
|
615
|
-
return this.request(
|
|
654
|
+
get(j5, x2) {
|
|
655
|
+
return this.request(j5, F.GET, undefined, x2);
|
|
616
656
|
}
|
|
617
|
-
post(
|
|
618
|
-
return this.request(
|
|
657
|
+
post(j5, x2, q4) {
|
|
658
|
+
return this.request(j5, F.POST, x2, q4);
|
|
619
659
|
}
|
|
620
|
-
put(
|
|
621
|
-
return this.request(
|
|
660
|
+
put(j5, x2, q4) {
|
|
661
|
+
return this.request(j5, F.PUT, x2, q4);
|
|
622
662
|
}
|
|
623
|
-
delete(
|
|
624
|
-
return this.request(
|
|
663
|
+
delete(j5, x2, q4) {
|
|
664
|
+
return this.request(j5, F.DELETE, x2, q4);
|
|
625
665
|
}
|
|
626
|
-
patch(
|
|
627
|
-
return this.request(
|
|
666
|
+
patch(j5, x2, q4) {
|
|
667
|
+
return this.request(j5, F.PATCH, x2, q4);
|
|
628
668
|
}
|
|
629
669
|
}
|
|
630
670
|
|
|
631
671
|
// ../sdk/dist/api/users.js
|
|
632
|
-
class
|
|
672
|
+
class f {
|
|
633
673
|
client;
|
|
634
674
|
constructor(b) {
|
|
635
675
|
this.client = b;
|
|
636
676
|
}
|
|
637
|
-
getCurrent() {
|
|
638
|
-
return this.client.get("/user");
|
|
677
|
+
getCurrent(b) {
|
|
678
|
+
return this.client.get("/user", b);
|
|
639
679
|
}
|
|
640
|
-
getByUsername(b) {
|
|
641
|
-
return this.client.get(`/users/${b}
|
|
680
|
+
getByUsername(b, d) {
|
|
681
|
+
return this.client.get(`/users/${b}`, d);
|
|
642
682
|
}
|
|
643
683
|
}
|
|
644
684
|
|
|
645
685
|
// ../sdk/dist/api/emails.js
|
|
646
|
-
class
|
|
686
|
+
class d {
|
|
647
687
|
client;
|
|
648
688
|
constructor(b) {
|
|
649
689
|
this.client = b;
|
|
650
690
|
}
|
|
651
|
-
list() {
|
|
652
|
-
return this.client.get("/user/emails");
|
|
691
|
+
list(b) {
|
|
692
|
+
return this.client.get("/user/emails", b);
|
|
653
693
|
}
|
|
654
|
-
add(b) {
|
|
655
|
-
return this.client.post("/user/emails", b);
|
|
694
|
+
add(b, c) {
|
|
695
|
+
return this.client.post("/user/emails", b, c);
|
|
656
696
|
}
|
|
657
|
-
remove(b) {
|
|
658
|
-
return this.client.delete("/user/emails", b);
|
|
697
|
+
remove(b, c) {
|
|
698
|
+
return this.client.delete("/user/emails", b, c);
|
|
659
699
|
}
|
|
660
700
|
}
|
|
661
701
|
|
|
662
702
|
// ../sdk/dist/index.js
|
|
663
|
-
class
|
|
703
|
+
class Z {
|
|
664
704
|
client;
|
|
665
705
|
users;
|
|
666
706
|
repos;
|
|
@@ -679,7 +719,7 @@ class P {
|
|
|
679
719
|
git;
|
|
680
720
|
actions;
|
|
681
721
|
constructor(d2 = {}) {
|
|
682
|
-
this.client = new
|
|
722
|
+
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);
|
|
683
723
|
}
|
|
684
724
|
setToken(d2) {
|
|
685
725
|
return this.client.setToken(d2), this;
|
|
@@ -690,24 +730,32 @@ class P {
|
|
|
690
730
|
class GitVerseReleaseClient {
|
|
691
731
|
client;
|
|
692
732
|
repoInfo;
|
|
693
|
-
|
|
694
|
-
|
|
733
|
+
retryFn;
|
|
734
|
+
constructor(token, repoInfo, retryFn) {
|
|
735
|
+
this.client = new Z({ token });
|
|
695
736
|
this.repoInfo = repoInfo;
|
|
737
|
+
this.retryFn = retryFn;
|
|
696
738
|
}
|
|
697
739
|
async createRelease(tag, name, body, options = {}) {
|
|
698
740
|
const { owner, repo } = this.repoInfo;
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
741
|
+
const createFn = async () => {
|
|
742
|
+
try {
|
|
743
|
+
await this.client.releases.create(owner, repo, {
|
|
744
|
+
body,
|
|
745
|
+
draft: options.draft,
|
|
746
|
+
name,
|
|
747
|
+
prerelease: options.prerelease,
|
|
748
|
+
tag_name: tag
|
|
749
|
+
});
|
|
750
|
+
return `${this.repoInfo.url}/releases/tag/${tag}`;
|
|
751
|
+
} catch (error) {
|
|
752
|
+
throw new Error(`Failed to create GitVerse release: ${error instanceof Error ? error.message : String(error)}`);
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
if (this.retryFn) {
|
|
756
|
+
return await this.retryFn(createFn, "Create GitVerse Release");
|
|
710
757
|
}
|
|
758
|
+
return await createFn();
|
|
711
759
|
}
|
|
712
760
|
async releaseExists(tag) {
|
|
713
761
|
const { owner, repo } = this.repoInfo;
|
|
@@ -723,12 +771,12 @@ class GitVerseReleaseClient {
|
|
|
723
771
|
return await this.client.releases.getByTag(owner, repo, tag);
|
|
724
772
|
}
|
|
725
773
|
}
|
|
726
|
-
function createGitVerseClient(repoInfo) {
|
|
774
|
+
function createGitVerseClient(repoInfo, retryFn) {
|
|
727
775
|
const token = process.env.GITVERSE_TOKEN;
|
|
728
776
|
if (!token) {
|
|
729
777
|
throw new Error("GITVERSE_TOKEN environment variable is required for creating releases");
|
|
730
778
|
}
|
|
731
|
-
return new GitVerseReleaseClient(token, repoInfo);
|
|
779
|
+
return new GitVerseReleaseClient(token, repoInfo, retryFn);
|
|
732
780
|
}
|
|
733
781
|
|
|
734
782
|
// src/utils/changelog.ts
|
|
@@ -805,7 +853,7 @@ function hasFixes(commits) {
|
|
|
805
853
|
}
|
|
806
854
|
|
|
807
855
|
// src/utils/changelog.ts
|
|
808
|
-
function generateChangelog(options, config) {
|
|
856
|
+
function generateChangelog(options, config, packageName) {
|
|
809
857
|
const { version, commits, date = new Date, repoUrl } = options;
|
|
810
858
|
const sections = [];
|
|
811
859
|
const dateStr = date.toISOString().split("T")[0];
|
|
@@ -813,17 +861,17 @@ function generateChangelog(options, config) {
|
|
|
813
861
|
sections.push("");
|
|
814
862
|
const grouped = groupCommitsByType(commits);
|
|
815
863
|
const typeOrder = ["feat", "fix", "perf", "refactor", "docs", "test", "build", "ci", "chore", "style", "revert"];
|
|
816
|
-
const breakingCommits = commits.filter((
|
|
864
|
+
const breakingCommits = commits.filter((c) => c.breaking);
|
|
817
865
|
if (breakingCommits.length > 0) {
|
|
818
866
|
sections.push("### ⚠️ BREAKING CHANGES");
|
|
819
867
|
sections.push("");
|
|
820
868
|
for (const commit of breakingCommits) {
|
|
821
|
-
sections.push(formatCommit(commit, config, repoUrl));
|
|
869
|
+
sections.push(formatCommit(commit, config, repoUrl, packageName));
|
|
822
870
|
}
|
|
823
871
|
sections.push("");
|
|
824
872
|
}
|
|
825
873
|
for (const type of typeOrder) {
|
|
826
|
-
const typeCommits = grouped[type]?.filter((
|
|
874
|
+
const typeCommits = grouped[type]?.filter((c) => !c.breaking);
|
|
827
875
|
if (!typeCommits || typeCommits.length === 0) {
|
|
828
876
|
continue;
|
|
829
877
|
}
|
|
@@ -831,17 +879,17 @@ function generateChangelog(options, config) {
|
|
|
831
879
|
sections.push(`### ${title}`);
|
|
832
880
|
sections.push("");
|
|
833
881
|
for (const commit of typeCommits) {
|
|
834
|
-
sections.push(formatCommit(commit, config, repoUrl));
|
|
882
|
+
sections.push(formatCommit(commit, config, repoUrl, packageName));
|
|
835
883
|
}
|
|
836
884
|
sections.push("");
|
|
837
885
|
}
|
|
838
886
|
return sections.join(`
|
|
839
887
|
`);
|
|
840
888
|
}
|
|
841
|
-
function formatCommit(commit, config, repoUrl) {
|
|
889
|
+
function formatCommit(commit, config, repoUrl, packageName) {
|
|
842
890
|
const parts = [];
|
|
843
891
|
let message = commit.subject;
|
|
844
|
-
if (commit.scope) {
|
|
892
|
+
if (commit.scope && commit.scope !== packageName) {
|
|
845
893
|
message = `**${commit.scope}:** ${message}`;
|
|
846
894
|
}
|
|
847
895
|
parts.push(`- ${message}`);
|
|
@@ -891,18 +939,18 @@ All notable changes to this project will be documented in this file.
|
|
|
891
939
|
await writeFile(changelogPath, lines.join(`
|
|
892
940
|
`));
|
|
893
941
|
}
|
|
894
|
-
function generateReleaseNotes(commits, config, repoUrl) {
|
|
942
|
+
function generateReleaseNotes(commits, config, repoUrl, packageName) {
|
|
895
943
|
const sections = [];
|
|
896
|
-
const breakingCommits = commits.filter((
|
|
944
|
+
const breakingCommits = commits.filter((c) => c.breaking);
|
|
897
945
|
if (breakingCommits.length > 0) {
|
|
898
946
|
sections.push("⚠️ BREAKING CHANGES");
|
|
899
947
|
sections.push("");
|
|
900
948
|
for (const commit of breakingCommits) {
|
|
901
|
-
sections.push(formatCommit(commit, config, repoUrl));
|
|
949
|
+
sections.push(formatCommit(commit, config, repoUrl, packageName));
|
|
902
950
|
}
|
|
903
951
|
sections.push("");
|
|
904
952
|
}
|
|
905
|
-
const grouped = groupCommitsByType(commits.filter((
|
|
953
|
+
const grouped = groupCommitsByType(commits.filter((c) => !c.breaking));
|
|
906
954
|
const typeOrder = ["feat", "fix", "perf", "refactor", "docs", "test", "build", "ci", "chore", "style", "revert"];
|
|
907
955
|
for (const type of typeOrder) {
|
|
908
956
|
const typeCommits = grouped[type];
|
|
@@ -913,7 +961,7 @@ function generateReleaseNotes(commits, config, repoUrl) {
|
|
|
913
961
|
sections.push(title);
|
|
914
962
|
sections.push("");
|
|
915
963
|
for (const commit of typeCommits) {
|
|
916
|
-
sections.push(formatCommit(commit, config, repoUrl));
|
|
964
|
+
sections.push(formatCommit(commit, config, repoUrl, packageName));
|
|
917
965
|
}
|
|
918
966
|
sections.push("");
|
|
919
967
|
}
|
|
@@ -925,6 +973,27 @@ function generateReleaseNotes(commits, config, repoUrl) {
|
|
|
925
973
|
import { exec } from "node:child_process";
|
|
926
974
|
import { promisify } from "node:util";
|
|
927
975
|
var execAsync = promisify(exec);
|
|
976
|
+
async function executeCommand(command) {
|
|
977
|
+
const { stdout, stderr } = await execAsync(command);
|
|
978
|
+
if (stderr && !stderr.includes("warning")) {
|
|
979
|
+
console.warn(`Command stderr: ${stderr}`);
|
|
980
|
+
}
|
|
981
|
+
return stdout.trim();
|
|
982
|
+
}
|
|
983
|
+
async function runBeforeCommitHook(command) {
|
|
984
|
+
console.log(`
|
|
985
|
+
\uD83D\uDD27 Running before-commit hook: ${command}`);
|
|
986
|
+
try {
|
|
987
|
+
await executeCommand(command);
|
|
988
|
+
console.log(`✅ Before-commit hook completed successfully
|
|
989
|
+
`);
|
|
990
|
+
return true;
|
|
991
|
+
} catch (error) {
|
|
992
|
+
console.warn(`⚠️ Before-commit hook failed: ${error instanceof Error ? error.message : String(error)}
|
|
993
|
+
`);
|
|
994
|
+
return false;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
928
997
|
var GITVERSE_URL_REGEX_1 = /gitverse\.ru[:/]([^/]+)\/([^/.]+)(\.git)?$/;
|
|
929
998
|
var GITVERSE_URL_REGEX_2 = /gitverse\.ru\/([^/]+)\/([^/.]+)(\.git)?$/;
|
|
930
999
|
async function git(command) {
|
|
@@ -1045,11 +1114,36 @@ async function pushChanges(tag) {
|
|
|
1045
1114
|
async function isWorkingTreeClean() {
|
|
1046
1115
|
try {
|
|
1047
1116
|
const status = await git("status --porcelain");
|
|
1048
|
-
|
|
1117
|
+
if (status.length === 0) {
|
|
1118
|
+
return true;
|
|
1119
|
+
}
|
|
1120
|
+
const lines = status.split(`
|
|
1121
|
+
`).filter((line) => line.length > 0);
|
|
1122
|
+
const unstagedChanges = lines.filter((line) => {
|
|
1123
|
+
const workingTreeStatus = line[1];
|
|
1124
|
+
return workingTreeStatus !== " ";
|
|
1125
|
+
});
|
|
1126
|
+
if (unstagedChanges.length > 0) {
|
|
1127
|
+
console.log(`
|
|
1128
|
+
⚠️ Unstaged changes detected:`);
|
|
1129
|
+
for (const line of unstagedChanges) {
|
|
1130
|
+
console.log(` ${line}`);
|
|
1131
|
+
}
|
|
1132
|
+
console.log("");
|
|
1133
|
+
return false;
|
|
1134
|
+
}
|
|
1135
|
+
console.log("✓ Working tree clean (staged changes will be included in release commit)");
|
|
1136
|
+
return true;
|
|
1049
1137
|
} catch {
|
|
1050
1138
|
return false;
|
|
1051
1139
|
}
|
|
1052
1140
|
}
|
|
1141
|
+
async function addChangedFiles() {
|
|
1142
|
+
console.log("\uD83D\uDCE5 Adding changed files to staging area...");
|
|
1143
|
+
await git("add -A");
|
|
1144
|
+
console.log(`✅ Files added to staging area
|
|
1145
|
+
`);
|
|
1146
|
+
}
|
|
1053
1147
|
async function tagExists(tag) {
|
|
1054
1148
|
try {
|
|
1055
1149
|
await git(`rev-parse "${tag}"`);
|
|
@@ -1059,12 +1153,77 @@ async function tagExists(tag) {
|
|
|
1059
1153
|
}
|
|
1060
1154
|
}
|
|
1061
1155
|
|
|
1156
|
+
// src/utils/retry.ts
|
|
1157
|
+
function sleep(ms) {
|
|
1158
|
+
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
1159
|
+
}
|
|
1160
|
+
function calculateDelay(attempt, initialDelay, maxDelay) {
|
|
1161
|
+
const delay = initialDelay * 2 ** attempt;
|
|
1162
|
+
return Math.min(delay, maxDelay);
|
|
1163
|
+
}
|
|
1164
|
+
function isRetriableError(error) {
|
|
1165
|
+
if (!(error instanceof Error)) {
|
|
1166
|
+
return false;
|
|
1167
|
+
}
|
|
1168
|
+
const message = error.message.toLowerCase();
|
|
1169
|
+
if (message.includes("network") || message.includes("timeout") || message.includes("econnreset")) {
|
|
1170
|
+
return true;
|
|
1171
|
+
}
|
|
1172
|
+
if (message.includes("500") || message.includes("502") || message.includes("503") || message.includes("504")) {
|
|
1173
|
+
return true;
|
|
1174
|
+
}
|
|
1175
|
+
if (message.includes("rate limit") || message.includes("429")) {
|
|
1176
|
+
return true;
|
|
1177
|
+
}
|
|
1178
|
+
return false;
|
|
1179
|
+
}
|
|
1180
|
+
async function retry(fn, options) {
|
|
1181
|
+
const { maxAttempts, initialDelay, maxDelay, operationName = "Operation" } = options;
|
|
1182
|
+
let lastError;
|
|
1183
|
+
for (let attempt = 0;attempt < maxAttempts; attempt++) {
|
|
1184
|
+
try {
|
|
1185
|
+
return await fn();
|
|
1186
|
+
} catch (error) {
|
|
1187
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
1188
|
+
const canRetry = isRetriableError(error);
|
|
1189
|
+
if (attempt === maxAttempts - 1 || !canRetry) {
|
|
1190
|
+
if (!canRetry && attempt < maxAttempts - 1) {
|
|
1191
|
+
console.error(`
|
|
1192
|
+
❌ ${operationName} failed with non-retriable error:`);
|
|
1193
|
+
console.error(lastError.message);
|
|
1194
|
+
}
|
|
1195
|
+
throw lastError;
|
|
1196
|
+
}
|
|
1197
|
+
const delay = calculateDelay(attempt, initialDelay, maxDelay);
|
|
1198
|
+
console.warn(`
|
|
1199
|
+
⚠️ ${operationName} failed (attempt ${attempt + 1}/${maxAttempts}):`);
|
|
1200
|
+
console.warn(` ${lastError.message}`);
|
|
1201
|
+
console.warn(` Retrying in ${delay}ms...`);
|
|
1202
|
+
await sleep(delay);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
throw lastError || new Error(`${operationName} failed after ${maxAttempts} attempts`);
|
|
1206
|
+
}
|
|
1207
|
+
function createRetryFunction(config) {
|
|
1208
|
+
return async (fn, operationName) => {
|
|
1209
|
+
if (!config.enabled) {
|
|
1210
|
+
return await fn();
|
|
1211
|
+
}
|
|
1212
|
+
return await retry(fn, {
|
|
1213
|
+
initialDelay: config.initialDelay,
|
|
1214
|
+
maxAttempts: config.maxAttempts,
|
|
1215
|
+
maxDelay: config.maxDelay,
|
|
1216
|
+
operationName
|
|
1217
|
+
});
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1062
1221
|
// src/utils/version.ts
|
|
1063
1222
|
var VERSION_REGEX = /^(\d+)\.(\d+)\.(\d+)(?:-(.+))?$/;
|
|
1064
1223
|
var PRERELEASE_INCREMENT_REGEX = /^(.+)\.(\d+)$/;
|
|
1065
1224
|
function parseVersion(version) {
|
|
1066
|
-
const
|
|
1067
|
-
const match =
|
|
1225
|
+
const v = version.startsWith("v") ? version.slice(1) : version;
|
|
1226
|
+
const match = v.match(VERSION_REGEX);
|
|
1068
1227
|
if (!(match?.[1] && match[2] && match[3])) {
|
|
1069
1228
|
throw new Error(`Invalid version format: ${version}`);
|
|
1070
1229
|
}
|
|
@@ -1082,12 +1241,34 @@ function formatVersion(ver) {
|
|
|
1082
1241
|
}
|
|
1083
1242
|
return result;
|
|
1084
1243
|
}
|
|
1085
|
-
function
|
|
1244
|
+
function shouldBumpMajor(currentVersion, mode = "auto") {
|
|
1245
|
+
if (mode === "disabled") {
|
|
1246
|
+
return true;
|
|
1247
|
+
}
|
|
1248
|
+
if (mode === "enabled") {
|
|
1249
|
+
return false;
|
|
1250
|
+
}
|
|
1251
|
+
if (!currentVersion) {
|
|
1252
|
+
return true;
|
|
1253
|
+
}
|
|
1254
|
+
const current = parseVersion(currentVersion);
|
|
1255
|
+
if (mode === "auto") {
|
|
1256
|
+
return current.major >= 1;
|
|
1257
|
+
}
|
|
1258
|
+
try {
|
|
1259
|
+
const _threshold = parseVersion(mode);
|
|
1260
|
+
return compareVersions(currentVersion, mode) >= 0;
|
|
1261
|
+
} catch {
|
|
1262
|
+
return true;
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
function determineBumpType(commits, currentVersion, preMajorMode = "auto") {
|
|
1086
1266
|
if (commits.length === 0) {
|
|
1087
1267
|
return null;
|
|
1088
1268
|
}
|
|
1089
1269
|
if (hasBreakingChanges(commits)) {
|
|
1090
|
-
|
|
1270
|
+
const useMajor = shouldBumpMajor(currentVersion, preMajorMode);
|
|
1271
|
+
return useMajor ? "major" : "minor";
|
|
1091
1272
|
}
|
|
1092
1273
|
if (hasFeatures(commits)) {
|
|
1093
1274
|
return "minor";
|
|
@@ -1133,8 +1314,8 @@ function bumpVersion(currentVersion, bumpType, prereleasePrefix) {
|
|
|
1133
1314
|
}
|
|
1134
1315
|
return formatVersion(ver);
|
|
1135
1316
|
}
|
|
1136
|
-
function calculateVersionBump(currentVersion, commits, forceVersion, prerelease) {
|
|
1137
|
-
const bumpType = prerelease ? "prerelease" : determineBumpType(commits) || "patch";
|
|
1317
|
+
function calculateVersionBump(currentVersion, commits, forceVersion, prerelease, preMajorMode) {
|
|
1318
|
+
const bumpType = prerelease ? "prerelease" : determineBumpType(commits, currentVersion, preMajorMode) || "patch";
|
|
1138
1319
|
const newVersion = forceVersion || bumpVersion(currentVersion, bumpType, prerelease);
|
|
1139
1320
|
return {
|
|
1140
1321
|
bumpType,
|
|
@@ -1146,6 +1327,29 @@ function calculateVersionBump(currentVersion, commits, forceVersion, prerelease)
|
|
|
1146
1327
|
newVersion
|
|
1147
1328
|
};
|
|
1148
1329
|
}
|
|
1330
|
+
function compareVersions(a, b) {
|
|
1331
|
+
const verA = parseVersion(a);
|
|
1332
|
+
const verB = parseVersion(b);
|
|
1333
|
+
if (verA.major !== verB.major) {
|
|
1334
|
+
return verA.major > verB.major ? 1 : -1;
|
|
1335
|
+
}
|
|
1336
|
+
if (verA.minor !== verB.minor) {
|
|
1337
|
+
return verA.minor > verB.minor ? 1 : -1;
|
|
1338
|
+
}
|
|
1339
|
+
if (verA.patch !== verB.patch) {
|
|
1340
|
+
return verA.patch > verB.patch ? 1 : -1;
|
|
1341
|
+
}
|
|
1342
|
+
if (verA.prerelease && !verB.prerelease) {
|
|
1343
|
+
return -1;
|
|
1344
|
+
}
|
|
1345
|
+
if (!verA.prerelease && verB.prerelease) {
|
|
1346
|
+
return 1;
|
|
1347
|
+
}
|
|
1348
|
+
if (verA.prerelease && verB.prerelease) {
|
|
1349
|
+
return verA.prerelease.localeCompare(verB.prerelease);
|
|
1350
|
+
}
|
|
1351
|
+
return 0;
|
|
1352
|
+
}
|
|
1149
1353
|
|
|
1150
1354
|
// src/index.ts
|
|
1151
1355
|
function printDryRunInfo(pkg, currentVersion, versionBump, tag, commits, changelogEntry) {
|
|
@@ -1185,10 +1389,11 @@ async function collectCommits(pkg, options, warnings) {
|
|
|
1185
1389
|
throw new Error(`No commits found since last release for ${pkg.packageName}`);
|
|
1186
1390
|
}
|
|
1187
1391
|
const commits = parseCommits(rawCommits);
|
|
1188
|
-
|
|
1392
|
+
const filteredCommits = commits.filter((commit) => !commit.scope || commit.scope === pkg.name);
|
|
1393
|
+
if (filteredCommits.length === 0 && !options.version) {
|
|
1189
1394
|
warnings.push("No conventional commits found, but will proceed with patch bump");
|
|
1190
1395
|
}
|
|
1191
|
-
return
|
|
1396
|
+
return filteredCommits;
|
|
1192
1397
|
}
|
|
1193
1398
|
function resolvePrereleaseTag(options, config) {
|
|
1194
1399
|
if (typeof options.prerelease === "string") {
|
|
@@ -1199,20 +1404,24 @@ function resolvePrereleaseTag(options, config) {
|
|
|
1199
1404
|
}
|
|
1200
1405
|
return;
|
|
1201
1406
|
}
|
|
1202
|
-
async function createGitVerseRelease(options, repoInfo, commits, config, pkg, versionBump, tag,
|
|
1203
|
-
if (options.noRelease) {
|
|
1407
|
+
async function createGitVerseRelease(options, repoInfo, commits, config, pkg, versionBump, tag, retryFn) {
|
|
1408
|
+
if (options.noRelease || !config.gitverse.enabled) {
|
|
1204
1409
|
return;
|
|
1205
1410
|
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
const
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1411
|
+
const gitverseClient = createGitVerseClient(repoInfo, retryFn);
|
|
1412
|
+
if (config.gitverse.checkExisting) {
|
|
1413
|
+
const exists = await gitverseClient.releaseExists(tag);
|
|
1414
|
+
if (exists) {
|
|
1415
|
+
console.log(`
|
|
1416
|
+
✅ Release ${tag} already exists, skipping creation
|
|
1417
|
+
`);
|
|
1418
|
+
return `${repoInfo.url}/releases/tag/${tag}`;
|
|
1419
|
+
}
|
|
1215
1420
|
}
|
|
1421
|
+
const releaseNotes = generateReleaseNotes(commits, config.changelog, repoInfo.url, pkg.name);
|
|
1422
|
+
return await gitverseClient.createRelease(tag, `${pkg.packageName} v${versionBump.newVersion}`, releaseNotes, {
|
|
1423
|
+
prerelease: !!options.prerelease
|
|
1424
|
+
});
|
|
1216
1425
|
}
|
|
1217
1426
|
async function performGitOperations(config, options, pkg, newVersion, tag, changelogPath) {
|
|
1218
1427
|
if (config.git.commitChanges && !options.noCommit) {
|
|
@@ -1242,6 +1451,12 @@ async function release(packageName, options = {}) {
|
|
|
1242
1451
|
const repoInfo = await getRepoInfo();
|
|
1243
1452
|
const pkg = await resolvePackage(config, packageName);
|
|
1244
1453
|
result.packageName = pkg.packageName;
|
|
1454
|
+
if (!options.dryRun && config.git.beforeCommit) {
|
|
1455
|
+
const hookSuccess = await runBeforeCommitHook(config.git.beforeCommit);
|
|
1456
|
+
if (hookSuccess) {
|
|
1457
|
+
await addChangedFiles();
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1245
1460
|
if (!(options.dryRun || await isWorkingTreeClean())) {
|
|
1246
1461
|
throw new Error("Working tree is not clean. Please commit or stash your changes.");
|
|
1247
1462
|
}
|
|
@@ -1249,7 +1464,7 @@ async function release(packageName, options = {}) {
|
|
|
1249
1464
|
result.oldVersion = currentVersion;
|
|
1250
1465
|
const commits = await collectCommits(pkg, options, result.warnings);
|
|
1251
1466
|
const prereleaseTag = resolvePrereleaseTag(options, config);
|
|
1252
|
-
const versionBump = calculateVersionBump(currentVersion, commits, options.version, prereleaseTag);
|
|
1467
|
+
const versionBump = calculateVersionBump(currentVersion, commits, options.version, prereleaseTag, config.versioning.preMajorMode);
|
|
1253
1468
|
result.newVersion = versionBump.newVersion;
|
|
1254
1469
|
const tag = `${pkg.tagPrefix}${versionBump.newVersion}`;
|
|
1255
1470
|
result.tag = tag;
|
|
@@ -1261,15 +1476,27 @@ async function release(packageName, options = {}) {
|
|
|
1261
1476
|
date: new Date,
|
|
1262
1477
|
repoUrl: repoInfo.url,
|
|
1263
1478
|
version: versionBump.newVersion
|
|
1264
|
-
}, config.changelog);
|
|
1479
|
+
}, config.changelog, pkg.name);
|
|
1265
1480
|
if (options.dryRun) {
|
|
1266
1481
|
printDryRunInfo(pkg, currentVersion, versionBump, tag, commits, changelogEntry);
|
|
1267
1482
|
result.success = true;
|
|
1268
1483
|
return result;
|
|
1269
1484
|
}
|
|
1485
|
+
const retryFn = createRetryFunction(config.retry);
|
|
1270
1486
|
const changelogPath = await updatePackageFiles(pkg, versionBump.newVersion, changelogEntry);
|
|
1271
1487
|
await performGitOperations(config, options, pkg, versionBump.newVersion, tag, changelogPath);
|
|
1272
|
-
|
|
1488
|
+
try {
|
|
1489
|
+
result.releaseUrl = await createGitVerseRelease(options, repoInfo, commits, config, pkg, versionBump, tag, retryFn);
|
|
1490
|
+
} catch (error) {
|
|
1491
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1492
|
+
if (config.gitverse.failOnError) {
|
|
1493
|
+
throw new Error(`GitVerse release creation failed: ${errorMessage}`);
|
|
1494
|
+
}
|
|
1495
|
+
result.warnings.push(`Failed to create GitVerse release: ${errorMessage}`);
|
|
1496
|
+
console.warn(`
|
|
1497
|
+
⚠️ Warning: ${errorMessage}
|
|
1498
|
+
`);
|
|
1499
|
+
}
|
|
1273
1500
|
result.success = true;
|
|
1274
1501
|
printSuccessInfo(pkg, currentVersion, versionBump.newVersion, tag, result.releaseUrl);
|
|
1275
1502
|
return result;
|
|
@@ -1304,11 +1531,66 @@ async function resolvePackage(config, packageName) {
|
|
|
1304
1531
|
}
|
|
1305
1532
|
return pkg;
|
|
1306
1533
|
}
|
|
1534
|
+
async function createReleaseOnly(tag, packageName, configPath) {
|
|
1535
|
+
const result = {
|
|
1536
|
+
errors: [],
|
|
1537
|
+
newVersion: "",
|
|
1538
|
+
oldVersion: "",
|
|
1539
|
+
packageName: packageName || "unknown",
|
|
1540
|
+
success: false,
|
|
1541
|
+
tag,
|
|
1542
|
+
warnings: []
|
|
1543
|
+
};
|
|
1544
|
+
try {
|
|
1545
|
+
const config = await loadConfig(configPath);
|
|
1546
|
+
validateConfig(config);
|
|
1547
|
+
const repoInfo = await getRepoInfo();
|
|
1548
|
+
const pkg = await resolvePackage(config, packageName);
|
|
1549
|
+
result.packageName = pkg.packageName;
|
|
1550
|
+
const version = tag.replace(pkg.tagPrefix, "");
|
|
1551
|
+
result.newVersion = version;
|
|
1552
|
+
const rawCommits = await getCommitsSinceTag(pkg.tagPrefix, pkg.path);
|
|
1553
|
+
const commits = parseCommits(rawCommits);
|
|
1554
|
+
const retryFn = createRetryFunction(config.retry);
|
|
1555
|
+
const gitverseClient = createGitVerseClient(repoInfo, retryFn);
|
|
1556
|
+
if (config.gitverse.checkExisting) {
|
|
1557
|
+
const exists = await gitverseClient.releaseExists(tag);
|
|
1558
|
+
if (exists) {
|
|
1559
|
+
console.log(`
|
|
1560
|
+
✅ Release ${tag} already exists
|
|
1561
|
+
`);
|
|
1562
|
+
result.releaseUrl = `${repoInfo.url}/releases/tag/${tag}`;
|
|
1563
|
+
result.success = true;
|
|
1564
|
+
return result;
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
const releaseNotes = generateReleaseNotes(commits, config.changelog, repoInfo.url, pkg.name);
|
|
1568
|
+
result.releaseUrl = await gitverseClient.createRelease(tag, `${pkg.packageName} v${version}`, releaseNotes);
|
|
1569
|
+
result.success = true;
|
|
1570
|
+
console.log(`
|
|
1571
|
+
✅ Release created successfully!`);
|
|
1572
|
+
console.log(`\uD83D\uDCE6 Package: ${pkg.packageName}`);
|
|
1573
|
+
console.log(`\uD83C\uDFF7️ Tag: ${tag}`);
|
|
1574
|
+
console.log(`\uD83C\uDF10 Release: ${result.releaseUrl}
|
|
1575
|
+
`);
|
|
1576
|
+
return result;
|
|
1577
|
+
} catch (error) {
|
|
1578
|
+
result.success = false;
|
|
1579
|
+
result.errors.push(error instanceof Error ? error.message : String(error));
|
|
1580
|
+
console.error(`
|
|
1581
|
+
❌ Release creation failed:
|
|
1582
|
+
`);
|
|
1583
|
+
console.error(error);
|
|
1584
|
+
console.error("");
|
|
1585
|
+
return result;
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1307
1588
|
export {
|
|
1308
1589
|
validateConfig,
|
|
1309
1590
|
release,
|
|
1310
1591
|
loadConfig,
|
|
1592
|
+
createReleaseOnly,
|
|
1311
1593
|
createGitVerseClient
|
|
1312
1594
|
};
|
|
1313
1595
|
|
|
1314
|
-
//# debugId=
|
|
1596
|
+
//# debugId=FFEDCCEDE0AB7D8364756E2164756E21
|