skuba 4.2.2 → 4.3.0-beta.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/jest-preset.js +5 -1
- package/lib/api/git/index.d.ts +1 -0
- package/lib/api/git/index.js +3 -1
- package/lib/api/git/index.js.map +1 -1
- package/lib/api/git/pull.d.ts +35 -0
- package/lib/api/git/pull.js +34 -0
- package/lib/api/git/pull.js.map +1 -0
- package/lib/api/github/index.d.ts +1 -0
- package/lib/api/github/index.js +5 -1
- package/lib/api/github/index.js.map +1 -1
- package/lib/api/github/push.d.ts +62 -0
- package/lib/api/github/push.js +133 -0
- package/lib/api/github/push.js.map +1 -0
- package/lib/cli/configure/analysis/diff.d.ts +1 -1
- package/lib/cli/configure/analysis/package.d.ts +1 -1
- package/lib/cli/configure/processing/ignoreFile.d.ts +1 -1
- package/lib/cli/configure/processing/javascript.d.ts +1 -1
- package/lib/cli/configure/processing/json.d.ts +1 -1
- package/lib/cli/configure/processing/package.d.ts +11 -11
- package/lib/cli/lint/autofix.js +23 -13
- package/lib/cli/lint/autofix.js.map +1 -1
- package/lib/cli/lint/external.d.ts +1 -0
- package/lib/cli/test/reporters/github/annotations.js +19 -7
- package/lib/cli/test/reporters/github/annotations.js.map +1 -1
- package/lib/utils/error.d.ts +1 -1
- package/lib/wrapper/http.d.ts +1 -1
- package/package.json +10 -6
- package/template/express-rest-api/.buildkite/pipeline.yml +3 -3
- package/template/express-rest-api/package.json +1 -1
- package/template/koa-rest-api/.buildkite/pipeline.yml +3 -3
- package/template/koa-rest-api/package.json +2 -2
- package/template/lambda-sqs-worker/package.json +1 -1
package/jest-preset.js
CHANGED
|
@@ -21,10 +21,14 @@ module.exports = {
|
|
|
21
21
|
'!<rootDir>/jest.*.ts',
|
|
22
22
|
],
|
|
23
23
|
coverageDirectory: 'coverage',
|
|
24
|
+
reporters: ['default', require.resolve('./lib/cli/test/reporters/github')],
|
|
24
25
|
testEnvironment: 'node',
|
|
25
26
|
testPathIgnorePatterns: [
|
|
26
27
|
'/node_modules.*/',
|
|
27
28
|
'<rootDir>/(coverage|dist|lib|tmp).*/',
|
|
28
29
|
],
|
|
29
|
-
|
|
30
|
+
watchPlugins: [
|
|
31
|
+
require.resolve('jest-watch-typeahead/filename'),
|
|
32
|
+
require.resolve('jest-watch-typeahead/testname'),
|
|
33
|
+
],
|
|
30
34
|
};
|
package/lib/api/git/index.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export { getChangedFiles } from './getChangedFiles';
|
|
|
5
5
|
export { getHeadCommitId, getHeadCommitMessage } from './log';
|
|
6
6
|
export { getOwnerAndRepo } from './remote';
|
|
7
7
|
export { push } from './push';
|
|
8
|
+
export { fastForwardBranch } from './pull';
|
|
8
9
|
export { reset } from './reset';
|
package/lib/api/git/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reset = exports.push = exports.getOwnerAndRepo = exports.getHeadCommitMessage = exports.getHeadCommitId = exports.getChangedFiles = exports.currentBranch = exports.commitAllChanges = exports.commit = void 0;
|
|
3
|
+
exports.reset = exports.fastForwardBranch = exports.push = exports.getOwnerAndRepo = exports.getHeadCommitMessage = exports.getHeadCommitId = exports.getChangedFiles = exports.currentBranch = exports.commitAllChanges = exports.commit = void 0;
|
|
4
4
|
var commit_1 = require("./commit");
|
|
5
5
|
Object.defineProperty(exports, "commit", { enumerable: true, get: function () { return commit_1.commit; } });
|
|
6
6
|
var commitAllChanges_1 = require("./commitAllChanges");
|
|
@@ -16,6 +16,8 @@ var remote_1 = require("./remote");
|
|
|
16
16
|
Object.defineProperty(exports, "getOwnerAndRepo", { enumerable: true, get: function () { return remote_1.getOwnerAndRepo; } });
|
|
17
17
|
var push_1 = require("./push");
|
|
18
18
|
Object.defineProperty(exports, "push", { enumerable: true, get: function () { return push_1.push; } });
|
|
19
|
+
var pull_1 = require("./pull");
|
|
20
|
+
Object.defineProperty(exports, "fastForwardBranch", { enumerable: true, get: function () { return pull_1.fastForwardBranch; } });
|
|
19
21
|
var reset_1 = require("./reset");
|
|
20
22
|
Object.defineProperty(exports, "reset", { enumerable: true, get: function () { return reset_1.reset; } });
|
|
21
23
|
//# sourceMappingURL=index.js.map
|
package/lib/api/git/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/git/index.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,6BAA8D;AAArD,sGAAA,eAAe,OAAA;AAAE,2GAAA,oBAAoB,OAAA;AAC9C,mCAA2C;AAAlC,yGAAA,eAAe,OAAA;AACxB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,iCAAgC;AAAvB,8FAAA,KAAK,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/git/index.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,6BAA8D;AAArD,sGAAA,eAAe,OAAA;AAAE,2GAAA,oBAAoB,OAAA;AAC9C,mCAA2C;AAAlC,yGAAA,eAAe,OAAA;AACxB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,+BAA2C;AAAlC,yGAAA,iBAAiB,OAAA;AAC1B,iCAAgC;AAAvB,8FAAA,KAAK,OAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use a GitHub app token to auth the Git push.
|
|
3
|
+
*
|
|
4
|
+
* This defaults to the `GITHUB_API_TOKEN` and `GITHUB_TOKEN` environment
|
|
5
|
+
* variables if `token` is not provided.
|
|
6
|
+
*/
|
|
7
|
+
interface GitHubAppAuth {
|
|
8
|
+
type: 'gitHubApp';
|
|
9
|
+
token?: string;
|
|
10
|
+
}
|
|
11
|
+
interface PullParameters {
|
|
12
|
+
/**
|
|
13
|
+
* The auth mechanism for the push.
|
|
14
|
+
*
|
|
15
|
+
* Currently, only GitHub app tokens are supported.
|
|
16
|
+
*/
|
|
17
|
+
auth: GitHubAppAuth;
|
|
18
|
+
dir: string;
|
|
19
|
+
/**
|
|
20
|
+
* The branch to merge into
|
|
21
|
+
*/
|
|
22
|
+
ref: string;
|
|
23
|
+
remote?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The destination branch or tag on the remote.
|
|
26
|
+
*
|
|
27
|
+
* This defaults to `ref`.
|
|
28
|
+
*/
|
|
29
|
+
remoteRef?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Fast forwards the local branch to the remote state
|
|
33
|
+
*/
|
|
34
|
+
export declare const fastForwardBranch: ({ auth, dir, ref, remote, remoteRef, }: PullParameters) => Promise<void>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fastForwardBranch = void 0;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const isomorphic_git_1 = __importDefault(require("isomorphic-git"));
|
|
9
|
+
const node_1 = __importDefault(require("isomorphic-git/http/node"));
|
|
10
|
+
const environment_1 = require("../github/environment");
|
|
11
|
+
const remote_1 = require("./remote");
|
|
12
|
+
/**
|
|
13
|
+
* Fast forwards the local branch to the remote state
|
|
14
|
+
*/
|
|
15
|
+
const fastForwardBranch = async ({ auth, dir, ref, remote, remoteRef, }) => {
|
|
16
|
+
const { owner, repo } = await (0, remote_1.getOwnerAndRepo)({ dir });
|
|
17
|
+
const url = `https://github.com/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`;
|
|
18
|
+
return isomorphic_git_1.default.fastForward({
|
|
19
|
+
onAuth: () => ({
|
|
20
|
+
username: 'x-access-token',
|
|
21
|
+
password: auth.token ?? (0, environment_1.apiTokenFromEnvironment)(),
|
|
22
|
+
}),
|
|
23
|
+
dir,
|
|
24
|
+
fs: fs_extra_1.default,
|
|
25
|
+
http: node_1.default,
|
|
26
|
+
ref,
|
|
27
|
+
remote,
|
|
28
|
+
remoteRef,
|
|
29
|
+
url,
|
|
30
|
+
singleBranch: true,
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
exports.fastForwardBranch = fastForwardBranch;
|
|
34
|
+
//# sourceMappingURL=pull.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull.js","sourceRoot":"","sources":["../../../src/api/git/pull.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA0B;AAC1B,oEAAiC;AACjC,oEAA4C;AAE5C,uDAAgE;AAEhE,qCAA2C;AAsC3C;;GAEG;AACI,MAAM,iBAAiB,GAAG,KAAK,EAAE,EACtC,IAAI,EACJ,GAAG,EACH,GAAG,EACH,MAAM,EACN,SAAS,GACM,EAAE,EAAE;IACnB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,wBAAe,EAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAEvD,MAAM,GAAG,GAAG,sBAAsB,kBAAkB,CAClD,KAAK,CACN,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;IAEhC,OAAO,wBAAG,CAAC,WAAW,CAAC;QACrB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YACb,QAAQ,EAAE,gBAAgB;YAC1B,QAAQ,EAAE,IAAI,CAAC,KAAK,IAAI,IAAA,qCAAuB,GAAE;SAClD,CAAC;QACF,GAAG;QACH,EAAE,EAAF,kBAAE;QACF,IAAI,EAAJ,cAAI;QACJ,GAAG;QACH,MAAM;QACN,SAAS;QACT,GAAG;QACH,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;AACL,CAAC,CAAC;AA3BW,QAAA,iBAAiB,qBA2B5B"}
|
|
@@ -4,3 +4,4 @@ export { createCheckRun } from './checkRun';
|
|
|
4
4
|
export { enabledFromEnvironment } from './environment';
|
|
5
5
|
export { getPullRequestNumber } from './pullRequest';
|
|
6
6
|
export { putIssueComment } from './issueComment';
|
|
7
|
+
export { commitAndPush, commitAndPushAllChanges, mapChangedFilesToFileChanges, } from './push';
|
package/lib/api/github/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.putIssueComment = exports.getPullRequestNumber = exports.enabledFromEnvironment = exports.createCheckRun = exports.buildNameFromEnvironment = void 0;
|
|
3
|
+
exports.mapChangedFilesToFileChanges = exports.commitAndPushAllChanges = exports.commitAndPush = exports.putIssueComment = exports.getPullRequestNumber = exports.enabledFromEnvironment = exports.createCheckRun = exports.buildNameFromEnvironment = void 0;
|
|
4
4
|
var environment_1 = require("./environment");
|
|
5
5
|
Object.defineProperty(exports, "buildNameFromEnvironment", { enumerable: true, get: function () { return environment_1.buildNameFromEnvironment; } });
|
|
6
6
|
var checkRun_1 = require("./checkRun");
|
|
@@ -11,4 +11,8 @@ var pullRequest_1 = require("./pullRequest");
|
|
|
11
11
|
Object.defineProperty(exports, "getPullRequestNumber", { enumerable: true, get: function () { return pullRequest_1.getPullRequestNumber; } });
|
|
12
12
|
var issueComment_1 = require("./issueComment");
|
|
13
13
|
Object.defineProperty(exports, "putIssueComment", { enumerable: true, get: function () { return issueComment_1.putIssueComment; } });
|
|
14
|
+
var push_1 = require("./push");
|
|
15
|
+
Object.defineProperty(exports, "commitAndPush", { enumerable: true, get: function () { return push_1.commitAndPush; } });
|
|
16
|
+
Object.defineProperty(exports, "commitAndPushAllChanges", { enumerable: true, get: function () { return push_1.commitAndPushAllChanges; } });
|
|
17
|
+
Object.defineProperty(exports, "mapChangedFilesToFileChanges", { enumerable: true, get: function () { return push_1.mapChangedFilesToFileChanges; } });
|
|
14
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/github/index.ts"],"names":[],"mappings":";;;AACA,6CAAyD;AAAhD,uHAAA,wBAAwB,OAAA;AACjC,uCAA4C;AAAnC,0GAAA,cAAc,OAAA;AACvB,6CAAuD;AAA9C,qHAAA,sBAAsB,OAAA;AAC/B,6CAAqD;AAA5C,mHAAA,oBAAoB,OAAA;AAC7B,+CAAiD;AAAxC,+GAAA,eAAe,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/github/index.ts"],"names":[],"mappings":";;;AACA,6CAAyD;AAAhD,uHAAA,wBAAwB,OAAA;AACjC,uCAA4C;AAAnC,0GAAA,cAAc,OAAA;AACvB,6CAAuD;AAA9C,qHAAA,sBAAsB,OAAA;AAC/B,6CAAqD;AAA5C,mHAAA,oBAAoB,OAAA;AAC7B,+CAAiD;AAAxC,+GAAA,eAAe,OAAA;AACxB,+BAIgB;AAHd,qGAAA,aAAa,OAAA;AACb,+GAAA,uBAAuB,OAAA;AACvB,oHAAA,4BAA4B,OAAA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { FileAddition, FileDeletion } from '@octokit/graphql-schema';
|
|
2
|
+
import type { ChangedFile } from '../git/getChangedFiles';
|
|
3
|
+
interface CommitAndPushAllChangesParams {
|
|
4
|
+
dir: string;
|
|
5
|
+
/**
|
|
6
|
+
* The branch name
|
|
7
|
+
*/
|
|
8
|
+
branch: string;
|
|
9
|
+
/**
|
|
10
|
+
* The headline of the commit message
|
|
11
|
+
*/
|
|
12
|
+
messageHeadline: string;
|
|
13
|
+
/**
|
|
14
|
+
* The body of the commit message
|
|
15
|
+
*/
|
|
16
|
+
messageBody?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Updates the local git working directory to reflect the new remote state
|
|
19
|
+
*/
|
|
20
|
+
updateLocal?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Commits and pushes all changes from the local git repository up to a GitHub branch.
|
|
24
|
+
* Returns the commit id or `undefined` if there are no changes to commit.
|
|
25
|
+
*/
|
|
26
|
+
export declare const commitAndPushAllChanges: ({ dir, branch, messageHeadline, messageBody, updateLocal, }: CommitAndPushAllChangesParams) => Promise<string | undefined>;
|
|
27
|
+
export interface FileChanges {
|
|
28
|
+
additions: FileAddition[];
|
|
29
|
+
deletions: FileDeletion[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Maps ChangedFiles to {@link https://docs.github.com/en/graphql/reference/input-objects#filechanges| FileChanges}
|
|
33
|
+
*/
|
|
34
|
+
export declare const mapChangedFilesToFileChanges: (changedFiles: ChangedFile[]) => Promise<FileChanges>;
|
|
35
|
+
interface CommitAndPushParams {
|
|
36
|
+
dir: string;
|
|
37
|
+
/**
|
|
38
|
+
* The branch name
|
|
39
|
+
*/
|
|
40
|
+
branch: string;
|
|
41
|
+
/**
|
|
42
|
+
* The headline of the commit message
|
|
43
|
+
*/
|
|
44
|
+
messageHeadline: string;
|
|
45
|
+
/**
|
|
46
|
+
* The body of the commit message
|
|
47
|
+
*/
|
|
48
|
+
messageBody?: string;
|
|
49
|
+
/**
|
|
50
|
+
* File additions and deletions
|
|
51
|
+
*/
|
|
52
|
+
fileChanges: FileChanges;
|
|
53
|
+
/**
|
|
54
|
+
* Updates the local git working directory to reflect the new remote state
|
|
55
|
+
*/
|
|
56
|
+
updateLocal?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Commits and pushes file changes up to a GitHub branch
|
|
60
|
+
*/
|
|
61
|
+
export declare const commitAndPush: ({ dir, branch, messageHeadline, messageBody, fileChanges, updateLocal, }: CommitAndPushParams) => Promise<string>;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.commitAndPush = exports.mapChangedFilesToFileChanges = exports.commitAndPushAllChanges = void 0;
|
|
30
|
+
const graphql_1 = require("@octokit/graphql");
|
|
31
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
32
|
+
const Git = __importStar(require("../git"));
|
|
33
|
+
const environment_1 = require("./environment");
|
|
34
|
+
/**
|
|
35
|
+
* Commits and pushes all changes from the local git repository up to a GitHub branch.
|
|
36
|
+
* Returns the commit id or `undefined` if there are no changes to commit.
|
|
37
|
+
*/
|
|
38
|
+
const commitAndPushAllChanges = async ({ dir, branch, messageHeadline, messageBody, updateLocal, }) => {
|
|
39
|
+
const changedFiles = await Git.getChangedFiles({ dir });
|
|
40
|
+
if (!changedFiles.length) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
const fileChanges = await (0, exports.mapChangedFilesToFileChanges)(changedFiles);
|
|
44
|
+
return await (0, exports.commitAndPush)({
|
|
45
|
+
dir,
|
|
46
|
+
branch,
|
|
47
|
+
messageHeadline,
|
|
48
|
+
messageBody,
|
|
49
|
+
fileChanges,
|
|
50
|
+
updateLocal,
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
exports.commitAndPushAllChanges = commitAndPushAllChanges;
|
|
54
|
+
/**
|
|
55
|
+
* Maps ChangedFiles to {@link https://docs.github.com/en/graphql/reference/input-objects#filechanges| FileChanges}
|
|
56
|
+
*/
|
|
57
|
+
const mapChangedFilesToFileChanges = async (changedFiles) => {
|
|
58
|
+
const { added, deleted } = changedFiles.reduce((files, changedFile) => {
|
|
59
|
+
const filePath = changedFile.path;
|
|
60
|
+
if (changedFile.state === 'deleted') {
|
|
61
|
+
files.deleted.push(filePath);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
files.added.push(filePath);
|
|
65
|
+
}
|
|
66
|
+
return files;
|
|
67
|
+
}, { added: [], deleted: [] });
|
|
68
|
+
const additions = await Promise.all(added.map(async (filePath) => ({
|
|
69
|
+
path: filePath,
|
|
70
|
+
contents: await fs_extra_1.default.promises.readFile(filePath, {
|
|
71
|
+
encoding: 'base64',
|
|
72
|
+
}),
|
|
73
|
+
})));
|
|
74
|
+
const deletions = deleted.map((filePath) => ({
|
|
75
|
+
path: filePath,
|
|
76
|
+
}));
|
|
77
|
+
return {
|
|
78
|
+
additions,
|
|
79
|
+
deletions,
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
exports.mapChangedFilesToFileChanges = mapChangedFilesToFileChanges;
|
|
83
|
+
/**
|
|
84
|
+
* Commits and pushes file changes up to a GitHub branch
|
|
85
|
+
*/
|
|
86
|
+
const commitAndPush = async ({ dir, branch, messageHeadline, messageBody, fileChanges, updateLocal = false, }) => {
|
|
87
|
+
const authToken = (0, environment_1.apiTokenFromEnvironment)();
|
|
88
|
+
if (!authToken) {
|
|
89
|
+
throw new Error('Could not determine API token from the environment');
|
|
90
|
+
}
|
|
91
|
+
const [{ owner, repo }, headCommitId] = await Promise.all([
|
|
92
|
+
Git.getOwnerAndRepo({ dir }),
|
|
93
|
+
Git.getHeadCommitId({ dir }),
|
|
94
|
+
]);
|
|
95
|
+
const input = {
|
|
96
|
+
branch: {
|
|
97
|
+
repositoryNameWithOwner: `${owner}/${repo}`,
|
|
98
|
+
branchName: branch,
|
|
99
|
+
},
|
|
100
|
+
message: {
|
|
101
|
+
headline: messageHeadline,
|
|
102
|
+
body: messageBody,
|
|
103
|
+
},
|
|
104
|
+
expectedHeadOid: headCommitId,
|
|
105
|
+
clientMutationId: 'skuba',
|
|
106
|
+
fileChanges,
|
|
107
|
+
};
|
|
108
|
+
const result = await (0, graphql_1.graphql)(`
|
|
109
|
+
mutation Mutation($input: CreateCommitOnBranchInput!) {
|
|
110
|
+
createCommitOnBranch(input: $input) {
|
|
111
|
+
commit {
|
|
112
|
+
id
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
`, {
|
|
117
|
+
input,
|
|
118
|
+
headers: {
|
|
119
|
+
authorization: `bearer ${authToken}`,
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
if (updateLocal) {
|
|
123
|
+
await Promise.all([...fileChanges.additions, ...fileChanges.deletions].map((file) => fs_extra_1.default.rm(file.path)));
|
|
124
|
+
await Git.fastForwardBranch({
|
|
125
|
+
ref: branch,
|
|
126
|
+
auth: { type: 'gitHubApp' },
|
|
127
|
+
dir,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return result.createCommitOnBranch.commit.id;
|
|
131
|
+
};
|
|
132
|
+
exports.commitAndPush = commitAndPush;
|
|
133
|
+
//# sourceMappingURL=push.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../../src/api/github/push.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAA2C;AAM3C,wDAA0B;AAE1B,4CAA8B;AAG9B,+CAAwD;AA8BxD;;;GAGG;AACI,MAAM,uBAAuB,GAAG,KAAK,EAAE,EAC5C,GAAG,EACH,MAAM,EACN,eAAe,EACf,WAAW,EACX,WAAW,GACmB,EAA+B,EAAE;IAC/D,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACxD,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;QACxB,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,WAAW,GAAG,MAAM,IAAA,oCAA4B,EAAC,YAAY,CAAC,CAAC;IAErE,OAAO,MAAM,IAAA,qBAAa,EAAC;QACzB,GAAG;QACH,MAAM;QACN,eAAe;QACf,WAAW;QACX,WAAW;QACX,WAAW;KACZ,CAAC,CAAC;AACL,CAAC,CAAC;AArBW,QAAA,uBAAuB,2BAqBlC;AAOF;;GAEG;AACI,MAAM,4BAA4B,GAAG,KAAK,EAC/C,YAA2B,EACL,EAAE;IACxB,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC,MAAM,CAI5C,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE;QACrB,MAAM,QAAQ,GAAG,WAAW,CA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CAAC,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC;QAC5B,GAAG,CAAC,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC;KAC7B,CAAC,CAAC;IAEH,MAAM,KAAK,GAA8B;QACvC,MAAM,EAAE;YACN,uBAAuB,EAAE,GAAG,KAAK,IAAI,IAAI,EAAE;YAC3C,UAAU,EAAE,MAAM;SACnB;QACD,OAAO,EAAE;YACP,QAAQ,EAAE,eAAe;YACzB,IAAI,EAAE,WAAW;SAClB;QACD,eAAe,EAAE,YAAY;QAC7B,gBAAgB,EAAE,OAAO;QACzB,WAAW;KACZ,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,IAAA,iBAAO,EAC1B;;;;;;;;KAQC,EACD;QACE,KAAK;QACL,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,SAAS,EAAE;SACrC;KACF,CACF,CAAC;IAEF,IAAI,WAAW,EAAE;QACf,MAAM,OAAO,CAAC,GAAG,CACf,CAAC,GAAG,WAAW,CAAC,SAAS,EAAE,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAChE,kBAAE,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CACjB,CACF,CAAC;QAEF,MAAM,GAAG,CAAC,iBAAiB,CAAC;YAC1B,GAAG,EAAE,MAAM;YACX,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;YAC3B,GAAG;SACJ,CAAC,CAAC;KACJ;IAED,OAAO,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;AAC/C,CAAC,CAAC;AAjEW,QAAA,aAAa,iBAiExB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const determineOperation: (oldData?: string
|
|
1
|
+
export declare const determineOperation: (oldData?: string, newData?: string) => string;
|
|
@@ -3,7 +3,7 @@ import type { DependencyDiff, DependencySet } from '../types';
|
|
|
3
3
|
interface GetDestinationManifestProps {
|
|
4
4
|
cwd?: string;
|
|
5
5
|
}
|
|
6
|
-
export declare const getDestinationManifest: (props?: GetDestinationManifestProps
|
|
6
|
+
export declare const getDestinationManifest: (props?: GetDestinationManifestProps) => Promise<readPkgUp.NormalizedReadResult>;
|
|
7
7
|
interface DiffDependenciesProps {
|
|
8
8
|
old: Record<string, string | undefined>;
|
|
9
9
|
new: Record<string, string | undefined>;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* than `lib/`) but they generally represent the same _intent_.
|
|
6
6
|
*/
|
|
7
7
|
export declare const generateSimpleVariants: (patterns: string[]) => Set<string>;
|
|
8
|
-
export declare const mergeWithIgnoreFile: (rawTemplateFile: string) => (rawInputFile?: string
|
|
8
|
+
export declare const mergeWithIgnoreFile: (rawTemplateFile: string) => (rawInputFile?: string) => string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const prependImport: (name: string, file?: string
|
|
1
|
+
export declare const prependImport: (name: string, file?: string) => string;
|
|
2
2
|
export declare const stripImports: (names: readonly string[], inputFile: string) => string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const formatObject: (data: Record<Exclude<PropertyKey, symbol>, unknown>, filepath?: string
|
|
1
|
+
export declare const formatObject: (data: Record<Exclude<PropertyKey, symbol>, unknown>, filepath?: string) => string;
|
|
2
2
|
export declare const parseObject: (input: string | undefined) => Record<Exclude<PropertyKey, symbol>, unknown> | undefined;
|
|
@@ -22,7 +22,7 @@ export declare const createDependencyFilter: (names: readonly string[], type: 'd
|
|
|
22
22
|
main?: string | undefined;
|
|
23
23
|
exports?: import("type-fest").PackageJson.Exports | undefined;
|
|
24
24
|
imports?: import("type-fest").PackageJson.Imports | undefined;
|
|
25
|
-
bin?: string | Record<string, string
|
|
25
|
+
bin?: string | Partial<Record<string, string>> | undefined;
|
|
26
26
|
man?: string | string[] | undefined;
|
|
27
27
|
directories?: import("type-fest").PackageJson.DirectoryLocations | undefined;
|
|
28
28
|
repository?: string | {
|
|
@@ -32,17 +32,17 @@ export declare const createDependencyFilter: (names: readonly string[], type: 'd
|
|
|
32
32
|
} | undefined;
|
|
33
33
|
scripts?: import("type-fest").PackageJson.Scripts | undefined;
|
|
34
34
|
config?: Record<string, unknown> | undefined;
|
|
35
|
-
dependencies?:
|
|
36
|
-
devDependencies?:
|
|
37
|
-
optionalDependencies?:
|
|
38
|
-
peerDependencies?:
|
|
39
|
-
peerDependenciesMeta?: Record<string, {
|
|
35
|
+
dependencies?: Partial<Record<string, string>> | undefined;
|
|
36
|
+
devDependencies?: Partial<Record<string, string>> | undefined;
|
|
37
|
+
optionalDependencies?: Partial<Record<string, string>> | undefined;
|
|
38
|
+
peerDependencies?: Partial<Record<string, string>> | undefined;
|
|
39
|
+
peerDependenciesMeta?: Partial<Record<string, {
|
|
40
40
|
optional: true;
|
|
41
|
-
}
|
|
41
|
+
}>> | undefined;
|
|
42
42
|
bundledDependencies?: string[] | undefined;
|
|
43
43
|
bundleDependencies?: string[] | undefined;
|
|
44
44
|
engines?: {
|
|
45
|
-
[x: string]: string;
|
|
45
|
+
[x: string]: string | undefined;
|
|
46
46
|
} | undefined;
|
|
47
47
|
engineStrict?: boolean | undefined;
|
|
48
48
|
os?: import("type-fest").LiteralUnion<"aix" | "darwin" | "freebsd" | "linux" | "openbsd" | "sunos" | "win32" | "!aix" | "!darwin" | "!freebsd" | "!linux" | "!openbsd" | "!sunos" | "!win32", string>[] | undefined;
|
|
@@ -60,14 +60,14 @@ export declare const createDependencyFilter: (names: readonly string[], type: 'd
|
|
|
60
60
|
main?: string | undefined;
|
|
61
61
|
browser?: string | undefined;
|
|
62
62
|
} | undefined;
|
|
63
|
-
browser?: string | Record<string, string | false
|
|
63
|
+
browser?: string | Partial<Record<string, string | false>> | undefined;
|
|
64
64
|
sideEffects?: boolean | string[] | undefined;
|
|
65
65
|
types?: string | undefined;
|
|
66
|
-
typesVersions?: Record<string, Record<string, string[]
|
|
66
|
+
typesVersions?: Partial<Record<string, Partial<Record<string, string[]>>>> | undefined;
|
|
67
67
|
typings?: string | undefined;
|
|
68
68
|
workspaces?: string[] | import("type-fest").PackageJson.WorkspaceConfig | undefined;
|
|
69
69
|
flat?: boolean | undefined;
|
|
70
|
-
resolutions?:
|
|
70
|
+
resolutions?: Partial<Record<string, string>> | undefined;
|
|
71
71
|
jspm?: import("type-fest").PackageJson | undefined;
|
|
72
72
|
};
|
|
73
73
|
export declare const withPackage: (fn: (data: PackageJson) => PackageJson) => (input: string | undefined) => string;
|
package/lib/cli/lint/autofix.js
CHANGED
|
@@ -30,6 +30,7 @@ exports.autofix = void 0;
|
|
|
30
30
|
const util_1 = require("util");
|
|
31
31
|
const simple_git_1 = __importDefault(require("simple-git"));
|
|
32
32
|
const Git = __importStar(require("../../api/git"));
|
|
33
|
+
const GitHub = __importStar(require("../../api/github"));
|
|
33
34
|
const eslint_1 = require("../../cli/adapter/eslint");
|
|
34
35
|
const prettier_1 = require("../../cli/adapter/prettier");
|
|
35
36
|
const env_1 = require("../../utils/env");
|
|
@@ -87,23 +88,32 @@ const autofix = async (params) => {
|
|
|
87
88
|
// Unconditionally re-run Prettier; reaching here means we have pre-existing
|
|
88
89
|
// format violations or may have created new ones through ESLint fixes.
|
|
89
90
|
await (0, prettier_1.runPrettier)('format', logger);
|
|
90
|
-
|
|
91
|
+
if (process.env.GITHUB_ACTIONS) {
|
|
92
|
+
// GitHub runners have Git installed locally
|
|
93
|
+
const ref = await Git.commitAllChanges({
|
|
94
|
+
dir,
|
|
95
|
+
message: AUTOFIX_COMMIT_MESSAGE,
|
|
96
|
+
});
|
|
97
|
+
if (!ref) {
|
|
98
|
+
return logging_1.log.warn('No autofixes detected.');
|
|
99
|
+
}
|
|
100
|
+
await (0, wait_1.throwOnTimeout)((0, simple_git_1.default)().push(), { s: 30 });
|
|
101
|
+
logging_1.log.warn(`Pushed fix commit ${ref}.`);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
// Other CI Environments, use GitHub API
|
|
105
|
+
if (!currentBranch) {
|
|
106
|
+
logging_1.log.warn('Could not determine the current branch');
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const ref = await (0, wait_1.throwOnTimeout)(GitHub.commitAndPushAllChanges({
|
|
91
110
|
dir,
|
|
92
|
-
|
|
93
|
-
|
|
111
|
+
branch: currentBranch,
|
|
112
|
+
messageHeadline: AUTOFIX_COMMIT_MESSAGE,
|
|
113
|
+
}), { s: 30 });
|
|
94
114
|
if (!ref) {
|
|
95
115
|
return logging_1.log.warn('No autofixes detected.');
|
|
96
116
|
}
|
|
97
|
-
await (0, wait_1.throwOnTimeout)(process.env.GITHUB_ACTIONS
|
|
98
|
-
? // GitHub's checkout action should preconfigure the Git CLI.
|
|
99
|
-
(0, simple_git_1.default)().push()
|
|
100
|
-
: // In other CI environments (Buildkite) we fall back to GitHub App auth.
|
|
101
|
-
Git.push({
|
|
102
|
-
auth: { type: 'gitHubApp' },
|
|
103
|
-
dir: process.cwd(),
|
|
104
|
-
ref,
|
|
105
|
-
remoteRef: currentBranch,
|
|
106
|
-
}), { s: 30 });
|
|
107
117
|
logging_1.log.warn(`Pushed fix commit ${ref}.`);
|
|
108
118
|
}
|
|
109
119
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autofix.js","sourceRoot":"","sources":["../../../src/cli/lint/autofix.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+B;AAE/B,4DAAmC;AAEnC,mDAAqC;AACrC,qDAAqD;AACrD,yDAAyD;AACzD,yCAA0C;AAC1C,iDAAwD;AACxD,2CAAkD;AAIlD,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAEpD,MAAM,UAAU,GAAG,KAAK,EAAE,EACxB,aAAa,EACb,GAAG,GAIJ,EAAE,EAAE;IACH,IAAI,CAAC,IAAA,aAAO,GAAE,EAAE;QACd,4EAA4E;QAC5E,2EAA2E;QAC3E,2DAA2D;QAC3D,OAAO,KAAK,CAAC;KACd;IA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|
+
*
|
|
26
|
+
* ```console
|
|
27
|
+
* Error: expect(received).toBe(expected) // Object.is equality
|
|
28
|
+
*
|
|
29
|
+
* Expected: "a"
|
|
30
|
+
* Received: "b"
|
|
31
|
+
* at /workdir/skuba/src/test.test.ts:2:15
|
|
32
|
+
* at Promise.then.completed (/workdir/skuba/node_modules/jest-circus/build/utils.js:390:28)
|
|
33
|
+
* ...
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
24
36
|
* This pattern will produce the following matches:
|
|
25
37
|
*
|
|
26
38
|
* 1. /workdir/skuba/src/test.test.ts
|
|
27
39
|
* 2. 2
|
|
28
40
|
* 2. 15
|
|
29
41
|
*/
|
|
30
|
-
const JEST_LOCATION_REGEX = /\((.+?):(\d+):(\d+)
|
|
42
|
+
const JEST_LOCATION_REGEX = /\n +at (.+\()?(.+?):(\d+):(\d+)/;
|
|
31
43
|
const createAnnotations = (testResults) => {
|
|
32
44
|
const cwd = process.cwd();
|
|
33
45
|
return testResults.flatMap((testResult) => {
|
|
@@ -44,14 +56,14 @@ const createAnnotations = (testResults) => {
|
|
|
44
56
|
if (testResult.numFailingTests > 0) {
|
|
45
57
|
return testResult.testResults.flatMap((assertionResult) => assertionResult.failureMessages.flatMap((failureMessage) => {
|
|
46
58
|
const match = JEST_LOCATION_REGEX.exec(failureMessage);
|
|
47
|
-
if (match?.length ===
|
|
59
|
+
if (match?.length === 5) {
|
|
48
60
|
return {
|
|
49
61
|
annotation_level: 'failure',
|
|
50
|
-
path: path_1.default.relative(cwd, match[
|
|
51
|
-
start_line: Number(match[
|
|
52
|
-
end_line: Number(match[
|
|
53
|
-
start_column: Number(match[
|
|
54
|
-
end_column: Number(match[
|
|
62
|
+
path: path_1.default.relative(cwd, match[2]),
|
|
63
|
+
start_line: Number(match[3]),
|
|
64
|
+
end_line: Number(match[3]),
|
|
65
|
+
start_column: Number(match[4]),
|
|
66
|
+
end_column: Number(match[4]),
|
|
55
67
|
message: (0, strip_ansi_1.default)(failureMessage),
|
|
56
68
|
title: 'Jest',
|
|
57
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations.js","sourceRoot":"","sources":["../../../../../src/cli/test/reporters/github/annotations.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGxB,4DAAmC;AAInC
|
|
1
|
+
{"version":3,"file":"annotations.js","sourceRoot":"","sources":["../../../../../src/cli/test/reporters/github/annotations.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGxB,4DAAmC;AAInC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,mBAAmB,GAAG,iCAAiC,CAAC;AAEvD,MAAM,iBAAiB,GAAG,CAC/B,WAAyB,EACJ,EAAE;IACvB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE1B,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QACxC,IAAI,UAAU,CAAC,aAAa,EAAE;YAC5B,OAAO;gBACL,gBAAgB,EAAE,SAAS;gBAC3B,IAAI,EAAE,cAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,YAAY,CAAC;gBACjD,UAAU,EAAE,CAAC;gBACb,QAAQ,EAAE,CAAC;gBACX,OAAO,EAAE,IAAA,oBAAS,EAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC;gBACpD,KAAK,EAAE,MAAM;aACd,CAAC;SACH;QAED,IAAI,UAAU,CAAC,eAAe,GAAG,CAAC,EAAE;YAClC,OAAO,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,EAAE,CACxD,eAAe,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,cAAc,EAAE,EAAE;gBACzD,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;gBACvD,IAAI,KAAK,EAAE,MAAM,KAAK,CAAC,EAAE;oBACvB,OAAO;wBACL,gBAAgB,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AC,CAAC,CAAC,EAAE,CAAC;QAC3E,GAAG,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC;KACxC,CAAC;IAEF,4CAA4C;IAC5C,OAAO,OAAO,CAAC,GAAG,CAAkB,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/D,WAAW,EAAE,IAAA,yBAAiB,EAAC,OAAO,CAAC;QACvC,WAAW;KACZ,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AA7BW,QAAA,yBAAyB,6BA6BpC"}
|
package/lib/utils/error.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare const ConcurrentlyErrors: t.Array<t.Record<{
|
|
|
19
19
|
*
|
|
20
20
|
* https://nodejs.org/api/util.html#custom-inspection-functions-on-objects
|
|
21
21
|
*/
|
|
22
|
-
export declare const createTerseError: (message?: string
|
|
22
|
+
export declare const createTerseError: (message?: string) => Error & {
|
|
23
23
|
[inspect.custom]: () => string | undefined;
|
|
24
24
|
};
|
|
25
25
|
export declare const handleCliError: (err: unknown) => void;
|
package/lib/wrapper/http.d.ts
CHANGED
|
@@ -11,4 +11,4 @@ export declare const createRequestListenerFromFunction: (fn: (...args: unknown[]
|
|
|
11
11
|
*
|
|
12
12
|
* This function resolves when the server is closed.
|
|
13
13
|
*/
|
|
14
|
-
export declare const serveRequestListener: (requestListener: http.RequestListener, port?: number
|
|
14
|
+
export declare const serveRequestListener: (requestListener: http.RequestListener, port?: number) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
"url": "https://github.com/seek-oss/skuba/issues"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
+
"@octokit/graphql": "^4.8.0",
|
|
10
|
+
"@octokit/graphql-schema": "^10.73.0",
|
|
9
11
|
"@octokit/rest": "^18.12.0",
|
|
10
12
|
"@octokit/types": "^6.34.0",
|
|
11
|
-
"@types/jest": "^
|
|
13
|
+
"@types/jest": "^28.0.0",
|
|
12
14
|
"@types/node": ">=14.18",
|
|
13
15
|
"chalk": "^4.1.0",
|
|
14
16
|
"concurrently": "^7.0.0",
|
|
@@ -26,6 +28,7 @@
|
|
|
26
28
|
"is-installed-globally": "^0.4.0",
|
|
27
29
|
"isomorphic-git": "^1.11.1",
|
|
28
30
|
"jest": "^28.1.0",
|
|
31
|
+
"jest-watch-typeahead": "^1.1.0",
|
|
29
32
|
"latest-version": "^5.1.0",
|
|
30
33
|
"lodash.mergewith": "^4.6.2",
|
|
31
34
|
"normalize-package-data": "^4.0.0",
|
|
@@ -41,10 +44,10 @@
|
|
|
41
44
|
"strip-ansi": "^6.0.1",
|
|
42
45
|
"ts-jest": "^28.0.2",
|
|
43
46
|
"ts-node": "^10.7.0",
|
|
44
|
-
"ts-node-dev": "^2.0.0
|
|
47
|
+
"ts-node-dev": "^2.0.0",
|
|
45
48
|
"tsconfig-paths": "^4.0.0",
|
|
46
49
|
"tsconfig-seek": "1.0.2",
|
|
47
|
-
"typescript": "~4.
|
|
50
|
+
"typescript": "~4.7.0"
|
|
48
51
|
},
|
|
49
52
|
"description": "SEEK development toolkit for backend applications and packages",
|
|
50
53
|
"devDependencies": {
|
|
@@ -62,12 +65,13 @@
|
|
|
62
65
|
"@types/supertest": "2.0.12",
|
|
63
66
|
"enhanced-resolve": "5.9.3",
|
|
64
67
|
"express": "4.18.1",
|
|
68
|
+
"graphql-tag": "2.12.6",
|
|
65
69
|
"jsonfile": "6.1.0",
|
|
66
70
|
"koa": "2.13.4",
|
|
67
|
-
"memfs": "3.4.
|
|
71
|
+
"memfs": "3.4.4",
|
|
68
72
|
"semver": "7.3.7",
|
|
69
73
|
"supertest": "6.2.3",
|
|
70
|
-
"type-fest": "2.
|
|
74
|
+
"type-fest": "2.13.0"
|
|
71
75
|
},
|
|
72
76
|
"engines": {
|
|
73
77
|
"node": ">=14.18"
|
|
@@ -123,5 +127,5 @@
|
|
|
123
127
|
"version": "4.0.0"
|
|
124
128
|
},
|
|
125
129
|
"types": "./lib/index.d.ts",
|
|
126
|
-
"version": "4.
|
|
130
|
+
"version": "4.3.0-beta.0"
|
|
127
131
|
}
|
|
@@ -61,7 +61,7 @@ steps:
|
|
|
61
61
|
- *aws-sm
|
|
62
62
|
- *private-npm
|
|
63
63
|
- *docker-ecr-cache
|
|
64
|
-
- seek-jobs/gantry#v1.
|
|
64
|
+
- seek-jobs/gantry#v1.8.1:
|
|
65
65
|
command: build
|
|
66
66
|
file: gantry.build.yml
|
|
67
67
|
region: <%- region %>
|
|
@@ -78,7 +78,7 @@ steps:
|
|
|
78
78
|
concurrency_group: <%- teamName %>/deploy/gantry/<%- devGantryEnvironmentName %>
|
|
79
79
|
key: deploy-dev
|
|
80
80
|
plugins:
|
|
81
|
-
- seek-jobs/gantry#v1.
|
|
81
|
+
- seek-jobs/gantry#v1.8.1:
|
|
82
82
|
command: apply
|
|
83
83
|
environment: <%- devGantryEnvironmentName %>
|
|
84
84
|
file: gantry.apply.yml
|
|
@@ -93,7 +93,7 @@ steps:
|
|
|
93
93
|
concurrency_group: <%- teamName %>/deploy/gantry/<%- prodGantryEnvironmentName %>
|
|
94
94
|
depends_on: deploy-dev
|
|
95
95
|
plugins:
|
|
96
|
-
- seek-jobs/gantry#v1.
|
|
96
|
+
- seek-jobs/gantry#v1.8.1:
|
|
97
97
|
command: apply
|
|
98
98
|
environment: <%- prodGantryEnvironmentName %>
|
|
99
99
|
file: gantry.apply.yml
|
|
@@ -61,7 +61,7 @@ steps:
|
|
|
61
61
|
- *aws-sm
|
|
62
62
|
- *private-npm
|
|
63
63
|
- *docker-ecr-cache
|
|
64
|
-
- seek-jobs/gantry#v1.
|
|
64
|
+
- seek-jobs/gantry#v1.8.1:
|
|
65
65
|
command: build
|
|
66
66
|
file: gantry.build.yml
|
|
67
67
|
region: <%- region %>
|
|
@@ -78,7 +78,7 @@ steps:
|
|
|
78
78
|
concurrency_group: <%- teamName %>/deploy/gantry/<%- devGantryEnvironmentName %>
|
|
79
79
|
key: deploy-dev
|
|
80
80
|
plugins:
|
|
81
|
-
- seek-jobs/gantry#v1.
|
|
81
|
+
- seek-jobs/gantry#v1.8.1:
|
|
82
82
|
command: apply
|
|
83
83
|
environment: <%- devGantryEnvironmentName %>
|
|
84
84
|
file: gantry.apply.yml
|
|
@@ -93,7 +93,7 @@ steps:
|
|
|
93
93
|
concurrency_group: <%- teamName %>/deploy/gantry/<%- prodGantryEnvironmentName %>
|
|
94
94
|
depends_on: deploy-dev
|
|
95
95
|
plugins:
|
|
96
|
-
- seek-jobs/gantry#v1.
|
|
96
|
+
- seek-jobs/gantry#v1.8.1:
|
|
97
97
|
command: apply
|
|
98
98
|
environment: <%- prodGantryEnvironmentName %>
|
|
99
99
|
file: gantry.apply.yml
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"runtypes": "^6.4.1",
|
|
16
16
|
"runtypes-filter": "^0.6.0",
|
|
17
17
|
"seek-datadog-custom-metrics": "^4.0.0",
|
|
18
|
-
"seek-koala": "^
|
|
18
|
+
"seek-koala": "^6.0.0",
|
|
19
19
|
"skuba-dive": "^2.0.0",
|
|
20
20
|
"uuid": "^8.3.2"
|
|
21
21
|
},
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@types/supertest": "^2.0.11",
|
|
29
29
|
"@types/uuid": "^8.3.1",
|
|
30
30
|
"chance": "^1.1.8",
|
|
31
|
-
"pino-pretty": "^
|
|
31
|
+
"pino-pretty": "^8.0.0",
|
|
32
32
|
"skuba": "*",
|
|
33
33
|
"supertest": "^6.1.6"
|
|
34
34
|
},
|