gitverse-release 3.2.0 → 3.3.1
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 +166 -3
- package/dist/cli.js +726 -318
- package/dist/cli.js.map +31 -29
- package/dist/gitverse.d.ts +7 -2
- package/dist/index.d.ts +5 -0
- package/dist/index.js +538 -317
- package/dist/index.js.map +29 -28
- package/dist/types.d.ts +151 -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/package.json +4 -7
- package/schema.json +289 -0
package/dist/cli.js
CHANGED
|
@@ -42,16 +42,36 @@ var DEFAULT_CONFIG = {
|
|
|
42
42
|
test: "✅ Tests"
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
+
commitlint: {
|
|
46
|
+
comments: true,
|
|
47
|
+
format: "ts",
|
|
48
|
+
headerMaxLength: 100,
|
|
49
|
+
output: "commitlint.config.ts",
|
|
50
|
+
scopeRequired: false,
|
|
51
|
+
scopes: ["deps", "ci", "docs"]
|
|
52
|
+
},
|
|
45
53
|
git: {
|
|
46
54
|
commitChanges: true,
|
|
47
55
|
commitMessage: "chore(release): {{package}} v{{version}} [skip ci]",
|
|
48
56
|
push: true,
|
|
49
57
|
tagMessage: "Release {{package}} v{{version}}"
|
|
50
58
|
},
|
|
59
|
+
gitverse: {
|
|
60
|
+
checkExisting: true,
|
|
61
|
+
enabled: true,
|
|
62
|
+
failOnError: true
|
|
63
|
+
},
|
|
51
64
|
monorepo: {
|
|
52
65
|
enabled: false,
|
|
53
66
|
packages: []
|
|
54
67
|
},
|
|
68
|
+
retry: {
|
|
69
|
+
enabled: true,
|
|
70
|
+
initialDelay: 2000,
|
|
71
|
+
maxAttempts: 5,
|
|
72
|
+
maxDelay: 30000,
|
|
73
|
+
operations: ["push", "createRelease"]
|
|
74
|
+
},
|
|
55
75
|
versioning: {
|
|
56
76
|
allowPrerelease: false,
|
|
57
77
|
preMajorMode: "auto",
|
|
@@ -83,14 +103,26 @@ function mergeConfig(defaults, user) {
|
|
|
83
103
|
...user.changelog?.types
|
|
84
104
|
}
|
|
85
105
|
},
|
|
106
|
+
commitlint: {
|
|
107
|
+
...defaults.commitlint,
|
|
108
|
+
...user.commitlint
|
|
109
|
+
},
|
|
86
110
|
git: {
|
|
87
111
|
...defaults.git,
|
|
88
112
|
...user.git
|
|
89
113
|
},
|
|
114
|
+
gitverse: {
|
|
115
|
+
...defaults.gitverse,
|
|
116
|
+
...user.gitverse
|
|
117
|
+
},
|
|
90
118
|
monorepo: {
|
|
91
119
|
...defaults.monorepo,
|
|
92
120
|
...user.monorepo
|
|
93
121
|
},
|
|
122
|
+
retry: {
|
|
123
|
+
...defaults.retry,
|
|
124
|
+
...user.retry
|
|
125
|
+
},
|
|
94
126
|
versioning: {
|
|
95
127
|
...defaults.versioning,
|
|
96
128
|
...user.versioning
|
|
@@ -109,14 +141,14 @@ function validateConfig(config) {
|
|
|
109
141
|
}
|
|
110
142
|
|
|
111
143
|
// ../sdk/dist/api/organizations.js
|
|
112
|
-
class
|
|
144
|
+
class k {
|
|
113
145
|
client;
|
|
114
146
|
constructor(b) {
|
|
115
147
|
this.client = b;
|
|
116
148
|
}
|
|
117
|
-
async checkMembership(b, h) {
|
|
149
|
+
async checkMembership(b, h, j) {
|
|
118
150
|
try {
|
|
119
|
-
return await this.client.get(`/orgs/${b}/members/${h}
|
|
151
|
+
return await this.client.get(`/orgs/${b}/members/${h}`, j), true;
|
|
120
152
|
} catch (d) {
|
|
121
153
|
if (d instanceof Error && d.message.includes("404"))
|
|
122
154
|
return false;
|
|
@@ -126,126 +158,126 @@ class j {
|
|
|
126
158
|
}
|
|
127
159
|
|
|
128
160
|
// ../sdk/dist/api/commits.js
|
|
129
|
-
class
|
|
161
|
+
class j {
|
|
130
162
|
client;
|
|
131
163
|
constructor(b) {
|
|
132
164
|
this.client = b;
|
|
133
165
|
}
|
|
134
|
-
list(b, d) {
|
|
135
|
-
return this.client.get(`/repos/${b}/${d}/commits
|
|
166
|
+
list(b, d, f) {
|
|
167
|
+
return this.client.get(`/repos/${b}/${d}/commits`, f);
|
|
136
168
|
}
|
|
137
|
-
get(b, d, f) {
|
|
138
|
-
return this.client.get(`/repos/${b}/${d}/commits/${f}
|
|
169
|
+
get(b, d, f, g) {
|
|
170
|
+
return this.client.get(`/repos/${b}/${d}/commits/${f}`, g);
|
|
139
171
|
}
|
|
140
|
-
create(b, d, f) {
|
|
141
|
-
return this.client.post(`/repos/${b}/${d}/git/commits`, f);
|
|
172
|
+
create(b, d, f, g) {
|
|
173
|
+
return this.client.post(`/repos/${b}/${d}/git/commits`, f, g);
|
|
142
174
|
}
|
|
143
175
|
}
|
|
144
176
|
|
|
145
177
|
// ../sdk/dist/api/actions.js
|
|
146
|
-
class
|
|
178
|
+
class x {
|
|
147
179
|
client;
|
|
148
180
|
constructor(b) {
|
|
149
181
|
this.client = b;
|
|
150
182
|
}
|
|
151
|
-
listOrgRunners(b) {
|
|
152
|
-
return this.client.get(`/orgs/${b}/actions/runners
|
|
183
|
+
listOrgRunners(b, h) {
|
|
184
|
+
return this.client.get(`/orgs/${b}/actions/runners`, h);
|
|
153
185
|
}
|
|
154
|
-
createOrgRegistrationToken(b) {
|
|
155
|
-
return this.client.post(`/orgs/${b}/actions/runners/registration-token`, {});
|
|
186
|
+
createOrgRegistrationToken(b, h) {
|
|
187
|
+
return this.client.post(`/orgs/${b}/actions/runners/registration-token`, {}, h);
|
|
156
188
|
}
|
|
157
|
-
getOrgRunner(b, h) {
|
|
158
|
-
return this.client.get(`/orgs/${b}/actions/runners/${h}
|
|
189
|
+
getOrgRunner(b, h, j2) {
|
|
190
|
+
return this.client.get(`/orgs/${b}/actions/runners/${h}`, j2);
|
|
159
191
|
}
|
|
160
|
-
deleteOrgRunner(b, h) {
|
|
161
|
-
return this.client.delete(`/orgs/${b}/actions/runners/${h}
|
|
192
|
+
deleteOrgRunner(b, h, j2) {
|
|
193
|
+
return this.client.delete(`/orgs/${b}/actions/runners/${h}`, undefined, j2);
|
|
162
194
|
}
|
|
163
|
-
listRepoRunners(b, h) {
|
|
164
|
-
return this.client.get(`/repos/${b}/${h}/actions/runners
|
|
195
|
+
listRepoRunners(b, h, j2) {
|
|
196
|
+
return this.client.get(`/repos/${b}/${h}/actions/runners`, j2);
|
|
165
197
|
}
|
|
166
|
-
createRepoRegistrationToken(b, h) {
|
|
167
|
-
return this.client.post(`/repos/${b}/${h}/actions/runners/registration-token`, {});
|
|
198
|
+
createRepoRegistrationToken(b, h, j2) {
|
|
199
|
+
return this.client.post(`/repos/${b}/${h}/actions/runners/registration-token`, {}, j2);
|
|
168
200
|
}
|
|
169
|
-
getRepoRunner(b, h, j2) {
|
|
170
|
-
return this.client.get(`/repos/${b}/${h}/actions/runners/${j2}
|
|
201
|
+
getRepoRunner(b, h, j2, q) {
|
|
202
|
+
return this.client.get(`/repos/${b}/${h}/actions/runners/${j2}`, q);
|
|
171
203
|
}
|
|
172
|
-
deleteRepoRunner(b, h, j2) {
|
|
173
|
-
return this.client.delete(`/repos/${b}/${h}/actions/runners/${j2}
|
|
204
|
+
deleteRepoRunner(b, h, j2, q) {
|
|
205
|
+
return this.client.delete(`/repos/${b}/${h}/actions/runners/${j2}`, undefined, q);
|
|
174
206
|
}
|
|
175
|
-
listOrgSecrets(b) {
|
|
176
|
-
return this.client.get(`/orgs/${b}/actions/secrets
|
|
207
|
+
listOrgSecrets(b, h) {
|
|
208
|
+
return this.client.get(`/orgs/${b}/actions/secrets`, h);
|
|
177
209
|
}
|
|
178
|
-
getOrgSecret(b, h) {
|
|
179
|
-
return this.client.get(`/orgs/${b}/actions/secrets/${h}
|
|
210
|
+
getOrgSecret(b, h, j2) {
|
|
211
|
+
return this.client.get(`/orgs/${b}/actions/secrets/${h}`, j2);
|
|
180
212
|
}
|
|
181
|
-
createOrUpdateOrgSecret(b, h, j2) {
|
|
182
|
-
return this.client.put(`/orgs/${b}/actions/secrets/${h}`, j2);
|
|
213
|
+
createOrUpdateOrgSecret(b, h, j2, q) {
|
|
214
|
+
return this.client.put(`/orgs/${b}/actions/secrets/${h}`, j2, q);
|
|
183
215
|
}
|
|
184
|
-
deleteOrgSecret(b, h) {
|
|
185
|
-
return this.client.delete(`/orgs/${b}/actions/secrets/${h}
|
|
216
|
+
deleteOrgSecret(b, h, j2) {
|
|
217
|
+
return this.client.delete(`/orgs/${b}/actions/secrets/${h}`, undefined, j2);
|
|
186
218
|
}
|
|
187
|
-
listRepoSecrets(b, h) {
|
|
188
|
-
return this.client.get(`/repos/${b}/${h}/actions/secrets
|
|
219
|
+
listRepoSecrets(b, h, j2) {
|
|
220
|
+
return this.client.get(`/repos/${b}/${h}/actions/secrets`, j2);
|
|
189
221
|
}
|
|
190
|
-
getRepoSecret(b, h, j2) {
|
|
191
|
-
return this.client.get(`/repos/${b}/${h}/actions/secrets/${j2}
|
|
222
|
+
getRepoSecret(b, h, j2, q) {
|
|
223
|
+
return this.client.get(`/repos/${b}/${h}/actions/secrets/${j2}`, q);
|
|
192
224
|
}
|
|
193
|
-
createOrUpdateRepoSecret(b, h, j2, q) {
|
|
194
|
-
return this.client.put(`/repos/${b}/${h}/actions/secrets/${j2}`, q);
|
|
225
|
+
createOrUpdateRepoSecret(b, h, j2, q, v) {
|
|
226
|
+
return this.client.put(`/repos/${b}/${h}/actions/secrets/${j2}`, q, v);
|
|
195
227
|
}
|
|
196
|
-
deleteRepoSecret(b, h, j2) {
|
|
197
|
-
return this.client.delete(`/repos/${b}/${h}/actions/secrets/${j2}
|
|
228
|
+
deleteRepoSecret(b, h, j2, q) {
|
|
229
|
+
return this.client.delete(`/repos/${b}/${h}/actions/secrets/${j2}`, undefined, q);
|
|
198
230
|
}
|
|
199
|
-
listOrgVariables(b) {
|
|
200
|
-
return this.client.get(`/orgs/${b}/actions/variables
|
|
231
|
+
listOrgVariables(b, h) {
|
|
232
|
+
return this.client.get(`/orgs/${b}/actions/variables`, h);
|
|
201
233
|
}
|
|
202
|
-
createOrgVariable(b, h) {
|
|
203
|
-
return this.client.post(`/orgs/${b}/actions/variables`, h);
|
|
234
|
+
createOrgVariable(b, h, j2) {
|
|
235
|
+
return this.client.post(`/orgs/${b}/actions/variables`, h, j2);
|
|
204
236
|
}
|
|
205
|
-
getOrgVariable(b, h) {
|
|
206
|
-
return this.client.get(`/orgs/${b}/actions/variables/${h}
|
|
237
|
+
getOrgVariable(b, h, j2) {
|
|
238
|
+
return this.client.get(`/orgs/${b}/actions/variables/${h}`, j2);
|
|
207
239
|
}
|
|
208
|
-
deleteOrgVariable(b, h) {
|
|
209
|
-
return this.client.delete(`/orgs/${b}/actions/variables/${h}
|
|
240
|
+
deleteOrgVariable(b, h, j2) {
|
|
241
|
+
return this.client.delete(`/orgs/${b}/actions/variables/${h}`, undefined, j2);
|
|
210
242
|
}
|
|
211
|
-
updateOrgVariable(b, h, j2) {
|
|
212
|
-
return this.client.patch(`/orgs/${b}/actions/variables/${h}`, j2);
|
|
243
|
+
updateOrgVariable(b, h, j2, q) {
|
|
244
|
+
return this.client.patch(`/orgs/${b}/actions/variables/${h}`, j2, q);
|
|
213
245
|
}
|
|
214
|
-
listRepoVariables(b, h) {
|
|
215
|
-
return this.client.get(`/repos/${b}/${h}/actions/variables
|
|
246
|
+
listRepoVariables(b, h, j2) {
|
|
247
|
+
return this.client.get(`/repos/${b}/${h}/actions/variables`, j2);
|
|
216
248
|
}
|
|
217
|
-
createRepoVariable(b, h, j2) {
|
|
218
|
-
return this.client.post(`/repos/${b}/${h}/actions/variables`, j2);
|
|
249
|
+
createRepoVariable(b, h, j2, q) {
|
|
250
|
+
return this.client.post(`/repos/${b}/${h}/actions/variables`, j2, q);
|
|
219
251
|
}
|
|
220
|
-
getRepoVariable(b, h, j2) {
|
|
221
|
-
return this.client.get(`/repos/${b}/${h}/actions/variables/${j2}
|
|
252
|
+
getRepoVariable(b, h, j2, q) {
|
|
253
|
+
return this.client.get(`/repos/${b}/${h}/actions/variables/${j2}`, q);
|
|
222
254
|
}
|
|
223
|
-
deleteRepoVariable(b, h, j2) {
|
|
224
|
-
return this.client.delete(`/repos/${b}/${h}/actions/variables/${j2}
|
|
255
|
+
deleteRepoVariable(b, h, j2, q) {
|
|
256
|
+
return this.client.delete(`/repos/${b}/${h}/actions/variables/${j2}`, undefined, q);
|
|
225
257
|
}
|
|
226
|
-
updateRepoVariable(b, h, j2, q) {
|
|
227
|
-
return this.client.patch(`/repos/${b}/${h}/actions/variables/${j2}`, q);
|
|
258
|
+
updateRepoVariable(b, h, j2, q, v) {
|
|
259
|
+
return this.client.patch(`/repos/${b}/${h}/actions/variables/${j2}`, q, v);
|
|
228
260
|
}
|
|
229
|
-
listArtifacts(b, h) {
|
|
230
|
-
return this.client.get(`/repos/${b}/${h}/actions/artifacts
|
|
261
|
+
listArtifacts(b, h, j2) {
|
|
262
|
+
return this.client.get(`/repos/${b}/${h}/actions/artifacts`, j2);
|
|
231
263
|
}
|
|
232
|
-
getArtifact(b, h, j2) {
|
|
233
|
-
return this.client.get(`/repos/${b}/${h}/actions/artifacts/${j2}
|
|
264
|
+
getArtifact(b, h, j2, q) {
|
|
265
|
+
return this.client.get(`/repos/${b}/${h}/actions/artifacts/${j2}`, q);
|
|
234
266
|
}
|
|
235
|
-
deleteArtifact(b, h, j2) {
|
|
236
|
-
return this.client.delete(`/repos/${b}/${h}/actions/artifacts/${j2}
|
|
267
|
+
deleteArtifact(b, h, j2, q) {
|
|
268
|
+
return this.client.delete(`/repos/${b}/${h}/actions/artifacts/${j2}`, undefined, q);
|
|
237
269
|
}
|
|
238
|
-
downloadArtifact(b, h, j2) {
|
|
239
|
-
return this.client.get(`/repos/${b}/${h}/actions/artifacts/${j2}/zip
|
|
270
|
+
downloadArtifact(b, h, j2, q) {
|
|
271
|
+
return this.client.get(`/repos/${b}/${h}/actions/artifacts/${j2}/zip`, q);
|
|
240
272
|
}
|
|
241
|
-
downloadArtifactRaw(b, h, j2) {
|
|
242
|
-
return this.client.get(`/repos/${b}/${h}/actions/artifacts/${j2}/zip/raw
|
|
273
|
+
downloadArtifactRaw(b, h, j2, q) {
|
|
274
|
+
return this.client.get(`/repos/${b}/${h}/actions/artifacts/${j2}/zip/raw`, q);
|
|
243
275
|
}
|
|
244
|
-
getWorkflowDispatchInputs(b, h, j2) {
|
|
245
|
-
return this.client.get(`/repos/${b}/${h}/actions/workflows/${j2}/dispatches
|
|
276
|
+
getWorkflowDispatchInputs(b, h, j2, q) {
|
|
277
|
+
return this.client.get(`/repos/${b}/${h}/actions/workflows/${j2}/dispatches`, q);
|
|
246
278
|
}
|
|
247
|
-
dispatchWorkflow(b, h, j2, q) {
|
|
248
|
-
return this.client.post(`/repos/${b}/${h}/actions/workflows/${j2}/dispatches`, q);
|
|
279
|
+
dispatchWorkflow(b, h, j2, q, v) {
|
|
280
|
+
return this.client.post(`/repos/${b}/${h}/actions/workflows/${j2}/dispatches`, q, v);
|
|
249
281
|
}
|
|
250
282
|
}
|
|
251
283
|
|
|
@@ -259,11 +291,11 @@ class j2 extends Error {
|
|
|
259
291
|
}
|
|
260
292
|
}
|
|
261
293
|
|
|
262
|
-
class
|
|
294
|
+
class k2 extends j2 {
|
|
263
295
|
rateLimit;
|
|
264
296
|
constructor(b, f, h) {
|
|
265
297
|
super(429, b, h);
|
|
266
|
-
this.name = "RateLimitError", this.rateLimit = f, Object.setPrototypeOf(this,
|
|
298
|
+
this.name = "RateLimitError", this.rateLimit = f, Object.setPrototypeOf(this, k2.prototype);
|
|
267
299
|
}
|
|
268
300
|
getRetryAfterSeconds() {
|
|
269
301
|
return this.rateLimit.retryAfter;
|
|
@@ -289,389 +321,387 @@ class q {
|
|
|
289
321
|
}
|
|
290
322
|
|
|
291
323
|
// ../sdk/dist/api/stars.js
|
|
292
|
-
class
|
|
324
|
+
class k3 {
|
|
293
325
|
client;
|
|
294
326
|
constructor(b) {
|
|
295
327
|
this.client = b;
|
|
296
328
|
}
|
|
297
|
-
list() {
|
|
298
|
-
return this.client.get("/user/starred");
|
|
329
|
+
list(b) {
|
|
330
|
+
return this.client.get("/user/starred", b);
|
|
299
331
|
}
|
|
300
|
-
async add(b, c) {
|
|
301
|
-
await this.client.put(`/user/starred/${b}/${c}
|
|
332
|
+
async add(b, c, f) {
|
|
333
|
+
await this.client.put(`/user/starred/${b}/${c}`, undefined, f);
|
|
302
334
|
}
|
|
303
|
-
async check(b, c) {
|
|
335
|
+
async check(b, c, f) {
|
|
304
336
|
try {
|
|
305
|
-
return await this.client.get(`/user/starred/${b}/${c}
|
|
306
|
-
} catch (
|
|
307
|
-
if (
|
|
337
|
+
return await this.client.get(`/user/starred/${b}/${c}`, f), true;
|
|
338
|
+
} catch (h) {
|
|
339
|
+
if (h instanceof j2 && h.status === 404)
|
|
308
340
|
return false;
|
|
309
|
-
throw
|
|
341
|
+
throw h;
|
|
310
342
|
}
|
|
311
343
|
}
|
|
312
|
-
async remove(b, c) {
|
|
313
|
-
await this.client.delete(`/user/starred/${b}/${c}
|
|
344
|
+
async remove(b, c, f) {
|
|
345
|
+
await this.client.delete(`/user/starred/${b}/${c}`, undefined, f);
|
|
314
346
|
}
|
|
315
347
|
}
|
|
316
348
|
|
|
317
349
|
// ../sdk/dist/api/issues.js
|
|
318
|
-
class
|
|
350
|
+
class B {
|
|
319
351
|
client;
|
|
320
352
|
constructor(c) {
|
|
321
353
|
this.client = c;
|
|
322
354
|
}
|
|
323
|
-
list(c, h, f) {
|
|
324
|
-
let
|
|
355
|
+
list(c, h, f, j3) {
|
|
356
|
+
let k4 = new URLSearchParams;
|
|
325
357
|
if (f)
|
|
326
|
-
|
|
327
|
-
let
|
|
328
|
-
return this.client.get(
|
|
358
|
+
k4.append("state", f);
|
|
359
|
+
let z = k4.toString(), A = `/repos/${c}/${h}/issues${z ? `?${z}` : ""}`;
|
|
360
|
+
return this.client.get(A, j3);
|
|
329
361
|
}
|
|
330
|
-
get(c, h, f) {
|
|
331
|
-
return this.client.get(`/repos/${c}/${h}/issues/${f}
|
|
362
|
+
get(c, h, f, j3) {
|
|
363
|
+
return this.client.get(`/repos/${c}/${h}/issues/${f}`, j3);
|
|
332
364
|
}
|
|
333
|
-
getComment(c, h, f) {
|
|
334
|
-
return this.client.get(`/repos/${c}/${h}/issues/comments/${f}
|
|
365
|
+
getComment(c, h, f, j3) {
|
|
366
|
+
return this.client.get(`/repos/${c}/${h}/issues/comments/${f}`, j3);
|
|
335
367
|
}
|
|
336
|
-
getComments(c, h, f) {
|
|
337
|
-
return this.client.get(`/repos/${c}/${h}/issues/${f}/comments
|
|
368
|
+
getComments(c, h, f, j3) {
|
|
369
|
+
return this.client.get(`/repos/${c}/${h}/issues/${f}/comments`, j3);
|
|
338
370
|
}
|
|
339
|
-
getLabels(c, h, f) {
|
|
340
|
-
return this.client.get(`/repos/${c}/${h}/issues/${f}/labels
|
|
371
|
+
getLabels(c, h, f, j3) {
|
|
372
|
+
return this.client.get(`/repos/${c}/${h}/issues/${f}/labels`, j3);
|
|
341
373
|
}
|
|
342
|
-
getTimeline(c, h, f) {
|
|
343
|
-
return this.client.get(`/repos/${c}/${h}/issues/${f}/timeline
|
|
374
|
+
getTimeline(c, h, f, j3) {
|
|
375
|
+
return this.client.get(`/repos/${c}/${h}/issues/${f}/timeline`, j3);
|
|
344
376
|
}
|
|
345
377
|
}
|
|
346
378
|
|
|
347
379
|
// ../sdk/dist/api/branches.js
|
|
348
|
-
class
|
|
380
|
+
class g {
|
|
349
381
|
client;
|
|
350
382
|
constructor(b) {
|
|
351
383
|
this.client = b;
|
|
352
384
|
}
|
|
353
|
-
list(b, d) {
|
|
354
|
-
return this.client.get(`/repos/${b}/${d}/branches
|
|
385
|
+
list(b, d, f) {
|
|
386
|
+
return this.client.get(`/repos/${b}/${d}/branches`, f);
|
|
355
387
|
}
|
|
356
388
|
}
|
|
357
389
|
|
|
358
390
|
// ../sdk/dist/utils.js
|
|
359
391
|
var z = /^([a-z][a-z0-9+.-]*:\/\/[^/]+)\/([a-z][a-z0-9+.-]*:\/\/.+)$/i;
|
|
360
|
-
function E(
|
|
361
|
-
if (!
|
|
362
|
-
return
|
|
363
|
-
let
|
|
364
|
-
if (
|
|
365
|
-
let q2 =
|
|
366
|
-
if (
|
|
367
|
-
return
|
|
368
|
-
}
|
|
369
|
-
return
|
|
370
|
-
}
|
|
371
|
-
function J(
|
|
372
|
-
let
|
|
373
|
-
for (let
|
|
374
|
-
if (typeof q2[
|
|
375
|
-
q2[
|
|
392
|
+
function E(j3) {
|
|
393
|
+
if (!j3)
|
|
394
|
+
return j3;
|
|
395
|
+
let k4 = j3.match(z);
|
|
396
|
+
if (k4?.[1] && k4?.[2]) {
|
|
397
|
+
let q2 = k4[1], v = k4[2];
|
|
398
|
+
if (v.startsWith(q2))
|
|
399
|
+
return v;
|
|
400
|
+
}
|
|
401
|
+
return j3;
|
|
402
|
+
}
|
|
403
|
+
function J(j3) {
|
|
404
|
+
let k4 = ["clone_url", "html_url", "url", "git_url", "mirror_url"], q2 = { ...j3 };
|
|
405
|
+
for (let v of k4)
|
|
406
|
+
if (typeof q2[v] === "string")
|
|
407
|
+
q2[v] = E(q2[v]);
|
|
376
408
|
return q2;
|
|
377
409
|
}
|
|
378
410
|
|
|
379
411
|
// ../sdk/dist/api/repositories.js
|
|
380
|
-
class
|
|
412
|
+
class A {
|
|
381
413
|
client;
|
|
382
414
|
constructor(g2) {
|
|
383
415
|
this.client = g2;
|
|
384
416
|
}
|
|
385
|
-
async get(g2,
|
|
386
|
-
let
|
|
387
|
-
return J(
|
|
417
|
+
async get(g2, k4, j3) {
|
|
418
|
+
let q2 = await this.client.get(`/repos/${g2}/${k4}`, j3);
|
|
419
|
+
return J(q2);
|
|
388
420
|
}
|
|
389
|
-
delete(g2,
|
|
390
|
-
return this.client.delete(`/repos/${g2}/${
|
|
421
|
+
delete(g2, k4, j3) {
|
|
422
|
+
return this.client.delete(`/repos/${g2}/${k4}`, undefined, j3);
|
|
391
423
|
}
|
|
392
|
-
async update(g2,
|
|
393
|
-
let
|
|
394
|
-
return J(
|
|
424
|
+
async update(g2, k4, j3, q2) {
|
|
425
|
+
let z2 = await this.client.patch(`/repos/${g2}/${k4}`, j3, q2);
|
|
426
|
+
return J(z2);
|
|
395
427
|
}
|
|
396
|
-
compare(g2,
|
|
397
|
-
return this.client.get(`/repos/${g2}/${
|
|
428
|
+
compare(g2, k4, j3, q2) {
|
|
429
|
+
return this.client.get(`/repos/${g2}/${k4}/compare/${j3}`, q2);
|
|
398
430
|
}
|
|
399
|
-
getLanguages(g2,
|
|
400
|
-
return this.client.get(`/repos/${g2}/${
|
|
431
|
+
getLanguages(g2, k4, j3) {
|
|
432
|
+
return this.client.get(`/repos/${g2}/${k4}/languages`, j3);
|
|
401
433
|
}
|
|
402
|
-
async listForAuthenticatedUser() {
|
|
403
|
-
return (await this.client.get("/user/repos")).map((
|
|
434
|
+
async listForAuthenticatedUser(g2) {
|
|
435
|
+
return (await this.client.get("/user/repos", g2)).map((j3) => J(j3));
|
|
404
436
|
}
|
|
405
|
-
async create(g2) {
|
|
406
|
-
let
|
|
407
|
-
return J(
|
|
437
|
+
async create(g2, k4) {
|
|
438
|
+
let j3 = await this.client.post("/user/repos", g2, k4);
|
|
439
|
+
return J(j3);
|
|
408
440
|
}
|
|
409
441
|
}
|
|
410
442
|
|
|
411
443
|
// ../sdk/dist/api/collaborators.js
|
|
412
|
-
class
|
|
444
|
+
class j3 {
|
|
413
445
|
client;
|
|
414
446
|
constructor(d) {
|
|
415
447
|
this.client = d;
|
|
416
448
|
}
|
|
417
|
-
list(d,
|
|
418
|
-
return this.client.get(`/repos/${d}/${
|
|
449
|
+
list(d, f, g2) {
|
|
450
|
+
return this.client.get(`/repos/${d}/${f}/collaborators`, g2);
|
|
419
451
|
}
|
|
420
|
-
add(d,
|
|
421
|
-
return this.client.put(`/repos/${d}/${
|
|
452
|
+
add(d, f, g2, h) {
|
|
453
|
+
return this.client.put(`/repos/${d}/${f}/collaborators/${g2}`, {}, h);
|
|
422
454
|
}
|
|
423
455
|
}
|
|
424
456
|
|
|
425
457
|
// ../sdk/dist/api/contents.js
|
|
426
|
-
class
|
|
458
|
+
class k4 {
|
|
427
459
|
client;
|
|
428
460
|
constructor(b) {
|
|
429
461
|
this.client = b;
|
|
430
462
|
}
|
|
431
|
-
get(b, d,
|
|
432
|
-
return this.client.get(`/repos/${b}/${d}/contents/${
|
|
463
|
+
get(b, d, f, g2) {
|
|
464
|
+
return this.client.get(`/repos/${b}/${d}/contents/${f}`, g2);
|
|
433
465
|
}
|
|
434
|
-
createFile(b, d,
|
|
435
|
-
return this.client.put(`/repos/${b}/${d}/contents/${
|
|
466
|
+
createFile(b, d, f, g2, j4) {
|
|
467
|
+
return this.client.put(`/repos/${b}/${d}/contents/${f}`, g2, j4);
|
|
436
468
|
}
|
|
437
|
-
updateFile(b, d,
|
|
438
|
-
return this.client.put(`/repos/${b}/${d}/contents/${
|
|
469
|
+
updateFile(b, d, f, g2, j4) {
|
|
470
|
+
return this.client.put(`/repos/${b}/${d}/contents/${f}`, g2, j4);
|
|
439
471
|
}
|
|
440
|
-
deleteFile(b, d,
|
|
441
|
-
return this.client.delete(`/repos/${b}/${d}/contents/${
|
|
472
|
+
deleteFile(b, d, f, g2, j4) {
|
|
473
|
+
return this.client.delete(`/repos/${b}/${d}/contents/${f}`, g2, j4);
|
|
442
474
|
}
|
|
443
475
|
}
|
|
444
476
|
|
|
445
477
|
// ../sdk/dist/api/teams.js
|
|
446
|
-
class
|
|
478
|
+
class k5 {
|
|
447
479
|
client;
|
|
448
480
|
constructor(b) {
|
|
449
481
|
this.client = b;
|
|
450
482
|
}
|
|
451
|
-
list(b) {
|
|
452
|
-
return this.client.get(`/orgs/${b}/teams
|
|
483
|
+
list(b, d) {
|
|
484
|
+
return this.client.get(`/orgs/${b}/teams`, d);
|
|
453
485
|
}
|
|
454
|
-
getInvitations(b, d) {
|
|
455
|
-
return this.client.get(`/orgs/${b}/teams/${d}/invitations
|
|
486
|
+
getInvitations(b, d, f) {
|
|
487
|
+
return this.client.get(`/orgs/${b}/teams/${d}/invitations`, f);
|
|
456
488
|
}
|
|
457
|
-
getMembers(b, d) {
|
|
458
|
-
return this.client.get(`/orgs/${b}/teams/${d}/members
|
|
489
|
+
getMembers(b, d, f) {
|
|
490
|
+
return this.client.get(`/orgs/${b}/teams/${d}/members`, f);
|
|
459
491
|
}
|
|
460
|
-
addRepository(b, d,
|
|
461
|
-
return this.client.put(`/orgs/${b}/teams/${d}/repos/${
|
|
492
|
+
addRepository(b, d, f, h, j4) {
|
|
493
|
+
return this.client.put(`/orgs/${b}/teams/${d}/repos/${f}/${h}`, {}, j4);
|
|
462
494
|
}
|
|
463
495
|
}
|
|
464
496
|
|
|
465
497
|
// ../sdk/dist/api/git.js
|
|
466
|
-
class
|
|
498
|
+
class j4 {
|
|
467
499
|
client;
|
|
468
500
|
constructor(b) {
|
|
469
501
|
this.client = b;
|
|
470
502
|
}
|
|
471
|
-
createRef(b, d,
|
|
472
|
-
return this.client.post(`/repos/${b}/${d}/git/refs`,
|
|
503
|
+
createRef(b, d, f, g2) {
|
|
504
|
+
return this.client.post(`/repos/${b}/${d}/git/refs`, f, g2);
|
|
473
505
|
}
|
|
474
|
-
createTree(b, d,
|
|
475
|
-
return this.client.post(`/repos/${b}/${d}/git/trees`,
|
|
506
|
+
createTree(b, d, f, g2) {
|
|
507
|
+
return this.client.post(`/repos/${b}/${d}/git/trees`, f, g2);
|
|
476
508
|
}
|
|
477
|
-
getTree(b, d,
|
|
478
|
-
return this.client.get(`/repos/${b}/${d}/git/trees/${
|
|
509
|
+
getTree(b, d, f, g2) {
|
|
510
|
+
return this.client.get(`/repos/${b}/${d}/git/trees/${f}`, g2);
|
|
479
511
|
}
|
|
480
512
|
}
|
|
481
513
|
|
|
482
514
|
// ../sdk/dist/api/releases.js
|
|
483
|
-
class
|
|
515
|
+
class q2 {
|
|
484
516
|
client;
|
|
485
517
|
constructor(b) {
|
|
486
518
|
this.client = b;
|
|
487
519
|
}
|
|
488
|
-
list(b,
|
|
489
|
-
return this.client.get(`/repos/${b}/${
|
|
520
|
+
list(b, f, h) {
|
|
521
|
+
return this.client.get(`/repos/${b}/${f}/releases`, h);
|
|
490
522
|
}
|
|
491
|
-
create(b,
|
|
492
|
-
return this.client.post(`/repos/${b}/${
|
|
523
|
+
create(b, f, h, j5) {
|
|
524
|
+
return this.client.post(`/repos/${b}/${f}/releases`, h, j5);
|
|
493
525
|
}
|
|
494
|
-
getByTag(b,
|
|
495
|
-
return this.client.get(`/repos/${b}/${
|
|
526
|
+
getByTag(b, f, h, j5) {
|
|
527
|
+
return this.client.get(`/repos/${b}/${f}/releases/tags/${h}`, j5);
|
|
496
528
|
}
|
|
497
|
-
deleteByTag(b,
|
|
498
|
-
return this.client.delete(`/repos/${b}/${
|
|
529
|
+
deleteByTag(b, f, h, j5) {
|
|
530
|
+
return this.client.delete(`/repos/${b}/${f}/releases/tags/${h}`, undefined, j5);
|
|
499
531
|
}
|
|
500
|
-
get(b,
|
|
501
|
-
return this.client.get(`/repos/${b}/${
|
|
532
|
+
get(b, f, h, j5) {
|
|
533
|
+
return this.client.get(`/repos/${b}/${f}/releases/${h}`, j5);
|
|
502
534
|
}
|
|
503
|
-
delete(b,
|
|
504
|
-
return this.client.delete(`/repos/${b}/${
|
|
535
|
+
delete(b, f, h, j5) {
|
|
536
|
+
return this.client.delete(`/repos/${b}/${f}/releases/${h}`, undefined, j5);
|
|
505
537
|
}
|
|
506
|
-
update(b,
|
|
507
|
-
return this.client.patch(`/repos/${b}/${
|
|
538
|
+
update(b, f, h, j5, k6) {
|
|
539
|
+
return this.client.patch(`/repos/${b}/${f}/releases/${h}`, j5, k6);
|
|
508
540
|
}
|
|
509
|
-
getAssets(b,
|
|
510
|
-
return this.client.get(`/repos/${b}/${
|
|
541
|
+
getAssets(b, f, h, j5) {
|
|
542
|
+
return this.client.get(`/repos/${b}/${f}/releases/${h}/assets`, j5);
|
|
511
543
|
}
|
|
512
|
-
uploadAsset(b,
|
|
513
|
-
return this.client.post(`/repos/${b}/${
|
|
544
|
+
uploadAsset(b, f, h, j5, k6) {
|
|
545
|
+
return this.client.post(`/repos/${b}/${f}/releases/${h}/assets`, j5, k6);
|
|
514
546
|
}
|
|
515
|
-
deleteAsset(b,
|
|
516
|
-
return this.client.delete(`/repos/${b}/${
|
|
547
|
+
deleteAsset(b, f, h, j5, k6) {
|
|
548
|
+
return this.client.delete(`/repos/${b}/${f}/releases/${h}/assets/${j5}`, undefined, k6);
|
|
517
549
|
}
|
|
518
550
|
}
|
|
519
551
|
|
|
520
552
|
// ../sdk/dist/api/pulls.js
|
|
521
|
-
class
|
|
553
|
+
class y {
|
|
522
554
|
client;
|
|
523
555
|
constructor(d) {
|
|
524
556
|
this.client = d;
|
|
525
557
|
}
|
|
526
|
-
create(d,
|
|
527
|
-
return this.client.post(`/repos/${d}/${
|
|
558
|
+
create(d, f, g2, j5) {
|
|
559
|
+
return this.client.post(`/repos/${d}/${f}/pulls`, g2, j5);
|
|
528
560
|
}
|
|
529
|
-
get(d,
|
|
530
|
-
return this.client.get(`/repos/${d}/${
|
|
561
|
+
get(d, f, g2, j5) {
|
|
562
|
+
return this.client.get(`/repos/${d}/${f}/pulls/${g2}`, j5);
|
|
531
563
|
}
|
|
532
|
-
list(d,
|
|
533
|
-
let
|
|
534
|
-
|
|
535
|
-
k3.searchParams.set("state", f2);
|
|
536
|
-
return this.client.get(k3.href.replace("http://localhost", ""));
|
|
564
|
+
list(d, f, g2, j5) {
|
|
565
|
+
let x2 = new URLSearchParams(Object.entries(g2 ?? {})), q3 = new URL(`/repos/${d}/${f}/pulls`, "http://localhost");
|
|
566
|
+
return q3.search = x2.toString(), this.client.get(q3.href.replace("http://localhost", ""), j5);
|
|
537
567
|
}
|
|
538
|
-
update(d,
|
|
539
|
-
return this.client.patch(`/repos/${d}/${
|
|
568
|
+
update(d, f, g2, j5, k6) {
|
|
569
|
+
return this.client.patch(`/repos/${d}/${f}/pulls/${g2}`, j5, k6);
|
|
540
570
|
}
|
|
541
|
-
getFiles(d,
|
|
542
|
-
return this.client.get(`/repos/${d}/${
|
|
571
|
+
getFiles(d, f, g2, j5) {
|
|
572
|
+
return this.client.get(`/repos/${d}/${f}/pulls/${g2}/files`, j5);
|
|
543
573
|
}
|
|
544
|
-
updateBranch(d,
|
|
545
|
-
return this.client.put(`/repos/${d}/${
|
|
574
|
+
updateBranch(d, f, g2, j5) {
|
|
575
|
+
return this.client.put(`/repos/${d}/${f}/pulls/${g2}/update-branch`, {}, j5);
|
|
546
576
|
}
|
|
547
|
-
getCommits(d,
|
|
548
|
-
return this.client.get(`/repos/${d}/${
|
|
577
|
+
getCommits(d, f, g2, j5) {
|
|
578
|
+
return this.client.get(`/repos/${d}/${f}/pulls/${g2}/commits`, j5);
|
|
549
579
|
}
|
|
550
|
-
async checkIfMerged(d,
|
|
580
|
+
async checkIfMerged(d, f, g2, j5) {
|
|
551
581
|
try {
|
|
552
|
-
return await this.client.get(`/repos/${d}/${
|
|
553
|
-
} catch (
|
|
554
|
-
if (
|
|
582
|
+
return await this.client.get(`/repos/${d}/${f}/pulls/${g2}/merge`, j5), true;
|
|
583
|
+
} catch (k6) {
|
|
584
|
+
if (k6 instanceof j2 && k6.status === 404)
|
|
555
585
|
return false;
|
|
556
|
-
throw
|
|
586
|
+
throw k6;
|
|
557
587
|
}
|
|
558
588
|
}
|
|
559
589
|
}
|
|
560
590
|
|
|
561
591
|
// ../sdk/dist/api/forks.js
|
|
562
|
-
class
|
|
592
|
+
class q3 {
|
|
563
593
|
client;
|
|
564
594
|
constructor(b) {
|
|
565
595
|
this.client = b;
|
|
566
596
|
}
|
|
567
|
-
async create(b,
|
|
568
|
-
let
|
|
569
|
-
return J(
|
|
597
|
+
async create(b, g2, h, j5) {
|
|
598
|
+
let k6 = await this.client.post(`/repos/${b}/${g2}/forks`, h, j5);
|
|
599
|
+
return J(k6);
|
|
570
600
|
}
|
|
571
601
|
}
|
|
572
602
|
|
|
573
603
|
// ../sdk/dist/client.js
|
|
574
604
|
var F = { DELETE: "DELETE", GET: "GET", PATCH: "PATCH", POST: "POST", PUT: "PUT" };
|
|
575
605
|
|
|
576
|
-
class
|
|
606
|
+
class _ {
|
|
577
607
|
baseUrl;
|
|
578
608
|
token;
|
|
579
609
|
apiVersion;
|
|
580
610
|
onApiVersionWarning;
|
|
581
|
-
constructor(
|
|
582
|
-
this.baseUrl =
|
|
611
|
+
constructor(j5 = {}) {
|
|
612
|
+
this.baseUrl = j5.baseUrl || "https://api.gitverse.ru", this.token = j5.token, this.apiVersion = j5.apiVersion || "1";
|
|
583
613
|
}
|
|
584
|
-
setToken(
|
|
585
|
-
this.token =
|
|
614
|
+
setToken(j5) {
|
|
615
|
+
this.token = j5;
|
|
586
616
|
}
|
|
587
|
-
extractRateLimitInfo(
|
|
588
|
-
let
|
|
589
|
-
if (!(
|
|
617
|
+
extractRateLimitInfo(j5) {
|
|
618
|
+
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");
|
|
619
|
+
if (!(x2 && q4 && z2 && B2))
|
|
590
620
|
return;
|
|
591
|
-
return { limit: Number.parseInt(
|
|
621
|
+
return { limit: Number.parseInt(x2, 10), remaining: Number.parseInt(q4, 10), reset: Number.parseInt(B2, 10), retryAfter: Number.parseInt(z2, 10) };
|
|
592
622
|
}
|
|
593
|
-
extractApiVersionInfo(
|
|
594
|
-
let
|
|
595
|
-
if (!(
|
|
623
|
+
extractApiVersionInfo(j5) {
|
|
624
|
+
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");
|
|
625
|
+
if (!(x2 && q4))
|
|
596
626
|
return;
|
|
597
|
-
return { decommissioning:
|
|
627
|
+
return { decommissioning: B2 || undefined, deprecated: z2, latestVersion: q4, version: x2 };
|
|
598
628
|
}
|
|
599
|
-
extractMetadata(
|
|
600
|
-
let
|
|
601
|
-
if (
|
|
602
|
-
let
|
|
603
|
-
this.onApiVersionWarning(
|
|
629
|
+
extractMetadata(j5) {
|
|
630
|
+
let x2 = this.extractRateLimitInfo(j5), q4 = this.extractApiVersionInfo(j5);
|
|
631
|
+
if (q4?.deprecated && this.onApiVersionWarning) {
|
|
632
|
+
let z2 = new q(q4.version, q4.latestVersion, q4.decommissioning);
|
|
633
|
+
this.onApiVersionWarning(z2);
|
|
604
634
|
}
|
|
605
|
-
return { apiVersion:
|
|
635
|
+
return { apiVersion: q4, rateLimit: x2 };
|
|
606
636
|
}
|
|
607
|
-
async request(
|
|
608
|
-
let
|
|
637
|
+
async request(j5, x2, q4, z2) {
|
|
638
|
+
let B2 = j5.startsWith("/") ? j5.slice(1) : j5, Y = `${this.baseUrl}/${B2}`, J2 = new Headers;
|
|
609
639
|
if (J2.set("Content-Type", "application/json"), J2.set("Accept", `application/vnd.gitverse.object+json; version=${this.apiVersion}`), this.token)
|
|
610
640
|
J2.set("Authorization", `Bearer ${this.token}`);
|
|
611
|
-
let
|
|
641
|
+
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;
|
|
612
642
|
try {
|
|
613
643
|
N = await D.json();
|
|
614
644
|
} catch {
|
|
615
645
|
N = undefined;
|
|
616
646
|
}
|
|
617
647
|
if (!D.ok) {
|
|
618
|
-
let
|
|
648
|
+
let Q = N?.message || D.statusText;
|
|
619
649
|
if (D.status === 429 && K.rateLimit)
|
|
620
|
-
throw new
|
|
621
|
-
throw new j2(D.status,
|
|
650
|
+
throw new k2(Q || "Превышен лимит запросов. Попробуйте позже.", K.rateLimit, K);
|
|
651
|
+
throw new j2(D.status, Q, K);
|
|
622
652
|
}
|
|
623
653
|
return N;
|
|
624
654
|
}
|
|
625
|
-
get(
|
|
626
|
-
return this.request(
|
|
655
|
+
get(j5, x2) {
|
|
656
|
+
return this.request(j5, F.GET, undefined, x2);
|
|
627
657
|
}
|
|
628
|
-
post(
|
|
629
|
-
return this.request(
|
|
658
|
+
post(j5, x2, q4) {
|
|
659
|
+
return this.request(j5, F.POST, x2, q4);
|
|
630
660
|
}
|
|
631
|
-
put(
|
|
632
|
-
return this.request(
|
|
661
|
+
put(j5, x2, q4) {
|
|
662
|
+
return this.request(j5, F.PUT, x2, q4);
|
|
633
663
|
}
|
|
634
|
-
delete(
|
|
635
|
-
return this.request(
|
|
664
|
+
delete(j5, x2, q4) {
|
|
665
|
+
return this.request(j5, F.DELETE, x2, q4);
|
|
636
666
|
}
|
|
637
|
-
patch(
|
|
638
|
-
return this.request(
|
|
667
|
+
patch(j5, x2, q4) {
|
|
668
|
+
return this.request(j5, F.PATCH, x2, q4);
|
|
639
669
|
}
|
|
640
670
|
}
|
|
641
671
|
|
|
642
672
|
// ../sdk/dist/api/users.js
|
|
643
|
-
class
|
|
673
|
+
class f {
|
|
644
674
|
client;
|
|
645
675
|
constructor(b) {
|
|
646
676
|
this.client = b;
|
|
647
677
|
}
|
|
648
|
-
getCurrent() {
|
|
649
|
-
return this.client.get("/user");
|
|
678
|
+
getCurrent(b) {
|
|
679
|
+
return this.client.get("/user", b);
|
|
650
680
|
}
|
|
651
|
-
getByUsername(b) {
|
|
652
|
-
return this.client.get(`/users/${b}
|
|
681
|
+
getByUsername(b, d) {
|
|
682
|
+
return this.client.get(`/users/${b}`, d);
|
|
653
683
|
}
|
|
654
684
|
}
|
|
655
685
|
|
|
656
686
|
// ../sdk/dist/api/emails.js
|
|
657
|
-
class
|
|
687
|
+
class d {
|
|
658
688
|
client;
|
|
659
689
|
constructor(b) {
|
|
660
690
|
this.client = b;
|
|
661
691
|
}
|
|
662
|
-
list() {
|
|
663
|
-
return this.client.get("/user/emails");
|
|
692
|
+
list(b) {
|
|
693
|
+
return this.client.get("/user/emails", b);
|
|
664
694
|
}
|
|
665
|
-
add(b) {
|
|
666
|
-
return this.client.post("/user/emails", b);
|
|
695
|
+
add(b, c) {
|
|
696
|
+
return this.client.post("/user/emails", b, c);
|
|
667
697
|
}
|
|
668
|
-
remove(b) {
|
|
669
|
-
return this.client.delete("/user/emails", b);
|
|
698
|
+
remove(b, c) {
|
|
699
|
+
return this.client.delete("/user/emails", b, c);
|
|
670
700
|
}
|
|
671
701
|
}
|
|
672
702
|
|
|
673
703
|
// ../sdk/dist/index.js
|
|
674
|
-
class
|
|
704
|
+
class Z {
|
|
675
705
|
client;
|
|
676
706
|
users;
|
|
677
707
|
repos;
|
|
@@ -690,7 +720,7 @@ class P {
|
|
|
690
720
|
git;
|
|
691
721
|
actions;
|
|
692
722
|
constructor(d2 = {}) {
|
|
693
|
-
this.client = new
|
|
723
|
+
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);
|
|
694
724
|
}
|
|
695
725
|
setToken(d2) {
|
|
696
726
|
return this.client.setToken(d2), this;
|
|
@@ -701,24 +731,32 @@ class P {
|
|
|
701
731
|
class GitVerseReleaseClient {
|
|
702
732
|
client;
|
|
703
733
|
repoInfo;
|
|
704
|
-
|
|
705
|
-
|
|
734
|
+
retryFn;
|
|
735
|
+
constructor(token, repoInfo, retryFn) {
|
|
736
|
+
this.client = new Z({ token });
|
|
706
737
|
this.repoInfo = repoInfo;
|
|
738
|
+
this.retryFn = retryFn;
|
|
707
739
|
}
|
|
708
740
|
async createRelease(tag, name, body, options = {}) {
|
|
709
741
|
const { owner, repo } = this.repoInfo;
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
742
|
+
const createFn = async () => {
|
|
743
|
+
try {
|
|
744
|
+
await this.client.releases.create(owner, repo, {
|
|
745
|
+
body,
|
|
746
|
+
draft: options.draft,
|
|
747
|
+
name,
|
|
748
|
+
prerelease: options.prerelease,
|
|
749
|
+
tag_name: tag
|
|
750
|
+
});
|
|
751
|
+
return `${this.repoInfo.url}/releases/tag/${tag}`;
|
|
752
|
+
} catch (error) {
|
|
753
|
+
throw new Error(`Failed to create GitVerse release: ${error instanceof Error ? error.message : String(error)}`);
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
if (this.retryFn) {
|
|
757
|
+
return await this.retryFn(createFn, "Create GitVerse Release");
|
|
721
758
|
}
|
|
759
|
+
return await createFn();
|
|
722
760
|
}
|
|
723
761
|
async releaseExists(tag) {
|
|
724
762
|
const { owner, repo } = this.repoInfo;
|
|
@@ -734,12 +772,12 @@ class GitVerseReleaseClient {
|
|
|
734
772
|
return await this.client.releases.getByTag(owner, repo, tag);
|
|
735
773
|
}
|
|
736
774
|
}
|
|
737
|
-
function createGitVerseClient(repoInfo) {
|
|
775
|
+
function createGitVerseClient(repoInfo, retryFn) {
|
|
738
776
|
const token = process.env.GITVERSE_TOKEN;
|
|
739
777
|
if (!token) {
|
|
740
778
|
throw new Error("GITVERSE_TOKEN environment variable is required for creating releases");
|
|
741
779
|
}
|
|
742
|
-
return new GitVerseReleaseClient(token, repoInfo);
|
|
780
|
+
return new GitVerseReleaseClient(token, repoInfo, retryFn);
|
|
743
781
|
}
|
|
744
782
|
|
|
745
783
|
// src/utils/changelog.ts
|
|
@@ -816,7 +854,7 @@ function hasFixes(commits) {
|
|
|
816
854
|
}
|
|
817
855
|
|
|
818
856
|
// src/utils/changelog.ts
|
|
819
|
-
function generateChangelog(options, config) {
|
|
857
|
+
function generateChangelog(options, config, packageName) {
|
|
820
858
|
const { version, commits, date = new Date, repoUrl } = options;
|
|
821
859
|
const sections = [];
|
|
822
860
|
const dateStr = date.toISOString().split("T")[0];
|
|
@@ -824,17 +862,17 @@ function generateChangelog(options, config) {
|
|
|
824
862
|
sections.push("");
|
|
825
863
|
const grouped = groupCommitsByType(commits);
|
|
826
864
|
const typeOrder = ["feat", "fix", "perf", "refactor", "docs", "test", "build", "ci", "chore", "style", "revert"];
|
|
827
|
-
const breakingCommits = commits.filter((
|
|
865
|
+
const breakingCommits = commits.filter((c) => c.breaking);
|
|
828
866
|
if (breakingCommits.length > 0) {
|
|
829
867
|
sections.push("### ⚠️ BREAKING CHANGES");
|
|
830
868
|
sections.push("");
|
|
831
869
|
for (const commit of breakingCommits) {
|
|
832
|
-
sections.push(formatCommit(commit, config, repoUrl));
|
|
870
|
+
sections.push(formatCommit(commit, config, repoUrl, packageName));
|
|
833
871
|
}
|
|
834
872
|
sections.push("");
|
|
835
873
|
}
|
|
836
874
|
for (const type of typeOrder) {
|
|
837
|
-
const typeCommits = grouped[type]?.filter((
|
|
875
|
+
const typeCommits = grouped[type]?.filter((c) => !c.breaking);
|
|
838
876
|
if (!typeCommits || typeCommits.length === 0) {
|
|
839
877
|
continue;
|
|
840
878
|
}
|
|
@@ -842,17 +880,17 @@ function generateChangelog(options, config) {
|
|
|
842
880
|
sections.push(`### ${title}`);
|
|
843
881
|
sections.push("");
|
|
844
882
|
for (const commit of typeCommits) {
|
|
845
|
-
sections.push(formatCommit(commit, config, repoUrl));
|
|
883
|
+
sections.push(formatCommit(commit, config, repoUrl, packageName));
|
|
846
884
|
}
|
|
847
885
|
sections.push("");
|
|
848
886
|
}
|
|
849
887
|
return sections.join(`
|
|
850
888
|
`);
|
|
851
889
|
}
|
|
852
|
-
function formatCommit(commit, config, repoUrl) {
|
|
890
|
+
function formatCommit(commit, config, repoUrl, packageName) {
|
|
853
891
|
const parts = [];
|
|
854
892
|
let message = commit.subject;
|
|
855
|
-
if (commit.scope) {
|
|
893
|
+
if (commit.scope && commit.scope !== packageName) {
|
|
856
894
|
message = `**${commit.scope}:** ${message}`;
|
|
857
895
|
}
|
|
858
896
|
parts.push(`- ${message}`);
|
|
@@ -902,18 +940,18 @@ All notable changes to this project will be documented in this file.
|
|
|
902
940
|
await writeFile(changelogPath, lines.join(`
|
|
903
941
|
`));
|
|
904
942
|
}
|
|
905
|
-
function generateReleaseNotes(commits, config, repoUrl) {
|
|
943
|
+
function generateReleaseNotes(commits, config, repoUrl, packageName) {
|
|
906
944
|
const sections = [];
|
|
907
|
-
const breakingCommits = commits.filter((
|
|
945
|
+
const breakingCommits = commits.filter((c) => c.breaking);
|
|
908
946
|
if (breakingCommits.length > 0) {
|
|
909
947
|
sections.push("⚠️ BREAKING CHANGES");
|
|
910
948
|
sections.push("");
|
|
911
949
|
for (const commit of breakingCommits) {
|
|
912
|
-
sections.push(formatCommit(commit, config, repoUrl));
|
|
950
|
+
sections.push(formatCommit(commit, config, repoUrl, packageName));
|
|
913
951
|
}
|
|
914
952
|
sections.push("");
|
|
915
953
|
}
|
|
916
|
-
const grouped = groupCommitsByType(commits.filter((
|
|
954
|
+
const grouped = groupCommitsByType(commits.filter((c) => !c.breaking));
|
|
917
955
|
const typeOrder = ["feat", "fix", "perf", "refactor", "docs", "test", "build", "ci", "chore", "style", "revert"];
|
|
918
956
|
for (const type of typeOrder) {
|
|
919
957
|
const typeCommits = grouped[type];
|
|
@@ -924,7 +962,7 @@ function generateReleaseNotes(commits, config, repoUrl) {
|
|
|
924
962
|
sections.push(title);
|
|
925
963
|
sections.push("");
|
|
926
964
|
for (const commit of typeCommits) {
|
|
927
|
-
sections.push(formatCommit(commit, config, repoUrl));
|
|
965
|
+
sections.push(formatCommit(commit, config, repoUrl, packageName));
|
|
928
966
|
}
|
|
929
967
|
sections.push("");
|
|
930
968
|
}
|
|
@@ -936,6 +974,27 @@ function generateReleaseNotes(commits, config, repoUrl) {
|
|
|
936
974
|
import { exec } from "node:child_process";
|
|
937
975
|
import { promisify } from "node:util";
|
|
938
976
|
var execAsync = promisify(exec);
|
|
977
|
+
async function executeCommand(command) {
|
|
978
|
+
const { stdout, stderr } = await execAsync(command);
|
|
979
|
+
if (stderr && !stderr.includes("warning")) {
|
|
980
|
+
console.warn(`Command stderr: ${stderr}`);
|
|
981
|
+
}
|
|
982
|
+
return stdout.trim();
|
|
983
|
+
}
|
|
984
|
+
async function runBeforeCommitHook(command) {
|
|
985
|
+
console.log(`
|
|
986
|
+
\uD83D\uDD27 Running before-commit hook: ${command}`);
|
|
987
|
+
try {
|
|
988
|
+
await executeCommand(command);
|
|
989
|
+
console.log(`✅ Before-commit hook completed successfully
|
|
990
|
+
`);
|
|
991
|
+
return true;
|
|
992
|
+
} catch (error) {
|
|
993
|
+
console.warn(`⚠️ Before-commit hook failed: ${error instanceof Error ? error.message : String(error)}
|
|
994
|
+
`);
|
|
995
|
+
return false;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
939
998
|
var GITVERSE_URL_REGEX_1 = /gitverse\.ru[:/]([^/]+)\/([^/.]+)(\.git)?$/;
|
|
940
999
|
var GITVERSE_URL_REGEX_2 = /gitverse\.ru\/([^/]+)\/([^/.]+)(\.git)?$/;
|
|
941
1000
|
async function git(command) {
|
|
@@ -1056,7 +1115,26 @@ async function pushChanges(tag) {
|
|
|
1056
1115
|
async function isWorkingTreeClean() {
|
|
1057
1116
|
try {
|
|
1058
1117
|
const status = await git("status --porcelain");
|
|
1059
|
-
|
|
1118
|
+
if (status.length === 0) {
|
|
1119
|
+
return true;
|
|
1120
|
+
}
|
|
1121
|
+
const lines = status.split(`
|
|
1122
|
+
`).filter((line) => line.length > 0);
|
|
1123
|
+
const unstagedChanges = lines.filter((line) => {
|
|
1124
|
+
const workingTreeStatus = line[1];
|
|
1125
|
+
return workingTreeStatus !== " ";
|
|
1126
|
+
});
|
|
1127
|
+
if (unstagedChanges.length > 0) {
|
|
1128
|
+
console.log(`
|
|
1129
|
+
⚠️ Unstaged changes detected:`);
|
|
1130
|
+
for (const line of unstagedChanges) {
|
|
1131
|
+
console.log(` ${line}`);
|
|
1132
|
+
}
|
|
1133
|
+
console.log("");
|
|
1134
|
+
return false;
|
|
1135
|
+
}
|
|
1136
|
+
console.log("✓ Working tree clean (staged changes will be included in release commit)");
|
|
1137
|
+
return true;
|
|
1060
1138
|
} catch {
|
|
1061
1139
|
return false;
|
|
1062
1140
|
}
|
|
@@ -1070,12 +1148,77 @@ async function tagExists(tag) {
|
|
|
1070
1148
|
}
|
|
1071
1149
|
}
|
|
1072
1150
|
|
|
1151
|
+
// src/utils/retry.ts
|
|
1152
|
+
function sleep(ms) {
|
|
1153
|
+
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
1154
|
+
}
|
|
1155
|
+
function calculateDelay(attempt, initialDelay, maxDelay) {
|
|
1156
|
+
const delay = initialDelay * 2 ** attempt;
|
|
1157
|
+
return Math.min(delay, maxDelay);
|
|
1158
|
+
}
|
|
1159
|
+
function isRetriableError(error) {
|
|
1160
|
+
if (!(error instanceof Error)) {
|
|
1161
|
+
return false;
|
|
1162
|
+
}
|
|
1163
|
+
const message = error.message.toLowerCase();
|
|
1164
|
+
if (message.includes("network") || message.includes("timeout") || message.includes("econnreset")) {
|
|
1165
|
+
return true;
|
|
1166
|
+
}
|
|
1167
|
+
if (message.includes("500") || message.includes("502") || message.includes("503") || message.includes("504")) {
|
|
1168
|
+
return true;
|
|
1169
|
+
}
|
|
1170
|
+
if (message.includes("rate limit") || message.includes("429")) {
|
|
1171
|
+
return true;
|
|
1172
|
+
}
|
|
1173
|
+
return false;
|
|
1174
|
+
}
|
|
1175
|
+
async function retry(fn, options) {
|
|
1176
|
+
const { maxAttempts, initialDelay, maxDelay, operationName = "Operation" } = options;
|
|
1177
|
+
let lastError;
|
|
1178
|
+
for (let attempt = 0;attempt < maxAttempts; attempt++) {
|
|
1179
|
+
try {
|
|
1180
|
+
return await fn();
|
|
1181
|
+
} catch (error) {
|
|
1182
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
1183
|
+
const canRetry = isRetriableError(error);
|
|
1184
|
+
if (attempt === maxAttempts - 1 || !canRetry) {
|
|
1185
|
+
if (!canRetry && attempt < maxAttempts - 1) {
|
|
1186
|
+
console.error(`
|
|
1187
|
+
❌ ${operationName} failed with non-retriable error:`);
|
|
1188
|
+
console.error(lastError.message);
|
|
1189
|
+
}
|
|
1190
|
+
throw lastError;
|
|
1191
|
+
}
|
|
1192
|
+
const delay = calculateDelay(attempt, initialDelay, maxDelay);
|
|
1193
|
+
console.warn(`
|
|
1194
|
+
⚠️ ${operationName} failed (attempt ${attempt + 1}/${maxAttempts}):`);
|
|
1195
|
+
console.warn(` ${lastError.message}`);
|
|
1196
|
+
console.warn(` Retrying in ${delay}ms...`);
|
|
1197
|
+
await sleep(delay);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
throw lastError || new Error(`${operationName} failed after ${maxAttempts} attempts`);
|
|
1201
|
+
}
|
|
1202
|
+
function createRetryFunction(config) {
|
|
1203
|
+
return async (fn, operationName) => {
|
|
1204
|
+
if (!config.enabled) {
|
|
1205
|
+
return await fn();
|
|
1206
|
+
}
|
|
1207
|
+
return await retry(fn, {
|
|
1208
|
+
initialDelay: config.initialDelay,
|
|
1209
|
+
maxAttempts: config.maxAttempts,
|
|
1210
|
+
maxDelay: config.maxDelay,
|
|
1211
|
+
operationName
|
|
1212
|
+
});
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1073
1216
|
// src/utils/version.ts
|
|
1074
1217
|
var VERSION_REGEX = /^(\d+)\.(\d+)\.(\d+)(?:-(.+))?$/;
|
|
1075
1218
|
var PRERELEASE_INCREMENT_REGEX = /^(.+)\.(\d+)$/;
|
|
1076
1219
|
function parseVersion(version) {
|
|
1077
|
-
const
|
|
1078
|
-
const match =
|
|
1220
|
+
const v = version.startsWith("v") ? version.slice(1) : version;
|
|
1221
|
+
const match = v.match(VERSION_REGEX);
|
|
1079
1222
|
if (!(match?.[1] && match[2] && match[3])) {
|
|
1080
1223
|
throw new Error(`Invalid version format: ${version}`);
|
|
1081
1224
|
}
|
|
@@ -1241,10 +1384,11 @@ async function collectCommits(pkg, options, warnings) {
|
|
|
1241
1384
|
throw new Error(`No commits found since last release for ${pkg.packageName}`);
|
|
1242
1385
|
}
|
|
1243
1386
|
const commits = parseCommits(rawCommits);
|
|
1244
|
-
|
|
1387
|
+
const filteredCommits = commits.filter((commit) => !commit.scope || commit.scope === pkg.name);
|
|
1388
|
+
if (filteredCommits.length === 0 && !options.version) {
|
|
1245
1389
|
warnings.push("No conventional commits found, but will proceed with patch bump");
|
|
1246
1390
|
}
|
|
1247
|
-
return
|
|
1391
|
+
return filteredCommits;
|
|
1248
1392
|
}
|
|
1249
1393
|
function resolvePrereleaseTag(options, config) {
|
|
1250
1394
|
if (typeof options.prerelease === "string") {
|
|
@@ -1255,23 +1399,33 @@ function resolvePrereleaseTag(options, config) {
|
|
|
1255
1399
|
}
|
|
1256
1400
|
return;
|
|
1257
1401
|
}
|
|
1258
|
-
async function createGitVerseRelease(options, repoInfo, commits, config, pkg, versionBump, tag,
|
|
1259
|
-
if (options.noRelease) {
|
|
1402
|
+
async function createGitVerseRelease(options, repoInfo, commits, config, pkg, versionBump, tag, retryFn) {
|
|
1403
|
+
if (options.noRelease || !config.gitverse.enabled) {
|
|
1260
1404
|
return;
|
|
1261
1405
|
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
const
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1406
|
+
const gitverseClient = createGitVerseClient(repoInfo, retryFn);
|
|
1407
|
+
if (config.gitverse.checkExisting) {
|
|
1408
|
+
const exists = await gitverseClient.releaseExists(tag);
|
|
1409
|
+
if (exists) {
|
|
1410
|
+
console.log(`
|
|
1411
|
+
✅ Release ${tag} already exists, skipping creation
|
|
1412
|
+
`);
|
|
1413
|
+
return `${repoInfo.url}/releases/tag/${tag}`;
|
|
1414
|
+
}
|
|
1271
1415
|
}
|
|
1416
|
+
const releaseNotes = generateReleaseNotes(commits, config.changelog, repoInfo.url, pkg.name);
|
|
1417
|
+
return await gitverseClient.createRelease(tag, `${pkg.packageName} v${versionBump.newVersion}`, releaseNotes, {
|
|
1418
|
+
prerelease: !!options.prerelease
|
|
1419
|
+
});
|
|
1272
1420
|
}
|
|
1273
1421
|
async function performGitOperations(config, options, pkg, newVersion, tag, changelogPath) {
|
|
1274
1422
|
if (config.git.commitChanges && !options.noCommit) {
|
|
1423
|
+
if (config.git.beforeCommit) {
|
|
1424
|
+
const hookSuccess = await runBeforeCommitHook(config.git.beforeCommit);
|
|
1425
|
+
if (!hookSuccess) {
|
|
1426
|
+
console.warn("⚠️ beforeCommit hook failed, proceeding with unformatted files");
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1275
1429
|
const commitMessage = config.git.commitMessage.replace("{{package}}", pkg.name).replace("{{version}}", newVersion);
|
|
1276
1430
|
await createCommit(commitMessage, [resolve2(pkg.path, "package.json"), changelogPath]);
|
|
1277
1431
|
}
|
|
@@ -1317,15 +1471,27 @@ async function release(packageName, options = {}) {
|
|
|
1317
1471
|
date: new Date,
|
|
1318
1472
|
repoUrl: repoInfo.url,
|
|
1319
1473
|
version: versionBump.newVersion
|
|
1320
|
-
}, config.changelog);
|
|
1474
|
+
}, config.changelog, pkg.name);
|
|
1321
1475
|
if (options.dryRun) {
|
|
1322
1476
|
printDryRunInfo(pkg, currentVersion, versionBump, tag, commits, changelogEntry);
|
|
1323
1477
|
result.success = true;
|
|
1324
1478
|
return result;
|
|
1325
1479
|
}
|
|
1480
|
+
const retryFn = createRetryFunction(config.retry);
|
|
1326
1481
|
const changelogPath = await updatePackageFiles(pkg, versionBump.newVersion, changelogEntry);
|
|
1327
1482
|
await performGitOperations(config, options, pkg, versionBump.newVersion, tag, changelogPath);
|
|
1328
|
-
|
|
1483
|
+
try {
|
|
1484
|
+
result.releaseUrl = await createGitVerseRelease(options, repoInfo, commits, config, pkg, versionBump, tag, retryFn);
|
|
1485
|
+
} catch (error) {
|
|
1486
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1487
|
+
if (config.gitverse.failOnError) {
|
|
1488
|
+
throw new Error(`GitVerse release creation failed: ${errorMessage}`);
|
|
1489
|
+
}
|
|
1490
|
+
result.warnings.push(`Failed to create GitVerse release: ${errorMessage}`);
|
|
1491
|
+
console.warn(`
|
|
1492
|
+
⚠️ Warning: ${errorMessage}
|
|
1493
|
+
`);
|
|
1494
|
+
}
|
|
1329
1495
|
result.success = true;
|
|
1330
1496
|
printSuccessInfo(pkg, currentVersion, versionBump.newVersion, tag, result.releaseUrl);
|
|
1331
1497
|
return result;
|
|
@@ -1360,14 +1526,187 @@ async function resolvePackage(config, packageName) {
|
|
|
1360
1526
|
}
|
|
1361
1527
|
return pkg;
|
|
1362
1528
|
}
|
|
1529
|
+
async function createReleaseOnly(tag, packageName, configPath) {
|
|
1530
|
+
const result = {
|
|
1531
|
+
errors: [],
|
|
1532
|
+
newVersion: "",
|
|
1533
|
+
oldVersion: "",
|
|
1534
|
+
packageName: packageName || "unknown",
|
|
1535
|
+
success: false,
|
|
1536
|
+
tag,
|
|
1537
|
+
warnings: []
|
|
1538
|
+
};
|
|
1539
|
+
try {
|
|
1540
|
+
const config = await loadConfig(configPath);
|
|
1541
|
+
validateConfig(config);
|
|
1542
|
+
const repoInfo = await getRepoInfo();
|
|
1543
|
+
const pkg = await resolvePackage(config, packageName);
|
|
1544
|
+
result.packageName = pkg.packageName;
|
|
1545
|
+
const version = tag.replace(pkg.tagPrefix, "");
|
|
1546
|
+
result.newVersion = version;
|
|
1547
|
+
const rawCommits = await getCommitsSinceTag(pkg.tagPrefix, pkg.path);
|
|
1548
|
+
const commits = parseCommits(rawCommits);
|
|
1549
|
+
const retryFn = createRetryFunction(config.retry);
|
|
1550
|
+
const gitverseClient = createGitVerseClient(repoInfo, retryFn);
|
|
1551
|
+
if (config.gitverse.checkExisting) {
|
|
1552
|
+
const exists = await gitverseClient.releaseExists(tag);
|
|
1553
|
+
if (exists) {
|
|
1554
|
+
console.log(`
|
|
1555
|
+
✅ Release ${tag} already exists
|
|
1556
|
+
`);
|
|
1557
|
+
result.releaseUrl = `${repoInfo.url}/releases/tag/${tag}`;
|
|
1558
|
+
result.success = true;
|
|
1559
|
+
return result;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
const releaseNotes = generateReleaseNotes(commits, config.changelog, repoInfo.url, pkg.name);
|
|
1563
|
+
result.releaseUrl = await gitverseClient.createRelease(tag, `${pkg.packageName} v${version}`, releaseNotes);
|
|
1564
|
+
result.success = true;
|
|
1565
|
+
console.log(`
|
|
1566
|
+
✅ Release created successfully!`);
|
|
1567
|
+
console.log(`\uD83D\uDCE6 Package: ${pkg.packageName}`);
|
|
1568
|
+
console.log(`\uD83C\uDFF7️ Tag: ${tag}`);
|
|
1569
|
+
console.log(`\uD83C\uDF10 Release: ${result.releaseUrl}
|
|
1570
|
+
`);
|
|
1571
|
+
return result;
|
|
1572
|
+
} catch (error) {
|
|
1573
|
+
result.success = false;
|
|
1574
|
+
result.errors.push(error instanceof Error ? error.message : String(error));
|
|
1575
|
+
console.error(`
|
|
1576
|
+
❌ Release creation failed:
|
|
1577
|
+
`);
|
|
1578
|
+
console.error(error);
|
|
1579
|
+
console.error("");
|
|
1580
|
+
return result;
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1363
1583
|
|
|
1364
1584
|
// src/cli.ts
|
|
1365
1585
|
import { parseArgs } from "node:util";
|
|
1586
|
+
|
|
1587
|
+
// src/utils/commitlint-generator.ts
|
|
1588
|
+
import { writeFile as writeFile2 } from "node:fs/promises";
|
|
1589
|
+
async function generateCommitlint(config, options = {}) {
|
|
1590
|
+
const {
|
|
1591
|
+
output = "commitlint.config.ts",
|
|
1592
|
+
format = "ts",
|
|
1593
|
+
scopes,
|
|
1594
|
+
scopeRequired = false,
|
|
1595
|
+
headerMaxLength = 100,
|
|
1596
|
+
comments = true,
|
|
1597
|
+
dryRun = false,
|
|
1598
|
+
verbose = false
|
|
1599
|
+
} = options;
|
|
1600
|
+
const commitTypes = extractCommitTypes(config);
|
|
1601
|
+
const commitScopes = extractCommitScopes(config, scopes);
|
|
1602
|
+
const configContent = generateConfigContent(commitTypes, commitScopes, { headerMaxLength, scopeRequired }, format, comments);
|
|
1603
|
+
if (verbose) {
|
|
1604
|
+
console.log(`
|
|
1605
|
+
\uD83D\uDCCA Configuration:`);
|
|
1606
|
+
console.log(` Types: ${commitTypes.join(", ")}`);
|
|
1607
|
+
console.log(` Scopes: ${commitScopes.join(", ")}`);
|
|
1608
|
+
console.log(` Scope required: ${scopeRequired}`);
|
|
1609
|
+
console.log(` Header max length: ${headerMaxLength}`);
|
|
1610
|
+
}
|
|
1611
|
+
if (dryRun) {
|
|
1612
|
+
console.log(`
|
|
1613
|
+
\uD83D\uDD0D Dry-run mode - Preview of generated config:
|
|
1614
|
+
`);
|
|
1615
|
+
console.log(configContent);
|
|
1616
|
+
console.log(`
|
|
1617
|
+
\uD83D\uDCDD Would write to: ${output}`);
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1620
|
+
await writeFile2(output, configContent);
|
|
1621
|
+
console.log(`✅ Generated commitlint config: ${output}`);
|
|
1622
|
+
}
|
|
1623
|
+
function extractCommitTypes(config) {
|
|
1624
|
+
return Object.keys(config.changelog.types);
|
|
1625
|
+
}
|
|
1626
|
+
function extractCommitScopes(config, additionalScopes) {
|
|
1627
|
+
const scopes = [];
|
|
1628
|
+
if (config.monorepo?.enabled && config.monorepo.packages) {
|
|
1629
|
+
scopes.push(...config.monorepo.packages.map((p) => p.name));
|
|
1630
|
+
}
|
|
1631
|
+
const defaultScopes = ["deps", "ci", "docs"];
|
|
1632
|
+
scopes.push(...defaultScopes);
|
|
1633
|
+
if (additionalScopes) {
|
|
1634
|
+
scopes.push(...additionalScopes);
|
|
1635
|
+
}
|
|
1636
|
+
return [...new Set(scopes)].sort();
|
|
1637
|
+
}
|
|
1638
|
+
function generateConfigContent(types2, scopes, rules, format, comments) {
|
|
1639
|
+
if (format === "json") {
|
|
1640
|
+
return generateJSONConfig(types2, scopes, rules);
|
|
1641
|
+
}
|
|
1642
|
+
const isTS = format === "ts";
|
|
1643
|
+
const _ext = isTS ? "ts" : "js";
|
|
1644
|
+
const header = comments ? `// AUTO-GENERATED by gitverse-release
|
|
1645
|
+
// Run: gitverse-release generate-commitlint
|
|
1646
|
+
// DO NOT EDIT MANUALLY - Changes will be overwritten
|
|
1647
|
+
|
|
1648
|
+
` : "";
|
|
1649
|
+
const typeImport = isTS ? `import type { UserConfig } from "@commitlint/types";
|
|
1650
|
+
|
|
1651
|
+
` : "";
|
|
1652
|
+
const configDeclaration = isTS ? "const config: UserConfig = " : "const config = ";
|
|
1653
|
+
const typesComment = comments ? ` // Types from release config
|
|
1654
|
+
` : "";
|
|
1655
|
+
const scopesComment = comments ? ` // Scopes from release config
|
|
1656
|
+
` : "";
|
|
1657
|
+
const scopeEmptyRule = rules.scopeRequired ? ` "scope-empty": [2, "never"], // scope required
|
|
1658
|
+
` : ` "scope-empty": [0], // scope optional
|
|
1659
|
+
`;
|
|
1660
|
+
const content = `${header}${typeImport}${configDeclaration}{
|
|
1661
|
+
extends: ["@commitlint/config-conventional"],
|
|
1662
|
+
|
|
1663
|
+
rules: {
|
|
1664
|
+
${typesComment} "type-enum": [2, "always", ${JSON.stringify(types2)}],
|
|
1665
|
+
|
|
1666
|
+
${scopesComment} "scope-enum": [2, "always", ${JSON.stringify(scopes)}],
|
|
1667
|
+
${scopeEmptyRule}
|
|
1668
|
+
"subject-case": [2, "always", "lower-case"],
|
|
1669
|
+
"subject-empty": [2, "never"],
|
|
1670
|
+
"header-max-length": [2, "always", ${rules.headerMaxLength}],
|
|
1671
|
+
"body-leading-blank": [2, "always"],
|
|
1672
|
+
"footer-leading-blank": [2, "always"],
|
|
1673
|
+
},
|
|
1674
|
+
};
|
|
1675
|
+
|
|
1676
|
+
${isTS ? "export default config;" : "module.exports = config;"}
|
|
1677
|
+
`;
|
|
1678
|
+
return content;
|
|
1679
|
+
}
|
|
1680
|
+
function generateJSONConfig(types2, scopes, rules) {
|
|
1681
|
+
const config = {
|
|
1682
|
+
extends: ["@commitlint/config-conventional"],
|
|
1683
|
+
rules: {
|
|
1684
|
+
"body-leading-blank": [2, "always"],
|
|
1685
|
+
"footer-leading-blank": [2, "always"],
|
|
1686
|
+
"header-max-length": [2, "always", rules.headerMaxLength],
|
|
1687
|
+
"scope-empty": rules.scopeRequired ? [2, "never"] : [0],
|
|
1688
|
+
"scope-enum": [2, "always", scopes],
|
|
1689
|
+
"subject-case": [2, "always", "lower-case"],
|
|
1690
|
+
"subject-empty": [2, "never"],
|
|
1691
|
+
"type-enum": [2, "always", types2]
|
|
1692
|
+
}
|
|
1693
|
+
};
|
|
1694
|
+
return JSON.stringify(config, null, 2);
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
// src/cli.ts
|
|
1366
1698
|
var HELP_TEXT = `
|
|
1367
1699
|
gitverse-release - Release automation tool for GitVerse
|
|
1368
1700
|
|
|
1369
1701
|
Usage:
|
|
1370
1702
|
gitverse-release [package-name] [options]
|
|
1703
|
+
gitverse-release create-only --tag <tag> [options]
|
|
1704
|
+
gitverse-release generate-commitlint [options]
|
|
1705
|
+
|
|
1706
|
+
Commands:
|
|
1707
|
+
(default) Full release: update version, commit, tag, push, create release
|
|
1708
|
+
create-only Create only GitVerse Release for existing tag (recovery mode)
|
|
1709
|
+
generate-commitlint Generate commitlint config from release config
|
|
1371
1710
|
|
|
1372
1711
|
Options:
|
|
1373
1712
|
--dry-run Test run without making changes
|
|
@@ -1379,9 +1718,18 @@ Options:
|
|
|
1379
1718
|
--no-tag Skip creating git tag
|
|
1380
1719
|
--no-push Skip pushing to remote
|
|
1381
1720
|
--no-release Skip creating GitVerse Release
|
|
1721
|
+
--tag <tag> Tag name (for create-only command)
|
|
1382
1722
|
--verbose Verbose output
|
|
1383
1723
|
--help Show this help message
|
|
1384
1724
|
|
|
1725
|
+
Generate Commitlint Options:
|
|
1726
|
+
--output <path> Output path for commitlint config (default: commitlint.config.ts)
|
|
1727
|
+
--format <format> Output format: ts, js, json (default: ts)
|
|
1728
|
+
--scopes <scopes> Additional scopes (comma-separated)
|
|
1729
|
+
--scope-required Make scope required in commits
|
|
1730
|
+
--header-max-length <n> Maximum header length (default: 100)
|
|
1731
|
+
--no-comments Disable comments in generated config
|
|
1732
|
+
|
|
1385
1733
|
Examples:
|
|
1386
1734
|
# Auto-detect version and create release
|
|
1387
1735
|
gitverse-release sdk
|
|
@@ -1398,6 +1746,16 @@ Examples:
|
|
|
1398
1746
|
# Custom config
|
|
1399
1747
|
gitverse-release sdk --config ./my-config.json
|
|
1400
1748
|
|
|
1749
|
+
# Create only release for existing tag (recovery)
|
|
1750
|
+
gitverse-release create-only --tag v1.2.3
|
|
1751
|
+
gitverse-release create-only --tag sdk-v4.0.2 --package sdk
|
|
1752
|
+
|
|
1753
|
+
# Generate commitlint config
|
|
1754
|
+
gitverse-release generate-commitlint
|
|
1755
|
+
gitverse-release generate-commitlint --dry-run
|
|
1756
|
+
gitverse-release generate-commitlint --format js --output .commitlintrc.js
|
|
1757
|
+
gitverse-release generate-commitlint --scopes deps,ci,docs --scope-required
|
|
1758
|
+
|
|
1401
1759
|
Environment Variables:
|
|
1402
1760
|
GITVERSE_TOKEN GitVerse API token (required)
|
|
1403
1761
|
|
|
@@ -1411,13 +1769,20 @@ async function main() {
|
|
|
1411
1769
|
options: {
|
|
1412
1770
|
config: { type: "string" },
|
|
1413
1771
|
"dry-run": { type: "boolean" },
|
|
1772
|
+
format: { type: "string" },
|
|
1773
|
+
"header-max-length": { type: "string" },
|
|
1414
1774
|
help: { type: "boolean" },
|
|
1775
|
+
"no-comments": { type: "boolean" },
|
|
1415
1776
|
"no-commit": { type: "boolean" },
|
|
1416
1777
|
"no-push": { type: "boolean" },
|
|
1417
1778
|
"no-release": { type: "boolean" },
|
|
1418
1779
|
"no-tag": { type: "boolean" },
|
|
1780
|
+
output: { type: "string" },
|
|
1419
1781
|
package: { type: "string" },
|
|
1420
1782
|
prerelease: { type: "string" },
|
|
1783
|
+
"scope-required": { type: "boolean" },
|
|
1784
|
+
scopes: { type: "string" },
|
|
1785
|
+
tag: { type: "string" },
|
|
1421
1786
|
verbose: { type: "boolean" },
|
|
1422
1787
|
version: { type: "string" }
|
|
1423
1788
|
}
|
|
@@ -1426,6 +1791,49 @@ async function main() {
|
|
|
1426
1791
|
console.log(HELP_TEXT);
|
|
1427
1792
|
process.exit(0);
|
|
1428
1793
|
}
|
|
1794
|
+
const command = positionals[0];
|
|
1795
|
+
if (command === "generate-commitlint") {
|
|
1796
|
+
const config = await loadConfig(values.config);
|
|
1797
|
+
const scopesList = values.scopes ? values.scopes.split(",").map((s) => s.trim()) : config.commitlint.scopes;
|
|
1798
|
+
const headerMaxLength = values["header-max-length"] ? Number.parseInt(values["header-max-length"], 10) : config.commitlint.headerMaxLength;
|
|
1799
|
+
await generateCommitlint(config, {
|
|
1800
|
+
comments: values["no-comments"] !== undefined ? !values["no-comments"] : config.commitlint.comments,
|
|
1801
|
+
dryRun: values["dry-run"],
|
|
1802
|
+
format: values.format ?? config.commitlint.format,
|
|
1803
|
+
headerMaxLength,
|
|
1804
|
+
output: values.output ?? config.commitlint.output,
|
|
1805
|
+
scopeRequired: values["scope-required"] ?? config.commitlint.scopeRequired,
|
|
1806
|
+
scopes: scopesList,
|
|
1807
|
+
verbose: values.verbose
|
|
1808
|
+
});
|
|
1809
|
+
process.exit(0);
|
|
1810
|
+
}
|
|
1811
|
+
if (command === "create-only") {
|
|
1812
|
+
if (!values.tag) {
|
|
1813
|
+
console.error("❌ Error: --tag is required for create-only command");
|
|
1814
|
+
console.log(`
|
|
1815
|
+
Usage: gitverse-release create-only --tag <tag> [--package <name>]`);
|
|
1816
|
+
process.exit(1);
|
|
1817
|
+
}
|
|
1818
|
+
const result2 = await createReleaseOnly(values.tag, values.package, values.config);
|
|
1819
|
+
if (values.verbose) {
|
|
1820
|
+
console.log(`
|
|
1821
|
+
\uD83D\uDCCA Result:`);
|
|
1822
|
+
console.log(JSON.stringify(result2, null, 2));
|
|
1823
|
+
}
|
|
1824
|
+
if (result2.errors.length > 0) {
|
|
1825
|
+
console.error(`
|
|
1826
|
+
❌ Errors:`);
|
|
1827
|
+
for (const error of result2.errors) {
|
|
1828
|
+
console.error(` - ${error}`);
|
|
1829
|
+
}
|
|
1830
|
+
process.exit(1);
|
|
1831
|
+
}
|
|
1832
|
+
if (!result2.success) {
|
|
1833
|
+
process.exit(1);
|
|
1834
|
+
}
|
|
1835
|
+
process.exit(0);
|
|
1836
|
+
}
|
|
1429
1837
|
const options = {
|
|
1430
1838
|
config: values.config,
|
|
1431
1839
|
dryRun: values["dry-run"],
|
|
@@ -1438,7 +1846,7 @@ async function main() {
|
|
|
1438
1846
|
verbose: values.verbose,
|
|
1439
1847
|
version: values.version
|
|
1440
1848
|
};
|
|
1441
|
-
const packageName =
|
|
1849
|
+
const packageName = command || options.package;
|
|
1442
1850
|
const result = await release(packageName, options);
|
|
1443
1851
|
if (options.verbose) {
|
|
1444
1852
|
console.log(`
|
|
@@ -1473,4 +1881,4 @@ async function main() {
|
|
|
1473
1881
|
}
|
|
1474
1882
|
main();
|
|
1475
1883
|
|
|
1476
|
-
//# debugId=
|
|
1884
|
+
//# debugId=CBF028718EBEA1DE64756E2164756E21
|