skuba 4.2.0 → 4.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/api/jest/index.d.ts +26 -11
- package/lib/cli/adapter/eslint.d.ts +2 -1
- package/lib/cli/adapter/eslint.js +5 -1
- package/lib/cli/adapter/eslint.js.map +1 -1
- package/lib/cli/configure/refreshIgnoreFiles.js +2 -1
- package/lib/cli/configure/refreshIgnoreFiles.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
- package/lib/cli/lint/autofix.d.ts +7 -1
- package/lib/cli/lint/autofix.js +16 -8
- package/lib/cli/lint/autofix.js.map +1 -1
- package/lib/cli/lint/external.js +19 -18
- package/lib/cli/lint/external.js.map +1 -1
- package/lib/cli/test/reporters/github/index.d.ts +2 -2
- package/lib/cli/test/reporters/github/index.js +14 -3
- package/lib/cli/test/reporters/github/index.js.map +1 -1
- package/lib/utils/args.js +1 -1
- package/lib/utils/args.js.map +1 -1
- package/lib/utils/error.d.ts +14 -0
- package/lib/utils/error.js +16 -2
- package/lib/utils/error.js.map +1 -1
- package/lib/utils/version.js +3 -4
- package/lib/utils/version.js.map +1 -1
- package/lib/utils/wait.d.ts +17 -0
- package/lib/utils/wait.js +32 -0
- package/lib/utils/wait.js.map +1 -0
- package/lib/utils/worker.js +2 -1
- package/lib/utils/worker.js.map +1 -1
- package/package.json +18 -19
- package/template/express-rest-api/.buildkite/pipeline.yml +2 -1
- package/template/greeter/.buildkite/pipeline.yml +2 -1
- package/template/koa-rest-api/.buildkite/pipeline.yml +2 -1
- package/template/koa-rest-api/package.json +5 -5
- package/template/koa-rest-api/src/api/jobs/getJobs.ts +2 -2
- package/template/koa-rest-api/src/api/jobs/postJob.ts +2 -2
- package/template/koa-rest-api/src/framework/logging.ts +8 -5
- package/template/koa-rest-api/src/framework/metrics.ts +2 -2
- package/template/koa-rest-api/src/framework/server.test.ts +21 -21
- package/template/koa-rest-api/src/framework/server.ts +4 -3
- package/template/koa-rest-api/src/listen.ts +2 -2
- package/template/koa-rest-api/src/testing/logging.ts +5 -20
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +2 -1
- package/template/lambda-sqs-worker/.nvmrc +1 -1
- package/template/lambda-sqs-worker/Dockerfile +1 -1
- package/template/lambda-sqs-worker/package.json +4 -4
- package/template/lambda-sqs-worker/serverless.yml +2 -2
- package/template/lambda-sqs-worker/src/app.test.ts +9 -9
- package/template/lambda-sqs-worker/src/app.ts +2 -1
- package/template/lambda-sqs-worker/src/framework/handler.test.ts +10 -10
- package/template/lambda-sqs-worker/src/framework/handler.ts +14 -17
- package/template/lambda-sqs-worker/src/framework/logging.ts +11 -6
- package/template/lambda-sqs-worker/src/testing/logging.ts +7 -5
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -1
- package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
- package/template/lambda-sqs-worker-cdk/Dockerfile +1 -1
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +2 -2
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
- package/template/lambda-sqs-worker-cdk/package.json +9 -11
- package/template/private-npm-package/.buildkite/pipeline.yml +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://github.com/seek-oss/skuba/actions?query=workflow%3ARelease)
|
|
6
6
|
[](https://github.com/seek-oss/skuba/actions?query=workflow%3AValidate)
|
|
7
|
-
[](https://nodejs.org/en/)
|
|
8
8
|
[](https://www.npmjs.com/package/skuba)
|
|
9
9
|
|
|
10
10
|
---
|
package/lib/api/jest/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ declare type DefaultOptions = 'collectCoverage' | 'collectCoverageFrom' | 'colle
|
|
|
11
11
|
*
|
|
12
12
|
* This concatenates array options like `testPathIgnorePatterns`.
|
|
13
13
|
*/
|
|
14
|
-
export declare const mergePreset: <AdditionalOptions extends "filter" | "json" | "silent" | "
|
|
14
|
+
export declare const mergePreset: <AdditionalOptions extends "filter" | "json" | "silent" | "cache" | "runner" | "projects" | "id" | "automock" | "cacheDirectory" | "clearMocks" | "coveragePathIgnorePatterns" | "dependencyExtractor" | "detectLeaks" | "detectOpenHandles" | "displayName" | "errorOnDeprecated" | "extensionsToTreatAsEsm" | "fakeTimers" | "forceCoverageMatch" | "globalSetup" | "globalTeardown" | "globals" | "haste" | "injectGlobals" | "moduleDirectories" | "moduleFileExtensions" | "moduleNameMapper" | "modulePathIgnorePatterns" | "modulePaths" | "prettierPath" | "resetMocks" | "resetModules" | "resolver" | "restoreMocks" | "rootDir" | "roots" | "runtime" | "sandboxInjectedGlobals" | "setupFiles" | "setupFilesAfterEnv" | "skipFilter" | "skipNodeResolution" | "slowTestThreshold" | "snapshotResolver" | "snapshotSerializers" | "snapshotFormat" | "testEnvironment" | "testEnvironmentOptions" | "testMatch" | "testLocationInResults" | "testPathIgnorePatterns" | "testRegex" | "testRunner" | "transform" | "transformIgnorePatterns" | "watchPathIgnorePatterns" | "unmockedModulePathPatterns" | "bail" | "ci" | "changedFilesWithAncestor" | "changedSince" | "collectCoverage" | "collectCoverageFrom" | "collectCoverageOnlyFrom" | "coverageDirectory" | "coverageProvider" | "coverageReporters" | "coverageThreshold" | "expand" | "findRelatedTests" | "forceExit" | "reporters" | "logHeapUsage" | "lastCommit" | "listTests" | "maxConcurrency" | "maxWorkers" | "noStackTrace" | "notify" | "notifyMode" | "onlyChanged" | "onlyFailures" | "outputFile" | "passWithNoTests" | "preset" | "replname" | "runTestsByPath" | "testFailureExitCode" | "testNamePattern" | "testResultsProcessor" | "testSequencer" | "testTimeout" | "updateSnapshot" | "useStderr" | "verbose" | "watch" | "watchAll" | "watchman" | "watchPlugins">(options: Pick<Partial<{
|
|
15
15
|
automock: boolean;
|
|
16
16
|
bail: number | boolean;
|
|
17
17
|
cache: boolean;
|
|
@@ -39,7 +39,9 @@ export declare const mergePreset: <AdditionalOptions extends "filter" | "json" |
|
|
|
39
39
|
displayName: string | Config.DisplayName;
|
|
40
40
|
expand: boolean;
|
|
41
41
|
extensionsToTreatAsEsm: string[];
|
|
42
|
-
|
|
42
|
+
fakeTimers: Config.GlobalFakeTimersConfig & ((Config.FakeTimersConfig & {
|
|
43
|
+
now?: number | undefined;
|
|
44
|
+
}) | Config.LegacyFakeTimersConfig);
|
|
43
45
|
filter: string;
|
|
44
46
|
findRelatedTests: boolean;
|
|
45
47
|
forceCoverageMatch: string[];
|
|
@@ -49,6 +51,7 @@ export declare const mergePreset: <AdditionalOptions extends "filter" | "json" |
|
|
|
49
51
|
globalSetup: string | null | undefined;
|
|
50
52
|
globalTeardown: string | null | undefined;
|
|
51
53
|
haste: Config.HasteConfig;
|
|
54
|
+
id: string;
|
|
52
55
|
injectGlobals: boolean;
|
|
53
56
|
reporters: (string | Config.ReporterConfig)[];
|
|
54
57
|
logHeapUsage: boolean;
|
|
@@ -58,13 +61,11 @@ export declare const mergePreset: <AdditionalOptions extends "filter" | "json" |
|
|
|
58
61
|
maxWorkers: string | number;
|
|
59
62
|
moduleDirectories: string[];
|
|
60
63
|
moduleFileExtensions: string[];
|
|
61
|
-
moduleLoader: string;
|
|
62
64
|
moduleNameMapper: {
|
|
63
65
|
[key: string]: string | string[];
|
|
64
66
|
};
|
|
65
67
|
modulePathIgnorePatterns: string[];
|
|
66
68
|
modulePaths: string[];
|
|
67
|
-
name: string;
|
|
68
69
|
noStackTrace: boolean;
|
|
69
70
|
notify: boolean;
|
|
70
71
|
notifyMode: string;
|
|
@@ -72,7 +73,6 @@ export declare const mergePreset: <AdditionalOptions extends "filter" | "json" |
|
|
|
72
73
|
onlyFailures: boolean;
|
|
73
74
|
outputFile: string;
|
|
74
75
|
passWithNoTests: boolean;
|
|
75
|
-
preprocessorIgnorePatterns: string[];
|
|
76
76
|
preset: string | null | undefined;
|
|
77
77
|
prettierPath: string | null | undefined;
|
|
78
78
|
projects: (string | Config.InitialProjectOptions)[];
|
|
@@ -85,9 +85,9 @@ export declare const mergePreset: <AdditionalOptions extends "filter" | "json" |
|
|
|
85
85
|
roots: string[];
|
|
86
86
|
runner: string;
|
|
87
87
|
runTestsByPath: boolean;
|
|
88
|
-
|
|
88
|
+
runtime: string;
|
|
89
|
+
sandboxInjectedGlobals: string[];
|
|
89
90
|
setupFiles: string[];
|
|
90
|
-
setupTestFrameworkScriptFile: string;
|
|
91
91
|
setupFilesAfterEnv: string[];
|
|
92
92
|
silent: boolean;
|
|
93
93
|
skipFilter: boolean;
|
|
@@ -95,7 +95,25 @@ export declare const mergePreset: <AdditionalOptions extends "filter" | "json" |
|
|
|
95
95
|
slowTestThreshold: number;
|
|
96
96
|
snapshotResolver: string;
|
|
97
97
|
snapshotSerializers: string[];
|
|
98
|
-
snapshotFormat:
|
|
98
|
+
snapshotFormat: {
|
|
99
|
+
readonly callToJSON?: boolean | undefined;
|
|
100
|
+
readonly escapeRegex?: boolean | undefined;
|
|
101
|
+
readonly escapeString?: boolean | undefined;
|
|
102
|
+
readonly highlight?: boolean | undefined;
|
|
103
|
+
readonly indent?: number | undefined;
|
|
104
|
+
readonly maxDepth?: number | undefined;
|
|
105
|
+
readonly maxWidth?: number | undefined;
|
|
106
|
+
readonly min?: boolean | undefined;
|
|
107
|
+
readonly printBasicPrototype?: boolean | undefined;
|
|
108
|
+
readonly printFunctionName?: boolean | undefined;
|
|
109
|
+
readonly theme?: {
|
|
110
|
+
readonly value?: string | undefined;
|
|
111
|
+
readonly tag?: string | undefined;
|
|
112
|
+
readonly content?: string | undefined;
|
|
113
|
+
readonly comment?: string | undefined;
|
|
114
|
+
readonly prop?: string | undefined;
|
|
115
|
+
} | undefined;
|
|
116
|
+
};
|
|
99
117
|
errorOnDeprecated: boolean;
|
|
100
118
|
testEnvironment: string;
|
|
101
119
|
testEnvironmentOptions: Record<string, unknown>;
|
|
@@ -103,15 +121,12 @@ export declare const mergePreset: <AdditionalOptions extends "filter" | "json" |
|
|
|
103
121
|
testLocationInResults: boolean;
|
|
104
122
|
testMatch: string[];
|
|
105
123
|
testNamePattern: string;
|
|
106
|
-
testPathDirs: string[];
|
|
107
124
|
testPathIgnorePatterns: string[];
|
|
108
125
|
testRegex: string | string[];
|
|
109
126
|
testResultsProcessor: string;
|
|
110
127
|
testRunner: string;
|
|
111
128
|
testSequencer: string;
|
|
112
|
-
testURL: string;
|
|
113
129
|
testTimeout: number;
|
|
114
|
-
timers: "real" | "fake" | "modern" | "legacy";
|
|
115
130
|
transform: {
|
|
116
131
|
[regex: string]: string | Config.TransformerConfig;
|
|
117
132
|
};
|
|
@@ -6,8 +6,9 @@ export interface ESLintResult {
|
|
|
6
6
|
}
|
|
7
7
|
export interface ESLintOutput {
|
|
8
8
|
errors: ESLintResult[];
|
|
9
|
-
|
|
9
|
+
fixable: boolean;
|
|
10
10
|
ok: boolean;
|
|
11
11
|
output: string;
|
|
12
|
+
warnings: ESLintResult[];
|
|
12
13
|
}
|
|
13
14
|
export declare const runESLint: (mode: 'format' | 'lint', logger: Logger) => Promise<ESLintOutput>;
|
|
@@ -48,8 +48,12 @@ const runESLint = async (mode, logger) => {
|
|
|
48
48
|
logger.plain(`Processed ${(0, logging_1.pluralise)(results.length, 'file')} in ${logger.timing(start, end)}.`);
|
|
49
49
|
const errors = [];
|
|
50
50
|
const warnings = [];
|
|
51
|
+
let fixable = false;
|
|
51
52
|
for (const result of results) {
|
|
52
53
|
const relativePath = path_1.default.relative(cwd, result.filePath);
|
|
54
|
+
if (result.fixableErrorCount + result.fixableWarningCount) {
|
|
55
|
+
fixable = true;
|
|
56
|
+
}
|
|
53
57
|
if (result.errorCount) {
|
|
54
58
|
errors.push({
|
|
55
59
|
filePath: relativePath,
|
|
@@ -70,7 +74,7 @@ const runESLint = async (mode, logger) => {
|
|
|
70
74
|
if (output) {
|
|
71
75
|
logger.plain(output);
|
|
72
76
|
}
|
|
73
|
-
return { ok, output,
|
|
77
|
+
return { errors, fixable, ok, output, warnings };
|
|
74
78
|
};
|
|
75
79
|
exports.runESLint = runESLint;
|
|
76
80
|
//# sourceMappingURL=eslint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.js","sourceRoot":"","sources":["../../../src/cli/adapter/eslint.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,kDAA0B;AAE1B,mCAAgC;AAGhC,iDAAgD;AAEhD,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;
|
|
1
|
+
{"version":3,"file":"eslint.js","sourceRoot":"","sources":["../../../src/cli/adapter/eslint.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,kDAA0B;AAE1B,mCAAgC;AAGhC,iDAAgD;AAEhD,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;AAeK,MAAM,SAAS,GAAG,KAAK,EAC5B,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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AAQ,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QACzD,IAAI,MAAM,CAAC,iBAAiB,GAAG,MAAM,CAAC,mBAAmB,EAAE;YACzD,OAAO,GAAG,IAAI,CAAC;SAChB;QAED,IAAI,MAAM,CAAC,UAAU,EAAE;YACrB,MAAM,CAAC,IAAI,CAAC;gBACV,QAAQ,EAAE,YAAY;gBACtB,QAAQ,EAAE,MAAM,CAAC,QAAQ;aAC1B,CAAC,CAAC;SACJ;QAED,IAAI,MAAM,CAAC,YAAY,EAAE;YACvB,QAAQ,CAAC,IAAI,CAAC;gBACZ,QAAQ,EAAE,YAAY;gBACtB,QAAQ,EAAE,MAAM,CAAC,QAAQ;aAC1B,CAAC,CAAC;SACJ;QAED,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,CAAC;KACrD;IAED,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;IAE/B,MAAM,eAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAElC,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE/C,IAAI,MAAM,EAAE;QACV,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KACtB;IAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AACnD,CAAC,CAAC;AA1FW,QAAA,SAAS,aA0FpB"}
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.tryRefreshIgnoreFiles = exports.refreshIgnoreFiles = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const util_1 = require("util");
|
|
8
9
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
10
|
const logging_1 = require("../../utils/logging");
|
|
10
11
|
const template_1 = require("../../utils/template");
|
|
@@ -39,7 +40,7 @@ const tryRefreshIgnoreFiles = async () => {
|
|
|
39
40
|
}
|
|
40
41
|
catch (err) {
|
|
41
42
|
logging_1.log.warn('Failed to refresh ignore files.');
|
|
42
|
-
logging_1.log.
|
|
43
|
+
logging_1.log.subtle((0, util_1.inspect)(err));
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
46
|
exports.tryRefreshIgnoreFiles = tryRefreshIgnoreFiles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refreshIgnoreFiles.js","sourceRoot":"","sources":["../../../src/cli/configure/refreshIgnoreFiles.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;
|
|
1
|
+
{"version":3,"file":"refreshIgnoreFiles.js","sourceRoot":"","sources":["../../../src/cli/configure/refreshIgnoreFiles.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,+BAA+B;AAE/B,wDAA0B;AAE1B,iDAA0C;AAC1C,mDAA4D;AAE5D,gDAA4D;AAC5D,gDAAiE;AACjE,wDAA8D;AAEvD,MAAM,kBAAkB,GAAG,KAAK,IAAI,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,KAAK,EAAE,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,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,CAAC;AA3BW,QAAA,kBAAkB,sBA2B7B;AAEK,MAAM,qBAAqB,GAAG,KAAK,IAAI,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,MAAM,CAAC,IAAA,cAAO,EAAC,GAAG,CAAC,CAAC,CAAC;KAC1B;AACH,CAAC,CAAC;AAPW,QAAA,qBAAqB,yBAOhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cli/lint/annotate/buildkite/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAAuD;AAKvD,qCAAmD;AACnD,yCAAuD;AACvD,+BAA6C;AAEtC,MAAM,0BAA0B,GAAG,KAAK,EAC7C,MAAoB,EACpB,QAAwB,EACxB,KAAc,EACd,eAAkC,EACnB,EAAE;IACjB,IAAI,MAAM,CAAC,EAAE,IAAI,QAAQ,CAAC,EAAE,IAAI,KAAK,EAAE;QACrC,OAAO;KACR;IAED,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cli/lint/annotate/buildkite/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAAuD;AAKvD,qCAAmD;AACnD,yCAAuD;AACvD,+BAA6C;AAEtC,MAAM,0BAA0B,GAAG,KAAK,EAC7C,MAAoB,EACpB,QAAwB,EACxB,KAAc,EACd,eAAkC,EACnB,EAAE;IACjB,IAAI,MAAM,CAAC,EAAE,IAAI,QAAQ,CAAC,EAAE,IAAI,KAAK,EAAE;QACrC,OAAO;KACR;IAED,MAAM,eAAe,GAAG;QACtB,gDAAgD;QAChD,GAAG,IAAA,gCAAuB,EAAC,MAAM,CAAC;QAClC,GAAG,IAAA,oCAAyB,EAAC,QAAQ,CAAC;QACtC,GAAG,IAAA,0BAAoB,EAAC,KAAK,EAAE,eAAe,CAAC;KAChD,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEf,MAAM,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE;QACxC,OAAO,EAAE,qBAAqB;QAC9B,kBAAkB,EAAE,IAAI;QACxB,KAAK,EAAE,OAAO;KACf,CAAC,CAAC;AACL,CAAC,CAAC;AAtBW,QAAA,0BAA0B,8BAsBrC"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import type { Input } from './types';
|
|
2
|
-
|
|
2
|
+
interface AutofixParameters {
|
|
3
|
+
debug: Input['debug'];
|
|
4
|
+
eslint: boolean;
|
|
5
|
+
prettier: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const autofix: (params: AutofixParameters) => Promise<void>;
|
|
8
|
+
export {};
|
package/lib/cli/lint/autofix.js
CHANGED
|
@@ -27,12 +27,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.autofix = void 0;
|
|
30
|
+
const util_1 = require("util");
|
|
30
31
|
const simple_git_1 = __importDefault(require("simple-git"));
|
|
31
32
|
const Git = __importStar(require("../../api/git"));
|
|
32
33
|
const eslint_1 = require("../../cli/adapter/eslint");
|
|
33
34
|
const prettier_1 = require("../../cli/adapter/prettier");
|
|
34
35
|
const env_1 = require("../../utils/env");
|
|
35
36
|
const logging_1 = require("../../utils/logging");
|
|
37
|
+
const wait_1 = require("../../utils/wait");
|
|
36
38
|
const AUTOFIX_COMMIT_MESSAGE = 'Run `skuba format`';
|
|
37
39
|
const shouldPush = async ({ currentBranch, dir, }) => {
|
|
38
40
|
if (!(0, env_1.isCiEnv)()) {
|
|
@@ -62,7 +64,10 @@ const shouldPush = async ({ currentBranch, dir, }) => {
|
|
|
62
64
|
// Allow the push attempt to go ahead if our guards have been cleared.
|
|
63
65
|
return true;
|
|
64
66
|
};
|
|
65
|
-
const autofix = async (
|
|
67
|
+
const autofix = async (params) => {
|
|
68
|
+
if (!params.eslint && !params.prettier) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
66
71
|
const dir = process.cwd();
|
|
67
72
|
let currentBranch;
|
|
68
73
|
try {
|
|
@@ -72,12 +77,15 @@ const autofix = async (input) => {
|
|
|
72
77
|
if (!(await shouldPush({ currentBranch, dir }))) {
|
|
73
78
|
return;
|
|
74
79
|
}
|
|
75
|
-
// Naively try to autofix issues as we can't tell from ESLint output.
|
|
76
80
|
try {
|
|
77
81
|
logging_1.log.newline();
|
|
78
|
-
logging_1.log.warn(`Trying to autofix with ESLint and Prettier...`);
|
|
79
|
-
const logger = (0, logging_1.createLogger)(
|
|
80
|
-
|
|
82
|
+
logging_1.log.warn(`Trying to autofix with ${params.eslint ? 'ESLint and ' : ''}Prettier...`);
|
|
83
|
+
const logger = (0, logging_1.createLogger)(params.debug);
|
|
84
|
+
if (params.eslint) {
|
|
85
|
+
await (0, eslint_1.runESLint)('format', logger);
|
|
86
|
+
}
|
|
87
|
+
// Unconditionally re-run Prettier; reaching here means we have pre-existing
|
|
88
|
+
// format violations or may have created new ones through ESLint fixes.
|
|
81
89
|
await (0, prettier_1.runPrettier)('format', logger);
|
|
82
90
|
const ref = await Git.commitAllChanges({
|
|
83
91
|
dir,
|
|
@@ -86,7 +94,7 @@ const autofix = async (input) => {
|
|
|
86
94
|
if (!ref) {
|
|
87
95
|
return logging_1.log.warn('No autofixes detected.');
|
|
88
96
|
}
|
|
89
|
-
await (process.env.GITHUB_ACTIONS
|
|
97
|
+
await (0, wait_1.throwOnTimeout)(process.env.GITHUB_ACTIONS
|
|
90
98
|
? // GitHub's checkout action should preconfigure the Git CLI.
|
|
91
99
|
(0, simple_git_1.default)().push()
|
|
92
100
|
: // In other CI environments (Buildkite) we fall back to GitHub App auth.
|
|
@@ -95,13 +103,13 @@ const autofix = async (input) => {
|
|
|
95
103
|
dir: process.cwd(),
|
|
96
104
|
ref,
|
|
97
105
|
remoteRef: currentBranch,
|
|
98
|
-
}));
|
|
106
|
+
}), { s: 30 });
|
|
99
107
|
logging_1.log.warn(`Pushed fix commit ${ref}.`);
|
|
100
108
|
}
|
|
101
109
|
catch (err) {
|
|
102
110
|
logging_1.log.warn(logging_1.log.bold('Failed to push fix commit.'));
|
|
103
111
|
logging_1.log.warn(logging_1.log.bold('Does your CI environment have write access to your Git repository?'));
|
|
104
|
-
logging_1.log.subtle(err);
|
|
112
|
+
logging_1.log.subtle((0, util_1.inspect)(err));
|
|
105
113
|
}
|
|
106
114
|
};
|
|
107
115
|
exports.autofix = autofix;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autofix.js","sourceRoot":"","sources":["../../../src/cli/lint/autofix.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAAmC;AAEnC,mDAAqC;AACrC,qDAAqD;AACrD,yDAAyD;AACzD,yCAA0C;AAC1C,iDAAwD;
|
|
1
|
+
{"version":3,"file":"autofix.js","sourceRoot":"","sources":["../../../src/cli/lint/autofix.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+B;AAE/B,4DAAmC;AAEnC,mDA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C;KACvC;IAAC,OAAO,GAAG,EAAE;QACZ,aAAG,CAAC,IAAI,CAAC,aAAG,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC,CAAC;QACjD,aAAG,CAAC,IAAI,CACN,aAAG,CAAC,IAAI,CACN,oEAAoE,CACrE,CACF,CAAC;QACF,aAAG,CAAC,MAAM,CAAC,IAAA,cAAO,EAAC,GAAG,CAAC,CAAC,CAAC;KAC1B;AACH,CAAC,CAAC;AAhEW,QAAA,OAAO,WAgElB"}
|
package/lib/cli/lint/external.js
CHANGED
|
@@ -5,7 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.externalLint = exports.StreamInterceptor = void 0;
|
|
7
7
|
const stream_1 = __importDefault(require("stream"));
|
|
8
|
+
const util_1 = require("util");
|
|
8
9
|
const logging_1 = require("../../utils/logging");
|
|
10
|
+
const wait_1 = require("../../utils/wait");
|
|
9
11
|
const annotate_1 = require("./annotate");
|
|
10
12
|
const autofix_1 = require("./autofix");
|
|
11
13
|
const eslint_1 = require("./eslint");
|
|
@@ -67,28 +69,27 @@ const externalLint = async (input) => {
|
|
|
67
69
|
tscOutputStream.pipe(input.tscOutputStream ?? process.stdout);
|
|
68
70
|
const { eslint, prettier, tscOk } = await lint({ ...input, tscOutputStream });
|
|
69
71
|
try {
|
|
70
|
-
await (0, annotate_1.createAnnotations)(eslint, prettier, tscOk, tscOutputStream);
|
|
72
|
+
await (0, wait_1.throwOnTimeout)((0, annotate_1.createAnnotations)(eslint, prettier, tscOk, tscOutputStream), { s: 30 });
|
|
71
73
|
}
|
|
72
74
|
catch (err) {
|
|
73
|
-
logging_1.log.warn('Failed to annotate results.');
|
|
74
|
-
logging_1.log.
|
|
75
|
+
logging_1.log.warn('Failed to annotate lint results.');
|
|
76
|
+
logging_1.log.subtle((0, util_1.inspect)(err));
|
|
75
77
|
}
|
|
76
|
-
if (eslint.ok
|
|
77
|
-
|
|
78
|
+
if (!eslint.ok || !prettier.ok || !tscOk) {
|
|
79
|
+
const tools = [
|
|
80
|
+
...(eslint.ok ? [] : ['ESLint']),
|
|
81
|
+
...(prettier.ok ? [] : ['Prettier']),
|
|
82
|
+
...(tscOk ? [] : ['tsc']),
|
|
83
|
+
];
|
|
84
|
+
logging_1.log.newline();
|
|
85
|
+
logging_1.log.err(`${tools.join(', ')} found issues that require triage.`);
|
|
86
|
+
process.exitCode = 1;
|
|
78
87
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
logging_1.log.newline();
|
|
85
|
-
logging_1.log.err(`${tools.join(', ')} found issues that require triage.`);
|
|
86
|
-
process.exitCode = 1;
|
|
87
|
-
if (eslint.ok && prettier.ok) {
|
|
88
|
-
// If these are fine then the issue lies with tsc, which we can't autofix.
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
await (0, autofix_1.autofix)(input);
|
|
88
|
+
await (0, autofix_1.autofix)({
|
|
89
|
+
debug: input.debug,
|
|
90
|
+
eslint: eslint.fixable,
|
|
91
|
+
prettier: !prettier.ok,
|
|
92
|
+
});
|
|
92
93
|
};
|
|
93
94
|
exports.externalLint = externalLint;
|
|
94
95
|
//# sourceMappingURL=external.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external.js","sourceRoot":"","sources":["../../../src/cli/lint/external.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;
|
|
1
|
+
{"version":3,"file":"external.js","sourceRoot":"","sources":["../../../src/cli/lint/external.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,+BAA+B;AAE/B,iDAA0C;AAC1C,2CAAkD;AAElD,yCAA+C;AAC/C,uCAAoC;AACpC,qCAA6E;AAC7E,yCAGoB;AACpB,+BAA2C;AAG3C,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAE9C,MAAa,iBAAkB,SAAQ,gBAAM,CAAC,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,aAAG,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;QAC7C,aAAG,CAAC,MAAM,CAAC,IAAA,cAAO,EAAC,GAAG,CAAC,CAAC,CAAC;KAC1B;IAED,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE;QACxC,MAAM,KAAK,GAAG;YACZ,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;YAChC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YACpC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;SAC1B,CAAC;QAEF,aAAG,CAAC,OAAO,EAAE,CAAC;QACd,aAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;QAEjE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;KACtB;IAED,MAAM,IAAA,iBAAO,EAAC;QACZ,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,MAAM,CAAC,OAAO;QACtB,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE;KACvB,CAAC,CAAC;AACL,CAAC,CAAC;AApCW,QAAA,YAAY,gBAoCvB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Reporter, TestContext } from '@jest/reporters';
|
|
2
2
|
import type { AggregatedResult } from '@jest/test-result';
|
|
3
3
|
export default class GitHubReporter implements Pick<Reporter, 'onRunComplete'> {
|
|
4
|
-
onRunComplete(_contexts: Set<
|
|
4
|
+
onRunComplete(_contexts: Set<TestContext>, { testResults }: AggregatedResult): Promise<void>;
|
|
5
5
|
}
|
|
@@ -23,15 +23,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const util_1 = require("util");
|
|
26
27
|
const GitHub = __importStar(require("../../../../api/github"));
|
|
27
28
|
const environment_1 = require("../../../../api/github/environment");
|
|
28
29
|
const logging_1 = require("../../../../utils/logging");
|
|
30
|
+
const wait_1 = require("../../../../utils/wait");
|
|
29
31
|
const annotations_1 = require("./annotations");
|
|
30
32
|
class GitHubReporter {
|
|
31
33
|
async onRunComplete(_contexts, { testResults }) {
|
|
32
34
|
if (!(0, environment_1.enabledFromEnvironment)()) {
|
|
33
35
|
return;
|
|
34
36
|
}
|
|
37
|
+
let lastCheckRun;
|
|
35
38
|
try {
|
|
36
39
|
const entries = (0, annotations_1.generateAnnotationEntries)(testResults);
|
|
37
40
|
const build = (0, environment_1.buildNameFromEnvironment)();
|
|
@@ -43,18 +46,26 @@ class GitHubReporter {
|
|
|
43
46
|
const summary = isOk
|
|
44
47
|
? '`skuba test` passed.'
|
|
45
48
|
: '`skuba test` found issues that require triage.';
|
|
46
|
-
|
|
49
|
+
const checkRun = {
|
|
47
50
|
name,
|
|
48
51
|
annotations,
|
|
49
52
|
conclusion: isOk ? 'success' : 'failure',
|
|
50
53
|
summary,
|
|
51
54
|
title: `${build} ${isOk ? 'passed' : 'failed'}`,
|
|
55
|
+
};
|
|
56
|
+
lastCheckRun = checkRun;
|
|
57
|
+
await (0, wait_1.throwOnTimeout)(GitHub.createCheckRun(checkRun), {
|
|
58
|
+
s: 30,
|
|
52
59
|
});
|
|
53
60
|
}
|
|
54
61
|
}
|
|
55
62
|
catch (err) {
|
|
56
|
-
logging_1.log.warn('Failed to
|
|
57
|
-
logging_1.log.
|
|
63
|
+
logging_1.log.warn('Failed to report test results to GitHub.');
|
|
64
|
+
logging_1.log.subtle((0, util_1.inspect)(err));
|
|
65
|
+
if (lastCheckRun) {
|
|
66
|
+
logging_1.log.subtle('Last request:');
|
|
67
|
+
logging_1.log.subtle(JSON.stringify(lastCheckRun));
|
|
68
|
+
}
|
|
58
69
|
}
|
|
59
70
|
}
|
|
60
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cli/test/reporters/github/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cli/test/reporters/github/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+B;AAK/B,+DAAiD;AACjD,oEAG4C;AAC5C,uDAAgD;AAChD,iDAAwD;AAExD,+CAA0D;AAE1D,MAAqB,cAAc;IACjC,KAAK,CAAC,aAAa,CACjB,SAA2B,EAC3B,EAAE,WAAW,EAAoB;QAEjC,IAAI,CAAC,IAAA,oCAAsB,GAAE,EAAE;YAC7B,OAAO;SACR;QAID,IAAI,YAAkC,CAAC;QAEvC,IAAI;YACF,MAAM,OAAO,GAAG,IAAA,uCAAyB,EAAC,WAAW,CAAC,CAAC;YAEvD,MAAM,KAAK,GAAG,IAAA,sCAAwB,GAAE,CAAC;YAEzC,uCAAuC;YACvC,0EAA0E;YAC1E,KAAK,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,OAAO,EAAE;gBAClD,MAAM,IAAI,GAAG,aAAa,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;gBAEnE,MAAM,IAAI,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC;gBAEjC,MAAM,OAAO,GAAG,IAAI;oBAClB,CAAC,CAAC,sBAAsB;oBACxB,CAAC,CAAC,gDAAgD,CAAC;gBAErD,MAAM,QAAQ,GAAa;oBACzB,IAAI;oBACJ,WAAW;oBACX,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;oBACxC,OAAO;oBACP,KAAK,EAAE,GAAG,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE;iBAChD,CAAC;gBAEF,YAAY,GAAG,QAAQ,CAAC;gBAExB,MAAM,IAAA,qBAAc,EAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;oBACpD,CAAC,EAAE,EAAE;iBACN,CAAC,CAAC;aACJ;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,aAAG,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;YACrD,aAAG,CAAC,MAAM,CAAC,IAAA,cAAO,EAAC,GAAG,CAAC,CAAC,CAAC;YAEzB,IAAI,YAAY,EAAE;gBAChB,aAAG,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;gBAC5B,aAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;aAC1C;SACF;IACH,CAAC;CACF;AArDD,iCAqDC"}
|
package/lib/utils/args.js
CHANGED
|
@@ -12,7 +12,7 @@ const hasSerialFlag = (args = process.argv, env = process.env) => args.some((arg
|
|
|
12
12
|
Boolean(
|
|
13
13
|
// Run serially on SEEK's central npm publishing pipeline.
|
|
14
14
|
// Exhausting agents here can cause grief.
|
|
15
|
-
env.BUILDKITE_AGENT_META_DATA_QUEUE?.split(',').
|
|
15
|
+
env.BUILDKITE_AGENT_META_DATA_QUEUE?.split(',').some((queueName) => queueName.startsWith('artefacts:npm')));
|
|
16
16
|
exports.hasSerialFlag = hasSerialFlag;
|
|
17
17
|
/**
|
|
18
18
|
* Parse process arguments.
|
package/lib/utils/args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/utils/args.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uCAA4C;AAErC,MAAM,YAAY,GAAG,CAAC,IA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,IAAI,IAAI,KAAK,QAAQ,EAAE;QACrB,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE;YAClB,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;YAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACtB;QAED,iCAAiC;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACtB;IAED,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC"}
|
package/lib/utils/error.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { inspect } from 'util';
|
|
1
3
|
import * as t from 'runtypes';
|
|
2
4
|
export declare type ConcurrentlyErrors = t.Static<typeof ConcurrentlyErrors>;
|
|
3
5
|
export declare const ConcurrentlyErrors: t.Array<t.Record<{
|
|
@@ -8,6 +10,18 @@ export declare const ConcurrentlyErrors: t.Array<t.Record<{
|
|
|
8
10
|
index: t.Number;
|
|
9
11
|
exitCode: t.Number;
|
|
10
12
|
}, false>, false>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates an error that returns its plain `message` rather than a full stack
|
|
15
|
+
* trace when `util.inspect`ed.
|
|
16
|
+
*
|
|
17
|
+
* This can be useful for terser handling and logging of known error scenarios
|
|
18
|
+
* that have descriptive messages.
|
|
19
|
+
*
|
|
20
|
+
* https://nodejs.org/api/util.html#custom-inspection-functions-on-objects
|
|
21
|
+
*/
|
|
22
|
+
export declare const createTerseError: (message?: string | undefined) => Error & {
|
|
23
|
+
[inspect.custom]: () => string | undefined;
|
|
24
|
+
};
|
|
11
25
|
export declare const handleCliError: (err: unknown) => void;
|
|
12
26
|
export declare const isErrorWithCode: <T>(err: unknown, code: T) => err is Record<PropertyKey, unknown> & {
|
|
13
27
|
code: T;
|
package/lib/utils/error.js
CHANGED
|
@@ -24,7 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
return result;
|
|
25
25
|
};
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.isErrorWithCode = exports.handleCliError = exports.ConcurrentlyErrors = void 0;
|
|
27
|
+
exports.isErrorWithCode = exports.handleCliError = exports.createTerseError = exports.ConcurrentlyErrors = void 0;
|
|
28
|
+
const util_1 = require("util");
|
|
28
29
|
const t = __importStar(require("runtypes"));
|
|
29
30
|
const logging_1 = require("./logging");
|
|
30
31
|
const validation_1 = require("./validation");
|
|
@@ -36,13 +37,26 @@ exports.ConcurrentlyErrors = t.Array(t.Record({
|
|
|
36
37
|
index: t.Number,
|
|
37
38
|
exitCode: t.Number,
|
|
38
39
|
}));
|
|
40
|
+
/**
|
|
41
|
+
* Creates an error that returns its plain `message` rather than a full stack
|
|
42
|
+
* trace when `util.inspect`ed.
|
|
43
|
+
*
|
|
44
|
+
* This can be useful for terser handling and logging of known error scenarios
|
|
45
|
+
* that have descriptive messages.
|
|
46
|
+
*
|
|
47
|
+
* https://nodejs.org/api/util.html#custom-inspection-functions-on-objects
|
|
48
|
+
*/
|
|
49
|
+
const createTerseError = (message) => Object.assign(new Error(message), {
|
|
50
|
+
[util_1.inspect.custom]: () => message,
|
|
51
|
+
});
|
|
52
|
+
exports.createTerseError = createTerseError;
|
|
39
53
|
const isExecaError = (err) => (0, validation_1.hasNumberProp)(err, 'exitCode');
|
|
40
54
|
const handleCliError = (err) => {
|
|
41
55
|
if (isExecaError(err)) {
|
|
42
56
|
process.exitCode = err.exitCode;
|
|
43
57
|
return;
|
|
44
58
|
}
|
|
45
|
-
logging_1.log.err(err);
|
|
59
|
+
logging_1.log.err((0, util_1.inspect)(err));
|
|
46
60
|
process.exitCode = 1;
|
|
47
61
|
return;
|
|
48
62
|
};
|
package/lib/utils/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;AAE5B,+BAA+B;AAG/B,4CAA8B;AAE9B,uCAAgC;AAChC,6CAAsD;AAIzC,QAAA,kBAAkB,GAAG,CAAC,CAAC,KAAK,CACvC,CAAC,CAAC,MAAM,CAAC;IACP,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,OAAO,EAAE,CAAC,CAAC,MAAM;QACjB,IAAI,EAAE,CAAC,CAAC,MAAM;KACf,CAAC;IACF,KAAK,EAAE,CAAC,CAAC,MAAM;IACf,QAAQ,EAAE,CAAC,CAAC,MAAM;CACnB,CAAC,CACH,CAAC;AAEF;;;;;;;;GAQG;AACI,MAAM,gBAAgB,GAAG,CAAC,OAAgB,EAAE,EAAE,CACnD,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE;IAChC,CAAC,cAAO,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,OAAO;CAChC,CAAC,CAAC;AAHQ,QAAA,gBAAgB,oBAGxB;AAEL,MAAM,YAAY,GAAG,CAAC,GAAY,EAAqB,EAAE,CACvD,IAAA,0BAAa,EAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAE1B,MAAM,cAAc,GAAG,CAAC,GAAY,EAAE,EAAE;IAC7C,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE;QACrB,OAAO,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;QAChC,OAAO;KACR;IAED,aAAG,CAAC,GAAG,CAAC,IAAA,cAAO,EAAC,GAAG,CAAC,CAAC,CAAC;IACtB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACrB,OAAO;AACT,CAAC,CAAC;AATW,QAAA,cAAc,kBASzB;AAEK,MAAM,eAAe,GAAG,CAC7B,GAAY,EACZ,IAAO,EAC4C,EAAE,CACrD,IAAA,oBAAO,EAAC,GAAG,EAAE,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC;AAJ/B,QAAA,eAAe,mBAIgB"}
|
package/lib/utils/version.js
CHANGED
|
@@ -6,12 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getSkubaVersionInfo = exports.getSkubaVersion = void 0;
|
|
7
7
|
const latest_version_1 = __importDefault(require("latest-version"));
|
|
8
8
|
const manifest_1 = require("./manifest");
|
|
9
|
-
const
|
|
9
|
+
const wait_1 = require("./wait");
|
|
10
10
|
const latestSkubaVersion = async () => {
|
|
11
11
|
try {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return typeof result === 'string' ? result : null;
|
|
12
|
+
const result = await (0, wait_1.withTimeout)((0, latest_version_1.default)('skuba'), { s: 2 });
|
|
13
|
+
return result.ok ? result.value : null;
|
|
15
14
|
}
|
|
16
15
|
catch {
|
|
17
16
|
return null;
|
package/lib/utils/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA2C;AAE3C,yCAA8C;
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA2C;AAE3C,yCAA8C;AAC9C,iCAAqC;AAErC,MAAM,kBAAkB,GAAG,KAAK,IAA4B,EAAE;IAC5D,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAW,EAAC,IAAA,wBAAa,EAAC,OAAO,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAEnE,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;KACxC;IAAC,MAAM;QACN,OAAO,IAAI,CAAC;KACb;AACH,CAAC,CAAC;AAEK,MAAM,eAAe,GAAG,KAAK,IAAqB,EAAE;IACzD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,2BAAgB,GAAE,CAAC;IAE7C,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAJW,QAAA,eAAe,mBAI1B;AAgBK,MAAM,mBAAmB,GAAG,KAAK,IAA+B,EAAE;IACvE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACxC,IAAA,uBAAe,GAAE;QACjB,kBAAkB,EAAE;KACrB,CAAC,CAAC;IAEH,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,6DAA6D;QAC7D,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK;YACL,MAAM;SACP,CAAC;KACH;IAED,OAAO;QACL,OAAO,EAAE,MAAM,KAAK,KAAK;QACzB,KAAK;QACL,MAAM;KACP,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,mBAAmB,uBAoB9B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface Timeout extends PromiseLike<void> {
|
|
2
|
+
clear?: () => void;
|
|
3
|
+
}
|
|
4
|
+
export declare const sleep: (ms: number) => Timeout;
|
|
5
|
+
export declare const throwOnTimeout: <T>(promise: PromiseLike<T>, { s }: {
|
|
6
|
+
s: number;
|
|
7
|
+
}) => Promise<T>;
|
|
8
|
+
declare type TimeoutResult<T> = {
|
|
9
|
+
ok: true;
|
|
10
|
+
value: T;
|
|
11
|
+
} | {
|
|
12
|
+
ok: false;
|
|
13
|
+
};
|
|
14
|
+
export declare const withTimeout: <T>(promise: T | PromiseLike<T>, { s }: {
|
|
15
|
+
s: number;
|
|
16
|
+
}) => Promise<TimeoutResult<T>>;
|
|
17
|
+
export {};
|