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/cli.js
CHANGED
|
@@ -42,18 +42,39 @@ 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,
|
|
77
|
+
preMajorMode: "auto",
|
|
57
78
|
prereleasePrefix: "beta",
|
|
58
79
|
tagPrefix: "v"
|
|
59
80
|
}
|
|
@@ -82,14 +103,26 @@ function mergeConfig(defaults, user) {
|
|
|
82
103
|
...user.changelog?.types
|
|
83
104
|
}
|
|
84
105
|
},
|
|
106
|
+
commitlint: {
|
|
107
|
+
...defaults.commitlint,
|
|
108
|
+
...user.commitlint
|
|
109
|
+
},
|
|
85
110
|
git: {
|
|
86
111
|
...defaults.git,
|
|
87
112
|
...user.git
|
|
88
113
|
},
|
|
114
|
+
gitverse: {
|
|
115
|
+
...defaults.gitverse,
|
|
116
|
+
...user.gitverse
|
|
117
|
+
},
|
|
89
118
|
monorepo: {
|
|
90
119
|
...defaults.monorepo,
|
|
91
120
|
...user.monorepo
|
|
92
121
|
},
|
|
122
|
+
retry: {
|
|
123
|
+
...defaults.retry,
|
|
124
|
+
...user.retry
|
|
125
|
+
},
|
|
93
126
|
versioning: {
|
|
94
127
|
...defaults.versioning,
|
|
95
128
|
...user.versioning
|
|
@@ -108,14 +141,14 @@ function validateConfig(config) {
|
|
|
108
141
|
}
|
|
109
142
|
|
|
110
143
|
// ../sdk/dist/api/organizations.js
|
|
111
|
-
class
|
|
144
|
+
class k {
|
|
112
145
|
client;
|
|
113
146
|
constructor(b) {
|
|
114
147
|
this.client = b;
|
|
115
148
|
}
|
|
116
|
-
async checkMembership(b, h) {
|
|
149
|
+
async checkMembership(b, h, j) {
|
|
117
150
|
try {
|
|
118
|
-
return await this.client.get(`/orgs/${b}/members/${h}
|
|
151
|
+
return await this.client.get(`/orgs/${b}/members/${h}`, j), true;
|
|
119
152
|
} catch (d) {
|
|
120
153
|
if (d instanceof Error && d.message.includes("404"))
|
|
121
154
|
return false;
|
|
@@ -125,126 +158,126 @@ class j {
|
|
|
125
158
|
}
|
|
126
159
|
|
|
127
160
|
// ../sdk/dist/api/commits.js
|
|
128
|
-
class
|
|
161
|
+
class j {
|
|
129
162
|
client;
|
|
130
163
|
constructor(b) {
|
|
131
164
|
this.client = b;
|
|
132
165
|
}
|
|
133
|
-
list(b, d) {
|
|
134
|
-
return this.client.get(`/repos/${b}/${d}/commits
|
|
166
|
+
list(b, d, f) {
|
|
167
|
+
return this.client.get(`/repos/${b}/${d}/commits`, f);
|
|
135
168
|
}
|
|
136
|
-
get(b, d, f) {
|
|
137
|
-
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);
|
|
138
171
|
}
|
|
139
|
-
create(b, d, f) {
|
|
140
|
-
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);
|
|
141
174
|
}
|
|
142
175
|
}
|
|
143
176
|
|
|
144
177
|
// ../sdk/dist/api/actions.js
|
|
145
|
-
class
|
|
178
|
+
class x {
|
|
146
179
|
client;
|
|
147
180
|
constructor(b) {
|
|
148
181
|
this.client = b;
|
|
149
182
|
}
|
|
150
|
-
listOrgRunners(b) {
|
|
151
|
-
return this.client.get(`/orgs/${b}/actions/runners
|
|
183
|
+
listOrgRunners(b, h) {
|
|
184
|
+
return this.client.get(`/orgs/${b}/actions/runners`, h);
|
|
152
185
|
}
|
|
153
|
-
createOrgRegistrationToken(b) {
|
|
154
|
-
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);
|
|
155
188
|
}
|
|
156
|
-
getOrgRunner(b, h) {
|
|
157
|
-
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);
|
|
158
191
|
}
|
|
159
|
-
deleteOrgRunner(b, h) {
|
|
160
|
-
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);
|
|
161
194
|
}
|
|
162
|
-
listRepoRunners(b, h) {
|
|
163
|
-
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);
|
|
164
197
|
}
|
|
165
|
-
createRepoRegistrationToken(b, h) {
|
|
166
|
-
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);
|
|
167
200
|
}
|
|
168
|
-
getRepoRunner(b, h, j2) {
|
|
169
|
-
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);
|
|
170
203
|
}
|
|
171
|
-
deleteRepoRunner(b, h, j2) {
|
|
172
|
-
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);
|
|
173
206
|
}
|
|
174
|
-
listOrgSecrets(b) {
|
|
175
|
-
return this.client.get(`/orgs/${b}/actions/secrets
|
|
207
|
+
listOrgSecrets(b, h) {
|
|
208
|
+
return this.client.get(`/orgs/${b}/actions/secrets`, h);
|
|
176
209
|
}
|
|
177
|
-
getOrgSecret(b, h) {
|
|
178
|
-
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);
|
|
179
212
|
}
|
|
180
|
-
createOrUpdateOrgSecret(b, h, j2) {
|
|
181
|
-
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);
|
|
182
215
|
}
|
|
183
|
-
deleteOrgSecret(b, h) {
|
|
184
|
-
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);
|
|
185
218
|
}
|
|
186
|
-
listRepoSecrets(b, h) {
|
|
187
|
-
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);
|
|
188
221
|
}
|
|
189
|
-
getRepoSecret(b, h, j2) {
|
|
190
|
-
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);
|
|
191
224
|
}
|
|
192
|
-
createOrUpdateRepoSecret(b, h, j2, q) {
|
|
193
|
-
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);
|
|
194
227
|
}
|
|
195
|
-
deleteRepoSecret(b, h, j2) {
|
|
196
|
-
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);
|
|
197
230
|
}
|
|
198
|
-
listOrgVariables(b) {
|
|
199
|
-
return this.client.get(`/orgs/${b}/actions/variables
|
|
231
|
+
listOrgVariables(b, h) {
|
|
232
|
+
return this.client.get(`/orgs/${b}/actions/variables`, h);
|
|
200
233
|
}
|
|
201
|
-
createOrgVariable(b, h) {
|
|
202
|
-
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);
|
|
203
236
|
}
|
|
204
|
-
getOrgVariable(b, h) {
|
|
205
|
-
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);
|
|
206
239
|
}
|
|
207
|
-
deleteOrgVariable(b, h) {
|
|
208
|
-
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);
|
|
209
242
|
}
|
|
210
|
-
updateOrgVariable(b, h, j2) {
|
|
211
|
-
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);
|
|
212
245
|
}
|
|
213
|
-
listRepoVariables(b, h) {
|
|
214
|
-
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);
|
|
215
248
|
}
|
|
216
|
-
createRepoVariable(b, h, j2) {
|
|
217
|
-
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);
|
|
218
251
|
}
|
|
219
|
-
getRepoVariable(b, h, j2) {
|
|
220
|
-
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);
|
|
221
254
|
}
|
|
222
|
-
deleteRepoVariable(b, h, j2) {
|
|
223
|
-
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);
|
|
224
257
|
}
|
|
225
|
-
updateRepoVariable(b, h, j2, q) {
|
|
226
|
-
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);
|
|
227
260
|
}
|
|
228
|
-
listArtifacts(b, h) {
|
|
229
|
-
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);
|
|
230
263
|
}
|
|
231
|
-
getArtifact(b, h, j2) {
|
|
232
|
-
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);
|
|
233
266
|
}
|
|
234
|
-
deleteArtifact(b, h, j2) {
|
|
235
|
-
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);
|
|
236
269
|
}
|
|
237
|
-
downloadArtifact(b, h, j2) {
|
|
238
|
-
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);
|
|
239
272
|
}
|
|
240
|
-
downloadArtifactRaw(b, h, j2) {
|
|
241
|
-
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);
|
|
242
275
|
}
|
|
243
|
-
getWorkflowDispatchInputs(b, h, j2) {
|
|
244
|
-
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);
|
|
245
278
|
}
|
|
246
|
-
dispatchWorkflow(b, h, j2, q) {
|
|
247
|
-
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);
|
|
248
281
|
}
|
|
249
282
|
}
|
|
250
283
|
|
|
@@ -258,11 +291,11 @@ class j2 extends Error {
|
|
|
258
291
|
}
|
|
259
292
|
}
|
|
260
293
|
|
|
261
|
-
class
|
|
294
|
+
class k2 extends j2 {
|
|
262
295
|
rateLimit;
|
|
263
296
|
constructor(b, f, h) {
|
|
264
297
|
super(429, b, h);
|
|
265
|
-
this.name = "RateLimitError", this.rateLimit = f, Object.setPrototypeOf(this,
|
|
298
|
+
this.name = "RateLimitError", this.rateLimit = f, Object.setPrototypeOf(this, k2.prototype);
|
|
266
299
|
}
|
|
267
300
|
getRetryAfterSeconds() {
|
|
268
301
|
return this.rateLimit.retryAfter;
|
|
@@ -288,380 +321,387 @@ class q {
|
|
|
288
321
|
}
|
|
289
322
|
|
|
290
323
|
// ../sdk/dist/api/stars.js
|
|
291
|
-
class
|
|
324
|
+
class k3 {
|
|
292
325
|
client;
|
|
293
326
|
constructor(b) {
|
|
294
327
|
this.client = b;
|
|
295
328
|
}
|
|
296
|
-
list() {
|
|
297
|
-
return this.client.get("/user/starred");
|
|
329
|
+
list(b) {
|
|
330
|
+
return this.client.get("/user/starred", b);
|
|
298
331
|
}
|
|
299
|
-
async add(b, c) {
|
|
300
|
-
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);
|
|
301
334
|
}
|
|
302
|
-
async check(b, c) {
|
|
335
|
+
async check(b, c, f) {
|
|
303
336
|
try {
|
|
304
|
-
return await this.client.get(`/user/starred/${b}/${c}
|
|
305
|
-
} catch (
|
|
306
|
-
if (
|
|
337
|
+
return await this.client.get(`/user/starred/${b}/${c}`, f), true;
|
|
338
|
+
} catch (h) {
|
|
339
|
+
if (h instanceof j2 && h.status === 404)
|
|
307
340
|
return false;
|
|
308
|
-
throw
|
|
341
|
+
throw h;
|
|
309
342
|
}
|
|
310
343
|
}
|
|
311
|
-
async remove(b, c) {
|
|
312
|
-
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);
|
|
313
346
|
}
|
|
314
347
|
}
|
|
315
348
|
|
|
316
349
|
// ../sdk/dist/api/issues.js
|
|
317
|
-
class
|
|
350
|
+
class B {
|
|
318
351
|
client;
|
|
319
352
|
constructor(c) {
|
|
320
353
|
this.client = c;
|
|
321
354
|
}
|
|
322
|
-
list(c, h, f) {
|
|
323
|
-
let
|
|
355
|
+
list(c, h, f, j3) {
|
|
356
|
+
let k4 = new URLSearchParams;
|
|
324
357
|
if (f)
|
|
325
|
-
|
|
326
|
-
let
|
|
327
|
-
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);
|
|
328
361
|
}
|
|
329
|
-
get(c, h, f) {
|
|
330
|
-
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);
|
|
331
364
|
}
|
|
332
|
-
getComment(c, h, f) {
|
|
333
|
-
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);
|
|
334
367
|
}
|
|
335
|
-
getComments(c, h, f) {
|
|
336
|
-
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);
|
|
337
370
|
}
|
|
338
|
-
getLabels(c, h, f) {
|
|
339
|
-
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);
|
|
340
373
|
}
|
|
341
|
-
getTimeline(c, h, f) {
|
|
342
|
-
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);
|
|
343
376
|
}
|
|
344
377
|
}
|
|
345
378
|
|
|
346
379
|
// ../sdk/dist/api/branches.js
|
|
347
|
-
class
|
|
380
|
+
class g {
|
|
348
381
|
client;
|
|
349
382
|
constructor(b) {
|
|
350
383
|
this.client = b;
|
|
351
384
|
}
|
|
352
|
-
list(b, d) {
|
|
353
|
-
return this.client.get(`/repos/${b}/${d}/branches
|
|
385
|
+
list(b, d, f) {
|
|
386
|
+
return this.client.get(`/repos/${b}/${d}/branches`, f);
|
|
354
387
|
}
|
|
355
388
|
}
|
|
356
389
|
|
|
357
390
|
// ../sdk/dist/utils.js
|
|
358
391
|
var z = /^([a-z][a-z0-9+.-]*:\/\/[^/]+)\/([a-z][a-z0-9+.-]*:\/\/.+)$/i;
|
|
359
|
-
function E(
|
|
360
|
-
if (!
|
|
361
|
-
return
|
|
362
|
-
let
|
|
363
|
-
if (
|
|
364
|
-
let q2 =
|
|
365
|
-
if (
|
|
366
|
-
return
|
|
367
|
-
}
|
|
368
|
-
return
|
|
369
|
-
}
|
|
370
|
-
function J(
|
|
371
|
-
let
|
|
372
|
-
for (let
|
|
373
|
-
if (typeof q2[
|
|
374
|
-
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]);
|
|
375
408
|
return q2;
|
|
376
409
|
}
|
|
377
410
|
|
|
378
411
|
// ../sdk/dist/api/repositories.js
|
|
379
|
-
class
|
|
412
|
+
class A {
|
|
380
413
|
client;
|
|
381
414
|
constructor(g2) {
|
|
382
415
|
this.client = g2;
|
|
383
416
|
}
|
|
384
|
-
async get(g2,
|
|
385
|
-
let
|
|
386
|
-
return J(
|
|
417
|
+
async get(g2, k4, j3) {
|
|
418
|
+
let q2 = await this.client.get(`/repos/${g2}/${k4}`, j3);
|
|
419
|
+
return J(q2);
|
|
387
420
|
}
|
|
388
|
-
delete(g2,
|
|
389
|
-
return this.client.delete(`/repos/${g2}/${
|
|
421
|
+
delete(g2, k4, j3) {
|
|
422
|
+
return this.client.delete(`/repos/${g2}/${k4}`, undefined, j3);
|
|
390
423
|
}
|
|
391
|
-
async update(g2,
|
|
392
|
-
let
|
|
393
|
-
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);
|
|
394
427
|
}
|
|
395
|
-
compare(g2,
|
|
396
|
-
return this.client.get(`/repos/${g2}/${
|
|
428
|
+
compare(g2, k4, j3, q2) {
|
|
429
|
+
return this.client.get(`/repos/${g2}/${k4}/compare/${j3}`, q2);
|
|
397
430
|
}
|
|
398
|
-
getLanguages(g2,
|
|
399
|
-
return this.client.get(`/repos/${g2}/${
|
|
431
|
+
getLanguages(g2, k4, j3) {
|
|
432
|
+
return this.client.get(`/repos/${g2}/${k4}/languages`, j3);
|
|
400
433
|
}
|
|
401
|
-
async listForAuthenticatedUser() {
|
|
402
|
-
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));
|
|
403
436
|
}
|
|
404
|
-
async create(g2) {
|
|
405
|
-
let
|
|
406
|
-
return J(
|
|
437
|
+
async create(g2, k4) {
|
|
438
|
+
let j3 = await this.client.post("/user/repos", g2, k4);
|
|
439
|
+
return J(j3);
|
|
407
440
|
}
|
|
408
441
|
}
|
|
409
442
|
|
|
410
443
|
// ../sdk/dist/api/collaborators.js
|
|
411
|
-
class
|
|
444
|
+
class j3 {
|
|
412
445
|
client;
|
|
413
446
|
constructor(d) {
|
|
414
447
|
this.client = d;
|
|
415
448
|
}
|
|
416
|
-
list(d,
|
|
417
|
-
return this.client.get(`/repos/${d}/${
|
|
449
|
+
list(d, f, g2) {
|
|
450
|
+
return this.client.get(`/repos/${d}/${f}/collaborators`, g2);
|
|
418
451
|
}
|
|
419
|
-
add(d,
|
|
420
|
-
return this.client.put(`/repos/${d}/${
|
|
452
|
+
add(d, f, g2, h) {
|
|
453
|
+
return this.client.put(`/repos/${d}/${f}/collaborators/${g2}`, {}, h);
|
|
421
454
|
}
|
|
422
455
|
}
|
|
423
456
|
|
|
424
457
|
// ../sdk/dist/api/contents.js
|
|
425
|
-
class
|
|
458
|
+
class k4 {
|
|
426
459
|
client;
|
|
427
460
|
constructor(b) {
|
|
428
461
|
this.client = b;
|
|
429
462
|
}
|
|
430
|
-
get(b, d,
|
|
431
|
-
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);
|
|
432
465
|
}
|
|
433
|
-
createFile(b, d,
|
|
434
|
-
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);
|
|
435
468
|
}
|
|
436
|
-
updateFile(b, d,
|
|
437
|
-
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);
|
|
438
471
|
}
|
|
439
|
-
deleteFile(b, d,
|
|
440
|
-
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);
|
|
441
474
|
}
|
|
442
475
|
}
|
|
443
476
|
|
|
444
477
|
// ../sdk/dist/api/teams.js
|
|
445
|
-
class
|
|
478
|
+
class k5 {
|
|
446
479
|
client;
|
|
447
480
|
constructor(b) {
|
|
448
481
|
this.client = b;
|
|
449
482
|
}
|
|
450
|
-
list(b) {
|
|
451
|
-
return this.client.get(`/orgs/${b}/teams
|
|
483
|
+
list(b, d) {
|
|
484
|
+
return this.client.get(`/orgs/${b}/teams`, d);
|
|
452
485
|
}
|
|
453
|
-
getInvitations(b, d) {
|
|
454
|
-
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);
|
|
455
488
|
}
|
|
456
|
-
getMembers(b, d) {
|
|
457
|
-
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);
|
|
458
491
|
}
|
|
459
|
-
addRepository(b, d,
|
|
460
|
-
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);
|
|
461
494
|
}
|
|
462
495
|
}
|
|
463
496
|
|
|
464
497
|
// ../sdk/dist/api/git.js
|
|
465
|
-
class
|
|
498
|
+
class j4 {
|
|
466
499
|
client;
|
|
467
500
|
constructor(b) {
|
|
468
501
|
this.client = b;
|
|
469
502
|
}
|
|
470
|
-
createRef(b, d,
|
|
471
|
-
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);
|
|
472
505
|
}
|
|
473
|
-
createTree(b, d,
|
|
474
|
-
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);
|
|
475
508
|
}
|
|
476
|
-
getTree(b, d,
|
|
477
|
-
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);
|
|
478
511
|
}
|
|
479
512
|
}
|
|
480
513
|
|
|
481
514
|
// ../sdk/dist/api/releases.js
|
|
482
|
-
class
|
|
515
|
+
class q2 {
|
|
483
516
|
client;
|
|
484
517
|
constructor(b) {
|
|
485
518
|
this.client = b;
|
|
486
519
|
}
|
|
487
|
-
list(b,
|
|
488
|
-
return this.client.get(`/repos/${b}/${
|
|
520
|
+
list(b, f, h) {
|
|
521
|
+
return this.client.get(`/repos/${b}/${f}/releases`, h);
|
|
489
522
|
}
|
|
490
|
-
create(b,
|
|
491
|
-
return this.client.post(`/repos/${b}/${
|
|
523
|
+
create(b, f, h, j5) {
|
|
524
|
+
return this.client.post(`/repos/${b}/${f}/releases`, h, j5);
|
|
492
525
|
}
|
|
493
|
-
getByTag(b,
|
|
494
|
-
return this.client.get(`/repos/${b}/${
|
|
526
|
+
getByTag(b, f, h, j5) {
|
|
527
|
+
return this.client.get(`/repos/${b}/${f}/releases/tags/${h}`, j5);
|
|
495
528
|
}
|
|
496
|
-
deleteByTag(b,
|
|
497
|
-
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);
|
|
498
531
|
}
|
|
499
|
-
get(b,
|
|
500
|
-
return this.client.get(`/repos/${b}/${
|
|
532
|
+
get(b, f, h, j5) {
|
|
533
|
+
return this.client.get(`/repos/${b}/${f}/releases/${h}`, j5);
|
|
501
534
|
}
|
|
502
|
-
delete(b,
|
|
503
|
-
return this.client.delete(`/repos/${b}/${
|
|
535
|
+
delete(b, f, h, j5) {
|
|
536
|
+
return this.client.delete(`/repos/${b}/${f}/releases/${h}`, undefined, j5);
|
|
504
537
|
}
|
|
505
|
-
update(b,
|
|
506
|
-
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);
|
|
507
540
|
}
|
|
508
|
-
getAssets(b,
|
|
509
|
-
return this.client.get(`/repos/${b}/${
|
|
541
|
+
getAssets(b, f, h, j5) {
|
|
542
|
+
return this.client.get(`/repos/${b}/${f}/releases/${h}/assets`, j5);
|
|
510
543
|
}
|
|
511
|
-
uploadAsset(b,
|
|
512
|
-
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);
|
|
513
546
|
}
|
|
514
|
-
deleteAsset(b,
|
|
515
|
-
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);
|
|
516
549
|
}
|
|
517
550
|
}
|
|
518
551
|
|
|
519
552
|
// ../sdk/dist/api/pulls.js
|
|
520
|
-
class
|
|
553
|
+
class y {
|
|
521
554
|
client;
|
|
522
555
|
constructor(d) {
|
|
523
556
|
this.client = d;
|
|
524
557
|
}
|
|
525
|
-
create(d,
|
|
526
|
-
return this.client.post(`/repos/${d}/${
|
|
558
|
+
create(d, f, g2, j5) {
|
|
559
|
+
return this.client.post(`/repos/${d}/${f}/pulls`, g2, j5);
|
|
527
560
|
}
|
|
528
|
-
get(d,
|
|
529
|
-
return this.client.get(`/repos/${d}/${
|
|
561
|
+
get(d, f, g2, j5) {
|
|
562
|
+
return this.client.get(`/repos/${d}/${f}/pulls/${g2}`, j5);
|
|
530
563
|
}
|
|
531
|
-
list(d,
|
|
532
|
-
let
|
|
533
|
-
|
|
534
|
-
k3.searchParams.set("state", f2);
|
|
535
|
-
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);
|
|
536
567
|
}
|
|
537
|
-
update(d,
|
|
538
|
-
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);
|
|
539
570
|
}
|
|
540
|
-
getFiles(d,
|
|
541
|
-
return this.client.get(`/repos/${d}/${
|
|
571
|
+
getFiles(d, f, g2, j5) {
|
|
572
|
+
return this.client.get(`/repos/${d}/${f}/pulls/${g2}/files`, j5);
|
|
542
573
|
}
|
|
543
|
-
updateBranch(d,
|
|
544
|
-
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);
|
|
545
576
|
}
|
|
546
|
-
getCommits(d,
|
|
547
|
-
return this.client.get(`/repos/${d}/${
|
|
577
|
+
getCommits(d, f, g2, j5) {
|
|
578
|
+
return this.client.get(`/repos/${d}/${f}/pulls/${g2}/commits`, j5);
|
|
579
|
+
}
|
|
580
|
+
async checkIfMerged(d, f, g2, j5) {
|
|
581
|
+
try {
|
|
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)
|
|
585
|
+
return false;
|
|
586
|
+
throw k6;
|
|
587
|
+
}
|
|
548
588
|
}
|
|
549
589
|
}
|
|
550
590
|
|
|
551
591
|
// ../sdk/dist/api/forks.js
|
|
552
|
-
class
|
|
592
|
+
class q3 {
|
|
553
593
|
client;
|
|
554
594
|
constructor(b) {
|
|
555
595
|
this.client = b;
|
|
556
596
|
}
|
|
557
|
-
async create(b,
|
|
558
|
-
let
|
|
559
|
-
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);
|
|
560
600
|
}
|
|
561
601
|
}
|
|
562
602
|
|
|
563
603
|
// ../sdk/dist/client.js
|
|
564
604
|
var F = { DELETE: "DELETE", GET: "GET", PATCH: "PATCH", POST: "POST", PUT: "PUT" };
|
|
565
605
|
|
|
566
|
-
class
|
|
606
|
+
class _ {
|
|
567
607
|
baseUrl;
|
|
568
608
|
token;
|
|
569
609
|
apiVersion;
|
|
570
610
|
onApiVersionWarning;
|
|
571
|
-
constructor(
|
|
572
|
-
this.baseUrl =
|
|
611
|
+
constructor(j5 = {}) {
|
|
612
|
+
this.baseUrl = j5.baseUrl || "https://api.gitverse.ru", this.token = j5.token, this.apiVersion = j5.apiVersion || "1";
|
|
573
613
|
}
|
|
574
|
-
setToken(
|
|
575
|
-
this.token =
|
|
614
|
+
setToken(j5) {
|
|
615
|
+
this.token = j5;
|
|
576
616
|
}
|
|
577
|
-
extractRateLimitInfo(
|
|
578
|
-
let
|
|
579
|
-
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))
|
|
580
620
|
return;
|
|
581
|
-
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) };
|
|
582
622
|
}
|
|
583
|
-
extractApiVersionInfo(
|
|
584
|
-
let
|
|
585
|
-
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))
|
|
586
626
|
return;
|
|
587
|
-
return { decommissioning:
|
|
627
|
+
return { decommissioning: B2 || undefined, deprecated: z2, latestVersion: q4, version: x2 };
|
|
588
628
|
}
|
|
589
|
-
extractMetadata(
|
|
590
|
-
let
|
|
591
|
-
if (
|
|
592
|
-
let
|
|
593
|
-
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);
|
|
594
634
|
}
|
|
595
|
-
return { apiVersion:
|
|
635
|
+
return { apiVersion: q4, rateLimit: x2 };
|
|
596
636
|
}
|
|
597
|
-
async request(
|
|
598
|
-
let
|
|
637
|
+
async request(j5, x2, q4, z2) {
|
|
638
|
+
let B2 = j5.startsWith("/") ? j5.slice(1) : j5, Y = `${this.baseUrl}/${B2}`, J2 = new Headers;
|
|
599
639
|
if (J2.set("Content-Type", "application/json"), J2.set("Accept", `application/vnd.gitverse.object+json; version=${this.apiVersion}`), this.token)
|
|
600
640
|
J2.set("Authorization", `Bearer ${this.token}`);
|
|
601
|
-
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;
|
|
602
642
|
try {
|
|
603
643
|
N = await D.json();
|
|
604
644
|
} catch {
|
|
605
645
|
N = undefined;
|
|
606
646
|
}
|
|
607
647
|
if (!D.ok) {
|
|
608
|
-
let
|
|
648
|
+
let Q = N?.message || D.statusText;
|
|
609
649
|
if (D.status === 429 && K.rateLimit)
|
|
610
|
-
throw new
|
|
611
|
-
throw new j2(D.status,
|
|
650
|
+
throw new k2(Q || "Превышен лимит запросов. Попробуйте позже.", K.rateLimit, K);
|
|
651
|
+
throw new j2(D.status, Q, K);
|
|
612
652
|
}
|
|
613
653
|
return N;
|
|
614
654
|
}
|
|
615
|
-
get(
|
|
616
|
-
return this.request(
|
|
655
|
+
get(j5, x2) {
|
|
656
|
+
return this.request(j5, F.GET, undefined, x2);
|
|
617
657
|
}
|
|
618
|
-
post(
|
|
619
|
-
return this.request(
|
|
658
|
+
post(j5, x2, q4) {
|
|
659
|
+
return this.request(j5, F.POST, x2, q4);
|
|
620
660
|
}
|
|
621
|
-
put(
|
|
622
|
-
return this.request(
|
|
661
|
+
put(j5, x2, q4) {
|
|
662
|
+
return this.request(j5, F.PUT, x2, q4);
|
|
623
663
|
}
|
|
624
|
-
delete(
|
|
625
|
-
return this.request(
|
|
664
|
+
delete(j5, x2, q4) {
|
|
665
|
+
return this.request(j5, F.DELETE, x2, q4);
|
|
626
666
|
}
|
|
627
|
-
patch(
|
|
628
|
-
return this.request(
|
|
667
|
+
patch(j5, x2, q4) {
|
|
668
|
+
return this.request(j5, F.PATCH, x2, q4);
|
|
629
669
|
}
|
|
630
670
|
}
|
|
631
671
|
|
|
632
672
|
// ../sdk/dist/api/users.js
|
|
633
|
-
class
|
|
673
|
+
class f {
|
|
634
674
|
client;
|
|
635
675
|
constructor(b) {
|
|
636
676
|
this.client = b;
|
|
637
677
|
}
|
|
638
|
-
getCurrent() {
|
|
639
|
-
return this.client.get("/user");
|
|
678
|
+
getCurrent(b) {
|
|
679
|
+
return this.client.get("/user", b);
|
|
640
680
|
}
|
|
641
|
-
getByUsername(b) {
|
|
642
|
-
return this.client.get(`/users/${b}
|
|
681
|
+
getByUsername(b, d) {
|
|
682
|
+
return this.client.get(`/users/${b}`, d);
|
|
643
683
|
}
|
|
644
684
|
}
|
|
645
685
|
|
|
646
686
|
// ../sdk/dist/api/emails.js
|
|
647
|
-
class
|
|
687
|
+
class d {
|
|
648
688
|
client;
|
|
649
689
|
constructor(b) {
|
|
650
690
|
this.client = b;
|
|
651
691
|
}
|
|
652
|
-
list() {
|
|
653
|
-
return this.client.get("/user/emails");
|
|
692
|
+
list(b) {
|
|
693
|
+
return this.client.get("/user/emails", b);
|
|
654
694
|
}
|
|
655
|
-
add(b) {
|
|
656
|
-
return this.client.post("/user/emails", b);
|
|
695
|
+
add(b, c) {
|
|
696
|
+
return this.client.post("/user/emails", b, c);
|
|
657
697
|
}
|
|
658
|
-
remove(b) {
|
|
659
|
-
return this.client.delete("/user/emails", b);
|
|
698
|
+
remove(b, c) {
|
|
699
|
+
return this.client.delete("/user/emails", b, c);
|
|
660
700
|
}
|
|
661
701
|
}
|
|
662
702
|
|
|
663
703
|
// ../sdk/dist/index.js
|
|
664
|
-
class
|
|
704
|
+
class Z {
|
|
665
705
|
client;
|
|
666
706
|
users;
|
|
667
707
|
repos;
|
|
@@ -680,7 +720,7 @@ class P {
|
|
|
680
720
|
git;
|
|
681
721
|
actions;
|
|
682
722
|
constructor(d2 = {}) {
|
|
683
|
-
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);
|
|
684
724
|
}
|
|
685
725
|
setToken(d2) {
|
|
686
726
|
return this.client.setToken(d2), this;
|
|
@@ -691,24 +731,32 @@ class P {
|
|
|
691
731
|
class GitVerseReleaseClient {
|
|
692
732
|
client;
|
|
693
733
|
repoInfo;
|
|
694
|
-
|
|
695
|
-
|
|
734
|
+
retryFn;
|
|
735
|
+
constructor(token, repoInfo, retryFn) {
|
|
736
|
+
this.client = new Z({ token });
|
|
696
737
|
this.repoInfo = repoInfo;
|
|
738
|
+
this.retryFn = retryFn;
|
|
697
739
|
}
|
|
698
740
|
async createRelease(tag, name, body, options = {}) {
|
|
699
741
|
const { owner, repo } = this.repoInfo;
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
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");
|
|
711
758
|
}
|
|
759
|
+
return await createFn();
|
|
712
760
|
}
|
|
713
761
|
async releaseExists(tag) {
|
|
714
762
|
const { owner, repo } = this.repoInfo;
|
|
@@ -724,12 +772,12 @@ class GitVerseReleaseClient {
|
|
|
724
772
|
return await this.client.releases.getByTag(owner, repo, tag);
|
|
725
773
|
}
|
|
726
774
|
}
|
|
727
|
-
function createGitVerseClient(repoInfo) {
|
|
775
|
+
function createGitVerseClient(repoInfo, retryFn) {
|
|
728
776
|
const token = process.env.GITVERSE_TOKEN;
|
|
729
777
|
if (!token) {
|
|
730
778
|
throw new Error("GITVERSE_TOKEN environment variable is required for creating releases");
|
|
731
779
|
}
|
|
732
|
-
return new GitVerseReleaseClient(token, repoInfo);
|
|
780
|
+
return new GitVerseReleaseClient(token, repoInfo, retryFn);
|
|
733
781
|
}
|
|
734
782
|
|
|
735
783
|
// src/utils/changelog.ts
|
|
@@ -806,7 +854,7 @@ function hasFixes(commits) {
|
|
|
806
854
|
}
|
|
807
855
|
|
|
808
856
|
// src/utils/changelog.ts
|
|
809
|
-
function generateChangelog(options, config) {
|
|
857
|
+
function generateChangelog(options, config, packageName) {
|
|
810
858
|
const { version, commits, date = new Date, repoUrl } = options;
|
|
811
859
|
const sections = [];
|
|
812
860
|
const dateStr = date.toISOString().split("T")[0];
|
|
@@ -814,17 +862,17 @@ function generateChangelog(options, config) {
|
|
|
814
862
|
sections.push("");
|
|
815
863
|
const grouped = groupCommitsByType(commits);
|
|
816
864
|
const typeOrder = ["feat", "fix", "perf", "refactor", "docs", "test", "build", "ci", "chore", "style", "revert"];
|
|
817
|
-
const breakingCommits = commits.filter((
|
|
865
|
+
const breakingCommits = commits.filter((c) => c.breaking);
|
|
818
866
|
if (breakingCommits.length > 0) {
|
|
819
867
|
sections.push("### ⚠️ BREAKING CHANGES");
|
|
820
868
|
sections.push("");
|
|
821
869
|
for (const commit of breakingCommits) {
|
|
822
|
-
sections.push(formatCommit(commit, config, repoUrl));
|
|
870
|
+
sections.push(formatCommit(commit, config, repoUrl, packageName));
|
|
823
871
|
}
|
|
824
872
|
sections.push("");
|
|
825
873
|
}
|
|
826
874
|
for (const type of typeOrder) {
|
|
827
|
-
const typeCommits = grouped[type]?.filter((
|
|
875
|
+
const typeCommits = grouped[type]?.filter((c) => !c.breaking);
|
|
828
876
|
if (!typeCommits || typeCommits.length === 0) {
|
|
829
877
|
continue;
|
|
830
878
|
}
|
|
@@ -832,17 +880,17 @@ function generateChangelog(options, config) {
|
|
|
832
880
|
sections.push(`### ${title}`);
|
|
833
881
|
sections.push("");
|
|
834
882
|
for (const commit of typeCommits) {
|
|
835
|
-
sections.push(formatCommit(commit, config, repoUrl));
|
|
883
|
+
sections.push(formatCommit(commit, config, repoUrl, packageName));
|
|
836
884
|
}
|
|
837
885
|
sections.push("");
|
|
838
886
|
}
|
|
839
887
|
return sections.join(`
|
|
840
888
|
`);
|
|
841
889
|
}
|
|
842
|
-
function formatCommit(commit, config, repoUrl) {
|
|
890
|
+
function formatCommit(commit, config, repoUrl, packageName) {
|
|
843
891
|
const parts = [];
|
|
844
892
|
let message = commit.subject;
|
|
845
|
-
if (commit.scope) {
|
|
893
|
+
if (commit.scope && commit.scope !== packageName) {
|
|
846
894
|
message = `**${commit.scope}:** ${message}`;
|
|
847
895
|
}
|
|
848
896
|
parts.push(`- ${message}`);
|
|
@@ -892,18 +940,18 @@ All notable changes to this project will be documented in this file.
|
|
|
892
940
|
await writeFile(changelogPath, lines.join(`
|
|
893
941
|
`));
|
|
894
942
|
}
|
|
895
|
-
function generateReleaseNotes(commits, config, repoUrl) {
|
|
943
|
+
function generateReleaseNotes(commits, config, repoUrl, packageName) {
|
|
896
944
|
const sections = [];
|
|
897
|
-
const breakingCommits = commits.filter((
|
|
945
|
+
const breakingCommits = commits.filter((c) => c.breaking);
|
|
898
946
|
if (breakingCommits.length > 0) {
|
|
899
947
|
sections.push("⚠️ BREAKING CHANGES");
|
|
900
948
|
sections.push("");
|
|
901
949
|
for (const commit of breakingCommits) {
|
|
902
|
-
sections.push(formatCommit(commit, config, repoUrl));
|
|
950
|
+
sections.push(formatCommit(commit, config, repoUrl, packageName));
|
|
903
951
|
}
|
|
904
952
|
sections.push("");
|
|
905
953
|
}
|
|
906
|
-
const grouped = groupCommitsByType(commits.filter((
|
|
954
|
+
const grouped = groupCommitsByType(commits.filter((c) => !c.breaking));
|
|
907
955
|
const typeOrder = ["feat", "fix", "perf", "refactor", "docs", "test", "build", "ci", "chore", "style", "revert"];
|
|
908
956
|
for (const type of typeOrder) {
|
|
909
957
|
const typeCommits = grouped[type];
|
|
@@ -914,7 +962,7 @@ function generateReleaseNotes(commits, config, repoUrl) {
|
|
|
914
962
|
sections.push(title);
|
|
915
963
|
sections.push("");
|
|
916
964
|
for (const commit of typeCommits) {
|
|
917
|
-
sections.push(formatCommit(commit, config, repoUrl));
|
|
965
|
+
sections.push(formatCommit(commit, config, repoUrl, packageName));
|
|
918
966
|
}
|
|
919
967
|
sections.push("");
|
|
920
968
|
}
|
|
@@ -926,6 +974,27 @@ function generateReleaseNotes(commits, config, repoUrl) {
|
|
|
926
974
|
import { exec } from "node:child_process";
|
|
927
975
|
import { promisify } from "node:util";
|
|
928
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
|
+
}
|
|
929
998
|
var GITVERSE_URL_REGEX_1 = /gitverse\.ru[:/]([^/]+)\/([^/.]+)(\.git)?$/;
|
|
930
999
|
var GITVERSE_URL_REGEX_2 = /gitverse\.ru\/([^/]+)\/([^/.]+)(\.git)?$/;
|
|
931
1000
|
async function git(command) {
|
|
@@ -1046,11 +1115,36 @@ async function pushChanges(tag) {
|
|
|
1046
1115
|
async function isWorkingTreeClean() {
|
|
1047
1116
|
try {
|
|
1048
1117
|
const status = await git("status --porcelain");
|
|
1049
|
-
|
|
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;
|
|
1050
1138
|
} catch {
|
|
1051
1139
|
return false;
|
|
1052
1140
|
}
|
|
1053
1141
|
}
|
|
1142
|
+
async function addChangedFiles() {
|
|
1143
|
+
console.log("\uD83D\uDCE5 Adding changed files to staging area...");
|
|
1144
|
+
await git("add -A");
|
|
1145
|
+
console.log(`✅ Files added to staging area
|
|
1146
|
+
`);
|
|
1147
|
+
}
|
|
1054
1148
|
async function tagExists(tag) {
|
|
1055
1149
|
try {
|
|
1056
1150
|
await git(`rev-parse "${tag}"`);
|
|
@@ -1060,12 +1154,77 @@ async function tagExists(tag) {
|
|
|
1060
1154
|
}
|
|
1061
1155
|
}
|
|
1062
1156
|
|
|
1157
|
+
// src/utils/retry.ts
|
|
1158
|
+
function sleep(ms) {
|
|
1159
|
+
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
1160
|
+
}
|
|
1161
|
+
function calculateDelay(attempt, initialDelay, maxDelay) {
|
|
1162
|
+
const delay = initialDelay * 2 ** attempt;
|
|
1163
|
+
return Math.min(delay, maxDelay);
|
|
1164
|
+
}
|
|
1165
|
+
function isRetriableError(error) {
|
|
1166
|
+
if (!(error instanceof Error)) {
|
|
1167
|
+
return false;
|
|
1168
|
+
}
|
|
1169
|
+
const message = error.message.toLowerCase();
|
|
1170
|
+
if (message.includes("network") || message.includes("timeout") || message.includes("econnreset")) {
|
|
1171
|
+
return true;
|
|
1172
|
+
}
|
|
1173
|
+
if (message.includes("500") || message.includes("502") || message.includes("503") || message.includes("504")) {
|
|
1174
|
+
return true;
|
|
1175
|
+
}
|
|
1176
|
+
if (message.includes("rate limit") || message.includes("429")) {
|
|
1177
|
+
return true;
|
|
1178
|
+
}
|
|
1179
|
+
return false;
|
|
1180
|
+
}
|
|
1181
|
+
async function retry(fn, options) {
|
|
1182
|
+
const { maxAttempts, initialDelay, maxDelay, operationName = "Operation" } = options;
|
|
1183
|
+
let lastError;
|
|
1184
|
+
for (let attempt = 0;attempt < maxAttempts; attempt++) {
|
|
1185
|
+
try {
|
|
1186
|
+
return await fn();
|
|
1187
|
+
} catch (error) {
|
|
1188
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
1189
|
+
const canRetry = isRetriableError(error);
|
|
1190
|
+
if (attempt === maxAttempts - 1 || !canRetry) {
|
|
1191
|
+
if (!canRetry && attempt < maxAttempts - 1) {
|
|
1192
|
+
console.error(`
|
|
1193
|
+
❌ ${operationName} failed with non-retriable error:`);
|
|
1194
|
+
console.error(lastError.message);
|
|
1195
|
+
}
|
|
1196
|
+
throw lastError;
|
|
1197
|
+
}
|
|
1198
|
+
const delay = calculateDelay(attempt, initialDelay, maxDelay);
|
|
1199
|
+
console.warn(`
|
|
1200
|
+
⚠️ ${operationName} failed (attempt ${attempt + 1}/${maxAttempts}):`);
|
|
1201
|
+
console.warn(` ${lastError.message}`);
|
|
1202
|
+
console.warn(` Retrying in ${delay}ms...`);
|
|
1203
|
+
await sleep(delay);
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
throw lastError || new Error(`${operationName} failed after ${maxAttempts} attempts`);
|
|
1207
|
+
}
|
|
1208
|
+
function createRetryFunction(config) {
|
|
1209
|
+
return async (fn, operationName) => {
|
|
1210
|
+
if (!config.enabled) {
|
|
1211
|
+
return await fn();
|
|
1212
|
+
}
|
|
1213
|
+
return await retry(fn, {
|
|
1214
|
+
initialDelay: config.initialDelay,
|
|
1215
|
+
maxAttempts: config.maxAttempts,
|
|
1216
|
+
maxDelay: config.maxDelay,
|
|
1217
|
+
operationName
|
|
1218
|
+
});
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1063
1222
|
// src/utils/version.ts
|
|
1064
1223
|
var VERSION_REGEX = /^(\d+)\.(\d+)\.(\d+)(?:-(.+))?$/;
|
|
1065
1224
|
var PRERELEASE_INCREMENT_REGEX = /^(.+)\.(\d+)$/;
|
|
1066
1225
|
function parseVersion(version) {
|
|
1067
|
-
const
|
|
1068
|
-
const match =
|
|
1226
|
+
const v = version.startsWith("v") ? version.slice(1) : version;
|
|
1227
|
+
const match = v.match(VERSION_REGEX);
|
|
1069
1228
|
if (!(match?.[1] && match[2] && match[3])) {
|
|
1070
1229
|
throw new Error(`Invalid version format: ${version}`);
|
|
1071
1230
|
}
|
|
@@ -1083,12 +1242,34 @@ function formatVersion(ver) {
|
|
|
1083
1242
|
}
|
|
1084
1243
|
return result;
|
|
1085
1244
|
}
|
|
1086
|
-
function
|
|
1245
|
+
function shouldBumpMajor(currentVersion, mode = "auto") {
|
|
1246
|
+
if (mode === "disabled") {
|
|
1247
|
+
return true;
|
|
1248
|
+
}
|
|
1249
|
+
if (mode === "enabled") {
|
|
1250
|
+
return false;
|
|
1251
|
+
}
|
|
1252
|
+
if (!currentVersion) {
|
|
1253
|
+
return true;
|
|
1254
|
+
}
|
|
1255
|
+
const current = parseVersion(currentVersion);
|
|
1256
|
+
if (mode === "auto") {
|
|
1257
|
+
return current.major >= 1;
|
|
1258
|
+
}
|
|
1259
|
+
try {
|
|
1260
|
+
const _threshold = parseVersion(mode);
|
|
1261
|
+
return compareVersions(currentVersion, mode) >= 0;
|
|
1262
|
+
} catch {
|
|
1263
|
+
return true;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
function determineBumpType(commits, currentVersion, preMajorMode = "auto") {
|
|
1087
1267
|
if (commits.length === 0) {
|
|
1088
1268
|
return null;
|
|
1089
1269
|
}
|
|
1090
1270
|
if (hasBreakingChanges(commits)) {
|
|
1091
|
-
|
|
1271
|
+
const useMajor = shouldBumpMajor(currentVersion, preMajorMode);
|
|
1272
|
+
return useMajor ? "major" : "minor";
|
|
1092
1273
|
}
|
|
1093
1274
|
if (hasFeatures(commits)) {
|
|
1094
1275
|
return "minor";
|
|
@@ -1134,8 +1315,8 @@ function bumpVersion(currentVersion, bumpType, prereleasePrefix) {
|
|
|
1134
1315
|
}
|
|
1135
1316
|
return formatVersion(ver);
|
|
1136
1317
|
}
|
|
1137
|
-
function calculateVersionBump(currentVersion, commits, forceVersion, prerelease) {
|
|
1138
|
-
const bumpType = prerelease ? "prerelease" : determineBumpType(commits) || "patch";
|
|
1318
|
+
function calculateVersionBump(currentVersion, commits, forceVersion, prerelease, preMajorMode) {
|
|
1319
|
+
const bumpType = prerelease ? "prerelease" : determineBumpType(commits, currentVersion, preMajorMode) || "patch";
|
|
1139
1320
|
const newVersion = forceVersion || bumpVersion(currentVersion, bumpType, prerelease);
|
|
1140
1321
|
return {
|
|
1141
1322
|
bumpType,
|
|
@@ -1147,6 +1328,29 @@ function calculateVersionBump(currentVersion, commits, forceVersion, prerelease)
|
|
|
1147
1328
|
newVersion
|
|
1148
1329
|
};
|
|
1149
1330
|
}
|
|
1331
|
+
function compareVersions(a, b) {
|
|
1332
|
+
const verA = parseVersion(a);
|
|
1333
|
+
const verB = parseVersion(b);
|
|
1334
|
+
if (verA.major !== verB.major) {
|
|
1335
|
+
return verA.major > verB.major ? 1 : -1;
|
|
1336
|
+
}
|
|
1337
|
+
if (verA.minor !== verB.minor) {
|
|
1338
|
+
return verA.minor > verB.minor ? 1 : -1;
|
|
1339
|
+
}
|
|
1340
|
+
if (verA.patch !== verB.patch) {
|
|
1341
|
+
return verA.patch > verB.patch ? 1 : -1;
|
|
1342
|
+
}
|
|
1343
|
+
if (verA.prerelease && !verB.prerelease) {
|
|
1344
|
+
return -1;
|
|
1345
|
+
}
|
|
1346
|
+
if (!verA.prerelease && verB.prerelease) {
|
|
1347
|
+
return 1;
|
|
1348
|
+
}
|
|
1349
|
+
if (verA.prerelease && verB.prerelease) {
|
|
1350
|
+
return verA.prerelease.localeCompare(verB.prerelease);
|
|
1351
|
+
}
|
|
1352
|
+
return 0;
|
|
1353
|
+
}
|
|
1150
1354
|
|
|
1151
1355
|
// src/index.ts
|
|
1152
1356
|
function printDryRunInfo(pkg, currentVersion, versionBump, tag, commits, changelogEntry) {
|
|
@@ -1186,10 +1390,11 @@ async function collectCommits(pkg, options, warnings) {
|
|
|
1186
1390
|
throw new Error(`No commits found since last release for ${pkg.packageName}`);
|
|
1187
1391
|
}
|
|
1188
1392
|
const commits = parseCommits(rawCommits);
|
|
1189
|
-
|
|
1393
|
+
const filteredCommits = commits.filter((commit) => !commit.scope || commit.scope === pkg.name);
|
|
1394
|
+
if (filteredCommits.length === 0 && !options.version) {
|
|
1190
1395
|
warnings.push("No conventional commits found, but will proceed with patch bump");
|
|
1191
1396
|
}
|
|
1192
|
-
return
|
|
1397
|
+
return filteredCommits;
|
|
1193
1398
|
}
|
|
1194
1399
|
function resolvePrereleaseTag(options, config) {
|
|
1195
1400
|
if (typeof options.prerelease === "string") {
|
|
@@ -1200,20 +1405,24 @@ function resolvePrereleaseTag(options, config) {
|
|
|
1200
1405
|
}
|
|
1201
1406
|
return;
|
|
1202
1407
|
}
|
|
1203
|
-
async function createGitVerseRelease(options, repoInfo, commits, config, pkg, versionBump, tag,
|
|
1204
|
-
if (options.noRelease) {
|
|
1408
|
+
async function createGitVerseRelease(options, repoInfo, commits, config, pkg, versionBump, tag, retryFn) {
|
|
1409
|
+
if (options.noRelease || !config.gitverse.enabled) {
|
|
1205
1410
|
return;
|
|
1206
1411
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1412
|
+
const gitverseClient = createGitVerseClient(repoInfo, retryFn);
|
|
1413
|
+
if (config.gitverse.checkExisting) {
|
|
1414
|
+
const exists = await gitverseClient.releaseExists(tag);
|
|
1415
|
+
if (exists) {
|
|
1416
|
+
console.log(`
|
|
1417
|
+
✅ Release ${tag} already exists, skipping creation
|
|
1418
|
+
`);
|
|
1419
|
+
return `${repoInfo.url}/releases/tag/${tag}`;
|
|
1420
|
+
}
|
|
1216
1421
|
}
|
|
1422
|
+
const releaseNotes = generateReleaseNotes(commits, config.changelog, repoInfo.url, pkg.name);
|
|
1423
|
+
return await gitverseClient.createRelease(tag, `${pkg.packageName} v${versionBump.newVersion}`, releaseNotes, {
|
|
1424
|
+
prerelease: !!options.prerelease
|
|
1425
|
+
});
|
|
1217
1426
|
}
|
|
1218
1427
|
async function performGitOperations(config, options, pkg, newVersion, tag, changelogPath) {
|
|
1219
1428
|
if (config.git.commitChanges && !options.noCommit) {
|
|
@@ -1243,6 +1452,12 @@ async function release(packageName, options = {}) {
|
|
|
1243
1452
|
const repoInfo = await getRepoInfo();
|
|
1244
1453
|
const pkg = await resolvePackage(config, packageName);
|
|
1245
1454
|
result.packageName = pkg.packageName;
|
|
1455
|
+
if (!options.dryRun && config.git.beforeCommit) {
|
|
1456
|
+
const hookSuccess = await runBeforeCommitHook(config.git.beforeCommit);
|
|
1457
|
+
if (hookSuccess) {
|
|
1458
|
+
await addChangedFiles();
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1246
1461
|
if (!(options.dryRun || await isWorkingTreeClean())) {
|
|
1247
1462
|
throw new Error("Working tree is not clean. Please commit or stash your changes.");
|
|
1248
1463
|
}
|
|
@@ -1250,7 +1465,7 @@ async function release(packageName, options = {}) {
|
|
|
1250
1465
|
result.oldVersion = currentVersion;
|
|
1251
1466
|
const commits = await collectCommits(pkg, options, result.warnings);
|
|
1252
1467
|
const prereleaseTag = resolvePrereleaseTag(options, config);
|
|
1253
|
-
const versionBump = calculateVersionBump(currentVersion, commits, options.version, prereleaseTag);
|
|
1468
|
+
const versionBump = calculateVersionBump(currentVersion, commits, options.version, prereleaseTag, config.versioning.preMajorMode);
|
|
1254
1469
|
result.newVersion = versionBump.newVersion;
|
|
1255
1470
|
const tag = `${pkg.tagPrefix}${versionBump.newVersion}`;
|
|
1256
1471
|
result.tag = tag;
|
|
@@ -1262,15 +1477,27 @@ async function release(packageName, options = {}) {
|
|
|
1262
1477
|
date: new Date,
|
|
1263
1478
|
repoUrl: repoInfo.url,
|
|
1264
1479
|
version: versionBump.newVersion
|
|
1265
|
-
}, config.changelog);
|
|
1480
|
+
}, config.changelog, pkg.name);
|
|
1266
1481
|
if (options.dryRun) {
|
|
1267
1482
|
printDryRunInfo(pkg, currentVersion, versionBump, tag, commits, changelogEntry);
|
|
1268
1483
|
result.success = true;
|
|
1269
1484
|
return result;
|
|
1270
1485
|
}
|
|
1486
|
+
const retryFn = createRetryFunction(config.retry);
|
|
1271
1487
|
const changelogPath = await updatePackageFiles(pkg, versionBump.newVersion, changelogEntry);
|
|
1272
1488
|
await performGitOperations(config, options, pkg, versionBump.newVersion, tag, changelogPath);
|
|
1273
|
-
|
|
1489
|
+
try {
|
|
1490
|
+
result.releaseUrl = await createGitVerseRelease(options, repoInfo, commits, config, pkg, versionBump, tag, retryFn);
|
|
1491
|
+
} catch (error) {
|
|
1492
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1493
|
+
if (config.gitverse.failOnError) {
|
|
1494
|
+
throw new Error(`GitVerse release creation failed: ${errorMessage}`);
|
|
1495
|
+
}
|
|
1496
|
+
result.warnings.push(`Failed to create GitVerse release: ${errorMessage}`);
|
|
1497
|
+
console.warn(`
|
|
1498
|
+
⚠️ Warning: ${errorMessage}
|
|
1499
|
+
`);
|
|
1500
|
+
}
|
|
1274
1501
|
result.success = true;
|
|
1275
1502
|
printSuccessInfo(pkg, currentVersion, versionBump.newVersion, tag, result.releaseUrl);
|
|
1276
1503
|
return result;
|
|
@@ -1305,14 +1532,187 @@ async function resolvePackage(config, packageName) {
|
|
|
1305
1532
|
}
|
|
1306
1533
|
return pkg;
|
|
1307
1534
|
}
|
|
1535
|
+
async function createReleaseOnly(tag, packageName, configPath) {
|
|
1536
|
+
const result = {
|
|
1537
|
+
errors: [],
|
|
1538
|
+
newVersion: "",
|
|
1539
|
+
oldVersion: "",
|
|
1540
|
+
packageName: packageName || "unknown",
|
|
1541
|
+
success: false,
|
|
1542
|
+
tag,
|
|
1543
|
+
warnings: []
|
|
1544
|
+
};
|
|
1545
|
+
try {
|
|
1546
|
+
const config = await loadConfig(configPath);
|
|
1547
|
+
validateConfig(config);
|
|
1548
|
+
const repoInfo = await getRepoInfo();
|
|
1549
|
+
const pkg = await resolvePackage(config, packageName);
|
|
1550
|
+
result.packageName = pkg.packageName;
|
|
1551
|
+
const version = tag.replace(pkg.tagPrefix, "");
|
|
1552
|
+
result.newVersion = version;
|
|
1553
|
+
const rawCommits = await getCommitsSinceTag(pkg.tagPrefix, pkg.path);
|
|
1554
|
+
const commits = parseCommits(rawCommits);
|
|
1555
|
+
const retryFn = createRetryFunction(config.retry);
|
|
1556
|
+
const gitverseClient = createGitVerseClient(repoInfo, retryFn);
|
|
1557
|
+
if (config.gitverse.checkExisting) {
|
|
1558
|
+
const exists = await gitverseClient.releaseExists(tag);
|
|
1559
|
+
if (exists) {
|
|
1560
|
+
console.log(`
|
|
1561
|
+
✅ Release ${tag} already exists
|
|
1562
|
+
`);
|
|
1563
|
+
result.releaseUrl = `${repoInfo.url}/releases/tag/${tag}`;
|
|
1564
|
+
result.success = true;
|
|
1565
|
+
return result;
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
const releaseNotes = generateReleaseNotes(commits, config.changelog, repoInfo.url, pkg.name);
|
|
1569
|
+
result.releaseUrl = await gitverseClient.createRelease(tag, `${pkg.packageName} v${version}`, releaseNotes);
|
|
1570
|
+
result.success = true;
|
|
1571
|
+
console.log(`
|
|
1572
|
+
✅ Release created successfully!`);
|
|
1573
|
+
console.log(`\uD83D\uDCE6 Package: ${pkg.packageName}`);
|
|
1574
|
+
console.log(`\uD83C\uDFF7️ Tag: ${tag}`);
|
|
1575
|
+
console.log(`\uD83C\uDF10 Release: ${result.releaseUrl}
|
|
1576
|
+
`);
|
|
1577
|
+
return result;
|
|
1578
|
+
} catch (error) {
|
|
1579
|
+
result.success = false;
|
|
1580
|
+
result.errors.push(error instanceof Error ? error.message : String(error));
|
|
1581
|
+
console.error(`
|
|
1582
|
+
❌ Release creation failed:
|
|
1583
|
+
`);
|
|
1584
|
+
console.error(error);
|
|
1585
|
+
console.error("");
|
|
1586
|
+
return result;
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1308
1589
|
|
|
1309
1590
|
// src/cli.ts
|
|
1310
1591
|
import { parseArgs } from "node:util";
|
|
1592
|
+
|
|
1593
|
+
// src/utils/commitlint-generator.ts
|
|
1594
|
+
import { writeFile as writeFile2 } from "node:fs/promises";
|
|
1595
|
+
async function generateCommitlint(config, options = {}) {
|
|
1596
|
+
const {
|
|
1597
|
+
output = "commitlint.config.ts",
|
|
1598
|
+
format = "ts",
|
|
1599
|
+
scopes,
|
|
1600
|
+
scopeRequired = false,
|
|
1601
|
+
headerMaxLength = 100,
|
|
1602
|
+
comments = true,
|
|
1603
|
+
dryRun = false,
|
|
1604
|
+
verbose = false
|
|
1605
|
+
} = options;
|
|
1606
|
+
const commitTypes = extractCommitTypes(config);
|
|
1607
|
+
const commitScopes = extractCommitScopes(config, scopes);
|
|
1608
|
+
const configContent = generateConfigContent(commitTypes, commitScopes, { headerMaxLength, scopeRequired }, format, comments);
|
|
1609
|
+
if (verbose) {
|
|
1610
|
+
console.log(`
|
|
1611
|
+
\uD83D\uDCCA Configuration:`);
|
|
1612
|
+
console.log(` Types: ${commitTypes.join(", ")}`);
|
|
1613
|
+
console.log(` Scopes: ${commitScopes.join(", ")}`);
|
|
1614
|
+
console.log(` Scope required: ${scopeRequired}`);
|
|
1615
|
+
console.log(` Header max length: ${headerMaxLength}`);
|
|
1616
|
+
}
|
|
1617
|
+
if (dryRun) {
|
|
1618
|
+
console.log(`
|
|
1619
|
+
\uD83D\uDD0D Dry-run mode - Preview of generated config:
|
|
1620
|
+
`);
|
|
1621
|
+
console.log(configContent);
|
|
1622
|
+
console.log(`
|
|
1623
|
+
\uD83D\uDCDD Would write to: ${output}`);
|
|
1624
|
+
return;
|
|
1625
|
+
}
|
|
1626
|
+
await writeFile2(output, configContent);
|
|
1627
|
+
console.log(`✅ Generated commitlint config: ${output}`);
|
|
1628
|
+
}
|
|
1629
|
+
function extractCommitTypes(config) {
|
|
1630
|
+
return Object.keys(config.changelog.types);
|
|
1631
|
+
}
|
|
1632
|
+
function extractCommitScopes(config, additionalScopes) {
|
|
1633
|
+
const scopes = [];
|
|
1634
|
+
if (config.monorepo?.enabled && config.monorepo.packages) {
|
|
1635
|
+
scopes.push(...config.monorepo.packages.map((p) => p.name));
|
|
1636
|
+
}
|
|
1637
|
+
const defaultScopes = ["deps", "ci", "docs"];
|
|
1638
|
+
scopes.push(...defaultScopes);
|
|
1639
|
+
if (additionalScopes) {
|
|
1640
|
+
scopes.push(...additionalScopes);
|
|
1641
|
+
}
|
|
1642
|
+
return [...new Set(scopes)].sort();
|
|
1643
|
+
}
|
|
1644
|
+
function generateConfigContent(types2, scopes, rules, format, comments) {
|
|
1645
|
+
if (format === "json") {
|
|
1646
|
+
return generateJSONConfig(types2, scopes, rules);
|
|
1647
|
+
}
|
|
1648
|
+
const isTS = format === "ts";
|
|
1649
|
+
const _ext = isTS ? "ts" : "js";
|
|
1650
|
+
const header = comments ? `// AUTO-GENERATED by gitverse-release
|
|
1651
|
+
// Run: gitverse-release generate-commitlint
|
|
1652
|
+
// DO NOT EDIT MANUALLY - Changes will be overwritten
|
|
1653
|
+
|
|
1654
|
+
` : "";
|
|
1655
|
+
const typeImport = isTS ? `import type { UserConfig } from "@commitlint/types";
|
|
1656
|
+
|
|
1657
|
+
` : "";
|
|
1658
|
+
const configDeclaration = isTS ? "const config: UserConfig = " : "const config = ";
|
|
1659
|
+
const typesComment = comments ? ` // Types from release config
|
|
1660
|
+
` : "";
|
|
1661
|
+
const scopesComment = comments ? ` // Scopes from release config
|
|
1662
|
+
` : "";
|
|
1663
|
+
const scopeEmptyRule = rules.scopeRequired ? ` "scope-empty": [2, "never"], // scope required
|
|
1664
|
+
` : ` "scope-empty": [0], // scope optional
|
|
1665
|
+
`;
|
|
1666
|
+
const content = `${header}${typeImport}${configDeclaration}{
|
|
1667
|
+
extends: ["@commitlint/config-conventional"],
|
|
1668
|
+
|
|
1669
|
+
rules: {
|
|
1670
|
+
${typesComment} "type-enum": [2, "always", ${JSON.stringify(types2)}],
|
|
1671
|
+
|
|
1672
|
+
${scopesComment} "scope-enum": [2, "always", ${JSON.stringify(scopes)}],
|
|
1673
|
+
${scopeEmptyRule}
|
|
1674
|
+
"subject-case": [2, "always", "lower-case"],
|
|
1675
|
+
"subject-empty": [2, "never"],
|
|
1676
|
+
"header-max-length": [2, "always", ${rules.headerMaxLength}],
|
|
1677
|
+
"body-leading-blank": [2, "always"],
|
|
1678
|
+
"footer-leading-blank": [2, "always"],
|
|
1679
|
+
},
|
|
1680
|
+
};
|
|
1681
|
+
|
|
1682
|
+
${isTS ? "export default config;" : "module.exports = config;"}
|
|
1683
|
+
`;
|
|
1684
|
+
return content;
|
|
1685
|
+
}
|
|
1686
|
+
function generateJSONConfig(types2, scopes, rules) {
|
|
1687
|
+
const config = {
|
|
1688
|
+
extends: ["@commitlint/config-conventional"],
|
|
1689
|
+
rules: {
|
|
1690
|
+
"body-leading-blank": [2, "always"],
|
|
1691
|
+
"footer-leading-blank": [2, "always"],
|
|
1692
|
+
"header-max-length": [2, "always", rules.headerMaxLength],
|
|
1693
|
+
"scope-empty": rules.scopeRequired ? [2, "never"] : [0],
|
|
1694
|
+
"scope-enum": [2, "always", scopes],
|
|
1695
|
+
"subject-case": [2, "always", "lower-case"],
|
|
1696
|
+
"subject-empty": [2, "never"],
|
|
1697
|
+
"type-enum": [2, "always", types2]
|
|
1698
|
+
}
|
|
1699
|
+
};
|
|
1700
|
+
return JSON.stringify(config, null, 2);
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
// src/cli.ts
|
|
1311
1704
|
var HELP_TEXT = `
|
|
1312
1705
|
gitverse-release - Release automation tool for GitVerse
|
|
1313
1706
|
|
|
1314
1707
|
Usage:
|
|
1315
1708
|
gitverse-release [package-name] [options]
|
|
1709
|
+
gitverse-release create-only --tag <tag> [options]
|
|
1710
|
+
gitverse-release generate-commitlint [options]
|
|
1711
|
+
|
|
1712
|
+
Commands:
|
|
1713
|
+
(default) Full release: update version, commit, tag, push, create release
|
|
1714
|
+
create-only Create only GitVerse Release for existing tag (recovery mode)
|
|
1715
|
+
generate-commitlint Generate commitlint config from release config
|
|
1316
1716
|
|
|
1317
1717
|
Options:
|
|
1318
1718
|
--dry-run Test run without making changes
|
|
@@ -1324,9 +1724,18 @@ Options:
|
|
|
1324
1724
|
--no-tag Skip creating git tag
|
|
1325
1725
|
--no-push Skip pushing to remote
|
|
1326
1726
|
--no-release Skip creating GitVerse Release
|
|
1727
|
+
--tag <tag> Tag name (for create-only command)
|
|
1327
1728
|
--verbose Verbose output
|
|
1328
1729
|
--help Show this help message
|
|
1329
1730
|
|
|
1731
|
+
Generate Commitlint Options:
|
|
1732
|
+
--output <path> Output path for commitlint config (default: commitlint.config.ts)
|
|
1733
|
+
--format <format> Output format: ts, js, json (default: ts)
|
|
1734
|
+
--scopes <scopes> Additional scopes (comma-separated)
|
|
1735
|
+
--scope-required Make scope required in commits
|
|
1736
|
+
--header-max-length <n> Maximum header length (default: 100)
|
|
1737
|
+
--no-comments Disable comments in generated config
|
|
1738
|
+
|
|
1330
1739
|
Examples:
|
|
1331
1740
|
# Auto-detect version and create release
|
|
1332
1741
|
gitverse-release sdk
|
|
@@ -1343,6 +1752,16 @@ Examples:
|
|
|
1343
1752
|
# Custom config
|
|
1344
1753
|
gitverse-release sdk --config ./my-config.json
|
|
1345
1754
|
|
|
1755
|
+
# Create only release for existing tag (recovery)
|
|
1756
|
+
gitverse-release create-only --tag v1.2.3
|
|
1757
|
+
gitverse-release create-only --tag sdk-v4.0.2 --package sdk
|
|
1758
|
+
|
|
1759
|
+
# Generate commitlint config
|
|
1760
|
+
gitverse-release generate-commitlint
|
|
1761
|
+
gitverse-release generate-commitlint --dry-run
|
|
1762
|
+
gitverse-release generate-commitlint --format js --output .commitlintrc.js
|
|
1763
|
+
gitverse-release generate-commitlint --scopes deps,ci,docs --scope-required
|
|
1764
|
+
|
|
1346
1765
|
Environment Variables:
|
|
1347
1766
|
GITVERSE_TOKEN GitVerse API token (required)
|
|
1348
1767
|
|
|
@@ -1356,13 +1775,20 @@ async function main() {
|
|
|
1356
1775
|
options: {
|
|
1357
1776
|
config: { type: "string" },
|
|
1358
1777
|
"dry-run": { type: "boolean" },
|
|
1778
|
+
format: { type: "string" },
|
|
1779
|
+
"header-max-length": { type: "string" },
|
|
1359
1780
|
help: { type: "boolean" },
|
|
1781
|
+
"no-comments": { type: "boolean" },
|
|
1360
1782
|
"no-commit": { type: "boolean" },
|
|
1361
1783
|
"no-push": { type: "boolean" },
|
|
1362
1784
|
"no-release": { type: "boolean" },
|
|
1363
1785
|
"no-tag": { type: "boolean" },
|
|
1786
|
+
output: { type: "string" },
|
|
1364
1787
|
package: { type: "string" },
|
|
1365
1788
|
prerelease: { type: "string" },
|
|
1789
|
+
"scope-required": { type: "boolean" },
|
|
1790
|
+
scopes: { type: "string" },
|
|
1791
|
+
tag: { type: "string" },
|
|
1366
1792
|
verbose: { type: "boolean" },
|
|
1367
1793
|
version: { type: "string" }
|
|
1368
1794
|
}
|
|
@@ -1371,6 +1797,49 @@ async function main() {
|
|
|
1371
1797
|
console.log(HELP_TEXT);
|
|
1372
1798
|
process.exit(0);
|
|
1373
1799
|
}
|
|
1800
|
+
const command = positionals[0];
|
|
1801
|
+
if (command === "generate-commitlint") {
|
|
1802
|
+
const config = await loadConfig(values.config);
|
|
1803
|
+
const scopesList = values.scopes ? values.scopes.split(",").map((s) => s.trim()) : config.commitlint.scopes;
|
|
1804
|
+
const headerMaxLength = values["header-max-length"] ? Number.parseInt(values["header-max-length"], 10) : config.commitlint.headerMaxLength;
|
|
1805
|
+
await generateCommitlint(config, {
|
|
1806
|
+
comments: values["no-comments"] !== undefined ? !values["no-comments"] : config.commitlint.comments,
|
|
1807
|
+
dryRun: values["dry-run"],
|
|
1808
|
+
format: values.format ?? config.commitlint.format,
|
|
1809
|
+
headerMaxLength,
|
|
1810
|
+
output: values.output ?? config.commitlint.output,
|
|
1811
|
+
scopeRequired: values["scope-required"] ?? config.commitlint.scopeRequired,
|
|
1812
|
+
scopes: scopesList,
|
|
1813
|
+
verbose: values.verbose
|
|
1814
|
+
});
|
|
1815
|
+
process.exit(0);
|
|
1816
|
+
}
|
|
1817
|
+
if (command === "create-only") {
|
|
1818
|
+
if (!values.tag) {
|
|
1819
|
+
console.error("❌ Error: --tag is required for create-only command");
|
|
1820
|
+
console.log(`
|
|
1821
|
+
Usage: gitverse-release create-only --tag <tag> [--package <name>]`);
|
|
1822
|
+
process.exit(1);
|
|
1823
|
+
}
|
|
1824
|
+
const result2 = await createReleaseOnly(values.tag, values.package, values.config);
|
|
1825
|
+
if (values.verbose) {
|
|
1826
|
+
console.log(`
|
|
1827
|
+
\uD83D\uDCCA Result:`);
|
|
1828
|
+
console.log(JSON.stringify(result2, null, 2));
|
|
1829
|
+
}
|
|
1830
|
+
if (result2.errors.length > 0) {
|
|
1831
|
+
console.error(`
|
|
1832
|
+
❌ Errors:`);
|
|
1833
|
+
for (const error of result2.errors) {
|
|
1834
|
+
console.error(` - ${error}`);
|
|
1835
|
+
}
|
|
1836
|
+
process.exit(1);
|
|
1837
|
+
}
|
|
1838
|
+
if (!result2.success) {
|
|
1839
|
+
process.exit(1);
|
|
1840
|
+
}
|
|
1841
|
+
process.exit(0);
|
|
1842
|
+
}
|
|
1374
1843
|
const options = {
|
|
1375
1844
|
config: values.config,
|
|
1376
1845
|
dryRun: values["dry-run"],
|
|
@@ -1383,7 +1852,7 @@ async function main() {
|
|
|
1383
1852
|
verbose: values.verbose,
|
|
1384
1853
|
version: values.version
|
|
1385
1854
|
};
|
|
1386
|
-
const packageName =
|
|
1855
|
+
const packageName = command || options.package;
|
|
1387
1856
|
const result = await release(packageName, options);
|
|
1388
1857
|
if (options.verbose) {
|
|
1389
1858
|
console.log(`
|
|
@@ -1418,4 +1887,4 @@ async function main() {
|
|
|
1418
1887
|
}
|
|
1419
1888
|
main();
|
|
1420
1889
|
|
|
1421
|
-
//# debugId=
|
|
1890
|
+
//# debugId=47967437F070163A64756E2164756E21
|