skuba 5.1.1 → 5.2.0-beta.1
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/git/commit.js +4 -0
- package/lib/api/git/commit.js.map +1 -1
- package/lib/api/git/commitAllChanges.js +4 -0
- package/lib/api/git/commitAllChanges.js.map +1 -1
- package/lib/api/git/currentBranch.js +4 -0
- package/lib/api/git/currentBranch.js.map +1 -1
- package/lib/api/git/getChangedFiles.js +4 -0
- package/lib/api/git/getChangedFiles.js.map +1 -1
- package/lib/api/git/log.js +4 -0
- package/lib/api/git/log.js.map +1 -1
- package/lib/api/git/pull.js +4 -0
- package/lib/api/git/pull.js.map +1 -1
- package/lib/api/git/push.js +4 -0
- package/lib/api/git/push.js.map +1 -1
- package/lib/api/git/remote.js +4 -0
- package/lib/api/git/remote.js.map +1 -1
- package/lib/api/git/reset.js +4 -0
- package/lib/api/git/reset.js.map +1 -1
- package/lib/api/github/checkRun.js +4 -0
- package/lib/api/github/checkRun.js.map +1 -1
- package/lib/api/github/environment.js +5 -1
- package/lib/api/github/environment.js.map +1 -1
- package/lib/api/github/issueComment.js +4 -0
- package/lib/api/github/issueComment.js.map +1 -1
- package/lib/api/github/pullRequest.js +4 -0
- package/lib/api/github/pullRequest.js.map +1 -1
- package/lib/api/github/push.js +4 -0
- package/lib/api/github/push.js.map +1 -1
- package/lib/api/jest/index.d.ts +1 -1
- package/lib/api/jest/index.js +4 -0
- package/lib/api/jest/index.js.map +1 -1
- package/lib/api/net/socket.js +4 -0
- package/lib/api/net/socket.js.map +1 -1
- package/lib/cli/adapter/eslint.js +11 -2
- package/lib/cli/adapter/eslint.js.map +2 -2
- package/lib/cli/adapter/prettier.js +4 -0
- package/lib/cli/adapter/prettier.js.map +1 -1
- package/lib/cli/build/args.js +4 -0
- package/lib/cli/build/args.js.map +1 -1
- package/lib/cli/build/esbuild.js +5 -0
- package/lib/cli/build/esbuild.js.map +1 -1
- package/lib/cli/build/index.js +4 -0
- package/lib/cli/build/index.js.map +1 -1
- package/lib/cli/configure/addEmptyExports.d.ts +1 -0
- package/lib/cli/configure/addEmptyExports.js +12 -3
- package/lib/cli/configure/addEmptyExports.js.map +2 -2
- package/lib/cli/configure/analyseConfiguration.js +4 -0
- package/lib/cli/configure/analyseConfiguration.js.map +1 -1
- package/lib/cli/configure/analyseDependencies.js +4 -0
- package/lib/cli/configure/analyseDependencies.js.map +1 -1
- package/lib/cli/configure/analysis/diff.js +4 -0
- package/lib/cli/configure/analysis/diff.js.map +1 -1
- package/lib/cli/configure/analysis/files.js +4 -0
- package/lib/cli/configure/analysis/files.js.map +1 -1
- package/lib/cli/configure/analysis/git.js +4 -0
- package/lib/cli/configure/analysis/git.js.map +1 -1
- package/lib/cli/configure/analysis/package.js +4 -0
- package/lib/cli/configure/analysis/package.js.map +1 -1
- package/lib/cli/configure/analysis/project.js +4 -0
- package/lib/cli/configure/analysis/project.js.map +1 -1
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
- package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
- package/lib/cli/configure/dependencies/skuba.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDeps.js +2 -0
- package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
- package/lib/cli/configure/ensureTemplateCompletion.js +4 -0
- package/lib/cli/configure/ensureTemplateCompletion.js.map +1 -1
- package/lib/cli/configure/getEntryPoint.js +4 -0
- package/lib/cli/configure/getEntryPoint.js.map +1 -1
- package/lib/cli/configure/getProjectType.js.map +1 -1
- package/lib/cli/configure/index.js +4 -0
- package/lib/cli/configure/index.js.map +1 -1
- package/lib/cli/configure/modules/eslint.js +1 -0
- package/lib/cli/configure/modules/eslint.js.map +1 -1
- package/lib/cli/configure/modules/jest.js.map +1 -1
- package/lib/cli/configure/modules/package.js.map +1 -1
- package/lib/cli/configure/modules/prettier.js +1 -0
- package/lib/cli/configure/modules/prettier.js.map +1 -1
- package/lib/cli/configure/modules/renovate.d.ts +1 -0
- package/lib/cli/configure/modules/renovate.js +12 -0
- package/lib/cli/configure/modules/renovate.js.map +2 -2
- package/lib/cli/configure/modules/skubaDive.js +4 -0
- package/lib/cli/configure/modules/skubaDive.js.map +1 -1
- package/lib/cli/configure/modules/tsconfig.js.map +1 -1
- package/lib/cli/configure/patchRenovateConfig.d.ts +1 -0
- package/lib/cli/configure/patchRenovateConfig.js +132 -0
- package/lib/cli/configure/patchRenovateConfig.js.map +7 -0
- package/lib/cli/configure/processing/package.js +4 -0
- package/lib/cli/configure/processing/package.js.map +1 -1
- package/lib/cli/configure/processing/prettier.js +4 -0
- package/lib/cli/configure/processing/prettier.js.map +1 -1
- package/lib/cli/configure/processing/record.js +4 -0
- package/lib/cli/configure/processing/record.js.map +1 -1
- package/lib/cli/configure/processing/typescript.js +4 -3
- package/lib/cli/configure/processing/typescript.js.map +2 -2
- package/lib/cli/configure/refreshIgnoreFiles.d.ts +1 -0
- package/lib/cli/configure/refreshIgnoreFiles.js +12 -5
- package/lib/cli/configure/refreshIgnoreFiles.js.map +2 -2
- package/lib/cli/format.js +10 -1
- package/lib/cli/format.js.map +2 -2
- package/lib/cli/init/getConfig.js +7 -0
- package/lib/cli/init/getConfig.js.map +1 -1
- package/lib/cli/init/git.js +5 -0
- package/lib/cli/init/git.js.map +1 -1
- package/lib/cli/init/index.js +8 -0
- package/lib/cli/init/index.js.map +2 -2
- package/lib/cli/init/prompts.d.ts +1 -1
- package/lib/cli/init/prompts.js.map +2 -2
- package/lib/cli/init/types.js +6 -0
- package/lib/cli/init/types.js.map +1 -1
- package/lib/cli/init/validation.d.ts +1 -1
- package/lib/cli/init/validation.js.map +1 -1
- package/lib/cli/init/writePackageJson.js +4 -0
- package/lib/cli/init/writePackageJson.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/eslint.d.ts +1 -1
- package/lib/cli/lint/annotate/buildkite/eslint.js +4 -0
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/index.d.ts +3 -3
- package/lib/cli/lint/annotate/buildkite/index.js +4 -0
- package/lib/cli/lint/annotate/buildkite/index.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/prettier.d.ts +1 -1
- package/lib/cli/lint/annotate/buildkite/prettier.js +4 -0
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/tsc.d.ts +1 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js +4 -0
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +2 -2
- package/lib/cli/lint/annotate/github/eslint.d.ts +1 -1
- package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/github/index.d.ts +3 -3
- package/lib/cli/lint/annotate/github/index.js +4 -0
- package/lib/cli/lint/annotate/github/index.js.map +2 -2
- package/lib/cli/lint/annotate/github/prettier.d.ts +1 -1
- package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/github/tsc.d.ts +1 -1
- package/lib/cli/lint/annotate/github/tsc.js +4 -0
- package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
- package/lib/cli/lint/autofix.js +54 -11
- package/lib/cli/lint/autofix.js.map +3 -3
- package/lib/cli/lint/eslint.js +4 -0
- package/lib/cli/lint/eslint.js.map +1 -1
- package/lib/cli/lint/external.js +4 -0
- package/lib/cli/lint/external.js.map +1 -1
- package/lib/cli/lint/index.js +6 -1
- package/lib/cli/lint/index.js.map +2 -2
- package/lib/cli/lint/internal.js +4 -0
- package/lib/cli/lint/internal.js.map +1 -1
- package/lib/cli/lint/prettier.js +4 -0
- package/lib/cli/lint/prettier.js.map +1 -1
- package/lib/cli/node.js +6 -0
- package/lib/cli/node.js.map +1 -1
- package/lib/cli/start.js +4 -0
- package/lib/cli/start.js.map +1 -1
- package/lib/cli/test/reporters/github/annotations.js +4 -0
- package/lib/cli/test/reporters/github/annotations.js.map +1 -1
- package/lib/cli/test/reporters/github/index.js +4 -0
- package/lib/cli/test/reporters/github/index.js.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/skuba.js +4 -0
- package/lib/skuba.js.map +1 -1
- package/lib/utils/args.js +6 -0
- package/lib/utils/args.js.map +1 -1
- package/lib/utils/command.d.ts +1 -1
- package/lib/utils/command.js +4 -0
- package/lib/utils/command.js.map +2 -2
- package/lib/utils/copy.js +4 -0
- package/lib/utils/copy.js.map +1 -1
- package/lib/utils/dir.js +4 -0
- package/lib/utils/dir.js.map +1 -1
- package/lib/utils/error.js +4 -0
- package/lib/utils/error.js.map +1 -1
- package/lib/utils/exec.js +7 -1
- package/lib/utils/exec.js.map +1 -1
- package/lib/utils/logging.js +4 -0
- package/lib/utils/logging.js.map +1 -1
- package/lib/utils/logo.js +4 -0
- package/lib/utils/logo.js.map +1 -1
- package/lib/utils/manifest.js +4 -0
- package/lib/utils/manifest.js.map +1 -1
- package/lib/utils/port.js +4 -0
- package/lib/utils/port.js.map +1 -1
- package/lib/utils/template.d.ts +1 -1
- package/lib/utils/template.js +4 -0
- package/lib/utils/template.js.map +2 -2
- package/lib/utils/validation.js.map +1 -1
- package/lib/utils/version.js +4 -0
- package/lib/utils/version.js.map +1 -1
- package/lib/wrapper/functionHandler.js +4 -0
- package/lib/wrapper/functionHandler.js.map +1 -1
- package/lib/wrapper/http.d.ts +6 -0
- package/lib/wrapper/http.js +15 -8
- package/lib/wrapper/http.js.map +2 -2
- package/lib/wrapper/index.js.map +1 -1
- package/lib/wrapper/main.js +4 -0
- package/lib/wrapper/main.js.map +1 -1
- package/lib/wrapper/requestListener.js +19 -5
- package/lib/wrapper/requestListener.js.map +3 -3
- package/package.json +14 -12
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/package.json +1 -1
- package/template/express-rest-api/src/config.ts +1 -1
- package/template/express-rest-api/src/listen.ts +7 -0
- package/template/greeter/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/package.json +5 -5
- package/template/koa-rest-api/src/config.ts +1 -1
- package/template/koa-rest-api/src/listen.ts +7 -0
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +3 -3
- package/template/lambda-sqs-worker/package.json +5 -4
- package/template/lambda-sqs-worker/src/config.ts +1 -1
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/cli/lint/annotate/github/tsc.ts"],
|
|
4
|
-
"sourcesContent": ["import stripAnsi from 'strip-ansi';\n\nimport type * as GitHub from '../../../../api/github';\nimport type { StreamInterceptor } from '
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import stripAnsi from 'strip-ansi';\n\nimport type * as GitHub from '../../../../api/github';\nimport type { StreamInterceptor } from '../../../lint/external';\n\ntype TscLevel = 'error' | 'warning' | 'info';\n\n/**\n * Matches the `tsc \u2502` prefix on each `tsc` log.\n */\n\n/**\n * Matches regular and pretty `tsc` output.\n *\n * For example, given the following input string:\n *\n * ```console\n * src/skuba.ts:43:7 - error TS2769: No overload matches this call.\n * Overload 1 of 2, '(obj: LogContext, msg?: string | undefined, ...args: any[]): void', gave the following error.\n * Argument of type 'unknown' is not assignable to parameter of type 'LogContext'.\n * Overload 2 of 2, '(msg?: string | undefined, ...args: any[]): void', gave the following error.\n * Argument of type 'unknown' is not assignable to parameter of type 'string | undefined'.\n * Type 'unknown' is not assignable to type 'string'.\n * ```\n *\n * This pattern will produce the following matches:\n *\n * 1. src/skuba.ts\n * 2. 43\n * 3. 7\n * 4. error\n * 5. 2769\n * 6. No overload matches this call [...] not assignable to type 'string'.\n */\nconst tscOutputRegex =\n /([^\\s].*)[\\(:](\\d+)[,:](\\d+)(?:\\):\\s+|\\s+-\\s+)(error|warning|info)\\s+TS(\\d+)\\s*:\\s*([\\s\\S]*?)(?=\\n\\S)(?=\\n\\D)/g;\n\nconst annotationLevelMap: Record<\n TscLevel,\n GitHub.Annotation['annotation_level']\n> = {\n error: 'failure',\n warning: 'warning',\n info: 'notice',\n};\n\nexport const createTscAnnotations = (\n tscOk: boolean,\n tscOutputStream: StreamInterceptor,\n): GitHub.Annotation[] => {\n if (tscOk) {\n return [];\n }\n\n const matches = stripAnsi(tscOutputStream.output()).matchAll(tscOutputRegex);\n return Array.from(matches).flatMap<GitHub.Annotation>((match) =>\n match?.length === 7\n ? {\n annotation_level: annotationLevelMap[match[4] as TscLevel],\n path: match[1],\n start_line: Number(match[2]),\n end_line: Number(match[2]),\n start_column: Number(match[3]),\n end_column: Number(match[3]),\n message: match[6].trim(),\n title: `tsc (TS${match[5]})`,\n }\n : [],\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAsB;AAkCtB,MAAM,iBACJ;AAEF,MAAM,qBAGF;AAAA,EACF,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AACR;AAEO,MAAM,uBAAuB,CAClC,OACA,oBACwB;AACxB,MAAI,OAAO;AACT,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,cAAU,kBAAAA,SAAU,gBAAgB,OAAO,CAAC,EAAE,SAAS,cAAc;AAC3E,SAAO,MAAM,KAAK,OAAO,EAAE;AAAA,IAA2B,CAAC,UACrD,OAAO,WAAW,IACd;AAAA,MACE,kBAAkB,mBAAmB,MAAM,CAAC,CAAa;AAAA,MACzD,MAAM,MAAM,CAAC;AAAA,MACb,YAAY,OAAO,MAAM,CAAC,CAAC;AAAA,MAC3B,UAAU,OAAO,MAAM,CAAC,CAAC;AAAA,MACzB,cAAc,OAAO,MAAM,CAAC,CAAC;AAAA,MAC7B,YAAY,OAAO,MAAM,CAAC,CAAC;AAAA,MAC3B,SAAS,MAAM,CAAC,EAAE,KAAK;AAAA,MACvB,OAAO,UAAU,MAAM,CAAC;AAAA,IAC1B,IACA,CAAC;AAAA,EACP;AACF;",
|
|
6
6
|
"names": ["stripAnsi"]
|
|
7
7
|
}
|
package/lib/cli/lint/autofix.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -28,16 +32,30 @@ __export(autofix_exports, {
|
|
|
28
32
|
autofix: () => autofix
|
|
29
33
|
});
|
|
30
34
|
module.exports = __toCommonJS(autofix_exports);
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
31
36
|
var import_util = require("util");
|
|
37
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
32
38
|
var import_simple_git = __toESM(require("simple-git"));
|
|
33
39
|
var Git = __toESM(require("../../api/git"));
|
|
34
40
|
var GitHub = __toESM(require("../../api/github"));
|
|
35
|
-
var import_eslint = require("../../cli/adapter/eslint");
|
|
36
|
-
var import_prettier = require("../../cli/adapter/prettier");
|
|
37
41
|
var import_env = require("../../utils/env");
|
|
38
42
|
var import_logging = require("../../utils/logging");
|
|
39
43
|
var import_wait = require("../../utils/wait");
|
|
44
|
+
var import_eslint = require("../adapter/eslint");
|
|
45
|
+
var import_prettier = require("../adapter/prettier");
|
|
46
|
+
var import_addEmptyExports = require("../configure/addEmptyExports");
|
|
47
|
+
var import_refreshIgnoreFiles = require("../configure/refreshIgnoreFiles");
|
|
40
48
|
const AUTOFIX_COMMIT_MESSAGE = "Run `skuba format`";
|
|
49
|
+
const AUTOFIX_DELETE_FILES = [
|
|
50
|
+
// Try to delete this SEEK-Jobs/gutenberg automation file that may have been
|
|
51
|
+
// accidentally committed in a prior autofix.
|
|
52
|
+
"Dockerfile-incunabulum"
|
|
53
|
+
];
|
|
54
|
+
const AUTOFIX_CODEGEN_FILES = /* @__PURE__ */ new Set([
|
|
55
|
+
...AUTOFIX_DELETE_FILES,
|
|
56
|
+
...import_addEmptyExports.JEST_SETUP_FILES,
|
|
57
|
+
...import_refreshIgnoreFiles.REFRESHABLE_IGNORE_FILES
|
|
58
|
+
]);
|
|
41
59
|
const AUTOFIX_IGNORE_FILES = [
|
|
42
60
|
{
|
|
43
61
|
path: ".npmrc",
|
|
@@ -72,11 +90,32 @@ const shouldPush = async ({
|
|
|
72
90
|
}
|
|
73
91
|
return true;
|
|
74
92
|
};
|
|
93
|
+
const tryCodegen = async (dir) => {
|
|
94
|
+
try {
|
|
95
|
+
await Promise.all(
|
|
96
|
+
AUTOFIX_DELETE_FILES.map(
|
|
97
|
+
(filename) => import_fs_extra.default.promises.rm(import_path.default.join(dir, filename), { force: true })
|
|
98
|
+
)
|
|
99
|
+
);
|
|
100
|
+
const changedFiles = await Git.getChangedFiles({
|
|
101
|
+
dir,
|
|
102
|
+
ignore: AUTOFIX_IGNORE_FILES
|
|
103
|
+
});
|
|
104
|
+
return changedFiles.some(
|
|
105
|
+
(changedFile) => AUTOFIX_CODEGEN_FILES.has(changedFile.path)
|
|
106
|
+
);
|
|
107
|
+
} catch (err) {
|
|
108
|
+
import_logging.log.warn(import_logging.log.bold("Failed to evaluate codegen changes."));
|
|
109
|
+
import_logging.log.subtle((0, import_util.inspect)(err));
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
75
113
|
const autofix = async (params) => {
|
|
76
|
-
|
|
114
|
+
const dir = process.cwd();
|
|
115
|
+
const codegen = await tryCodegen(dir);
|
|
116
|
+
if (!params.eslint && !params.prettier && !codegen) {
|
|
77
117
|
return;
|
|
78
118
|
}
|
|
79
|
-
const dir = process.cwd();
|
|
80
119
|
let currentBranch;
|
|
81
120
|
try {
|
|
82
121
|
currentBranch = await Git.currentBranch({ dir });
|
|
@@ -87,14 +126,18 @@ const autofix = async (params) => {
|
|
|
87
126
|
}
|
|
88
127
|
try {
|
|
89
128
|
import_logging.log.newline();
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
129
|
+
if (!params.eslint && !params.prettier) {
|
|
130
|
+
import_logging.log.warn("Trying to push codegen updates...");
|
|
131
|
+
} else {
|
|
132
|
+
import_logging.log.warn(
|
|
133
|
+
`Trying to autofix with ${params.eslint ? "ESLint and " : ""}Prettier...`
|
|
134
|
+
);
|
|
135
|
+
const logger = (0, import_logging.createLogger)(params.debug);
|
|
136
|
+
if (params.eslint) {
|
|
137
|
+
await (0, import_eslint.runESLint)("format", logger);
|
|
138
|
+
}
|
|
139
|
+
await (0, import_prettier.runPrettier)("format", logger);
|
|
96
140
|
}
|
|
97
|
-
await (0, import_prettier.runPrettier)("format", logger);
|
|
98
141
|
if (process.env.GITHUB_ACTIONS) {
|
|
99
142
|
const ref2 = await Git.commitAllChanges({
|
|
100
143
|
dir,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/autofix.ts"],
|
|
4
|
-
"sourcesContent": ["import { inspect } from 'util';\n\nimport simpleGit from 'simple-git';\n\nimport * as Git from '../../api/git';\nimport * as GitHub from '../../api/github';\nimport {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["ref", "simpleGit"]
|
|
4
|
+
"sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport fs from 'fs-extra';\nimport simpleGit from 'simple-git';\n\nimport * as Git from '../../api/git';\nimport * as GitHub from '../../api/github';\nimport { isCiEnv } from '../../utils/env';\nimport { createLogger, log } from '../../utils/logging';\nimport { throwOnTimeout } from '../../utils/wait';\nimport { runESLint } from '../adapter/eslint';\nimport { runPrettier } from '../adapter/prettier';\nimport { JEST_SETUP_FILES } from '../configure/addEmptyExports';\nimport { REFRESHABLE_IGNORE_FILES } from '../configure/refreshIgnoreFiles';\n\nimport type { Input } from './types';\n\nconst AUTOFIX_COMMIT_MESSAGE = 'Run `skuba format`';\n\nconst AUTOFIX_DELETE_FILES = [\n // Try to delete this SEEK-Jobs/gutenberg automation file that may have been\n // accidentally committed in a prior autofix.\n 'Dockerfile-incunabulum',\n];\n\nconst AUTOFIX_CODEGEN_FILES = new Set<string>([\n ...AUTOFIX_DELETE_FILES,\n ...JEST_SETUP_FILES,\n ...REFRESHABLE_IGNORE_FILES,\n]);\n\nexport const AUTOFIX_IGNORE_FILES: Git.ChangedFile[] = [\n {\n path: '.npmrc',\n state: 'added',\n },\n {\n path: 'Dockerfile-incunabulum',\n state: 'added',\n },\n];\n\nconst shouldPush = async ({\n currentBranch,\n dir,\n}: {\n currentBranch?: string;\n dir: string;\n}) => {\n if (!isCiEnv()) {\n // We're not running in a CI environment so we don't need to push autofixes.\n // Ideally we'd drive this off of repository write permissions, but that is\n // non-trivial to infer without attempting an actual write.\n return false;\n }\n\n const isDefaultBuildkiteBranch =\n currentBranch &&\n [process.env.BUILDKITE_PIPELINE_DEFAULT_BRANCH, 'master', 'main'].includes(\n currentBranch,\n );\n\n const isProtectedGitHubBranch = process.env.GITHUB_REF_PROTECTED === 'true';\n\n if (isDefaultBuildkiteBranch || isProtectedGitHubBranch) {\n // The current branch is a protected branch.\n // We respect GitHub Flow; avoid pushing directly to the default branch.\n return false;\n }\n\n let headCommitMessage;\n try {\n headCommitMessage = await Git.getHeadCommitMessage({ dir });\n } catch {}\n\n if (headCommitMessage === AUTOFIX_COMMIT_MESSAGE) {\n // Short circuit when the head commit appears to be one of our autofixes.\n // Repeating the same operation is unlikely to correct outstanding issues.\n return false;\n }\n\n // Allow the push attempt to go ahead if our guards have been cleared.\n return true;\n};\n\ninterface AutofixParameters {\n debug: Input['debug'];\n\n eslint: boolean;\n prettier: boolean;\n}\n\n/**\n * @returns Whether skuba codegenned a file change which should be included in\n * an autofix commit.\n */\nconst tryCodegen = async (dir: string): Promise<boolean> => {\n try {\n // Try to forcibly remove `AUTOFIX_DELETE_FILES` from source control.\n // These may include outdated configuration files or internal files that\n // were accidentally committed by an autofix.\n await Promise.all(\n AUTOFIX_DELETE_FILES.map((filename) =>\n fs.promises.rm(path.join(dir, filename), { force: true }),\n ),\n );\n\n // Search codegenned file changes in the local Git working directory.\n // These may include the `AUTOFIX_DELETE_FILES` deleted above or fixups to\n // ignore files and module exports that were run at the start of the\n // `skuba lint` command.\n const changedFiles = await Git.getChangedFiles({\n dir,\n\n ignore: AUTOFIX_IGNORE_FILES,\n });\n\n // Determine if a meaningful codegen change\n return changedFiles.some((changedFile) =>\n AUTOFIX_CODEGEN_FILES.has(changedFile.path),\n );\n } catch (err) {\n log.warn(log.bold('Failed to evaluate codegen changes.'));\n log.subtle(inspect(err));\n\n return false;\n }\n};\n\nexport const autofix = async (params: AutofixParameters): Promise<void> => {\n const dir = process.cwd();\n\n const codegen = await tryCodegen(dir);\n\n if (!params.eslint && !params.prettier && !codegen) {\n return;\n }\n\n let currentBranch;\n try {\n currentBranch = await Git.currentBranch({ dir });\n } catch {}\n\n if (!(await shouldPush({ currentBranch, dir }))) {\n return;\n }\n\n try {\n log.newline();\n if (!params.eslint && !params.prettier) {\n log.warn('Trying to push codegen updates...');\n } else {\n log.warn(\n `Trying to autofix with ${\n params.eslint ? 'ESLint and ' : ''\n }Prettier...`,\n );\n\n const logger = createLogger(params.debug);\n\n if (params.eslint) {\n await runESLint('format', logger);\n }\n // Unconditionally re-run Prettier; reaching here means we have pre-existing\n // format violations or may have created new ones through ESLint fixes.\n await runPrettier('format', logger);\n }\n\n if (process.env.GITHUB_ACTIONS) {\n // GitHub runners have Git installed locally\n const ref = await Git.commitAllChanges({\n dir,\n message: AUTOFIX_COMMIT_MESSAGE,\n\n ignore: AUTOFIX_IGNORE_FILES,\n });\n\n if (!ref) {\n return log.warn('No autofixes detected.');\n }\n\n await throwOnTimeout(simpleGit().push(), { s: 30 });\n log.warn(`Pushed fix commit ${ref}.`);\n return;\n }\n\n // Other CI Environments, use GitHub API\n if (!currentBranch) {\n log.warn('Could not determine the current branch.');\n log.warn(\n 'Please propagate BUILDKITE_BRANCH, GITHUB_HEAD_REF, GITHUB_REF_NAME, or the .git directory to your container.',\n );\n return;\n }\n\n const ref = await throwOnTimeout(\n GitHub.uploadAllFileChanges({\n branch: currentBranch,\n dir,\n messageHeadline: AUTOFIX_COMMIT_MESSAGE,\n\n ignore: AUTOFIX_IGNORE_FILES,\n }),\n { s: 30 },\n );\n\n if (!ref) {\n return log.warn('No autofixes detected.');\n }\n\n log.warn(`Pushed fix commit ${ref}.`);\n } catch (err) {\n log.warn(log.bold('Failed to push fix commit.'));\n log.warn(\n log.bold(\n 'Does your CI environment have write access to your Git repository?',\n ),\n );\n log.subtle(inspect(err));\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAwB;AAExB,sBAAe;AACf,wBAAsB;AAEtB,UAAqB;AACrB,aAAwB;AACxB,iBAAwB;AACxB,qBAAkC;AAClC,kBAA+B;AAC/B,oBAA0B;AAC1B,sBAA4B;AAC5B,6BAAiC;AACjC,gCAAyC;AAIzC,MAAM,yBAAyB;AAE/B,MAAM,uBAAuB;AAAA;AAAA;AAAA,EAG3B;AACF;AAEA,MAAM,wBAAwB,oBAAI,IAAY;AAAA,EAC5C,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL,CAAC;AAEM,MAAM,uBAA0C;AAAA,EACrD;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAA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,qBAAqB,MAAM;AAAA,EACtC,SAAS,KAAP;AACA,uBAAI,KAAK,mBAAI,KAAK,4BAA4B,CAAC;AAC/C,uBAAI;AAAA,MACF,mBAAI;AAAA,QACF;AAAA,MACF;AAAA,IACF;AACA,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AAAA,EACzB;AACF;",
|
|
6
|
+
"names": ["fs", "path", "ref", "simpleGit"]
|
|
7
7
|
}
|
package/lib/cli/lint/eslint.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/eslint.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\nimport { isMainThread } from 'worker_threads';\n\nimport chalk from 'chalk';\n\nimport { createLogger } from '../../utils/logging';\nimport { execWorkerThread, postWorkerOutput } from '../../utils/worker';\nimport type { ESLintOutput } from '../adapter/eslint';\nimport { runESLint } from '../adapter/eslint';\n\nimport type { Input } from './types';\n\nconst LOG_PREFIX = chalk.magenta('ESLint \u2502');\n\nexport const runESLintInCurrentThread = ({ debug }: Input) =>\n runESLint('lint', createLogger(debug, LOG_PREFIX));\n\nexport const runESLintInWorkerThread = (input: Input) =>\n execWorkerThread<Input, ESLintOutput>(\n path.posix.join(__dirname, 'eslint.js'),\n input,\n );\n\nif (!isMainThread) {\n postWorkerOutput(runESLintInCurrentThread, createLogger(false, LOG_PREFIX));\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,4BAA6B;AAE7B,mBAAkB;AAElB,qBAA6B;AAC7B,oBAAmD;AAEnD,oBAA0B;AAI1B,MAAM,aAAa,aAAAA,QAAM,QAAQ,iBAAY;AAEtC,MAAM,2BAA2B,CAAC,EAAE,MAAM,UAC/C,yBAAU,YAAQ,6BAAa,OAAO,UAAU,CAAC;AAE5C,MAAM,0BAA0B,CAAC,cACtC;AAAA,EACE,YAAAC,QAAK,MAAM,KAAK,WAAW,WAAW;AAAA,EACtC;AACF;AAEF,IAAI,CAAC,oCAAc;AACjB,sCAAiB,8BAA0B,6BAAa,OAAO,UAAU,CAAC;AAC5E;",
|
|
6
6
|
"names": ["chalk", "path"]
|
|
7
7
|
}
|
package/lib/cli/lint/external.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/external.ts"],
|
|
4
4
|
"sourcesContent": ["import stream from 'stream';\nimport { inspect } from 'util';\n\nimport { log } from '../../utils/logging';\nimport { throwOnTimeout } from '../../utils/wait';\n\nimport { createAnnotations } from './annotate';\nimport { autofix } from './autofix';\nimport { runESLintInCurrentThread, runESLintInWorkerThread } from './eslint';\nimport {\n runPrettierInCurrentThread,\n runPrettierInWorkerThread,\n} from './prettier';\nimport { runTscInNewProcess } from './tsc';\nimport type { Input } from './types';\n\nconst tscPrefixRegex = /^(.*?tsc\\s+\u2502.*?\\s)/gm;\n\nexport class StreamInterceptor extends stream.Transform {\n private chunks: Uint8Array[] = [];\n\n public output() {\n return Buffer.concat(this.chunks).toString().replace(tscPrefixRegex, '');\n }\n\n _transform(\n chunk: Uint8Array,\n _encoding: BufferEncoding,\n callback: stream.TransformCallback,\n ) {\n this.chunks.push(chunk);\n\n callback(null, chunk);\n }\n}\n\nconst lintConcurrently = async ({ tscOutputStream, ...input }: Input) => {\n const [eslint, prettier, tscOk] = await Promise.all([\n runESLintInWorkerThread(input),\n runPrettierInWorkerThread(input),\n runTscInNewProcess({ ...input, tscOutputStream }),\n ]);\n\n return { eslint, prettier, tscOk };\n};\n\n/**\n * Run linting tools `--serial`ly for resource-constrained environments.\n *\n * Note that we still run ESLint and Prettier in worker threads as a\n * counterintuitive optimisation. Memory can be more readily freed on worker\n * thread exit, which isn't as easy with a monolithic main thread.\n */\nconst lintSerially = async ({ tscOutputStream, ...input }: Input) => {\n const eslint = await runESLintInWorkerThread(input);\n const prettier = await runPrettierInWorkerThread(input);\n const tscOk = await runTscInNewProcess({ ...input, tscOutputStream });\n\n return { eslint, prettier, tscOk };\n};\n\nconst lintSeriallyWithoutWorkerThreads = async (input: Input) => {\n const eslint = await runESLintInCurrentThread(input);\n const prettier = await runPrettierInCurrentThread(input);\n const tscOk = await runTscInNewProcess(input);\n\n return { eslint, prettier, tscOk };\n};\n\nconst selectLintFunction = (input: Input) => {\n if (!input.workerThreads) {\n return lintSeriallyWithoutWorkerThreads;\n }\n\n // `--debug` implies `--serial`.\n const isSerial = input.debug || input.serial;\n\n return isSerial ? lintSerially : lintConcurrently;\n};\n\nexport const externalLint = async (input: Input) => {\n const lint = selectLintFunction(input);\n\n const tscOutputStream = new StreamInterceptor();\n tscOutputStream.pipe(input.tscOutputStream ?? process.stdout);\n\n const { eslint, prettier, tscOk } = await lint({ ...input, tscOutputStream });\n\n try {\n await throwOnTimeout(\n createAnnotations(eslint, prettier, tscOk, tscOutputStream),\n { s: 30 },\n );\n } catch (err) {\n log.warn('Failed to annotate lint results.');\n log.subtle(inspect(err));\n }\n\n if (!eslint.ok || !prettier.ok || !tscOk) {\n const tools = [\n ...(eslint.ok ? [] : ['ESLint']),\n ...(prettier.ok ? [] : ['Prettier']),\n ...(tscOk ? [] : ['tsc']),\n ];\n\n log.newline();\n log.err(`${tools.join(', ')} found issues that require triage.`);\n\n process.exitCode = 1;\n }\n\n await autofix({\n debug: input.debug,\n eslint: eslint.fixable,\n prettier: !prettier.ok,\n });\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AACnB,kBAAwB;AAExB,qBAAoB;AACpB,kBAA+B;AAE/B,sBAAkC;AAClC,qBAAwB;AACxB,oBAAkE;AAClE,sBAGO;AACP,iBAAmC;AAGnC,MAAM,iBAAiB;AAEhB,MAAM,0BAA0B,cAAAA,QAAO,UAAU;AAAA,EAAjD;AAAA;AACL,SAAQ,SAAuB,CAAC;AAAA;AAAA,EAEzB,SAAS;AACd,WAAO,OAAO,OAAO,KAAK,MAAM,EAAE,SAAS,EAAE,QAAQ,gBAAgB,EAAE;AAAA,EACzE;AAAA,EAEA,WACE,OACA,WACA,UACA;AACA,SAAK,OAAO,KAAK,KAAK;AAEtB,aAAS,MAAM,KAAK;AAAA,EACtB;AACF;AAEA,MAAM,mBAAmB,OAAO,EAAE,iBAAiB,GAAG,MAAM,MAAa;AACvE,QAAM,CAAC,QAAQ,UAAU,KAAK,IAAI,MAAM,QA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AAI,CAAC,OAAO,MAAM,CAAC,SAAS,MAAM,CAAC,OAAO;AACxC,UAAM,QAAQ;AAAA,MACZ,GAAI,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ;AAAA,MAC9B,GAAI,SAAS,KAAK,CAAC,IAAI,CAAC,UAAU;AAAA,MAClC,GAAI,QAAQ,CAAC,IAAI,CAAC,KAAK;AAAA,IACzB;AAEA,uBAAI,QAAQ;AACZ,uBAAI,IAAI,GAAG,MAAM,KAAK,IAAI,qCAAqC;AAE/D,YAAQ,WAAW;AAAA,EACrB;AAEA,YAAM,wBAAQ;AAAA,IACZ,OAAO,MAAM;AAAA,IACb,QAAQ,OAAO;AAAA,IACf,UAAU,CAAC,SAAS;AAAA,EACtB,CAAC;AACH;",
|
|
6
6
|
"names": ["stream"]
|
|
7
7
|
}
|
package/lib/cli/lint/index.js
CHANGED
|
@@ -23,11 +23,16 @@ __export(lint_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(lint_exports);
|
|
24
24
|
var import_args = require("../../utils/args");
|
|
25
25
|
var import_addEmptyExports = require("../configure/addEmptyExports");
|
|
26
|
+
var import_patchRenovateConfig = require("../configure/patchRenovateConfig");
|
|
26
27
|
var import_refreshIgnoreFiles = require("../configure/refreshIgnoreFiles");
|
|
27
28
|
var import_external = require("./external");
|
|
28
29
|
var import_internal = require("./internal");
|
|
29
30
|
const lint = async (args = process.argv.slice(2), tscOutputStream = void 0, workerThreads = true) => {
|
|
30
|
-
await Promise.all([
|
|
31
|
+
await Promise.all([
|
|
32
|
+
(0, import_addEmptyExports.tryAddEmptyExports)(),
|
|
33
|
+
(0, import_patchRenovateConfig.tryPatchRenovateConfig)(),
|
|
34
|
+
(0, import_refreshIgnoreFiles.tryRefreshIgnoreFiles)()
|
|
35
|
+
]);
|
|
31
36
|
const opts = {
|
|
32
37
|
debug: (0, import_args.hasDebugFlag)(args),
|
|
33
38
|
serial: (0, import_args.hasSerialFlag)(args),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/index.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Writable } from 'stream';\n\nimport { hasDebugFlag, hasSerialFlag } from '../../utils/args';\nimport { tryAddEmptyExports } from '../configure/addEmptyExports';\nimport { tryRefreshIgnoreFiles } from '../configure/refreshIgnoreFiles';\n\nimport { externalLint } from './external';\nimport { internalLint } from './internal';\nimport type { Input } from './types';\n\nexport const lint = async (\n args = process.argv.slice(2),\n tscOutputStream: Writable | undefined = undefined,\n workerThreads = true,\n) => {\n await Promise.all([tryAddEmptyExports()
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAA4C;AAC5C,6BAAmC;AACnC,gCAAsC;AAEtC,sBAA6B;AAC7B,sBAA6B;AAGtB,MAAM,OAAO,OAClB,OAAO,QAAQ,KAAK,MAAM,CAAC,GAC3B,kBAAwC,QACxC,gBAAgB,SACb;AACH,QAAM,QAAQ,IAAI,
|
|
4
|
+
"sourcesContent": ["import type { Writable } from 'stream';\n\nimport { hasDebugFlag, hasSerialFlag } from '../../utils/args';\nimport { tryAddEmptyExports } from '../configure/addEmptyExports';\nimport { tryPatchRenovateConfig } from '../configure/patchRenovateConfig';\nimport { tryRefreshIgnoreFiles } from '../configure/refreshIgnoreFiles';\n\nimport { externalLint } from './external';\nimport { internalLint } from './internal';\nimport type { Input } from './types';\n\nexport const lint = async (\n args = process.argv.slice(2),\n tscOutputStream: Writable | undefined = undefined,\n workerThreads = true,\n) => {\n await Promise.all([\n tryAddEmptyExports(),\n tryPatchRenovateConfig(),\n tryRefreshIgnoreFiles(),\n ]);\n\n const opts: Input = {\n debug: hasDebugFlag(args),\n serial: hasSerialFlag(args),\n tscOutputStream,\n workerThreads,\n };\n\n await externalLint(opts);\n\n await internalLint();\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAA4C;AAC5C,6BAAmC;AACnC,iCAAuC;AACvC,gCAAsC;AAEtC,sBAA6B;AAC7B,sBAA6B;AAGtB,MAAM,OAAO,OAClB,OAAO,QAAQ,KAAK,MAAM,CAAC,GAC3B,kBAAwC,QACxC,gBAAgB,SACb;AACH,QAAM,QAAQ,IAAI;AAAA,QAChB,2CAAmB;AAAA,QACnB,mDAAuB;AAAA,QACvB,iDAAsB;AAAA,EACxB,CAAC;AAED,QAAM,OAAc;AAAA,IAClB,WAAO,0BAAa,IAAI;AAAA,IACxB,YAAQ,2BAAc,IAAI;AAAA,IAC1B;AAAA,IACA;AAAA,EACF;AAEA,YAAM,8BAAa,IAAI;AAEvB,YAAM,8BAAa;AACrB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/lint/internal.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/internal.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nimport chalk from 'chalk';\nimport { pathExists } from 'fs-extra';\n\nimport { log } from '../../utils/logging';\nimport { getConsumerManifest } from '../../utils/manifest';\n\nconst noSkubaTemplateJs = async () => {\n const manifest = await getConsumerManifest();\n\n if (!manifest) {\n return;\n }\n\n const templateConfigPath = path.join(\n path.dirname(manifest.path),\n 'skuba.template.js',\n );\n\n if (await pathExists(templateConfigPath)) {\n log.err(\n `Template is incomplete; run ${chalk.bold(\n 'yarn skuba configure',\n )}. ${chalk.dim('no-skuba-template-js')}`,\n );\n\n process.exitCode = 1;\n }\n};\n\nexport const internalLint = async () => {\n await noSkubaTemplateJs();\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkB;AAClB,sBAA2B;AAE3B,qBAAoB;AACpB,sBAAoC;AAEpC,MAAM,oBAAoB,YAAY;AACpC,QAAM,WAAW,UAAM,qCAAoB;AAE3C,MAAI,CAAC,UAAU;AACb;AAAA,EACF;AAEA,QAAM,qBAAqB,YAAAA,QAAK;AAAA,IAC9B,YAAAA,QAAK,QAAQ,SAAS,IAAI;AAAA,IAC1B;AAAA,EACF;AAEA,MAAI,UAAM,4BAAW,kBAAkB,GAAG;AACxC,uBAAI;AAAA,MACF,+BAA+B,aAAAC,QAAM;AAAA,QACnC;AAAA,MACF,MAAM,aAAAA,QAAM,IAAI,sBAAsB;AAAA,IACxC;AAEA,YAAQ,WAAW;AAAA,EACrB;AACF;AAEO,MAAM,eAAe,YAAY;AACtC,QAAM,kBAAkB;AAC1B;",
|
|
6
6
|
"names": ["path", "chalk"]
|
|
7
7
|
}
|
package/lib/cli/lint/prettier.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/prettier.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\nimport { isMainThread } from 'worker_threads';\n\nimport chalk from 'chalk';\n\nimport { createLogger } from '../../utils/logging';\nimport { execWorkerThread, postWorkerOutput } from '../../utils/worker';\nimport type { PrettierOutput } from '../adapter/prettier';\nimport { runPrettier } from '../adapter/prettier';\n\nimport type { Input } from './types';\n\nconst LOG_PREFIX = chalk.cyan('Prettier \u2502');\n\nexport const runPrettierInCurrentThread = ({ debug }: Input) =>\n runPrettier('lint', createLogger(debug, LOG_PREFIX));\n\nexport const runPrettierInWorkerThread = (input: Input) =>\n execWorkerThread<Input, PrettierOutput>(\n path.posix.join(__dirname, 'prettier.js'),\n input,\n );\n\nif (!isMainThread) {\n postWorkerOutput(runPrettierInCurrentThread, createLogger(false, LOG_PREFIX));\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,4BAA6B;AAE7B,mBAAkB;AAElB,qBAA6B;AAC7B,oBAAmD;AAEnD,sBAA4B;AAI5B,MAAM,aAAa,aAAAA,QAAM,KAAK,iBAAY;AAEnC,MAAM,6BAA6B,CAAC,EAAE,MAAM,UACjD,6BAAY,YAAQ,6BAAa,OAAO,UAAU,CAAC;AAE9C,MAAM,4BAA4B,CAAC,cACxC;AAAA,EACE,YAAAC,QAAK,MAAM,KAAK,WAAW,aAAa;AAAA,EACxC;AACF;AAEF,IAAI,CAAC,oCAAc;AACjB,sCAAiB,gCAA4B,6BAAa,OAAO,UAAU,CAAC;AAC9E;",
|
|
6
6
|
"names": ["chalk", "path"]
|
|
7
7
|
}
|
package/lib/cli/node.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -52,6 +56,8 @@ const node = async () => {
|
|
|
52
56
|
"tsconfig-paths/register",
|
|
53
57
|
"--require",
|
|
54
58
|
"ts-node/register/transpile-only",
|
|
59
|
+
// Override dangerously warn-only default on Node.js <15 so that we
|
|
60
|
+
// predictably return a non-zero exit code on an unhandled rejection.
|
|
55
61
|
"--unhandled-rejections=throw",
|
|
56
62
|
import_path.default.join(__dirname, "..", "wrapper"),
|
|
57
63
|
...args.script
|
package/lib/cli/node.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/cli/node.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nimport getPort from 'get-port';\nimport * as tsNode from 'ts-node';\n\nimport { parseRunArgs } from '../utils/args';\nimport { createExec } from '../utils/exec';\nimport { isIpPort } from '../utils/validation';\n\nexport const node = async () => {\n const args = parseRunArgs(process.argv.slice(2));\n\n const availablePort = await getPort();\n\n if (args.entryPoint) {\n const exec = createExec({\n env: {\n __SKUBA_ENTRY_POINT: args.entryPoint,\n __SKUBA_PORT: String(isIpPort(args.port) ? args.port : availablePort),\n },\n });\n\n // Run a script with plain `node` to support inspector options.\n // https://github.com/TypeStrong/ts-node#programmatic\n return exec(\n 'node',\n ...args.node,\n '--require',\n 'dotenv/config',\n '--require',\n 'tsconfig-paths/register',\n '--require',\n 'ts-node/register/transpile-only',\n // Override dangerously warn-only default on Node.js <15 so that we\n // predictably return a non-zero exit code on an unhandled rejection.\n '--unhandled-rejections=throw',\n path.join(__dirname, '..', 'wrapper'),\n ...args.script,\n );\n }\n\n // REPL with `ts-node` to support import statements.\n return tsNode\n .createRepl({\n service: tsNode.register({\n require: ['dotenv/config', 'tsconfig-paths/register'],\n transpileOnly: true,\n }),\n })\n .start();\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAoB;AACpB,aAAwB;AAExB,kBAA6B;AAC7B,kBAA2B;AAC3B,wBAAyB;AAElB,MAAM,OAAO,YAAY;AAC9B,QAAM,WAAO,0BAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AAE/C,QAAM,gBAAgB,UAAM,gBAAAA,SAAQ;AAEpC,MAAI,KAAK,YAAY;AACnB,UAAM,WAAO,wBAAW;AAAA,MACtB,KAAK;AAAA,QACH,qBAAqB,KAAK;AAAA,QAC1B,cAAc,WAAO,4BAAS,KAAK,IAAI,IAAI,KAAK,OAAO,aAAa;AAAA,MACtE;AAAA,IACF,CAAC;AAID,WAAO;AAAA,MACL;AAAA,MACA,GAAG,KAAK;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA,MAGA;AAAA,MACA,YAAAC,QAAK,KAAK,WAAW,MAAM,SAAS;AAAA,MACpC,GAAG,KAAK;AAAA,IACV;AAAA,EACF;AAGA,SAAO,OACJ,WAAW;AAAA,IACV,SAAS,OAAO,SAAS;AAAA,MACvB,SAAS,CAAC,iBAAiB,yBAAyB;AAAA,MACpD,eAAe;AAAA,IACjB,CAAC;AAAA,EACH,CAAC,EACA,MAAM;AACX;",
|
|
6
6
|
"names": ["getPort", "path"]
|
|
7
7
|
}
|
package/lib/cli/start.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
package/lib/cli/start.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/cli/start.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nimport getPort from 'get-port';\n\nimport { parseRunArgs } from '../utils/args';\nimport { createExec } from '../utils/exec';\nimport { getEntryPointFromManifest } from '../utils/manifest';\nimport { isIpPort } from '../utils/validation';\n\nexport const start = async () => {\n const [args, availablePort] = await Promise.all([\n parseRunArgs(process.argv.slice(2)),\n getPort(),\n ]);\n\n args.entryPoint ??= await getEntryPointFromManifest();\n\n const execProcess = createExec({\n env: {\n __SKUBA_ENTRY_POINT: args.entryPoint,\n __SKUBA_PORT: String(isIpPort(args.port) ? args.port : availablePort),\n },\n });\n\n return execProcess(\n 'ts-node-dev',\n ...args.node,\n '--require',\n 'dotenv/config',\n '--require',\n 'tsconfig-paths/register',\n '--respawn',\n '--transpile-only',\n path.join(__dirname, '..', 'wrapper'),\n ...args.script,\n );\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAoB;AAEpB,kBAA6B;AAC7B,kBAA2B;AAC3B,sBAA0C;AAC1C,wBAAyB;AAElB,MAAM,QAAQ,YAAY;AAC/B,QAAM,CAAC,MAAM,aAAa,IAAI,MAAM,QAAQ,IAAI;AAAA,QAC9C,0BAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AAAA,QAClC,gBAAAA,SAAQ;AAAA,EACV,CAAC;AAED,OAAK,eAAL,KAAK,aAAe,UAAM,2CAA0B;AAEpD,QAAM,kBAAc,wBAAW;AAAA,IAC7B,KAAK;AAAA,MACH,qBAAqB,KAAK;AAAA,MAC1B,cAAc,WAAO,4BAAS,KAAK,IAAI,IAAI,KAAK,OAAO,aAAa;AAAA,IACtE;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA,GAAG,KAAK;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAAC,QAAK,KAAK,WAAW,MAAM,SAAS;AAAA,IACpC,GAAG,KAAK;AAAA,EACV;AACF;",
|
|
6
6
|
"names": ["getPort", "path"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/cli/test/reporters/github/annotations.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nimport type { TestResult } from '@jest/test-result';\nimport stripAnsi from 'strip-ansi';\nimport dedent from 'ts-dedent';\n\nimport type * as GitHub from '../../../../api/github';\n\n/**\n * Matches the first stack trace location in a Jest failure message.\n *\n * For example, given the following input message:\n *\n * ```console\n * Error: expect(received).toBe(expected) // Object.is equality\n *\n * Expected: \"a\"\n * Received: \"b\"\n * at Object.<anonymous> (/workdir/skuba/src/test.test.ts:2:15)\n * at Promise.then.completed (/workdir/skuba/node_modules/jest-circus/build/utils.js:390:28)\n * ...\n * ```\n *\n * or:\n *\n * ```console\n * Error: expect(received).toBe(expected) // Object.is equality\n *\n * Expected: \"a\"\n * Received: \"b\"\n * at /workdir/skuba/src/test.test.ts:2:15\n * at Promise.then.completed (/workdir/skuba/node_modules/jest-circus/build/utils.js:390:28)\n * ...\n * ```\n *\n * This pattern will produce the following matches:\n *\n * 1. /workdir/skuba/src/test.test.ts\n * 2. 2\n * 2. 15\n */\nconst JEST_LOCATION_REGEX = /\\n +at (.+\\()?(.+?):(\\d+):(\\d+)/;\n\nexport const createAnnotations = (\n testResults: TestResult[],\n): GitHub.Annotation[] => {\n const cwd = process.cwd();\n\n return testResults.flatMap((testResult) => {\n if (testResult.testExecError) {\n return {\n annotation_level: 'failure',\n path: path.relative(cwd, testResult.testFilePath),\n start_line: 1,\n end_line: 1,\n message: stripAnsi(\n testResult.failureMessage\n ? dedent(testResult.failureMessage)\n : testResult.testExecError.message,\n ),\n title: 'Jest',\n };\n }\n\n if (testResult.numFailingTests > 0) {\n return testResult.testResults.flatMap((assertionResult) =>\n assertionResult.failureMessages.flatMap((failureMessage) => {\n const match = JEST_LOCATION_REGEX.exec(failureMessage);\n if (match?.length === 5) {\n return {\n annotation_level: 'failure',\n path: path.relative(cwd, match[2]),\n start_line: Number(match[3]),\n end_line: Number(match[3]),\n start_column: Number(match[4]),\n end_column: Number(match[4]),\n message: stripAnsi(failureMessage),\n title: 'Jest',\n };\n }\n\n return [];\n }),\n );\n }\n\n return [];\n });\n};\n\nconst DEFAULT_DISPLAY_NAME = Symbol('DEFAULT_DISPLAY_NAME');\n\ninterface AnnotationEntry {\n annotations: GitHub.Annotation[];\n displayName: string | undefined;\n}\n\nexport const generateAnnotationEntries = (\n testResults: TestResult[],\n): AnnotationEntry[] => {\n type ResultsByDisplayName = Record<string | symbol, TestResult[]>;\n\n // Group test results by display name.\n const resultsByDisplayName = testResults.reduce<ResultsByDisplayName>(\n (acc, result) => {\n const displayName = result.displayName?.name ?? DEFAULT_DISPLAY_NAME;\n\n (acc[displayName] ??= []).push(result);\n\n return acc;\n },\n {},\n );\n\n const defaultResults = resultsByDisplayName[DEFAULT_DISPLAY_NAME];\n\n const entries = [\n ...(defaultResults?.length ? ([[undefined, defaultResults]] as const) : []),\n ...Object.entries(resultsByDisplayName),\n ];\n\n // Create annotations for each display name.\n return entries.map<AnnotationEntry>(([displayName, results]) => ({\n annotations: createAnnotations(results),\n displayName,\n }));\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAGjB,wBAAsB;AACtB,uBAAmB;AAqCnB,MAAM,sBAAsB;AAErB,MAAM,oBAAoB,CAC/B,gBACwB;AACxB,QAAM,MAAM,QAAQ,IAAI;AAExB,SAAO,YAAY,QAAQ,CAAC,eAAe;AACzC,QAAI,WAAW,eAAe;AAC5B,aAAO;AAAA,QACL,kBAAkB;AAAA,QAClB,MAAM,YAAAA,QAAK,SAAS,KAAK,WAAW,YAAY;AAAA,QAChD,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,aAAS,kBAAAC;AAAA,UACP,WAAW,qBACP,iBAAAC,SAAO,WAAW,cAAc,IAChC,WAAW,cAAc;AAAA,QAC/B;AAAA,QACA,OAA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6
6
|
"names": ["path", "stripAnsi", "dedent"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/cli/test/reporters/github/index.ts"],
|
|
4
4
|
"sourcesContent": ["import { inspect } from 'util';\n\nimport type { Reporter, TestContext } from '@jest/reporters';\nimport type { AggregatedResult } from '@jest/test-result';\n\nimport * as GitHub from '../../../../api/github';\nimport {\n buildNameFromEnvironment,\n enabledFromEnvironment,\n} from '../../../../api/github/environment';\nimport { log } from '../../../../utils/logging';\nimport { throwOnTimeout } from '../../../../utils/wait';\n\nimport { generateAnnotationEntries } from './annotations';\n\nexport default class GitHubReporter implements Pick<Reporter, 'onRunComplete'> {\n async onRunComplete(\n _contexts: Set<TestContext>,\n { testResults }: AggregatedResult,\n ): Promise<void> {\n if (!enabledFromEnvironment()) {\n return;\n }\n\n type CheckRun = Parameters<typeof GitHub.createCheckRun>[0];\n\n let lastCheckRun: CheckRun | undefined;\n\n try {\n const entries = generateAnnotationEntries(testResults);\n\n const build = buildNameFromEnvironment();\n\n // Create a check run per display name.\n // Run in series to reduce the likelihood of exceeding GitHub rate limits.\n for (const { displayName, annotations } of entries) {\n const name = `skuba/test${displayName ? ` (${displayName})` : ''}`;\n\n const isOk = !annotations.length;\n\n const summary = isOk\n ? '`skuba test` passed.'\n : '`skuba test` found issues that require triage.';\n\n const checkRun: CheckRun = {\n name,\n annotations,\n conclusion: isOk ? 'success' : 'failure',\n summary,\n title: `${build} ${isOk ? 'passed' : 'failed'}`,\n };\n\n lastCheckRun = checkRun;\n\n await throwOnTimeout(GitHub.createCheckRun(checkRun), {\n s: 30,\n });\n }\n } catch (err) {\n log.warn('Failed to report test results to GitHub.');\n log.subtle(inspect(err));\n\n if (lastCheckRun) {\n log.subtle('Last request:');\n log.subtle(JSON.stringify(lastCheckRun));\n }\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAKxB,aAAwB;AACxB,yBAGO;AACP,qBAAoB;AACpB,kBAA+B;AAE/B,yBAA0C;AAE1C,MAAO,eAAwE;AAAA,EAC7E,MAAM,cACJ,WACA,EAAE,YAAY,GACC;AACf,QAAI,KAAC,2CAAuB,GAAG;AAC7B;AAAA,IACF;AAIA,QAAI;AAEJ,QAAI;AACF,YAAM,cAAU,8CAA0B,WAAW;AAErD,YAAM,YAAQ,6CAAyB;AAIvC,iBAAW,EAAE,aAAa,YAAY,KAAK,SAAS;AAClD,cAAM,OAAO,aAAa,cAAc,KAAK,iBAAiB;AAE9D,cAAM,OAAO,CAAC,YAAY;AAE1B,cAAM,UAAU,OACZ,yBACA;AAEJ,cAAM,WAAqB;AAAA,UACzB;AAAA,UACA;AAAA,UACA,YAAY,OAAO,YAAY;AAAA,UAC/B;AAAA,UACA,OAAO,GAAG,SAAS,OAAO,WAAW;AAAA,QACvC;AAEA,uBAAe;AAEf,kBAAM,4BAAe,OAAO,eAAe,QAAQ,GAAG;AAAA,UACpD,GAAG;AAAA,QACL,CAAC;AAAA,MACH;AAAA,IACF,SAAS,KAAP;AACA,yBAAI,KAAK,0CAA0C;AACnD,yBAAI,WAAO,qBAAQ,GAAG,CAAC;AAEvB,UAAI,cAAc;AAChB,2BAAI,OAAO,eAAe;AAC1B,2BAAI,OAAO,KAAK,UAAU,YAAY,CAAC;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/index.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
package/lib/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Entry point for the Node.js development API.\n *\n * This is where skuba imports point to:\n *\n * ```typescript\n * import { Net } from 'skuba';\n *\n * const { Net } = require('skuba');\n * ```\n */\n\nexport * as Buildkite from './api/buildkite';\nexport * as Git from './api/git';\nexport * as GitHub from './api/github';\nexport * as Jest from './api/jest';\nexport * as Net from './api/net';\n\n// evanw/esbuild#2388\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace WebAssembly {\n interface Module {}\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,gBAA2B;AAC3B,UAAqB;AACrB,aAAwB;AACxB,WAAsB;AACtB,UAAqB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/skuba.js
CHANGED
|
@@ -15,6 +15,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
18
22
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
19
23
|
mod
|
|
20
24
|
));
|
package/lib/skuba.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/skuba.ts"],
|
|
4
4
|
"sourcesContent": ["#!/usr/bin/env node\n\n/**\n * Entry point for the CLI.\n *\n * This is where you end up when you run:\n *\n * ```bash\n * [yarn] skuba help\n * ```\n */\n\nimport path from 'path';\n\nimport { parseProcessArgs } from './utils/args';\nimport { COMMAND_DIR, COMMAND_SET, commandToModule } from './utils/command';\nimport { handleCliError } from './utils/error';\nimport { showHelp } from './utils/help';\nimport { log } from './utils/logging';\nimport { showLogoAndVersionInfo } from './utils/logo';\nimport { hasProp } from './utils/validation';\n\nconst skuba = async () => {\n const { commandName } = parseProcessArgs(process.argv);\n\n if (COMMAND_SET.has(commandName)) {\n const moduleName = commandToModule(commandName);\n\n /* eslint-disable @typescript-eslint/no-var-requires */\n const commandModule = require(path.join(\n COMMAND_DIR,\n moduleName,\n )) as unknown;\n\n if (!hasProp(commandModule, moduleName)) {\n log.err(log.bold(commandName), \"couldn't run! Please submit an issue.\");\n process.exitCode = 1;\n return;\n }\n\n const run = commandModule[moduleName] as () => Promise<unknown>;\n\n return run();\n }\n\n log.err(log.bold(commandName), 'is not recognised as a command.');\n await showLogoAndVersionInfo();\n showHelp();\n\n process.exitCode = 1;\n};\n\nskuba().catch(handleCliError);\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAYA,kBAAiB;AAEjB,kBAAiC;AACjC,qBAA0D;AAC1D,mBAA+B;AAC/B,kBAAyB;AACzB,qBAAoB;AACpB,kBAAuC;AACvC,wBAAwB;AAExB,MAAM,QAAQ,YAAY;AACxB,QAAM,EAAE,YAAY,QAAI,8BAAiB,QAAQ,IAAI;AAErD,MAAI,2BAAY,IAAI,WAAW,GAAG;AAChC,UAAM,iBAAa,gCAAgB,WAAW;AAG9C,UAAM,gBAAgB,QAAQ,YAAAA,QAAK;AAAA,MACjC;AAAA,MACA;AAAA,IACF,CAAC;AAED,QAAI,KAAC,2BAAQ,eAAe,UAAU,GAAG;AACvC,yBAAI,IAAI,mBAAI,KAAK,WAAW,GAAG,uCAAuC;AACtE,cAAQ,WAAW;AACnB;AAAA,IACF;AAEA,UAAM,MAAM,cAAc,UAAU;AAEpC,WAAO,IAAI;AAAA,EACb;AAEA,qBAAI,IAAI,mBAAI,KAAK,WAAW,GAAG,iCAAiC;AAChE,YAAM,oCAAuB;AAC7B,4BAAS;AAET,UAAQ,WAAW;AACrB;AAEA,MAAM,EAAE,MAAM,2BAAc;",
|
|
6
6
|
"names": ["path"]
|
|
7
7
|
}
|
package/lib/utils/args.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -34,6 +38,8 @@ var import_assert = __toESM(require("assert"));
|
|
|
34
38
|
var import_command = require("./command");
|
|
35
39
|
const hasDebugFlag = (args = process.argv) => args.some((arg) => arg.toLocaleLowerCase() === "--debug");
|
|
36
40
|
const hasSerialFlag = (args = process.argv, env = process.env) => args.some((arg) => arg.toLocaleLowerCase() === "--serial") || Boolean(
|
|
41
|
+
// Run serially on SEEK's central npm publishing pipeline.
|
|
42
|
+
// Exhausting agents here can cause grief.
|
|
37
43
|
env.BUILDKITE_AGENT_META_DATA_QUEUE?.split(",").some(
|
|
38
44
|
(queueName) => queueName.startsWith("artefacts:npm")
|
|
39
45
|
)
|
package/lib/utils/args.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/args.ts"],
|
|
4
4
|
"sourcesContent": ["import assert from 'assert';\n\nimport { COMMAND_ALIASES } from './command';\n\nexport const hasDebugFlag = (args = process.argv) =>\n args.some((arg) => arg.toLocaleLowerCase() === '--debug');\n\nexport const hasSerialFlag = (args = process.argv, env = process.env) =>\n args.some((arg) => arg.toLocaleLowerCase() === '--serial') ||\n Boolean(\n // Run serially on SEEK's central npm publishing pipeline.\n // Exhausting agents here can cause grief.\n env.BUILDKITE_AGENT_META_DATA_QUEUE?.split(',').some((queueName) =>\n queueName.startsWith('artefacts:npm'),\n ),\n );\n\n/**\n * Parse process arguments.\n *\n * This function mutates the input list by removing the command name element.\n * Downstream commands can access their args with an ordinary\n * `process.argv.slice(2)`.\n *\n * Example input:\n *\n * ```typescript\n * ['/bin/node', 'node_modules/.bin/skuba', 'test', '--foo', '--bar']\n * ```\n */\nexport const parseProcessArgs = (args = process.argv) => {\n const skubaIdx = args.findIndex((chunk) => /skuba(\\.[jt]s)?$/.test(chunk));\n\n assert(skubaIdx >= 0, 'Cannot parse args for `skuba`');\n\n const rawCommand = (args[skubaIdx + 1] ?? 'help').toLocaleLowerCase();\n\n const commandName = COMMAND_ALIASES[rawCommand] ?? rawCommand;\n\n const payload = {\n commandName,\n args: args.slice(skubaIdx + 2),\n };\n\n args.splice(skubaIdx + 1, 1);\n\n return payload;\n};\n\ninterface RunArgs {\n /** The path to the entry point script. */\n entryPoint?: string;\n\n /** The port to start an HTTP server on. */\n port?: number;\n\n /** Arguments passed through to the Node.js executable. */\n node: string[];\n\n /** Arguments passed through to the entry point script. */\n script: string[];\n}\n\n/**\n * Make a best effort to parse \"run\" args.\n *\n * These are arguments that would be passed to `skuba node` or `skuba start`.\n * Parsing is handrolled because we support some weird and wonderful behaviour:\n *\n * - The `--port` option may be intended for skuba itself\n * - The `--inspect` options may be intended for the Node.js inspector\n * - The entry point may be omitted in favour of `package.json` inference\n * - Other args may be intended for propagation to the entry point\n */\nexport const parseRunArgs = (argv: string[]): RunArgs => {\n const state: RunArgs = {\n node: [],\n script: [],\n };\n\n let args = argv.filter((element) => element.length);\n\n while (args.length) {\n args = parseRunArgsIteration(state, args);\n }\n\n return state;\n};\n\nconst isDigits = (arg: unknown) => typeof arg === 'string' && /^\\d+$/.test(arg);\n\nconst parseRunArgsIteration = (state: RunArgs, args: string[]): string[] => {\n const [arg1, arg2] = args;\n\n if (!arg1) {\n return [];\n }\n\n if (/^--inspect(-brk)?=\\d+$/.test(arg1)) {\n state.node.push(arg1);\n return args.slice(1);\n }\n\n // Node.js inspector options that are optionally followed by a numeric port.\n if (['--inspect', '--inspect-brk'].includes(arg1)) {\n if (isDigits(arg2)) {\n state.node.push(`${arg1}=${arg2}`);\n return args.slice(2);\n }\n\n state.node.push(arg1);\n\n if (arg2) {\n // Some other string that doesn't relate to the Node.js inspector option.\n // This is presumably the entry point script to run.\n state.entryPoint = arg2;\n state.script.push(...args.slice(2));\n }\n\n return [];\n }\n\n if (/^--port=\\d+$/.test(arg1)) {\n state.port = Number(arg1.slice(7));\n return args.slice(1);\n }\n\n if (arg1 === '--port') {\n if (isDigits(arg2)) {\n state.port = Number(arg2);\n return args.slice(2);\n }\n\n // Invalid port argument; eat it.\n return args.slice(1);\n }\n\n state.entryPoint = arg1;\n state.script.push(...args.slice(1));\n return [];\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AAEnB,qBAAgC;AAEzB,MAAM,eAAe,CAAC,OAAO,QAAQ,SAC1C,KAAK,KAAK,CAAC,QAAQ,IAAI,kBAAkB,MAAM,SAAS;AAEnD,MAAM,gBAAgB,CAAC,OAAO,QAAQ,MAAM,MAAM,QAAQ,QAC/D,KAAK,KAAK,CAAC,QAAQ,IAAI,kBAAkB,MAAM,UAAU,KACzD;AAAA;AAAA;AAAA,EAGE,IAAI,iCAAiC,MAAM,GAAG,EAAE;AAAA,IAAK,CAAC,cACpD,UAAU,WAAW,eAAe;AAAA,EACtC;AACF;AAeK,MAAM,mBAAmB,CAAC,OAAO,QAAQ,SAAS;AACvD,QAAM,WAAW,KAAK,UAAU,CAAC,UAAU,mBAAmB,KAAK,KAAK,CAAC;AAEzE,oBAAAA,SAAO,YAAY,GAAG,+BAA+B;AAErD,QAAM,cAAc,KAAK,WAAW,CAAC,KAAK,QAAQ,kBAAkB;AAEpE,QAAM,cAAc,+BAAgB,UAAU,KAAK;AAEnD,QAAM,UAAU;AAAA,IACd;AAAA,IACA,MAAM,KAAK,MAAM,WAAW,CAAC;AAAA,EAC/B;AAEA,OAAK,OAAO,WAAW,GAAG,CAAC;AAE3B,SAAO;AACT;AA2BO,MAAM,eAAe,CAAC,SAA4B;AACvD,QAAM,QAAiB;AAAA,IACrB,MAAM,CAAC;AAAA,IACP,QAAQ,CAAC;AAAA,EACX;AAEA,MAAI,OAAO,KAAK,OAAO,CAAC,YAAY,QAAQ,MAAM;AAElD,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MMAND_LIST[number];
|
|
1
|
+
export type Command = (typeof COMMAND_LIST)[number];
|
|
2
2
|
export declare const COMMAND_ALIASES: Record<string, Command>;
|
|
3
3
|
export declare const COMMAND_DIR: string;
|
|
4
4
|
export declare const COMMAND_LIST: readonly ["build", "build-package", "configure", "format", "help", "init", "lint", "node", "release", "start", "test", "version"];
|
package/lib/utils/command.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
package/lib/utils/command.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/command.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nexport type Command = typeof COMMAND_LIST[number];\n\nexport const COMMAND_ALIASES: Record<string, Command> = {\n '-h': 'help',\n '--help': 'help',\n '-v': 'version',\n '--version': 'version',\n};\n\nexport const COMMAND_DIR = path.join(__dirname, '..', 'cli');\n\nexport const COMMAND_LIST = [\n 'build',\n 'build-package',\n 'configure',\n 'format',\n 'help',\n 'init',\n 'lint',\n 'node',\n 'release',\n 'start',\n 'test',\n 'version',\n] as const;\n\nexport const COMMAND_SET = new Set<string>(COMMAND_LIST);\n\nexport const commandToModule = (command: Command): string =>\n command\n .split('-')\n .map((segment, index) =>\n index === 0\n ? segment\n : `${segment[0].toLocaleUpperCase()}${segment.slice(1)}`,\n )\n .join('');\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nexport type Command = (typeof COMMAND_LIST)[number];\n\nexport const COMMAND_ALIASES: Record<string, Command> = {\n '-h': 'help',\n '--help': 'help',\n '-v': 'version',\n '--version': 'version',\n};\n\nexport const COMMAND_DIR = path.join(__dirname, '..', 'cli');\n\nexport const COMMAND_LIST = [\n 'build',\n 'build-package',\n 'configure',\n 'format',\n 'help',\n 'init',\n 'lint',\n 'node',\n 'release',\n 'start',\n 'test',\n 'version',\n] as const;\n\nexport const COMMAND_SET = new Set<string>(COMMAND_LIST);\n\nexport const commandToModule = (command: Command): string =>\n command\n .split('-')\n .map((segment, index) =>\n index === 0\n ? segment\n : `${segment[0].toLocaleUpperCase()}${segment.slice(1)}`,\n )\n .join('');\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAIV,MAAM,kBAA2C;AAAA,EACtD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,MAAM;AAAA,EACN,aAAa;AACf;AAEO,MAAM,cAAc,YAAAA,QAAK,KAAK,WAAW,MAAM,KAAK;AAEpD,MAAM,eAAe;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,cAAc,IAAI,IAAY,YAAY;AAEhD,MAAM,kBAAkB,CAAC,YAC9B,QACG,MAAM,GAAG,EACT;AAAA,EAAI,CAAC,SAAS,UACb,UAAU,IACN,UACA,GAAG,QAAQ,CAAC,EAAE,kBAAkB,IAAI,QAAQ,MAAM,CAAC;AACzD,EACC,KAAK,EAAE;",
|
|
6
6
|
"names": ["path"]
|
|
7
7
|
}
|
package/lib/utils/copy.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|