skuba 3.15.3-beta.0 → 3.16.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/lib/api/github/checkRun.d.ts +14 -3
- package/lib/api/github/checkRun.js +77 -56
- package/lib/api/github/checkRun.js.map +1 -1
- package/lib/api/github/environment.d.ts +3 -0
- package/lib/api/github/environment.js +21 -0
- package/lib/api/github/environment.js.map +1 -0
- package/lib/api/github/index.d.ts +1 -1
- package/lib/api/github/index.js +2 -2
- package/lib/api/github/index.js.map +1 -1
- package/lib/cli/adapter/eslint.js +3 -4
- package/lib/cli/adapter/eslint.js.map +1 -1
- package/lib/cli/adapter/prettier.js +5 -4
- package/lib/cli/adapter/prettier.js.map +1 -1
- package/lib/cli/configure/refreshIgnoreFiles.d.ts +2 -0
- package/lib/cli/configure/refreshIgnoreFiles.js +55 -0
- package/lib/cli/configure/refreshIgnoreFiles.js.map +1 -0
- package/lib/cli/format.js +2 -0
- package/lib/cli/format.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js +0 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
- package/lib/cli/lint/annotate/github/eslint.js +1 -1
- package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/github/index.d.ts +1 -1
- package/lib/cli/lint/annotate/github/index.js +13 -5
- package/lib/cli/lint/annotate/github/index.js.map +1 -1
- package/lib/cli/lint/annotate/github/prettier.js +11 -8
- package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/github/tsc.js +37 -34
- package/lib/cli/lint/annotate/github/tsc.js.map +1 -1
- package/lib/cli/lint/annotate/index.d.ts +1 -1
- package/lib/cli/lint/annotate/index.js +2 -2
- package/lib/cli/lint/annotate/index.js.map +1 -1
- package/lib/cli/lint/external.js +13 -7
- package/lib/cli/lint/external.js.map +1 -1
- package/lib/cli/lint/index.js +2 -0
- package/lib/cli/lint/index.js.map +1 -1
- package/lib/utils/logging.d.ts +1 -2
- package/lib/utils/logging.js +3 -2
- package/lib/utils/logging.js.map +1 -1
- package/lib/utils/worker.d.ts +0 -1
- package/lib/wrapper/functionHandler.js +4 -1
- package/lib/wrapper/functionHandler.js.map +1 -1
- package/package.json +3 -3
- package/template/base/_.gitignore +1 -0
- package/template/express-rest-api/docker-compose.yml +4 -2
- package/template/greeter/docker-compose.yml +4 -2
- package/template/koa-rest-api/docker-compose.yml +4 -2
- package/template/lambda-sqs-worker/docker-compose.yml +3 -1
- package/template/lambda-sqs-worker/serverless.yml +1 -0
- package/template/lambda-sqs-worker-cdk/docker-compose.yml +3 -1
|
@@ -2,10 +2,21 @@ import { Endpoints } from '@octokit/types';
|
|
|
2
2
|
declare type Output = NonNullable<Endpoints['POST /repos/{owner}/{repo}/check-runs']['parameters']['output']>;
|
|
3
3
|
export declare type Annotation = NonNullable<Output['annotations']>[number];
|
|
4
4
|
interface CreateCheckRunParameters {
|
|
5
|
-
name: string;
|
|
6
|
-
summary: string;
|
|
7
5
|
annotations: Annotation[];
|
|
8
6
|
conclusion: 'failure' | 'success';
|
|
7
|
+
name: string;
|
|
8
|
+
summary: string;
|
|
9
|
+
title: string;
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Asynchronously creates a GitHub [check run] with annotations.
|
|
13
|
+
*
|
|
14
|
+
* The first 50 `annotations` are written in full to GitHub.
|
|
15
|
+
*
|
|
16
|
+
* A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with the `checks:write` permission
|
|
17
|
+
* must be present on the environment.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
*/
|
|
21
|
+
export declare const createCheckRun: ({ annotations, conclusion, name, summary, title, }: CreateCheckRunParameters) => Promise<void>;
|
|
11
22
|
export {};
|
|
@@ -8,83 +8,104 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
15
|
+
exports.createCheckRun = void 0;
|
|
13
16
|
const rest_1 = require("@octokit/rest");
|
|
17
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
18
|
+
const isomorphic_git_1 = __importDefault(require("isomorphic-git"));
|
|
19
|
+
const logging_1 = require("../../utils/logging");
|
|
14
20
|
const GITHUB_MAX_ANNOTATIONS = 50;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Matches the owner and repository names in a GitHub repository URL.
|
|
23
|
+
*
|
|
24
|
+
* For example, given the following input strings:
|
|
25
|
+
*
|
|
26
|
+
* ```console
|
|
27
|
+
* git@github.com:seek-oss/skuba.git
|
|
28
|
+
* https://github.com/seek-oss/skuba.git
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* This pattern will produce the following matches:
|
|
32
|
+
*
|
|
33
|
+
* 1. seek-oss
|
|
34
|
+
* 2. skuba
|
|
35
|
+
*/
|
|
36
|
+
const ownerRepoRegex = /github.com(?::|\/)(.+)\/(.+).git$/;
|
|
37
|
+
const getOwnerRepo = (dir) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
+
const remotes = yield isomorphic_git_1.default.listRemotes({ dir, fs: fs_extra_1.default });
|
|
39
|
+
for (const { url } of remotes) {
|
|
40
|
+
const match = ownerRepoRegex.exec(url);
|
|
41
|
+
const owner = match === null || match === void 0 ? void 0 : match[1];
|
|
42
|
+
const repo = match === null || match === void 0 ? void 0 : match[2];
|
|
43
|
+
if (owner && repo) {
|
|
44
|
+
return { owner, repo };
|
|
45
|
+
}
|
|
30
46
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
|
|
47
|
+
throw new Error('Could not find a GitHub remote');
|
|
48
|
+
});
|
|
49
|
+
const getHeadSha = (dir) => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
+
const [commit] = yield isomorphic_git_1.default.log({ depth: 1, dir, fs: fs_extra_1.default });
|
|
51
|
+
return commit.oid;
|
|
52
|
+
});
|
|
36
53
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
54
|
+
* Suffixes the title with the number of annotations added, e.g.
|
|
55
|
+
*
|
|
56
|
+
* ```text
|
|
57
|
+
* Build #12 failed (24 annotations added)
|
|
58
|
+
* ```
|
|
41
59
|
*/
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const numAnnotations = annotationsLength > GITHUB_MAX_ANNOTATIONS
|
|
60
|
+
const suffixTitle = (title, inputAnnotations) => {
|
|
61
|
+
const addedAnnotations = inputAnnotations > GITHUB_MAX_ANNOTATIONS
|
|
45
62
|
? GITHUB_MAX_ANNOTATIONS
|
|
46
|
-
:
|
|
47
|
-
|
|
48
|
-
const plural = numAnnotations === 1 ? '' : 's';
|
|
49
|
-
return `${build} ${status} (${numAnnotations} annotation${plural} added)`;
|
|
63
|
+
: inputAnnotations;
|
|
64
|
+
return `${title} (${(0, logging_1.pluralise)(addedAnnotations, 'annotation')} added)`;
|
|
50
65
|
};
|
|
51
66
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @param summary - report summary
|
|
54
|
-
* @param annotationsLength - Number of annotations added
|
|
55
|
-
* @returns summary with extra metadata
|
|
67
|
+
* Enriches the summary with more context about the check run.
|
|
56
68
|
*/
|
|
57
|
-
const createEnrichedSummary = (summary,
|
|
69
|
+
const createEnrichedSummary = (summary, inputAnnotations) => [
|
|
58
70
|
summary,
|
|
59
|
-
...(
|
|
71
|
+
...(inputAnnotations > GITHUB_MAX_ANNOTATIONS
|
|
60
72
|
? [
|
|
61
|
-
|
|
73
|
+
`${inputAnnotations} annotations were provided, but only the first ${GITHUB_MAX_ANNOTATIONS} are visible in GitHub.`,
|
|
62
74
|
]
|
|
63
75
|
: []),
|
|
64
76
|
].join('\n\n');
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Asynchronously creates a GitHub [check run] with annotations.
|
|
79
|
+
*
|
|
80
|
+
* The first 50 `annotations` are written in full to GitHub.
|
|
81
|
+
*
|
|
82
|
+
* A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with the `checks:write` permission
|
|
83
|
+
* must be present on the environment.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
*/
|
|
87
|
+
const createCheckRun = ({ annotations, conclusion, name, summary, title, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
88
|
+
var _a;
|
|
89
|
+
const dir = process.cwd();
|
|
90
|
+
const [headSha, { owner, repo }] = yield Promise.all([
|
|
91
|
+
getHeadSha(dir),
|
|
92
|
+
getOwnerRepo(dir),
|
|
93
|
+
]);
|
|
69
94
|
const client = new rest_1.Octokit({
|
|
70
|
-
auth: process.env.GITHUB_API_TOKEN,
|
|
95
|
+
auth: (_a = process.env.GITHUB_API_TOKEN) !== null && _a !== void 0 ? _a : process.env.GITHUB_TOKEN,
|
|
71
96
|
});
|
|
72
|
-
const { owner, repo } = getOwnerRepo();
|
|
73
|
-
const title = createTitle(conclusion, annotations.length);
|
|
74
|
-
const enrichedSummary = createEnrichedSummary(summary, annotations.length);
|
|
75
|
-
const checkRunName = `skuba/${name}`;
|
|
76
97
|
yield client.checks.create({
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
name
|
|
98
|
+
conclusion,
|
|
99
|
+
head_sha: headSha,
|
|
100
|
+
name,
|
|
80
101
|
output: {
|
|
81
|
-
title,
|
|
82
|
-
summary: enrichedSummary,
|
|
83
102
|
annotations: annotations.slice(0, GITHUB_MAX_ANNOTATIONS),
|
|
103
|
+
summary: createEnrichedSummary(summary, annotations.length),
|
|
104
|
+
title: suffixTitle(title, annotations.length),
|
|
84
105
|
},
|
|
85
|
-
|
|
86
|
-
|
|
106
|
+
owner,
|
|
107
|
+
repo,
|
|
87
108
|
});
|
|
88
109
|
});
|
|
89
|
-
exports.
|
|
110
|
+
exports.createCheckRun = createCheckRun;
|
|
90
111
|
//# sourceMappingURL=checkRun.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkRun.js","sourceRoot":"","sources":["../../../src/api/github/checkRun.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkRun.js","sourceRoot":"","sources":["../../../src/api/github/checkRun.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wCAAwC;AAExC,wDAA0B;AAC1B,oEAAiC;AAEjC,iDAAgD;AAQhD,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAElC;;;;;;;;;;;;;;GAcG;AACH,MAAM,cAAc,GAAG,mCAAmC,CAAC;AAE3D,MAAM,YAAY,GAAG,CACnB,GAAW,EAC+B,EAAE;IAC5C,MAAM,OAAO,GAAG,MAAM,wBAAG,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,EAAE,EAAF,kBAAE,EAAE,CAAC,CAAC;IAEnD,KAAK,MAAM,EAAE,GAAG,EAAE,IAAI,OAAO,EAAE;QAC7B,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEvC,MAAM,KAAK,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,CAAC,CAAC;QACzB,MAAM,IAAI,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,CAAC,CAAC;QAExB,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,OAAO,EAA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,UAAU,CAAC,GAAG,CAAC;QACf,YAAY,CAAC,GAAG,CAAC;KAClB,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAI,cAAO,CAAC;QACzB,IAAI,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,gBAAgB,mCAAI,OAAO,CAAC,GAAG,CAAC,YAAY;KAC/D,CAAC,CAAC;IAEH,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QACzB,UAAU;QACV,QAAQ,EAAE,OAAO;QACjB,IAAI;QACJ,MAAM,EAAE;YACN,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,sBAAsB,CAAC;YACzD,OAAO,EAAE,qBAAqB,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC;YAC3D,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC;SAC9C;QACD,KAAK;QACL,IAAI;KACL,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AA9BW,QAAA,cAAc,kBA8BzB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enabledFromEnvironment = exports.buildNameFromEnvironment = void 0;
|
|
4
|
+
const buildNameFromEnvironment = (env = process.env) => {
|
|
5
|
+
var _a;
|
|
6
|
+
if (env.BUILDKITE_BUILD_NUMBER) {
|
|
7
|
+
return `Build #${env.BUILDKITE_BUILD_NUMBER}`;
|
|
8
|
+
}
|
|
9
|
+
if (env.GITHUB_RUN_NUMBER) {
|
|
10
|
+
return `${(_a = env.GITHUB_WORKFLOW) !== null && _a !== void 0 ? _a : 'Build'} #${env.GITHUB_RUN_NUMBER}`;
|
|
11
|
+
}
|
|
12
|
+
return 'Build';
|
|
13
|
+
};
|
|
14
|
+
exports.buildNameFromEnvironment = buildNameFromEnvironment;
|
|
15
|
+
const enabledFromEnvironment = (env = process.env) =>
|
|
16
|
+
// Running in a CI environment.
|
|
17
|
+
Boolean(env.BUILDKITE || env.CI || env.GITHUB_ACTIONS) &&
|
|
18
|
+
// Has an API token at the ready.
|
|
19
|
+
Boolean(env.GITHUB_API_TOKEN || env.GITHUB_TOKEN);
|
|
20
|
+
exports.enabledFromEnvironment = enabledFromEnvironment;
|
|
21
|
+
//# sourceMappingURL=environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/api/github/environment.ts"],"names":[],"mappings":";;;AAAO,MAAM,wBAAwB,GAAG,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAU,EAAE;;IACpE,IAAI,GAAG,CAAC,sBAAsB,EAAE;QAC9B,OAAO,UAAU,GAAG,CAAC,sBAAsB,EAAE,CAAC;KAC/C;IAED,IAAI,GAAG,CAAC,iBAAiB,EAAE;QACzB,OAAO,GAAG,MAAA,GAAG,CAAC,eAAe,mCAAI,OAAO,KAAK,GAAG,CAAC,iBAAiB,EAAE,CAAC;KACtE;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAVW,QAAA,wBAAwB,4BAUnC;AAEK,MAAM,sBAAsB,GAAG,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAW,EAAE;AACnE,+BAA+B;AAC/B,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,cAAc,CAAC;IACtD,iCAAiC;IACjC,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;AAJvC,QAAA,sBAAsB,0BAIiB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { Annotation } from './checkRun';
|
|
2
|
-
export {
|
|
2
|
+
export { createCheckRun } from './checkRun';
|
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.
|
|
3
|
+
exports.createCheckRun = void 0;
|
|
4
4
|
var checkRun_1 = require("./checkRun");
|
|
5
|
-
Object.defineProperty(exports, "
|
|
5
|
+
Object.defineProperty(exports, "createCheckRun", { enumerable: true, get: function () { return checkRun_1.createCheckRun; } });
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/github/index.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/github/index.ts"],"names":[],"mappings":";;;AACA,uCAA4C;AAAnC,0GAAA,cAAc,OAAA"}
|
|
@@ -16,6 +16,7 @@ exports.runESLint = void 0;
|
|
|
16
16
|
const path_1 = __importDefault(require("path"));
|
|
17
17
|
const chalk_1 = __importDefault(require("chalk"));
|
|
18
18
|
const eslint_1 = require("eslint");
|
|
19
|
+
const logging_1 = require("../../utils/logging");
|
|
19
20
|
const symbolForResult = (result) => {
|
|
20
21
|
if (result.errorCount) {
|
|
21
22
|
return chalk_1.default.red('○');
|
|
@@ -25,9 +26,7 @@ const symbolForResult = (result) => {
|
|
|
25
26
|
const runESLint = (mode, logger) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
27
|
logger.debug('Initialising ESLint...');
|
|
27
28
|
const engine = new eslint_1.ESLint({
|
|
28
|
-
|
|
29
|
-
// everyone can apply to update their `.gitignore` files.
|
|
30
|
-
// cache: true,
|
|
29
|
+
cache: true,
|
|
31
30
|
extensions: ['js', 'ts', 'tsx'],
|
|
32
31
|
fix: mode === 'format',
|
|
33
32
|
reportUnusedDisableDirectives: 'error',
|
|
@@ -40,7 +39,7 @@ const runESLint = (mode, logger) => __awaiter(void 0, void 0, void 0, function*
|
|
|
40
39
|
engine.lintFiles('.'),
|
|
41
40
|
]);
|
|
42
41
|
const end = process.hrtime.bigint();
|
|
43
|
-
logger.plain(`Processed ${
|
|
42
|
+
logger.plain(`Processed ${(0, logging_1.pluralise)(results.length, 'file')} in ${logger.timing(start, end)}.`);
|
|
44
43
|
const errors = [];
|
|
45
44
|
const warnings = [];
|
|
46
45
|
for (const result of results) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.js","sourceRoot":"","sources":["../../../src/cli/adapter/eslint.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,kDAA0B;AAC1B,mCAAwC;
|
|
1
|
+
{"version":3,"file":"eslint.js","sourceRoot":"","sources":["../../../src/cli/adapter/eslint.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,kDAA0B;AAC1B,mCAAwC;AAExC,iDAAwD;AAExD,MAAM,eAAe,GAAG,CAAC,MAAyB,EAAE,EAAE;IACpD,IAAI,MAAM,CAAC,UAAU,EAAE;QACrB,OAAO,eAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KACvB;IAED,OAAO,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,eAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,eAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACpE,CAAC,CAAC;AAcK,MAAM,SAAS,GAAG,CACvB,IAAuB,EACvB,MAAc,EACS,EAAE;IACzB,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAEvC,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC;QACxB,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC;QAC/B,GAAG,EAAE,IAAI,KAAK,QAAQ;QACtB,6BAA6B,EAAE,OAAO;KACvC,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE1B,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAEpC,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CA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AE;QACV,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KACtB;IAED,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC1C,CAAC,CAAA,CAAC;AAlEW,QAAA,SAAS,aAkEpB"}
|
|
@@ -17,6 +17,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
17
17
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
18
18
|
const prettier_1 = require("prettier");
|
|
19
19
|
const dir_1 = require("../../utils/dir");
|
|
20
|
+
const logging_1 = require("../../utils/logging");
|
|
20
21
|
const manifest_1 = require("../../utils/manifest");
|
|
21
22
|
const formatOrLintFile = ({ data, filepath, options, parser }, logger, mode, result) => {
|
|
22
23
|
logger.debug(filepath);
|
|
@@ -75,7 +76,7 @@ const runPrettier = (mode, logger) => __awaiter(void 0, void 0, void 0, function
|
|
|
75
76
|
// This avoids exhibiting different behaviour than a Prettier IDE integration,
|
|
76
77
|
// and the headache of conflicting `.gitignore` and `.prettierignore` rules.
|
|
77
78
|
const filepaths = yield (0, dir_1.crawlDirectory)(directory, '.prettierignore');
|
|
78
|
-
logger.debug(`Discovered ${
|
|
79
|
+
logger.debug(`Discovered ${(0, logging_1.pluralise)(filepaths.length, 'file')}.`);
|
|
79
80
|
const result = {
|
|
80
81
|
count: filepaths.length,
|
|
81
82
|
errored: [],
|
|
@@ -102,15 +103,15 @@ const runPrettier = (mode, logger) => __awaiter(void 0, void 0, void 0, function
|
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
const end = process.hrtime.bigint();
|
|
105
|
-
logger.plain(`Processed ${
|
|
106
|
+
logger.plain(`Processed ${(0, logging_1.pluralise)(result.count - result.unparsed.length, 'file')} in ${logger.timing(start, end)}.`);
|
|
106
107
|
if (result.touched.length) {
|
|
107
|
-
logger.plain(`Formatted ${
|
|
108
|
+
logger.plain(`Formatted ${(0, logging_1.pluralise)(result.touched.length, 'file')}:`);
|
|
108
109
|
for (const filepath of result.touched) {
|
|
109
110
|
logger.warn(filepath);
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
if (result.errored.length) {
|
|
113
|
-
logger.plain(`Flagged ${
|
|
114
|
+
logger.plain(`Flagged ${(0, logging_1.pluralise)(result.errored.length, 'file')}:`);
|
|
114
115
|
for (const { err, filepath } of result.errored) {
|
|
115
116
|
logger.warn(filepath, ...(err ? [String(err)] : []));
|
|
116
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prettier.js","sourceRoot":"","sources":["../../../src/cli/adapter/prettier.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,wDAA0B;AAC1B,uCAA8E;AAE9E,yCAAiD;
|
|
1
|
+
{"version":3,"file":"prettier.js","sourceRoot":"","sources":["../../../src/cli/adapter/prettier.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,wDAA0B;AAC1B,uCAA8E;AAE9E,yCAAiD;AACjD,iDAAwD;AACxD,mDAA2D;AAgB3D,MAAM,gBAAgB,GAAG,CACvB,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAQ,EACzC,MAAc,EACd,IAAuB,EACvB,MAAc,EACM,EAAE;IACtB,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAEvB,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,GAAG,CAAC,CAAC;IAEzC,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/B,OAAO;KACR;IAED,IAAI,IAAI,KAAK,MAAM,EAAE;QACnB,IAAI,EAAW,CAAC;QAChB,IAAI;YACF,EAAE,GAAG,IAAA,gBAAK,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SAC3B;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM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AAE,CAAC;IAEpC,MAAM,CAAC,KAAK,CACV,aAAa,IAAA,mBAAS,EACpB,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,EACrC,MAAM,CACP,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CACrC,CAAC;IAEF,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE;QACzB,MAAM,CAAC,KAAK,CAAC,aAAa,IAAA,mBAAS,EAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;QACvE,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,OAAO,EAAE;YACrC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACvB;KACF;IAED,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE;QACzB,MAAM,CAAC,KAAK,CAAC,WAAW,IAAA,mBAAS,EAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;QACrE,KAAK,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,MAAM,CAAC,OAAO,EAAE;YAC9C,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACtD;KACF;IAED,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;AACrD,CAAC,CAAA,CAAC;AApFW,QAAA,WAAW,eAoFtB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.tryRefreshIgnoreFiles = exports.refreshIgnoreFiles = void 0;
|
|
16
|
+
const path_1 = __importDefault(require("path"));
|
|
17
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
18
|
+
const logging_1 = require("../../utils/logging");
|
|
19
|
+
const template_1 = require("../../utils/template");
|
|
20
|
+
const package_1 = require("./analysis/package");
|
|
21
|
+
const project_1 = require("./analysis/project");
|
|
22
|
+
const ignoreFile_1 = require("./processing/ignoreFile");
|
|
23
|
+
const refreshIgnoreFiles = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
const manifest = yield (0, package_1.getDestinationManifest)();
|
|
25
|
+
const destinationRoot = path_1.default.dirname(manifest.path);
|
|
26
|
+
const readDestinationFile = (0, project_1.createDestinationFileReader)(destinationRoot);
|
|
27
|
+
const refreshIgnoreFile = (filename) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
const [inputFile, templateFile] = yield Promise.all([
|
|
29
|
+
readDestinationFile(filename),
|
|
30
|
+
(0, template_1.readBaseTemplateFile)(`_${filename}`),
|
|
31
|
+
]);
|
|
32
|
+
const data = inputFile
|
|
33
|
+
? (0, ignoreFile_1.mergeWithIgnoreFile)(templateFile)(inputFile)
|
|
34
|
+
: templateFile;
|
|
35
|
+
const filepath = path_1.default.join(destinationRoot, filename);
|
|
36
|
+
yield fs_extra_1.default.promises.writeFile(filepath, data);
|
|
37
|
+
});
|
|
38
|
+
yield Promise.all([
|
|
39
|
+
refreshIgnoreFile('.eslintignore'),
|
|
40
|
+
refreshIgnoreFile('.gitignore'),
|
|
41
|
+
refreshIgnoreFile('.prettierignore'),
|
|
42
|
+
]);
|
|
43
|
+
});
|
|
44
|
+
exports.refreshIgnoreFiles = refreshIgnoreFiles;
|
|
45
|
+
const tryRefreshIgnoreFiles = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
try {
|
|
47
|
+
yield (0, exports.refreshIgnoreFiles)();
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
logging_1.log.warn('Failed to refresh ignore files.');
|
|
51
|
+
logging_1.log.warn(err);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
exports.tryRefreshIgnoreFiles = tryRefreshIgnoreFiles;
|
|
55
|
+
//# sourceMappingURL=refreshIgnoreFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refreshIgnoreFiles.js","sourceRoot":"","sources":["../../../src/cli/configure/refreshIgnoreFiles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,wDAA0B;AAE1B,iDAA0C;AAC1C,mDAA4D;AAE5D,gDAA4D;AAC5D,gDAAiE;AACjE,wDAA8D;AAEvD,MAAM,kBAAkB,GAAG,GAAS,EAAE;IAC3C,MAAM,QAAQ,GAAG,MAAM,IAAA,gCAAsB,GAAE,CAAC;IAEhD,MAAM,eAAe,GAAG,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEpD,MAAM,mBAAmB,GAAG,IAAA,qCAA2B,EAAC,eAAe,CAAC,CAAC;IAEzE,MAAM,iBAAiB,GAAG,CAAO,QAAgB,EAAE,EAAE;QACnD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAClD,mBAAmB,CAAC,QAAQ,CAAC;YAC7B,IAAA,+BAAoB,EAAC,IAAI,QAAQ,EAAE,CAAC;SACrC,CAAC,CAAC;QAEH,MAAM,IAAI,GAAG,SAAS;YACpB,CAAC,CAAC,IAAA,gCAAmB,EAAC,YAAY,CAAC,CAAC,SAAS,CAAC;YAC9C,CAAC,CAAC,YAAY,CAAC;QAEjB,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;QAEtD,MAAM,kBAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC,CAAA,CAAC;IAEF,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,iBAAiB,CAAC,eAAe,CAAC;QAClC,iBAAiB,CAAC,YAAY,CAAC;QAC/B,iBAAiB,CAAC,iBAAiB,CAAC;KACrC,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AA3BW,QAAA,kBAAkB,sBA2B7B;AAEK,MAAM,qBAAqB,GAAG,GAAS,EAAE;IAC9C,IAAI;QACF,MAAM,IAAA,0BAAkB,GAAE,CAAC;KAC5B;IAAC,OAAO,GAAG,EAAE;QACZ,aAAG,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAC5C,aAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACf;AACH,CAAC,CAAA,CAAC;AAPW,QAAA,qBAAqB,yBAOhC"}
|
package/lib/cli/format.js
CHANGED
|
@@ -18,7 +18,9 @@ const args_1 = require("../utils/args");
|
|
|
18
18
|
const logging_1 = require("../utils/logging");
|
|
19
19
|
const eslint_1 = require("./adapter/eslint");
|
|
20
20
|
const prettier_1 = require("./adapter/prettier");
|
|
21
|
+
const refreshIgnoreFiles_1 = require("./configure/refreshIgnoreFiles");
|
|
21
22
|
const format = (args = process.argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
+
yield (0, refreshIgnoreFiles_1.tryRefreshIgnoreFiles)();
|
|
22
24
|
const debug = (0, args_1.hasDebugFlag)(args);
|
|
23
25
|
logging_1.log.plain(chalk_1.default.magenta('ESLint'));
|
|
24
26
|
const eslint = yield (0, eslint_1.runESLint)('format', (0, logging_1.createLogger)(debug));
|
package/lib/cli/format.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/cli/format.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAE1B,wCAA6C;AAC7C,8CAAqD;AAErD,6CAA6C;AAC7C,iDAAiD;
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/cli/format.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAE1B,wCAA6C;AAC7C,8CAAqD;AAErD,6CAA6C;AAC7C,iDAAiD;AACjD,uEAAuE;AAEhE,MAAM,MAAM,GAAG,CAAO,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,EAAE;IAClD,MAAM,IAAA,0CAAqB,GAAE,CAAC;IAE9B,MAAM,KAAK,GAAG,IAAA,mBAAY,EAAC,IAAI,CAAC,CAAC;IAEjC,aAAG,CAAC,KAAK,CAAC,eAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEnC,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,QAAQ,EAAE,IAAA,sBAAY,EAAC,KAAK,CAAC,CAAC,CAAC;IAE9D,aAAG,CAAC,OAAO,EAAE,CAAC;IACd,aAAG,CAAC,KAAK,CAAC,eAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAElC,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAW,EAAC,QAAQ,EAAE,IAAA,sBAAY,EAAC,KAAK,CAAC,CAAC,CAAC;IAElE,IAAI,MAAM,CAAC,EAAE,IAAI,QAAQ,CAAC,EAAE,EAAE;QAC5B,OAAO;KACR;IAED,MAAM,KAAK,GAAG;QACZ,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QAChC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;KACrC,CAAC;IAEF,aAAG,CAAC,OAAO,EAAE,CAAC;IACd,aAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,mCAAmC,CAAC,CAAC;IAE/D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAA,CAAC;AA3BW,QAAA,MAAM,UA2BjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsc.js","sourceRoot":"","sources":["../../../../../src/cli/lint/annotate/buildkite/tsc.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,qEAAuD;AAGhD,MAAM,oBAAoB,GAAG,CAClC,KAAc,EACd,eAAkC,EACxB,EAAE,CACZ,CAAC,KAAK;IACJ,CAAC,CAAC;QACE,SAAS;QACT,SAAS,CAAC,EAAE,CAAC,QAAQ,CACnB,eAAe;aACZ,MAAM,EAAE;aACR,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,OAAO,CAAC;aACf,
|
|
1
|
+
{"version":3,"file":"tsc.js","sourceRoot":"","sources":["../../../../../src/cli/lint/annotate/buildkite/tsc.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,qEAAuD;AAGhD,MAAM,oBAAoB,GAAG,CAClC,KAAc,EACd,eAAkC,EACxB,EAAE,CACZ,CAAC,KAAK;IACJ,CAAC,CAAC;QACE,SAAS;QACT,SAAS,CAAC,EAAE,CAAC,QAAQ,CACnB,eAAe;aACZ,MAAM,EAAE;aACR,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,OAAO,CAAC;aACf,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;aAC9C,IAAI,CAAC,IAAI,CAAC;aACV,IAAI,EAAE,CACV;KACF;IACH,CAAC,CAAC,EAAE,CAAC;AAjBI,QAAA,oBAAoB,wBAiBxB"}
|
|
@@ -6,7 +6,7 @@ const createEslintAnnotations = (eslint) => [...eslint.errors, ...eslint.warning
|
|
|
6
6
|
// Annotations only support start_column and end_column on the same line.
|
|
7
7
|
const isSameLine = message.line === message.endLine;
|
|
8
8
|
const startColumn = isSameLine && message.column;
|
|
9
|
-
const endColumn = isSameLine &&
|
|
9
|
+
const endColumn = (isSameLine && message.endColumn) || startColumn;
|
|
10
10
|
return Object.assign(Object.assign(Object.assign({ annotation_level: message.severity === 2 ? 'failure' : 'warning', start_line: (_a = message.line) !== null && _a !== void 0 ? _a : 1, end_line: (_c = (_b = message.endLine) !== null && _b !== void 0 ? _b : message.line) !== null && _c !== void 0 ? _c : 1 }, (startColumn && { start_column: startColumn })), (endColumn && { end_column: endColumn })), { message: message.message, path: result.filePath, title: `ESLint${message.ruleId ? ` (${message.ruleId})` : ''}` });
|
|
11
11
|
}));
|
|
12
12
|
exports.createEslintAnnotations = createEslintAnnotations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.js","sourceRoot":"","sources":["../../../../../src/cli/lint/annotate/github/eslint.ts"],"names":[],"mappings":";;;AAGO,MAAM,uBAAuB,GAAG,CACrC,MAAoB,EACC,EAAE,CACvB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"eslint.js","sourceRoot":"","sources":["../../../../../src/cli/lint/annotate/github/eslint.ts"],"names":[],"mappings":";;;AAGO,MAAM,uBAAuB,GAAG,CACrC,MAAoB,EACC,EAAE,CACvB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAoB,CAAC,MAAM,EAAE,EAAE,CAC3E,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAqB,EAAE;;IACjD,yEAAyE;IACzE,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,OAAO,CAAC;IACpD,MAAM,WAAW,GAAG,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IACjD,MAAM,SAAS,GAAG,CAAC,UAAU,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC;IAEnE,mDACE,gBAAgB,EAAE,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAChE,UAAU,EAAE,MAAA,OAAO,CAAC,IAAI,mCAAI,CAAC,EAC7B,QAAQ,EAAE,MAAA,MAAA,OAAO,CAAC,OAAO,mCAAI,OAAO,CAAC,IAAI,mCAAI,CAAC,IAC3C,CAAC,WAAW,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,GAC9C,CAAC,SAAS,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,KAC3C,OAAO,EAAE,OAAO,CAAC,OAAO,EACxB,IAAI,EAAE,MAAM,CAAC,QAAQ,EACrB,KAAK,EAAE,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAC9D;AACJ,CAAC,CAAC,CACH,CAAC;AArBS,QAAA,uBAAuB,2BAqBhC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ESLintOutput } from '../../../../cli/adapter/eslint';
|
|
2
2
|
import { PrettierOutput } from '../../../../cli/adapter/prettier';
|
|
3
3
|
import { StreamInterceptor } from '../../../../cli/lint/external';
|
|
4
|
-
export declare const createGitHubAnnotations: (eslint: ESLintOutput, prettier: PrettierOutput, tscOk: boolean, tscOutputStream: StreamInterceptor
|
|
4
|
+
export declare const createGitHubAnnotations: (eslint: ESLintOutput, prettier: PrettierOutput, tscOk: boolean, tscOutputStream: StreamInterceptor) => Promise<void>;
|
|
@@ -30,10 +30,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.createGitHubAnnotations = void 0;
|
|
32
32
|
const GitHub = __importStar(require("../../../../api/github"));
|
|
33
|
+
const environment_1 = require("../../../../api/github/environment");
|
|
33
34
|
const eslint_1 = require("./eslint");
|
|
34
35
|
const prettier_1 = require("./prettier");
|
|
35
36
|
const tsc_1 = require("./tsc");
|
|
36
|
-
const createGitHubAnnotations = (eslint, prettier, tscOk, tscOutputStream
|
|
37
|
+
const createGitHubAnnotations = (eslint, prettier, tscOk, tscOutputStream) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
+
if (!(0, environment_1.enabledFromEnvironment)()) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
37
41
|
const annotations = [
|
|
38
42
|
...(0, eslint_1.createEslintAnnotations)(eslint),
|
|
39
43
|
...(0, prettier_1.createPrettierAnnotations)(prettier),
|
|
@@ -41,12 +45,16 @@ const createGitHubAnnotations = (eslint, prettier, tscOk, tscOutputStream, summa
|
|
|
41
45
|
];
|
|
42
46
|
const isOk = eslint.ok && prettier.ok && tscOk;
|
|
43
47
|
const conclusion = isOk ? 'success' : 'failure';
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
const summary = isOk
|
|
49
|
+
? '`skuba lint` passed.'
|
|
50
|
+
: '`skuba lint` found issues that require triage.';
|
|
51
|
+
const build = (0, environment_1.buildNameFromEnvironment)();
|
|
52
|
+
yield GitHub.createCheckRun({
|
|
53
|
+
name: 'skuba/lint',
|
|
54
|
+
summary,
|
|
48
55
|
annotations,
|
|
49
56
|
conclusion,
|
|
57
|
+
title: `${build} ${isOk ? 'passed' : 'failed'}`,
|
|
50
58
|
});
|
|
51
59
|
});
|
|
52
60
|
exports.createGitHubAnnotations = createGitHubAnnotations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cli/lint/annotate/github/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAAiD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cli/lint/annotate/github/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAAiD;AACjD,oEAG4C;AAK5C,qCAAmD;AACnD,yCAAuD;AACvD,+BAA6C;AAEtC,MAAM,uBAAuB,GAAG,CACrC,MAAoB,EACpB,QAAwB,EACxB,KAAc,EACd,eAAkC,EAClC,EAAE;IACF,IAAI,CAAC,IAAA,oCAAsB,GAAE,EAAE;QAC7B,OAAO;KACR;IAED,MAAM,WAAW,GAAwB;QACvC,GAAG,IAAA,gCAAuB,EAAC,MAAM,CAAC;QAClC,GAAG,IAAA,oCAAyB,EAAC,QAAQ,CAAC;QACtC,GAAG,IAAA,0BAAoB,EAAC,KAAK,EAAE,eAAe,CAAC;KAChD,CAAC;IAEF,MAAM,IAAI,GAAG,MAAM,CAAC,EAAE,IAAI,QAAQ,CAAC,EAAE,IAAI,KAAK,CAAC;IAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IAEhD,MAAM,OAAO,GAAG,IAAI;QAClB,CAAC,CAAC,sBAAsB;QACxB,CAAC,CAAC,gDAAgD,CAAC;IAErD,MAAM,KAAK,GAAG,IAAA,sCAAwB,GAAE,CAAC;IAEzC,MAAM,MAAM,CAAC,cAAc,CAAC;QAC1B,IAAI,EAAE,YAAY;QAClB,OAAO;QACP,WAAW;QACX,UAAU;QACV,KAAK,EAAE,GAAG,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE;KAChD,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAhCW,QAAA,uBAAuB,2BAgClC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPrettierAnnotations = void 0;
|
|
4
|
-
const createPrettierAnnotations = (prettier) => prettier.result.errored.map((result) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
const createPrettierAnnotations = (prettier) => prettier.result.errored.map((result) => {
|
|
5
|
+
const message = result.err instanceof Error ? result.err.message : result.err;
|
|
6
|
+
return {
|
|
7
|
+
annotation_level: 'failure',
|
|
8
|
+
start_line: 1,
|
|
9
|
+
end_line: 1,
|
|
10
|
+
path: result.filepath,
|
|
11
|
+
message: message ? String(message) : 'This file has not been formatted.',
|
|
12
|
+
title: 'Prettier',
|
|
13
|
+
};
|
|
14
|
+
});
|
|
12
15
|
exports.createPrettierAnnotations = createPrettierAnnotations;
|
|
13
16
|
//# sourceMappingURL=prettier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prettier.js","sourceRoot":"","sources":["../../../../../src/cli/lint/annotate/github/prettier.ts"],"names":[],"mappings":";;;AAGO,MAAM,yBAAyB,GAAG,CACvC,QAAwB,EACH,EAAE,CACvB,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"prettier.js","sourceRoot":"","sources":["../../../../../src/cli/lint/annotate/github/prettier.ts"],"names":[],"mappings":";;;AAGO,MAAM,yBAAyB,GAAG,CACvC,QAAwB,EACH,EAAE,CACvB,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;IACrC,MAAM,OAAO,GACX,MAAM,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;IAEhE,OAAO;QACL,gBAAgB,EAAE,SAAS;QAC3B,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;QACX,IAAI,EAAE,MAAM,CAAC,QAAQ;QACrB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,mCAAmC;QACxE,KAAK,EAAE,UAAU;KAClB,CAAC;AACJ,CAAC,CAAC,CAAC;AAfQ,QAAA,yBAAyB,6BAejC"}
|
|
@@ -6,51 +6,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.createTscAnnotations = void 0;
|
|
7
7
|
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
8
8
|
/**
|
|
9
|
-
* Matches the tsc
|
|
9
|
+
* Matches the `tsc │` prefix on each `tsc` log.
|
|
10
10
|
*/
|
|
11
|
-
const tscPrefixRegex = new RegExp(/(tsc\s+│ )/, 'g');
|
|
12
11
|
/**
|
|
13
|
-
* Matches regular and pretty tsc output
|
|
12
|
+
* Matches regular and pretty `tsc` output.
|
|
13
|
+
*
|
|
14
|
+
* For example, given the following input string:
|
|
15
|
+
*
|
|
16
|
+
* ```console
|
|
14
17
|
* src/skuba.ts:43:7 - error TS2769: No overload matches this call.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
* Overload 1 of 2, '(obj: LogContext, msg?: string | undefined, ...args: any[]): void', gave the following error.
|
|
19
|
+
* Argument of type 'unknown' is not assignable to parameter of type 'LogContext'.
|
|
20
|
+
* Overload 2 of 2, '(msg?: string | undefined, ...args: any[]): void', gave the following error.
|
|
21
|
+
* Argument of type 'unknown' is not assignable to parameter of type 'string | undefined'.
|
|
22
|
+
* Type 'unknown' is not assignable to type 'string'.
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* This pattern will produce the following matches:
|
|
26
|
+
*
|
|
27
|
+
* 1. src/skuba.ts
|
|
28
|
+
* 2. 43
|
|
29
|
+
* 3. 7
|
|
30
|
+
* 4. error
|
|
31
|
+
* 5. 2769
|
|
32
|
+
* 6. No overload matches this call [...] not assignable to type 'string'.
|
|
26
33
|
*/
|
|
27
|
-
const tscOutputRegex =
|
|
34
|
+
const tscOutputRegex = /([^\s].*)[\(:](\d+)[,:](\d+)(?:\):\s+|\s+-\s+)(error|warning|info)\s+TS(\d+)\s*:\s*([\s\S]*?)(?=\n\S)(?=\n\D)/g;
|
|
28
35
|
const annotationLevelMap = {
|
|
29
36
|
error: 'failure',
|
|
30
37
|
warning: 'warning',
|
|
31
38
|
info: 'notice',
|
|
32
39
|
};
|
|
33
40
|
const createTscAnnotations = (tscOk, tscOutputStream) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const rawOutput = (0, strip_ansi_1.default)(tscOutputStream.output()).replace(tscPrefixRegex, '');
|
|
37
|
-
const matches = rawOutput.matchAll(tscOutputRegex);
|
|
38
|
-
for (const match of matches) {
|
|
39
|
-
if ((match === null || match === void 0 ? void 0 : match.length) === 7) {
|
|
40
|
-
annotations.push({
|
|
41
|
-
annotation_level: annotationLevelMap[match[4]],
|
|
42
|
-
path: match[1],
|
|
43
|
-
start_line: Number(match[2]),
|
|
44
|
-
end_line: Number(match[2]),
|
|
45
|
-
start_column: Number(match[3]),
|
|
46
|
-
end_column: Number(match[3]),
|
|
47
|
-
message: match[6].trim(),
|
|
48
|
-
title: `tsc`,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
41
|
+
if (tscOk) {
|
|
42
|
+
return [];
|
|
52
43
|
}
|
|
53
|
-
|
|
44
|
+
const matches = (0, strip_ansi_1.default)(tscOutputStream.output()).matchAll(tscOutputRegex);
|
|
45
|
+
return Array.from(matches).flatMap((match) => (match === null || match === void 0 ? void 0 : match.length) === 7
|
|
46
|
+
? {
|
|
47
|
+
annotation_level: annotationLevelMap[match[4]],
|
|
48
|
+
path: match[1],
|
|
49
|
+
start_line: Number(match[2]),
|
|
50
|
+
end_line: Number(match[2]),
|
|
51
|
+
start_column: Number(match[3]),
|
|
52
|
+
end_column: Number(match[3]),
|
|
53
|
+
message: match[6].trim(),
|
|
54
|
+
title: `tsc (TS${match[5]})`,
|
|
55
|
+
}
|
|
56
|
+
: []);
|
|
54
57
|
};
|
|
55
58
|
exports.createTscAnnotations = createTscAnnotations;
|
|
56
59
|
//# sourceMappingURL=tsc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsc.js","sourceRoot":"","sources":["../../../../../src/cli/lint/annotate/github/tsc.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAmC;AAOnC;;GAEG;
|
|
1
|
+
{"version":3,"file":"tsc.js","sourceRoot":"","sources":["../../../../../src/cli/lint/annotate/github/tsc.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAmC;AAOnC;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,cAAc,GAClB,gHAAgH,CAAC;AAEnH,MAAM,kBAAkB,GAGpB;IACF,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,QAAQ;CACf,CAAC;AAEK,MAAM,oBAAoB,GAAG,CAClC,KAAc,EACd,eAAkC,EACb,EAAE;IACvB,IAAI,KAAK,EAAE;QACT,OAAO,EAAE,CAAC;KACX;IAED,MAAM,OAAO,GAAG,IAAA,oBAAS,EAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IAC7E,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAoB,CAAC,KAAK,EAAE,EAAE,CAC9D,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,MAAK,CAAC;QACjB,CAAC,CAAC;YACE,gBAAgB,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAa,CAAC;YAC1D,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;YACd,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC5B,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC1B,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9B,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC5B,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;YACxB,KAAK,EAAE,UAAU,KAAK,CAAC,CAAC,CAAC,GAAG;SAC7B;QACH,CAAC,CAAC,EAAE,CACP,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,oBAAoB,wBAuB/B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ESLintOutput } from 'cli/adapter/eslint';
|
|
2
2
|
import { PrettierOutput } from 'cli/adapter/prettier';
|
|
3
3
|
import { StreamInterceptor } from '../external';
|
|
4
|
-
export declare const createAnnotations: (eslint: ESLintOutput, prettier: PrettierOutput, tscOk: boolean, tscOutputStream: StreamInterceptor
|
|
4
|
+
export declare const createAnnotations: (eslint: ESLintOutput, prettier: PrettierOutput, tscOk: boolean, tscOutputStream: StreamInterceptor) => Promise<void>;
|
|
@@ -12,9 +12,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.createAnnotations = void 0;
|
|
13
13
|
const buildkite_1 = require("./buildkite");
|
|
14
14
|
const github_1 = require("./github");
|
|
15
|
-
const createAnnotations = (eslint, prettier, tscOk, tscOutputStream
|
|
15
|
+
const createAnnotations = (eslint, prettier, tscOk, tscOutputStream) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
16
|
yield Promise.all([
|
|
17
|
-
(0, github_1.createGitHubAnnotations)(eslint, prettier, tscOk, tscOutputStream
|
|
17
|
+
(0, github_1.createGitHubAnnotations)(eslint, prettier, tscOk, tscOutputStream),
|
|
18
18
|
(0, buildkite_1.createBuildkiteAnnotations)(eslint, prettier, tscOk, tscOutputStream),
|
|
19
19
|
]);
|
|
20
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cli/lint/annotate/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,2CAAyD;AACzD,qCAAmD;AAE5C,MAAM,iBAAiB,GAAG,CAC/B,MAAoB,EACpB,QAAwB,EACxB,KAAc,EACd,eAAkC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cli/lint/annotate/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,2CAAyD;AACzD,qCAAmD;AAE5C,MAAM,iBAAiB,GAAG,CAC/B,MAAoB,EACpB,QAAwB,EACxB,KAAc,EACd,eAAkC,EACnB,EAAE;IACjB,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,IAAA,gCAAuB,EAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,CAAC;QACjE,IAAA,sCAA0B,EAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,CAAC;KACrE,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAVW,QAAA,iBAAiB,qBAU5B"}
|
package/lib/cli/lint/external.js
CHANGED
|
@@ -30,13 +30,14 @@ const annotate_1 = require("./annotate");
|
|
|
30
30
|
const eslint_1 = require("./eslint");
|
|
31
31
|
const prettier_1 = require("./prettier");
|
|
32
32
|
const tsc_1 = require("./tsc");
|
|
33
|
+
const tscPrefixRegex = /^(.*?tsc\s+│.*?\s)/gm;
|
|
33
34
|
class StreamInterceptor extends stream_1.default.Transform {
|
|
34
35
|
constructor() {
|
|
35
36
|
super(...arguments);
|
|
36
37
|
this.chunks = [];
|
|
37
38
|
}
|
|
38
39
|
output() {
|
|
39
|
-
return Buffer.concat(this.chunks).toString();
|
|
40
|
+
return Buffer.concat(this.chunks).toString().replace(tscPrefixRegex, '');
|
|
40
41
|
}
|
|
41
42
|
_transform(chunk, _encoding, callback) {
|
|
42
43
|
this.chunks.push(chunk);
|
|
@@ -87,18 +88,23 @@ const externalLint = (input) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
87
88
|
const tscOutputStream = new StreamInterceptor();
|
|
88
89
|
tscOutputStream.pipe((_c = input.tscOutputStream) !== null && _c !== void 0 ? _c : process.stdout);
|
|
89
90
|
const { eslint, prettier, tscOk } = yield lint(Object.assign(Object.assign({}, input), { tscOutputStream }));
|
|
91
|
+
try {
|
|
92
|
+
yield (0, annotate_1.createAnnotations)(eslint, prettier, tscOk, tscOutputStream);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
logging_1.log.warn('Failed to annotate results.');
|
|
96
|
+
logging_1.log.warn(err);
|
|
97
|
+
}
|
|
98
|
+
if (eslint.ok && prettier.ok && tscOk) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
90
101
|
const tools = [
|
|
91
102
|
...(eslint.ok ? [] : ['ESLint']),
|
|
92
103
|
...(prettier.ok ? [] : ['Prettier']),
|
|
93
104
|
...(tscOk ? [] : ['tsc']),
|
|
94
105
|
];
|
|
95
|
-
const summary = `${tools.join(', ')} found issues that require triage.`;
|
|
96
|
-
yield (0, annotate_1.createAnnotations)(eslint, prettier, tscOk, tscOutputStream, summary);
|
|
97
|
-
if (eslint.ok && prettier.ok && tscOk) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
106
|
logging_1.log.newline();
|
|
101
|
-
logging_1.log.err(
|
|
107
|
+
logging_1.log.err(`${tools.join(', ')} found issues that require triage.`);
|
|
102
108
|
process.exitCode = 1;
|
|
103
109
|
});
|
|
104
110
|
exports.externalLint = externalLint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external.js","sourceRoot":"","sources":["../../../src/cli/lint/external.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA4B;AAE5B,iDAA0C;AAE1C,yCAA+C;AAC/C,qCAA6E;AAC7E,yCAGoB;AACpB,+BAA2C;AAG3C,MAAa,iBAAkB,SAAQ,gBAAM,CAAC,SAAS;IAAvD;;QACU,WAAM,GAAiB,EAAE,CAAC;IAepC,CAAC;IAbQ,MAAM;QACX,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"external.js","sourceRoot":"","sources":["../../../src/cli/lint/external.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA4B;AAE5B,iDAA0C;AAE1C,yCAA+C;AAC/C,qCAA6E;AAC7E,yCAGoB;AACpB,+BAA2C;AAG3C,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAE9C,MAAa,iBAAkB,SAAQ,gBAAM,CAAC,SAAS;IAAvD;;QACU,WAAM,GAAiB,EAAE,CAAC;IAepC,CAAC;IAbQ,MAAM;QACX,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,UAAU,CACR,KAAU,EACV,SAAyB,EACzB,QAAkC;QAElC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAExB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACxB,CAAC;CACF;AAhBD,8CAgBC;AAED,MAAM,gBAAgB,GAAG,CAAO,EA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AC,CAAC,KAAK,CAAC,CAAC;KAC1B,CAAC;IAEF,aAAG,CAAC,OAAO,EAAE,CAAC;IACd,aAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;IAEjE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAA,CAAC;AA7BW,QAAA,YAAY,gBA6BvB"}
|
package/lib/cli/lint/index.js
CHANGED
|
@@ -11,9 +11,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.lint = void 0;
|
|
13
13
|
const args_1 = require("../../utils/args");
|
|
14
|
+
const refreshIgnoreFiles_1 = require("../configure/refreshIgnoreFiles");
|
|
14
15
|
const external_1 = require("./external");
|
|
15
16
|
const internal_1 = require("./internal");
|
|
16
17
|
const lint = (args = process.argv, tscOutputStream = undefined, workerThreads = true) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
yield (0, refreshIgnoreFiles_1.tryRefreshIgnoreFiles)();
|
|
17
19
|
const opts = {
|
|
18
20
|
debug: (0, args_1.hasDebugFlag)(args),
|
|
19
21
|
serial: (0, args_1.hasSerialFlag)(args),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/lint/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA+D;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/lint/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA+D;AAC/D,wEAAwE;AAExE,yCAA0C;AAC1C,yCAA0C;AAGnC,MAAM,IAAI,GAAG,CAClB,IAAI,GAAG,OAAO,CAAC,IAAI,EACnB,kBAAqD,SAAS,EAC9D,aAAa,GAAG,IAAI,EACpB,EAAE;IACF,MAAM,IAAA,0CAAqB,GAAE,CAAC;IAE9B,MAAM,IAAI,GAAU;QAClB,KAAK,EAAE,IAAA,mBAAY,EAAC,IAAI,CAAC;QACzB,MAAM,EAAE,IAAA,oBAAa,EAAC,IAAI,CAAC;QAC3B,eAAe;QACf,aAAa;KACd,CAAC;IAEF,MAAM,IAAA,uBAAY,EAAC,IAAI,CAAC,CAAC;IAEzB,MAAM,IAAA,uBAAY,GAAE,CAAC;AACvB,CAAC,CAAA,CAAC;AAjBW,QAAA,IAAI,QAiBf"}
|
package/lib/utils/logging.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export declare type Logger = typeof log;
|
|
|
3
3
|
export declare const createLogger: (debug: boolean, ...prefixes: unknown[]) => {
|
|
4
4
|
bold: chalk.Chalk;
|
|
5
5
|
formatSubtle: chalk.Chalk;
|
|
6
|
-
pluralise: (count: number, subject: string) => string;
|
|
7
6
|
timing: (start: bigint, end: bigint) => string;
|
|
8
7
|
debug: (...message: unknown[]) => void;
|
|
9
8
|
subtle: (...message: unknown[]) => void;
|
|
@@ -16,7 +15,6 @@ export declare const createLogger: (debug: boolean, ...prefixes: unknown[]) => {
|
|
|
16
15
|
export declare const log: {
|
|
17
16
|
bold: chalk.Chalk;
|
|
18
17
|
formatSubtle: chalk.Chalk;
|
|
19
|
-
pluralise: (count: number, subject: string) => string;
|
|
20
18
|
timing: (start: bigint, end: bigint) => string;
|
|
21
19
|
debug: (...message: unknown[]) => void;
|
|
22
20
|
subtle: (...message: unknown[]) => void;
|
|
@@ -26,3 +24,4 @@ export declare const log: {
|
|
|
26
24
|
plain: (...message: unknown[]) => void;
|
|
27
25
|
warn: (...message: unknown[]) => void;
|
|
28
26
|
};
|
|
27
|
+
export declare const pluralise: (count: number, subject: string) => string;
|
package/lib/utils/logging.js
CHANGED
|
@@ -4,14 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.log = exports.createLogger = void 0;
|
|
7
|
+
exports.pluralise = exports.log = exports.createLogger = void 0;
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const createLogger = (debug, ...prefixes) => {
|
|
10
10
|
const log = (...message) => console.log(...prefixes, ...message);
|
|
11
11
|
return {
|
|
12
12
|
bold: chalk_1.default.bold,
|
|
13
13
|
formatSubtle: chalk_1.default.grey,
|
|
14
|
-
pluralise: (count, subject) => `${count} ${subject}${count === 1 ? '' : 's'}`,
|
|
15
14
|
timing: (start, end) => `${Number((end - start) / BigInt(10000000)) / 100}s`,
|
|
16
15
|
debug: (...message) => debug ? log(chalk_1.default.grey(...message)) : undefined,
|
|
17
16
|
subtle: (...message) => log(chalk_1.default.grey(...message)),
|
|
@@ -24,4 +23,6 @@ const createLogger = (debug, ...prefixes) => {
|
|
|
24
23
|
};
|
|
25
24
|
exports.createLogger = createLogger;
|
|
26
25
|
exports.log = (0, exports.createLogger)(false);
|
|
26
|
+
const pluralise = (count, subject) => `${count} ${subject}${count === 1 ? '' : 's'}`;
|
|
27
|
+
exports.pluralise = pluralise;
|
|
27
28
|
//# sourceMappingURL=logging.js.map
|
package/lib/utils/logging.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../src/utils/logging.ts"],"names":[],"mappings":";AAAA,+BAA+B;;;;;;AAE/B,kDAA0B;AAInB,MAAM,YAAY,GAAG,CAAC,KAAc,EAAE,GAAG,QAAmB,EAAE,EAAE;IACrE,MAAM,GAAG,GAAG,CAAC,GAAG,OAAkB,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC,CAAC;IAE5E,OAAO;QACL,IAAI,EAAE,eAAK,CAAC,IAAI;QAChB,YAAY,EAAE,eAAK,CAAC,IAAI;QAExB,
|
|
1
|
+
{"version":3,"file":"logging.js","sour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CAAC,eAAK,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC;KAC/D,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,YAAY,gBAmBvB;AAEW,QAAA,GAAG,GAAG,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC;AAEhC,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,OAAe,EAAE,EAAE,CAC1D,GAAG,KAAK,IAAI,OAAO,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AADpC,QAAA,SAAS,aAC2B"}
|
package/lib/utils/worker.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export declare const execWorkerThread: <Input, Output>(filepath: string, input:
|
|
|
9
9
|
export declare const postWorkerOutput: <Input, Output>(fn: (input: Input) => Promise<Output>, logger?: {
|
|
10
10
|
bold: import("chalk").Chalk;
|
|
11
11
|
formatSubtle: import("chalk").Chalk;
|
|
12
|
-
pluralise: (count: number, subject: string) => string;
|
|
13
12
|
timing: (start: bigint, end: bigint) => string;
|
|
14
13
|
debug: (...message: unknown[]) => void;
|
|
15
14
|
subtle: (...message: unknown[]) => void;
|
|
@@ -30,7 +30,10 @@ const runFunctionHandler = ({ availablePort, entryPoint, functionName, }) => __a
|
|
|
30
30
|
logging_1.log.subtle(logging_1.log.bold(functionName), 'is not a function');
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
logging_1.log.warn(logging_1.log.bold(functionName), `(${(0, function_arguments_1.default)(fn)
|
|
33
|
+
logging_1.log.warn(logging_1.log.bold(functionName), `(${(0, function_arguments_1.default)(fn)
|
|
34
|
+
// Add a `?` placeholder for unnamed arguments.
|
|
35
|
+
.map((arg) => arg || '?')
|
|
36
|
+
.join(', ')})`);
|
|
34
37
|
const requestListener = (0, http_1.createRequestListenerFromFunction)(fn);
|
|
35
38
|
return (0, http_1.serveRequestListener)(requestListener, availablePort);
|
|
36
39
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functionHandler.js","sourceRoot":"","sources":["../../src/wrapper/functionHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4EAAwC;AAExC,8CAAuC;AACvC,oDAA2D;AAE3D,iCAGgB;AAQhB;;GAEG;AACI,MAAM,kBAAkB,GAAG,CAAO,EACvC,aAAa,EACb,UAAU,EACV,YAAY,GACP,EAAiB,EAAE;IACxB,IAAI,CAAC,IAAA,qBAAQ,EAAC,UAAU,CAAC,EAAE;QACzB,aAAG,CAAC,MAAM,CAAC,aAAG,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC,CAAC;QACtD,OAAO;KACR;IAED,MAAM,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAEpC,IAAI,CAAC,IAAA,uBAAU,EAAC,EAAE,CAAC,EAAE;QACnB,aAAG,CAAC,MAAM,CAAC,aAAG,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAC,CAAC;QACxD,OAAO;KACR;IAED,aAAG,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"functionHandler.js","sourceRoot":"","sources":["../../src/wrapper/functionHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4EAAwC;AAExC,8CAAuC;AACvC,oDAA2D;AAE3D,iCAGgB;AAQhB;;GAEG;AACI,MAAM,kBAAkB,GAAG,CAAO,EACvC,aAAa,EACb,UAAU,EACV,YAAY,GACP,EAAiB,EAAE;IACxB,IAAI,CAAC,IAAA,qBAAQ,EAAC,UAAU,CAAC,EAAE;QACzB,aAAG,CAAC,MAAM,CAAC,aAAG,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC,CAAC;QACtD,OAAO;KACR;IAED,MAAM,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAEpC,IAAI,CAAC,IAAA,uBAAU,EAAC,EAAE,CAAC,EAAE;QACnB,aAAG,CAAC,MAAM,CAAC,aAAG,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAC,CAAC;QACxD,OAAO;KACR;IAED,aAAG,CAAC,IAAI,CACN,aAAG,CAAC,IAAI,CAAC,YAAY,CAAC,EACtB,IAAI,IAAA,4BAAM,EAAC,EAAE,CAAC;QACZ,+CAA+C;SAC9C,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC;SACxB,IAAI,CAAC,IAAI,CAAC,GAAG,CACjB,CAAC;IAEF,MAAM,eAAe,GAAG,IAAA,wCAAiC,EAAC,EAAE,CAAC,CAAC;IAE9D,OAAO,IAAA,2BAAoB,EAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AAC9D,CAAC,CAAA,CAAC;AA5BW,QAAA,kBAAkB,sBA4B7B"}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=12"
|
|
9
9
|
},
|
|
10
|
-
"version": "3.
|
|
10
|
+
"version": "3.16.0",
|
|
11
11
|
"main": "lib/index.js",
|
|
12
12
|
"typings": "lib/index.d.ts",
|
|
13
13
|
"files": [
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"url": "https://github.com/seek-oss/skuba.git"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@changesets/cli": "2.
|
|
42
|
+
"@changesets/cli": "2.18.0",
|
|
43
43
|
"@changesets/get-github-info": "0.5.0",
|
|
44
44
|
"@octokit/types": "6.34.0",
|
|
45
45
|
"@types/concurrently": "6.3.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"koa": "2.13.4",
|
|
57
57
|
"semver": "7.3.5",
|
|
58
58
|
"supertest": "6.1.6",
|
|
59
|
-
"type-fest": "2.5.
|
|
59
|
+
"type-fest": "2.5.2"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@octokit/rest": "^18.12.0",
|
|
@@ -2,12 +2,14 @@ version: '3.7'
|
|
|
2
2
|
|
|
3
3
|
services:
|
|
4
4
|
app:
|
|
5
|
-
|
|
6
|
-
# Enable Buildkite annotation support.
|
|
5
|
+
environment:
|
|
6
|
+
# Enable Buildkite + GitHub annotation support.
|
|
7
7
|
- BUILDKITE
|
|
8
8
|
- BUILDKITE_AGENT_ACCESS_TOKEN
|
|
9
|
+
- BUILDKITE_BUILD_NUMBER
|
|
9
10
|
- BUILDKITE_JOB_ID
|
|
10
11
|
- BUILDKITE_STEP_ID
|
|
12
|
+
- GITHUB_API_TOKEN
|
|
11
13
|
image: ${BUILDKITE_PLUGIN_DOCKER_IMAGE:-''}
|
|
12
14
|
init: true
|
|
13
15
|
volumes:
|
|
@@ -2,12 +2,14 @@ version: '3.7'
|
|
|
2
2
|
|
|
3
3
|
services:
|
|
4
4
|
app:
|
|
5
|
-
|
|
6
|
-
# Enable Buildkite annotation support.
|
|
5
|
+
environment:
|
|
6
|
+
# Enable Buildkite + GitHub annotation support.
|
|
7
7
|
- BUILDKITE
|
|
8
8
|
- BUILDKITE_AGENT_ACCESS_TOKEN
|
|
9
|
+
- BUILDKITE_BUILD_NUMBER
|
|
9
10
|
- BUILDKITE_JOB_ID
|
|
10
11
|
- BUILDKITE_STEP_ID
|
|
12
|
+
- GITHUB_API_TOKEN
|
|
11
13
|
image: ${BUILDKITE_PLUGIN_DOCKER_IMAGE:-''}
|
|
12
14
|
init: true
|
|
13
15
|
volumes:
|
|
@@ -2,12 +2,14 @@ version: '3.7'
|
|
|
2
2
|
|
|
3
3
|
services:
|
|
4
4
|
app:
|
|
5
|
-
|
|
6
|
-
# Enable Buildkite annotation support.
|
|
5
|
+
environment:
|
|
6
|
+
# Enable Buildkite + GitHub annotation support.
|
|
7
7
|
- BUILDKITE
|
|
8
8
|
- BUILDKITE_AGENT_ACCESS_TOKEN
|
|
9
|
+
- BUILDKITE_BUILD_NUMBER
|
|
9
10
|
- BUILDKITE_JOB_ID
|
|
10
11
|
- BUILDKITE_STEP_ID
|
|
12
|
+
- GITHUB_API_TOKEN
|
|
11
13
|
image: ${BUILDKITE_PLUGIN_DOCKER_IMAGE:-''}
|
|
12
14
|
init: true
|
|
13
15
|
volumes:
|
|
@@ -3,11 +3,13 @@ version: '3.7'
|
|
|
3
3
|
services:
|
|
4
4
|
app:
|
|
5
5
|
environment:
|
|
6
|
-
# Enable Buildkite annotation support.
|
|
6
|
+
# Enable Buildkite + GitHub annotation support.
|
|
7
7
|
- BUILDKITE
|
|
8
8
|
- BUILDKITE_AGENT_ACCESS_TOKEN
|
|
9
|
+
- BUILDKITE_BUILD_NUMBER
|
|
9
10
|
- BUILDKITE_JOB_ID
|
|
10
11
|
- BUILDKITE_STEP_ID
|
|
12
|
+
- GITHUB_API_TOKEN
|
|
11
13
|
# Tag AWS resources with the commit hash.
|
|
12
14
|
- BUILDKITE_COMMIT
|
|
13
15
|
# Pass through application configuration.
|
|
@@ -3,11 +3,13 @@ version: '3.7'
|
|
|
3
3
|
services:
|
|
4
4
|
app:
|
|
5
5
|
environment:
|
|
6
|
-
# Enable Buildkite annotation support.
|
|
6
|
+
# Enable Buildkite + GitHub annotation support.
|
|
7
7
|
- BUILDKITE
|
|
8
8
|
- BUILDKITE_AGENT_ACCESS_TOKEN
|
|
9
|
+
- BUILDKITE_BUILD_NUMBER
|
|
9
10
|
- BUILDKITE_JOB_ID
|
|
10
11
|
- BUILDKITE_STEP_ID
|
|
12
|
+
- GITHUB_API_TOKEN
|
|
11
13
|
# Tag AWS resources with the commit hash.
|
|
12
14
|
- BUILDKITE_COMMIT
|
|
13
15
|
# Pass through application configuration.
|