@skuba-lib/api 2.0.1 → 2.0.2
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/buildkite/package.json +1 -1
- package/git/package.json +1 -1
- package/github/package.json +1 -1
- package/lib/buildkite/index.cjs +19 -4
- package/lib/buildkite/index.d.cts +8 -2
- package/lib/buildkite/index.d.mts +8 -2
- package/lib/buildkite/index.mjs +11 -3
- package/lib/{chunk-CwYMPI_t.mjs → chunk-DoQ1iNfF.mjs} +3 -3
- package/lib/{error-DwxMLko3.cjs → error-BEFwIvK2.cjs} +10 -10
- package/lib/{error-DnkB3E6d.mjs → error-DIBTmfX2.mjs} +7 -7
- package/lib/{exec-5nrAPCdO.mjs → exec-Bcan8fLb.mjs} +268 -268
- package/lib/{exec-BYbHipiC.cjs → exec-CVlcoV9u.cjs} +261 -261
- package/lib/git/index.cjs +38 -13
- package/lib/git/index.d.cts +8 -2
- package/lib/git/index.d.mts +8 -2
- package/lib/git/index.mjs +20 -2
- package/lib/github/index.cjs +33 -11
- package/lib/github/index.d.cts +8 -2
- package/lib/github/index.d.mts +8 -2
- package/lib/github/index.mjs +18 -3
- package/lib/index.cjs +13 -9
- package/lib/index.d.cts +4 -4
- package/lib/index.d.mts +5 -4
- package/lib/index.mjs +8 -5
- package/lib/{git-B2_B1F3q.cjs → isFileGitIgnored-86LsBKuU.cjs} +3 -26
- package/lib/{index-Dl0KmK1O.d.cts → isFileGitIgnored-CwPJ0v2p.d.mts} +1 -4
- package/lib/{git-QhXK6ooP.mjs → isFileGitIgnored-Dv4xauFf.mjs} +2 -20
- package/lib/{index-BqiB0-6w.d.mts → isFileGitIgnored-E4x_jWjl.d.cts} +1 -4
- package/lib/{index-BOr919w6.d.cts → md-BWCfQS9I.d.cts} +1 -4
- package/lib/{index-CW8ZTeZU.d.mts → md-BZewxkUW.d.mts} +1 -4
- package/lib/{buildkite-DQj9dGPb.mjs → md-CvXERddQ.mjs} +3 -11
- package/lib/{buildkite-Oza5ZHmO.cjs → md-fbyvRhpo.cjs} +2 -15
- package/lib/net/index.cjs +15 -3
- package/lib/net/index.d.cts +8 -2
- package/lib/net/index.d.mts +8 -2
- package/lib/net/index.mjs +8 -3
- package/lib/{index-4aCFuPgQ.d.mts → push-BTAssEjq.d.cts} +3 -6
- package/lib/{index-DfhDLrNc.d.cts → push-Bv-gtPfj.d.mts} +3 -6
- package/lib/{github-Ckgo3Sm-.cjs → push-DV2iCZE-.cjs} +14 -34
- package/lib/{github-Cm4qHDkg.mjs → push-hzuiuMpZ.mjs} +3 -18
- package/lib/{net-BELapTCw.mjs → waitFor-D1MlNL9G.mjs} +2 -7
- package/lib/{index-B8rqBqBj.d.cts → waitFor-DGgQAaUj.d.mts} +1 -4
- package/lib/{index-CZi-UcD_.d.mts → waitFor-LnjEb972.d.cts} +1 -4
- package/lib/{net-CQMRE2g5.cjs → waitFor-PklD-Jqp.cjs} +2 -12
- package/net/package.json +1 -1
- package/package.json +12 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_error = require('./error-
|
|
2
|
-
const
|
|
1
|
+
const require_error = require('./error-BEFwIvK2.cjs');
|
|
2
|
+
const require_isFileGitIgnored = require('./isFileGitIgnored-86LsBKuU.cjs');
|
|
3
3
|
let path = require("path");
|
|
4
4
|
path = require_error.__toESM(path);
|
|
5
5
|
let fs_extra = require("fs-extra");
|
|
@@ -36,8 +36,8 @@ const createEnrichedSummary = (summary, inputAnnotations) => [summary, ...inputA
|
|
|
36
36
|
*/
|
|
37
37
|
const createCheckRun = async ({ annotations, conclusion, name, summary, text, title }) => {
|
|
38
38
|
const dir = process.cwd();
|
|
39
|
-
const [commitId, { owner, repo }] = await Promise.all([
|
|
40
|
-
await (await createRestClient({ auth:
|
|
39
|
+
const [commitId, { owner, repo }] = await Promise.all([require_isFileGitIgnored.getHeadCommitId({ dir }), require_isFileGitIgnored.getOwnerAndRepo({ dir })]);
|
|
40
|
+
await (await createRestClient({ auth: require_isFileGitIgnored.apiTokenFromEnvironment() })).checks.create({
|
|
41
41
|
conclusion,
|
|
42
42
|
head_sha: commitId,
|
|
43
43
|
name,
|
|
@@ -67,11 +67,11 @@ const getPullRequestNumber = async (params = {}) => {
|
|
|
67
67
|
const dir = process.cwd();
|
|
68
68
|
const number = Number(env.BUILDKITE_PULL_REQUEST ?? env.GITHUB_REF?.replace(/^refs\/pull\/(\d+).*$/, "$1"));
|
|
69
69
|
if (Number.isSafeInteger(number)) return number;
|
|
70
|
-
const client = params.client ?? await createRestClient({ auth:
|
|
71
|
-
const [commitId, { owner, repo }] = await Promise.all([
|
|
70
|
+
const client = params.client ?? await createRestClient({ auth: require_isFileGitIgnored.apiTokenFromEnvironment() });
|
|
71
|
+
const [commitId, { owner, repo }] = await Promise.all([require_isFileGitIgnored.getHeadCommitId({
|
|
72
72
|
dir,
|
|
73
73
|
env
|
|
74
|
-
}),
|
|
74
|
+
}), require_isFileGitIgnored.getOwnerAndRepo({ dir })]);
|
|
75
75
|
const pullRequestData = (await client.repos.listPullRequestsAssociatedWithCommit({
|
|
76
76
|
commit_sha: commitId,
|
|
77
77
|
owner,
|
|
@@ -102,8 +102,8 @@ const putIssueComment = async (params) => {
|
|
|
102
102
|
if (params.body === null && !params.internalId) throw new Error("Cannot remove comment without an internalId");
|
|
103
103
|
const env = params.env ?? process.env;
|
|
104
104
|
const dir = process.cwd();
|
|
105
|
-
const { owner, repo } = await
|
|
106
|
-
const client = await createRestClient({ auth:
|
|
105
|
+
const { owner, repo } = await require_isFileGitIgnored.getOwnerAndRepo({ dir });
|
|
106
|
+
const client = await createRestClient({ auth: require_isFileGitIgnored.apiTokenFromEnvironment() });
|
|
107
107
|
const issueNumber = params.issueNumber ?? await getPullRequestNumber({
|
|
108
108
|
client,
|
|
109
109
|
env
|
|
@@ -154,7 +154,7 @@ const putIssueComment = async (params) => {
|
|
|
154
154
|
* specified.
|
|
155
155
|
*/
|
|
156
156
|
const uploadAllFileChanges = async ({ branch, dir, messageHeadline, ignore, messageBody, updateLocal = false }) => {
|
|
157
|
-
const changedFiles = await
|
|
157
|
+
const changedFiles = await require_isFileGitIgnored.getChangedFiles({
|
|
158
158
|
dir,
|
|
159
159
|
ignore
|
|
160
160
|
});
|
|
@@ -169,7 +169,7 @@ const uploadAllFileChanges = async ({ branch, dir, messageHeadline, ignore, mess
|
|
|
169
169
|
});
|
|
170
170
|
if (updateLocal) {
|
|
171
171
|
await Promise.all([...fileChanges.additions, ...fileChanges.deletions].map((file) => fs_extra.default.rm(file.path)));
|
|
172
|
-
await
|
|
172
|
+
await require_isFileGitIgnored.fastForwardBranch({
|
|
173
173
|
ref: branch,
|
|
174
174
|
auth: { type: "gitHubApp" },
|
|
175
175
|
dir
|
|
@@ -193,7 +193,7 @@ const readFileChanges = async (dir, changedFiles) => {
|
|
|
193
193
|
added: [],
|
|
194
194
|
deleted: []
|
|
195
195
|
});
|
|
196
|
-
const gitRoot = await
|
|
196
|
+
const gitRoot = await require_isFileGitIgnored.findRoot({ dir });
|
|
197
197
|
const toRootPath = (filePath) => {
|
|
198
198
|
if (!gitRoot) return filePath;
|
|
199
199
|
return path.default.resolve(gitRoot, filePath);
|
|
@@ -214,9 +214,9 @@ const readFileChanges = async (dir, changedFiles) => {
|
|
|
214
214
|
* This will not update the local Git repository.
|
|
215
215
|
*/
|
|
216
216
|
const uploadFileChanges = async ({ dir, branch, messageHeadline, messageBody, fileChanges }) => {
|
|
217
|
-
const authToken =
|
|
217
|
+
const authToken = require_isFileGitIgnored.apiTokenFromEnvironment();
|
|
218
218
|
if (!authToken) throw new Error("Could not read a GitHub API token from the environment. Please set GITHUB_API_TOKEN or GITHUB_TOKEN.");
|
|
219
|
-
const [{ owner, repo }, headCommitId] = await Promise.all([
|
|
219
|
+
const [{ owner, repo }, headCommitId] = await Promise.all([require_isFileGitIgnored.getOwnerAndRepo({ dir }), require_isFileGitIgnored.getHeadCommitId({ dir })]);
|
|
220
220
|
return (await graphql(`
|
|
221
221
|
mutation Mutation($input: CreateCommitOnBranchInput!) {
|
|
222
222
|
createCommitOnBranch(input: $input) {
|
|
@@ -243,20 +243,6 @@ const uploadFileChanges = async ({ dir, branch, messageHeadline, messageBody, fi
|
|
|
243
243
|
})).createCommitOnBranch.commit.oid;
|
|
244
244
|
};
|
|
245
245
|
|
|
246
|
-
//#endregion
|
|
247
|
-
//#region src/github/index.ts
|
|
248
|
-
var github_exports = /* @__PURE__ */ require_error.__exportAll({
|
|
249
|
-
apiTokenFromEnvironment: () => require_git.apiTokenFromEnvironment,
|
|
250
|
-
buildNameFromEnvironment: () => require_git.buildNameFromEnvironment,
|
|
251
|
-
createCheckRun: () => createCheckRun,
|
|
252
|
-
enabledFromEnvironment: () => require_git.enabledFromEnvironment,
|
|
253
|
-
getPullRequestNumber: () => getPullRequestNumber,
|
|
254
|
-
putIssueComment: () => putIssueComment,
|
|
255
|
-
readFileChanges: () => readFileChanges,
|
|
256
|
-
uploadAllFileChanges: () => uploadAllFileChanges,
|
|
257
|
-
uploadFileChanges: () => uploadFileChanges
|
|
258
|
-
});
|
|
259
|
-
|
|
260
246
|
//#endregion
|
|
261
247
|
Object.defineProperty(exports, 'createCheckRun', {
|
|
262
248
|
enumerable: true,
|
|
@@ -270,12 +256,6 @@ Object.defineProperty(exports, 'getPullRequestNumber', {
|
|
|
270
256
|
return getPullRequestNumber;
|
|
271
257
|
}
|
|
272
258
|
});
|
|
273
|
-
Object.defineProperty(exports, 'github_exports', {
|
|
274
|
-
enumerable: true,
|
|
275
|
-
get: function () {
|
|
276
|
-
return github_exports;
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
259
|
Object.defineProperty(exports, 'putIssueComment', {
|
|
280
260
|
enumerable: true,
|
|
281
261
|
get: function () {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as
|
|
3
|
-
import { c as enabledFromEnvironment, h as findRoot, i as fastForwardBranch, l as getOwnerAndRepo, m as getChangedFiles, o as apiTokenFromEnvironment, s as buildNameFromEnvironment, u as getHeadCommitId } from "./git-QhXK6ooP.mjs";
|
|
1
|
+
import { r as pluralise } from "./error-DIBTmfX2.mjs";
|
|
2
|
+
import { a as apiTokenFromEnvironment, c as getOwnerAndRepo, l as getHeadCommitId, m as findRoot, p as getChangedFiles, r as fastForwardBranch } from "./isFileGitIgnored-Dv4xauFf.mjs";
|
|
4
3
|
import path from "path";
|
|
5
4
|
import fs from "fs-extra";
|
|
6
5
|
|
|
@@ -243,18 +242,4 @@ const uploadFileChanges = async ({ dir, branch, messageHeadline, messageBody, fi
|
|
|
243
242
|
};
|
|
244
243
|
|
|
245
244
|
//#endregion
|
|
246
|
-
|
|
247
|
-
var github_exports = /* @__PURE__ */ __exportAll({
|
|
248
|
-
apiTokenFromEnvironment: () => apiTokenFromEnvironment,
|
|
249
|
-
buildNameFromEnvironment: () => buildNameFromEnvironment,
|
|
250
|
-
createCheckRun: () => createCheckRun,
|
|
251
|
-
enabledFromEnvironment: () => enabledFromEnvironment,
|
|
252
|
-
getPullRequestNumber: () => getPullRequestNumber,
|
|
253
|
-
putIssueComment: () => putIssueComment,
|
|
254
|
-
readFileChanges: () => readFileChanges,
|
|
255
|
-
uploadAllFileChanges: () => uploadAllFileChanges,
|
|
256
|
-
uploadFileChanges: () => uploadFileChanges
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
//#endregion
|
|
260
|
-
export { putIssueComment as a, uploadFileChanges as i, readFileChanges as n, getPullRequestNumber as o, uploadAllFileChanges as r, createCheckRun as s, github_exports as t };
|
|
245
|
+
export { getPullRequestNumber as a, putIssueComment as i, uploadAllFileChanges as n, createCheckRun as o, uploadFileChanges as r, readFileChanges as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createExec } from "./exec-5nrAPCdO.mjs";
|
|
1
|
+
import { t as createExec } from "./exec-Bcan8fLb.mjs";
|
|
3
2
|
import net from "net";
|
|
4
3
|
|
|
5
4
|
//#region src/net/compose.ts
|
|
@@ -65,8 +64,4 @@ const waitFor = async ({ host = "localhost", port, resolveCompose = false, timeo
|
|
|
65
64
|
};
|
|
66
65
|
|
|
67
66
|
//#endregion
|
|
68
|
-
|
|
69
|
-
var net_exports = /* @__PURE__ */ __exportAll({ waitFor: () => waitFor });
|
|
70
|
-
|
|
71
|
-
//#endregion
|
|
72
|
-
export { waitFor as n, net_exports as t };
|
|
67
|
+
export { waitFor as t };
|
|
@@ -31,8 +31,5 @@ declare const waitFor: ({
|
|
|
31
31
|
resolveCompose?: boolean;
|
|
32
32
|
timeout?: number;
|
|
33
33
|
}) => Promise<SocketAddress>;
|
|
34
|
-
declare namespace index_d_exports {
|
|
35
|
-
export { waitFor };
|
|
36
|
-
}
|
|
37
34
|
//#endregion
|
|
38
|
-
export { waitFor as
|
|
35
|
+
export { waitFor as t };
|
|
@@ -31,8 +31,5 @@ declare const waitFor: ({
|
|
|
31
31
|
resolveCompose?: boolean;
|
|
32
32
|
timeout?: number;
|
|
33
33
|
}) => Promise<SocketAddress>;
|
|
34
|
-
declare namespace index_d_exports {
|
|
35
|
-
export { waitFor };
|
|
36
|
-
}
|
|
37
34
|
//#endregion
|
|
38
|
-
export { waitFor as
|
|
35
|
+
export { waitFor as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_error = require('./error-
|
|
2
|
-
const require_exec = require('./exec-
|
|
1
|
+
const require_error = require('./error-BEFwIvK2.cjs');
|
|
2
|
+
const require_exec = require('./exec-CVlcoV9u.cjs');
|
|
3
3
|
let net = require("net");
|
|
4
4
|
net = require_error.__toESM(net);
|
|
5
5
|
|
|
@@ -66,16 +66,6 @@ const waitFor = async ({ host = "localhost", port, resolveCompose = false, timeo
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
//#endregion
|
|
69
|
-
//#region src/net/index.ts
|
|
70
|
-
var net_exports = /* @__PURE__ */ require_error.__exportAll({ waitFor: () => waitFor });
|
|
71
|
-
|
|
72
|
-
//#endregion
|
|
73
|
-
Object.defineProperty(exports, 'net_exports', {
|
|
74
|
-
enumerable: true,
|
|
75
|
-
get: function () {
|
|
76
|
-
return net_exports;
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
69
|
Object.defineProperty(exports, 'waitFor', {
|
|
80
70
|
enumerable: true,
|
|
81
71
|
get: function () {
|
package/net/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skuba-lib/api",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Node.js development API for skuba",
|
|
5
5
|
"homepage": "https://github.com/seek-oss/skuba#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -13,24 +13,24 @@
|
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
-
"
|
|
17
|
-
"
|
|
16
|
+
"import": "./lib/index.mjs",
|
|
17
|
+
"require": "./lib/index.cjs"
|
|
18
18
|
},
|
|
19
19
|
"./buildkite": {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
"import": "./lib/buildkite/index.mjs",
|
|
21
|
+
"require": "./lib/buildkite/index.cjs"
|
|
22
22
|
},
|
|
23
23
|
"./git": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"import": "./lib/git/index.mjs",
|
|
25
|
+
"require": "./lib/git/index.cjs"
|
|
26
26
|
},
|
|
27
27
|
"./github": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
28
|
+
"import": "./lib/github/index.mjs",
|
|
29
|
+
"require": "./lib/github/index.cjs"
|
|
30
30
|
},
|
|
31
31
|
"./net": {
|
|
32
|
-
"
|
|
33
|
-
"
|
|
32
|
+
"import": "./lib/net/index.mjs",
|
|
33
|
+
"require": "./lib/net/index.cjs"
|
|
34
34
|
},
|
|
35
35
|
"./package.json": "./package.json"
|
|
36
36
|
},
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"zod": "^4.3.5"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"tsdown": "^0.
|
|
57
|
+
"tsdown": "^0.20.0"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=22.14.0"
|