skuba 0.0.0-master-20231002013336 → 0.0.0-master-20240206001217
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 +3 -3
- package/jest/transform.test.ts +3 -1
- package/lib/api/jest/index.d.ts +3 -3
- package/lib/api/jest/index.js +19 -1
- package/lib/api/jest/index.js.map +2 -2
- package/lib/api/net/compose.js +2 -1
- package/lib/api/net/compose.js.map +2 -2
- package/lib/cli/adapter/prettier.d.ts +1 -1
- package/lib/cli/adapter/prettier.js +11 -10
- package/lib/cli/adapter/prettier.js.map +2 -2
- package/lib/cli/build/index.js +0 -2
- package/lib/cli/build/index.js.map +2 -2
- package/lib/cli/buildPackage.js +0 -2
- package/lib/cli/buildPackage.js.map +2 -2
- package/lib/cli/configure/analyseConfiguration.d.ts +2 -0
- package/lib/cli/configure/analyseConfiguration.js.map +2 -2
- package/lib/cli/configure/getEntryPoint.js +1 -1
- package/lib/cli/configure/getEntryPoint.js.map +2 -2
- package/lib/cli/configure/getProjectType.d.ts +1 -1
- package/lib/cli/configure/getProjectType.js +6 -3
- package/lib/cli/configure/getProjectType.js.map +2 -2
- package/lib/cli/configure/index.js +11 -12
- package/lib/cli/configure/index.js.map +2 -2
- package/lib/cli/configure/modules/index.js +0 -2
- package/lib/cli/configure/modules/index.js.map +2 -2
- package/lib/cli/configure/modules/package.d.ts +1 -1
- package/lib/cli/configure/modules/package.js +2 -1
- package/lib/cli/configure/modules/package.js.map +2 -2
- package/lib/cli/configure/patchRenovateConfig.d.ts +2 -1
- package/lib/cli/configure/patchRenovateConfig.js +36 -21
- package/lib/cli/configure/patchRenovateConfig.js.map +2 -2
- package/lib/cli/configure/types.d.ts +2 -0
- package/lib/cli/configure/types.js.map +1 -1
- package/lib/cli/configure/upgrade/index.d.ts +15 -0
- package/lib/cli/configure/upgrade/index.js +130 -0
- package/lib/cli/configure/upgrade/index.js.map +7 -0
- package/lib/cli/configure/{addEmptyExports.d.ts → upgrade/patches/7.3.1/addEmptyExports.d.ts} +2 -2
- package/lib/cli/configure/{addEmptyExports.js → upgrade/patches/7.3.1/addEmptyExports.js} +15 -11
- package/lib/cli/configure/upgrade/patches/7.3.1/addEmptyExports.js.map +7 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/index.d.ts +2 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/index.js +55 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/index.js.map +7 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.d.ts +2 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.js +94 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.js.map +7 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/patchDockerfile.d.ts +2 -0
- package/lib/cli/configure/{patchDockerfile.js → upgrade/patches/7.3.1/patchDockerfile.js} +18 -12
- package/lib/cli/configure/upgrade/patches/7.3.1/patchDockerfile.js.map +7 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/patchServerListener.d.ts +2 -0
- package/lib/cli/configure/{patchServerListener.js → upgrade/patches/7.3.1/patchServerListener.js} +18 -14
- package/lib/cli/configure/upgrade/patches/7.3.1/patchServerListener.js.map +7 -0
- package/lib/cli/format.js +7 -14
- package/lib/cli/format.js.map +2 -2
- package/lib/cli/init/getConfig.d.ts +7 -5
- package/lib/cli/init/getConfig.js +61 -34
- package/lib/cli/init/getConfig.js.map +2 -2
- package/lib/cli/init/git.d.ts +2 -1
- package/lib/cli/init/git.js +2 -9
- package/lib/cli/init/git.js.map +2 -2
- package/lib/cli/init/index.d.ts +1 -1
- package/lib/cli/init/index.js +19 -10
- package/lib/cli/init/index.js.map +2 -2
- package/lib/cli/init/prompts.d.ts +26 -3
- package/lib/cli/init/prompts.js +10 -2
- package/lib/cli/init/prompts.js.map +2 -2
- package/lib/cli/init/types.d.ts +120 -27
- package/lib/cli/init/types.js +30 -35
- package/lib/cli/init/types.js.map +2 -2
- package/lib/cli/init/writePackageJson.d.ts +6 -0
- package/lib/cli/init/writePackageJson.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/index.d.ts +2 -1
- package/lib/cli/lint/annotate/buildkite/index.js +5 -3
- package/lib/cli/lint/annotate/buildkite/index.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/internal.d.ts +2 -0
- package/lib/cli/lint/annotate/buildkite/internal.js +45 -0
- package/lib/cli/lint/annotate/buildkite/internal.js.map +7 -0
- package/lib/cli/lint/annotate/github/index.d.ts +2 -1
- package/lib/cli/lint/annotate/github/index.js +4 -2
- package/lib/cli/lint/annotate/github/index.js.map +2 -2
- package/lib/cli/lint/annotate/github/internal.d.ts +3 -0
- package/lib/cli/lint/annotate/github/internal.js +36 -0
- package/lib/cli/lint/annotate/github/internal.js.map +7 -0
- package/lib/cli/lint/annotate/index.d.ts +4 -3
- package/lib/cli/lint/annotate/index.js +9 -3
- package/lib/cli/lint/annotate/index.js.map +2 -2
- package/lib/cli/lint/autofix.d.ts +3 -1
- package/lib/cli/lint/autofix.js +36 -59
- package/lib/cli/lint/autofix.js.map +3 -3
- package/lib/cli/lint/external.d.ts +6 -1
- package/lib/cli/lint/external.js +6 -29
- package/lib/cli/lint/external.js.map +2 -2
- package/lib/cli/lint/index.d.ts +2 -1
- package/lib/cli/lint/index.js +46 -14
- package/lib/cli/lint/index.js.map +2 -2
- package/lib/cli/lint/internal.d.ts +12 -1
- package/lib/cli/lint/internal.js +55 -19
- package/lib/cli/lint/internal.js.map +3 -3
- package/lib/cli/lint/internalLints/deleteFiles.d.ts +3 -0
- package/lib/cli/lint/internalLints/deleteFiles.js +102 -0
- package/lib/cli/lint/internalLints/deleteFiles.js.map +7 -0
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.d.ts +3 -0
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +75 -0
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +7 -0
- package/lib/cli/lint/internalLints/refreshConfigFiles.d.ts +11 -0
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +147 -0
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +7 -0
- package/lib/cli/test/index.js +0 -2
- package/lib/cli/test/index.js.map +2 -2
- package/lib/skuba.d.ts +1 -1
- package/lib/skuba.js.map +1 -1
- package/lib/utils/error.d.ts +30 -10
- package/lib/utils/error.js +10 -20
- package/lib/utils/error.js.map +2 -2
- package/lib/utils/exec.d.ts +2 -1
- package/lib/utils/exec.js +3 -2
- package/lib/utils/exec.js.map +2 -2
- package/lib/utils/logging.d.ts +2 -0
- package/lib/utils/logging.js +1 -0
- package/lib/utils/logging.js.map +2 -2
- package/lib/utils/logo.js +6 -10
- package/lib/utils/logo.js.map +3 -3
- package/lib/utils/manifest.d.ts +4 -4
- package/lib/utils/manifest.js +10 -10
- package/lib/utils/manifest.js.map +2 -2
- package/lib/utils/npmrc.d.ts +1 -0
- package/lib/utils/npmrc.js +29 -0
- package/lib/utils/npmrc.js.map +7 -0
- package/lib/utils/packageManager.d.ts +24 -0
- package/lib/utils/packageManager.js +97 -0
- package/lib/utils/packageManager.js.map +7 -0
- package/lib/utils/template.d.ts +46 -13
- package/lib/utils/template.js +17 -15
- package/lib/utils/template.js.map +2 -2
- package/lib/utils/worker.d.ts +1 -0
- package/lib/wrapper/http.d.ts +1 -0
- package/package.json +50 -47
- package/template/base/_.dockerignore +0 -1
- package/template/base/_.eslintignore +1 -0
- package/template/base/_.gitignore +1 -1
- package/template/base/_.npmrc +8 -0
- package/template/express-rest-api/.buildkite/pipeline.yml +16 -12
- package/template/express-rest-api/.gantry/dev.yml +3 -0
- package/template/express-rest-api/.nvmrc +1 -1
- package/template/express-rest-api/Dockerfile +6 -12
- package/template/express-rest-api/Dockerfile.dev-deps +8 -7
- package/template/express-rest-api/README.md +12 -12
- package/template/express-rest-api/docker-compose.yml +0 -10
- package/template/express-rest-api/gantry.apply.yml +5 -0
- package/template/express-rest-api/gantry.build.yml +1 -2
- package/template/express-rest-api/package.json +4 -4
- package/template/express-rest-api/skuba.template.js +1 -0
- package/template/greeter/.buildkite/pipeline.yml +15 -11
- package/template/greeter/.nvmrc +1 -1
- package/template/greeter/Dockerfile +8 -7
- package/template/greeter/README.md +9 -9
- package/template/greeter/docker-compose.yml +0 -10
- package/template/greeter/package.json +3 -3
- package/template/greeter/skuba.template.js +1 -0
- package/template/koa-rest-api/.buildkite/pipeline.yml +16 -12
- package/template/koa-rest-api/.gantry/dev.yml +3 -0
- package/template/koa-rest-api/.nvmrc +1 -1
- package/template/koa-rest-api/Dockerfile +6 -12
- package/template/koa-rest-api/Dockerfile.dev-deps +8 -7
- package/template/koa-rest-api/README.md +12 -12
- package/template/koa-rest-api/docker-compose.yml +0 -10
- package/template/koa-rest-api/gantry.apply.yml +5 -0
- package/template/koa-rest-api/gantry.build.yml +1 -2
- package/template/koa-rest-api/package.json +10 -8
- package/template/koa-rest-api/skuba.template.js +1 -0
- package/template/koa-rest-api/src/app.test.ts +8 -4
- package/template/koa-rest-api/src/framework/validation.test.ts +48 -15
- package/template/koa-rest-api/src/framework/validation.ts +31 -8
- package/template/koa-rest-api/src/testing/types.ts +16 -4
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +25 -18
- package/template/lambda-sqs-worker/.nvmrc +1 -1
- package/template/lambda-sqs-worker/Dockerfile +8 -8
- package/template/lambda-sqs-worker/README.md +14 -14
- package/template/lambda-sqs-worker/_.npmrc +12 -0
- package/template/lambda-sqs-worker/docker-compose.yml +0 -15
- package/template/lambda-sqs-worker/package.json +6 -7
- package/template/lambda-sqs-worker/serverless.yml +5 -2
- package/template/lambda-sqs-worker/skuba.template.js +1 -0
- package/template/lambda-sqs-worker/src/framework/validation.test.ts +1 -1
- package/template/lambda-sqs-worker/src/hooks.ts +1 -2
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +46 -21
- package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
- package/template/lambda-sqs-worker-cdk/Dockerfile +11 -9
- package/template/lambda-sqs-worker-cdk/cdk.json +12 -6
- package/template/lambda-sqs-worker-cdk/docker-compose.yml +0 -15
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +1590 -228
- package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +23 -3
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +128 -15
- package/template/lambda-sqs-worker-cdk/package.json +9 -7
- package/template/lambda-sqs-worker-cdk/shared/context-types.ts +1 -0
- package/template/lambda-sqs-worker-cdk/skuba.template.js +1 -0
- package/template/lambda-sqs-worker-cdk/src/app.ts +14 -1
- package/template/lambda-sqs-worker-cdk/src/postHook.ts +154 -0
- package/template/lambda-sqs-worker-cdk/src/preHook.ts +95 -0
- package/template/oss-npm-package/.github/workflows/release.yml +10 -7
- package/template/oss-npm-package/.github/workflows/validate.yml +10 -7
- package/template/oss-npm-package/.nvmrc +1 -1
- package/template/oss-npm-package/.releaserc +16 -0
- package/template/oss-npm-package/README.md +18 -18
- package/template/oss-npm-package/_package.json +3 -2
- package/template/oss-npm-package/skuba.template.js +1 -0
- package/template/private-npm-package/.nvmrc +1 -1
- package/template/private-npm-package/.releaserc +16 -0
- package/template/private-npm-package/README.md +18 -18
- package/template/private-npm-package/_package.json +3 -3
- package/template/private-npm-package/skuba.template.js +1 -0
- package/lib/cli/configure/addEmptyExports.js.map +0 -7
- package/lib/cli/configure/modules/tsconfig.d.ts +0 -2
- package/lib/cli/configure/modules/tsconfig.js +0 -87
- package/lib/cli/configure/modules/tsconfig.js.map +0 -7
- package/lib/cli/configure/patchDockerfile.d.ts +0 -1
- package/lib/cli/configure/patchDockerfile.js.map +0 -7
- package/lib/cli/configure/patchServerListener.d.ts +0 -3
- package/lib/cli/configure/patchServerListener.js.map +0 -7
- package/lib/cli/configure/refreshIgnoreFiles.d.ts +0 -3
- package/lib/cli/configure/refreshIgnoreFiles.js +0 -78
- package/lib/cli/configure/refreshIgnoreFiles.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/types.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod';\n\nimport { projectTypeSchema } from '../../utils/manifest';\nimport { packageManagerSchema } from '../../utils/packageManager';\n\nexport interface Input {\n /**\n * Whether to enable verbose debug logging.\n *\n * Defaults to `false`.\n */\n debug: boolean;\n}\n\nexport type InitConfigInput = z.infer<typeof initConfigInputSchema>;\n\nexport const initConfigInputSchema = z.object({\n destinationDir: z.string(),\n templateComplete: z.boolean(),\n templateData: z\n .object({\n ownerName: z.string(),\n repoName: z.string(),\n platformName: z.union([z.literal('amd64'), z.literal('arm64')]),\n defaultBranch: z.string(),\n })\n .catchall(z.string()),\n templateName: z.string(),\n});\n\nexport type InitConfig = z.infer<typeof initConfigSchema>;\n\nconst initConfigSchema = initConfigInputSchema\n .omit({\n templateData: true,\n })\n .extend({\n templateData: z\n .object({\n ownerName: z.string(),\n repoName: z.string(),\n defaultBranch: z.string(),\n\n // Derived from ownerName\n // TODO: use zod to transform `InitConfigInput` -> `InitConfig`?\n orgName: z.string(),\n teamName: z.string(),\n\n // Generated by init command\n port: z.string(),\n })\n .catchall(z.string()),\n\n entryPoint: z.string().optional(),\n packageManager: packageManagerSchema,\n type: projectTypeSchema.optional(),\n });\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AAElB,sBAAkC;AAClC,4BAAqC;AAa9B,MAAM,wBAAwB,aAAE,OAAO;AAAA,EAC5C,gBAAgB,aAAE,OAAO;AAAA,EACzB,kBAAkB,aAAE,QAAQ;AAAA,EAC5B,cAAc,aACX,OAAO;AAAA,IACN,WAAW,aAAE,OAAO;AAAA,IACpB,UAAU,aAAE,OAAO;AAAA,IACnB,cAAc,aAAE,MAAM,CAAC,aAAE,QAAQ,OAAO,GAAG,aAAE,QAAQ,OAAO,CAAC,CAAC;AAAA,IAC9D,eAAe,aAAE,OAAO;AAAA,EAC1B,CAAC,EACA,SAAS,aAAE,OAAO,CAAC;AAAA,EACtB,cAAc,aAAE,OAAO;AACzB,CAAC;AAID,MAAM,mBAAmB,sBACtB,KAAK;AAAA,EACJ,cAAc;AAChB,CAAC,EACA,OAAO;AAAA,EACN,cAAc,aACX,OAAO;AAAA,IACN,WAAW,aAAE,OAAO;AAAA,IACpB,UAAU,aAAE,OAAO;AAAA,IACnB,eAAe,aAAE,OAAO;AAAA;AAAA;AAAA,IAIxB,SAAS,aAAE,OAAO;AAAA,IAClB,UAAU,aAAE,OAAO;AAAA;AAAA,IAGnB,MAAM,aAAE,OAAO;AAAA,EACjB,CAAC,EACA,SAAS,aAAE,OAAO,CAAC;AAAA,EAEtB,YAAY,aAAE,OAAO,EAAE,SAAS;AAAA,EAChC,gBAAgB;AAAA,EAChB,MAAM,kCAAkB,SAAS;AACnC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,6 +6,12 @@ interface WritePackageJsonProps {
|
|
|
6
6
|
type?: ProjectType;
|
|
7
7
|
version: string;
|
|
8
8
|
}
|
|
9
|
+
export interface SkubaPackageJson {
|
|
10
|
+
entryPoint: string | null;
|
|
11
|
+
template: string;
|
|
12
|
+
type?: string;
|
|
13
|
+
version: string;
|
|
14
|
+
}
|
|
9
15
|
/**
|
|
10
16
|
* Write a `skuba` section into the destination `package.json`.
|
|
11
17
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/writePackageJson.ts"],
|
|
4
|
-
"sourcesContent": ["import fs from 'fs-extra';\n\nimport type { ProjectType } from '../../utils/manifest';\nimport { getDestinationManifest } from '../configure/analysis/package';\nimport { formatPackage } from '../configure/processing/package';\n\ninterface WritePackageJsonProps {\n cwd: string;\n entryPoint?: string;\n template: string;\n type?: ProjectType;\n version: string;\n}\n\n/**\n * Write a `skuba` section into the destination `package.json`.\n */\nexport const writePackageJson = async ({\n cwd,\n entryPoint,\n template,\n type,\n version,\n}: WritePackageJsonProps) => {\n const manifest = await getDestinationManifest({ cwd });\n\n manifest.packageJson.skuba = {\n entryPoint: entryPoint ?? null,\n template,\n type,\n version,\n };\n\n const updatedPackageJson = await formatPackage(manifest.packageJson);\n\n await fs.promises.writeFile(manifest.path, updatedPackageJson);\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAe;AAGf,qBAAuC;AACvC,IAAAA,kBAA8B;
|
|
4
|
+
"sourcesContent": ["import fs from 'fs-extra';\n\nimport type { ProjectType } from '../../utils/manifest';\nimport { getDestinationManifest } from '../configure/analysis/package';\nimport { formatPackage } from '../configure/processing/package';\n\ninterface WritePackageJsonProps {\n cwd: string;\n entryPoint?: string;\n template: string;\n type?: ProjectType;\n version: string;\n}\n\nexport interface SkubaPackageJson {\n entryPoint: string | null;\n template: string;\n type?: string;\n version: string;\n}\n\n/**\n * Write a `skuba` section into the destination `package.json`.\n */\nexport const writePackageJson = async ({\n cwd,\n entryPoint,\n template,\n type,\n version,\n}: WritePackageJsonProps) => {\n const manifest = await getDestinationManifest({ cwd });\n\n manifest.packageJson.skuba = {\n entryPoint: entryPoint ?? null,\n template,\n type,\n version,\n } satisfies SkubaPackageJson;\n\n const updatedPackageJson = await formatPackage(manifest.packageJson);\n\n await fs.promises.writeFile(manifest.path, updatedPackageJson);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAe;AAGf,qBAAuC;AACvC,IAAAA,kBAA8B;AAoBvB,MAAM,mBAAmB,OAAO;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA6B;AAC3B,QAAM,WAAW,UAAM,uCAAuB,EAAE,IAAI,CAAC;AAErD,WAAS,YAAY,QAAQ;AAAA,IAC3B,YAAY,cAAc;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,qBAAqB,UAAM,+BAAc,SAAS,WAAW;AAEnE,QAAM,gBAAAC,QAAG,SAAS,UAAU,SAAS,MAAM,kBAAkB;AAC/D;",
|
|
6
6
|
"names": ["import_package", "fs"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ESLintOutput } from '../../../adapter/eslint';
|
|
2
2
|
import type { PrettierOutput } from '../../../adapter/prettier';
|
|
3
3
|
import type { StreamInterceptor } from '../../../lint/external';
|
|
4
|
-
|
|
4
|
+
import type { InternalLintResult } from '../../internal';
|
|
5
|
+
export declare const createBuildkiteAnnotations: (internal: InternalLintResult, eslint: ESLintOutput, prettier: PrettierOutput, tscOk: boolean, tscOutputStream: StreamInterceptor) => Promise<void>;
|
|
@@ -33,20 +33,22 @@ __export(buildkite_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(buildkite_exports);
|
|
34
34
|
var Buildkite = __toESM(require("../../../../api/buildkite"));
|
|
35
35
|
var import_eslint = require("./eslint");
|
|
36
|
+
var import_internal = require("./internal");
|
|
36
37
|
var import_prettier = require("./prettier");
|
|
37
38
|
var import_tsc = require("./tsc");
|
|
38
|
-
const createBuildkiteAnnotations = async (eslint, prettier, tscOk, tscOutputStream) => {
|
|
39
|
-
if (eslint.ok && prettier.ok && tscOk) {
|
|
39
|
+
const createBuildkiteAnnotations = async (internal, eslint, prettier, tscOk, tscOutputStream) => {
|
|
40
|
+
if (internal.ok && eslint.ok && prettier.ok && tscOk) {
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
43
|
const buildkiteOutput = [
|
|
43
44
|
"`skuba lint` found issues that require triage:",
|
|
45
|
+
...(0, import_internal.createInternalAnnotations)(internal),
|
|
44
46
|
...(0, import_eslint.createEslintAnnotations)(eslint),
|
|
45
47
|
...(0, import_prettier.createPrettierAnnotations)(prettier),
|
|
46
48
|
...(0, import_tsc.createTscAnnotations)(tscOk, tscOutputStream)
|
|
47
49
|
].join("\n\n");
|
|
48
50
|
await Buildkite.annotate(buildkiteOutput, {
|
|
49
|
-
context: "skuba-lint
|
|
51
|
+
context: "skuba-lint",
|
|
50
52
|
scopeContextToStep: true,
|
|
51
53
|
style: "error"
|
|
52
54
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/cli/lint/annotate/buildkite/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as Buildkite from '../../../../api/buildkite';\nimport type { ESLintOutput } from '../../../adapter/eslint';\nimport type { PrettierOutput } from '../../../adapter/prettier';\nimport type { StreamInterceptor } from '../../../lint/external';\n\nimport { createEslintAnnotations } from './eslint';\nimport { createPrettierAnnotations } from './prettier';\nimport { createTscAnnotations } from './tsc';\n\nexport const createBuildkiteAnnotations = async (\n eslint: ESLintOutput,\n prettier: PrettierOutput,\n tscOk: boolean,\n tscOutputStream: StreamInterceptor,\n): Promise<void> => {\n if (eslint.ok && prettier.ok && tscOk) {\n return;\n }\n\n const buildkiteOutput = [\n '`skuba lint` found issues that require triage:',\n ...createEslintAnnotations(eslint),\n ...createPrettierAnnotations(prettier),\n ...createTscAnnotations(tscOk, tscOutputStream),\n ].join('\\n\\n');\n\n await Buildkite.annotate(buildkiteOutput, {\n context: 'skuba-lint
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;
|
|
4
|
+
"sourcesContent": ["import * as Buildkite from '../../../../api/buildkite';\nimport type { ESLintOutput } from '../../../adapter/eslint';\nimport type { PrettierOutput } from '../../../adapter/prettier';\nimport type { StreamInterceptor } from '../../../lint/external';\nimport type { InternalLintResult } from '../../internal';\n\nimport { createEslintAnnotations } from './eslint';\nimport { createInternalAnnotations } from './internal';\nimport { createPrettierAnnotations } from './prettier';\nimport { createTscAnnotations } from './tsc';\n\nexport const createBuildkiteAnnotations = async (\n internal: InternalLintResult,\n eslint: ESLintOutput,\n prettier: PrettierOutput,\n tscOk: boolean,\n tscOutputStream: StreamInterceptor,\n): Promise<void> => {\n if (internal.ok && eslint.ok && prettier.ok && tscOk) {\n return;\n }\n\n const buildkiteOutput = [\n '`skuba lint` found issues that require triage:',\n ...createInternalAnnotations(internal),\n ...createEslintAnnotations(eslint),\n ...createPrettierAnnotations(prettier),\n ...createTscAnnotations(tscOk, tscOutputStream),\n ].join('\\n\\n');\n\n await Buildkite.annotate(buildkiteOutput, {\n context: 'skuba-lint',\n scopeContextToStep: true,\n style: 'error',\n });\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAM3B,oBAAwC;AACxC,sBAA0C;AAC1C,sBAA0C;AAC1C,iBAAqC;AAE9B,MAAM,6BAA6B,OACxC,UACA,QACA,UACA,OACA,oBACkB;AAClB,MAAI,SAAS,MAAM,OAAO,MAAM,SAAS,MAAM,OAAO;AACpD;AAAA,EACF;AAEA,QAAM,kBAAkB;AAAA,IACtB;AAAA,IACA,OAAG,2CAA0B,QAAQ;AAAA,IACrC,OAAG,uCAAwB,MAAM;AAAA,IACjC,OAAG,2CAA0B,QAAQ;AAAA,IACrC,OAAG,iCAAqB,OAAO,eAAe;AAAA,EAChD,EAAE,KAAK,MAAM;AAEb,QAAM,UAAU,SAAS,iBAAiB;AAAA,IACxC,SAAS;AAAA,IACT,oBAAoB;AAAA,IACpB,OAAO;AAAA,EACT,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
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.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var internal_exports = {};
|
|
30
|
+
__export(internal_exports, {
|
|
31
|
+
createInternalAnnotations: () => createInternalAnnotations
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(internal_exports);
|
|
34
|
+
var Buildkite = __toESM(require("../../../../api/buildkite"));
|
|
35
|
+
const createInternalAnnotations = (internal) => !internal.ok && internal.annotations?.length ? [
|
|
36
|
+
"**skuba**",
|
|
37
|
+
Buildkite.md.terminal(
|
|
38
|
+
internal.annotations.map(({ message, path }) => `${path} ${message}`).join("\n")
|
|
39
|
+
)
|
|
40
|
+
] : [];
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
createInternalAnnotations
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/cli/lint/annotate/buildkite/internal.ts"],
|
|
4
|
+
"sourcesContent": ["import * as Buildkite from '../../../../api/buildkite';\nimport type { InternalLintResult } from '../../internal';\n\nexport const createInternalAnnotations = (\n internal: InternalLintResult,\n): string[] =>\n !internal.ok && internal.annotations?.length\n ? [\n '**skuba**',\n Buildkite.md.terminal(\n internal.annotations\n .map(({ message, path }) => `${path} ${message}`)\n .join('\\n'),\n ),\n ]\n : [];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAGpB,MAAM,4BAA4B,CACvC,aAEA,CAAC,SAAS,MAAM,SAAS,aAAa,SAClC;AAAA,EACE;AAAA,EACA,UAAU,GAAG;AAAA,IACX,SAAS,YACN,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM,GAAG,IAAI,IAAI,OAAO,EAAE,EAC/C,KAAK,IAAI;AAAA,EACd;AACF,IACA,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ESLintOutput } from '../../../adapter/eslint';
|
|
2
2
|
import type { PrettierOutput } from '../../../adapter/prettier';
|
|
3
3
|
import type { StreamInterceptor } from '../../../lint/external';
|
|
4
|
-
|
|
4
|
+
import type { InternalLintResult } from '../../internal';
|
|
5
|
+
export declare const createGitHubAnnotations: (internal: InternalLintResult, eslint: ESLintOutput, prettier: PrettierOutput, tscOk: boolean, tscOutputStream: StreamInterceptor) => Promise<void>;
|
|
@@ -34,18 +34,20 @@ module.exports = __toCommonJS(github_exports);
|
|
|
34
34
|
var GitHub = __toESM(require("../../../../api/github"));
|
|
35
35
|
var import_environment = require("../../../../api/github/environment");
|
|
36
36
|
var import_eslint = require("./eslint");
|
|
37
|
+
var import_internal = require("./internal");
|
|
37
38
|
var import_prettier = require("./prettier");
|
|
38
39
|
var import_tsc = require("./tsc");
|
|
39
|
-
const createGitHubAnnotations = async (eslint, prettier, tscOk, tscOutputStream) => {
|
|
40
|
+
const createGitHubAnnotations = async (internal, eslint, prettier, tscOk, tscOutputStream) => {
|
|
40
41
|
if (!(0, import_environment.enabledFromEnvironment)()) {
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
44
|
const annotations = [
|
|
45
|
+
...(0, import_internal.createInternalAnnotations)(internal),
|
|
44
46
|
...(0, import_eslint.createEslintAnnotations)(eslint),
|
|
45
47
|
...(0, import_prettier.createPrettierAnnotations)(prettier),
|
|
46
48
|
...(0, import_tsc.createTscAnnotations)(tscOk, tscOutputStream)
|
|
47
49
|
];
|
|
48
|
-
const isOk = eslint.ok && prettier.ok && tscOk;
|
|
50
|
+
const isOk = eslint.ok && prettier.ok && internal.ok && tscOk;
|
|
49
51
|
const summary = isOk ? "`skuba lint` passed." : "`skuba lint` found issues that require triage.";
|
|
50
52
|
const build = (0, import_environment.buildNameFromEnvironment)();
|
|
51
53
|
await GitHub.createCheckRun({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/cli/lint/annotate/github/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as GitHub from '../../../../api/github';\nimport {\n buildNameFromEnvironment,\n enabledFromEnvironment,\n} from '../../../../api/github/environment';\nimport type { ESLintOutput } from '../../../adapter/eslint';\nimport type { PrettierOutput } from '../../../adapter/prettier';\nimport type { StreamInterceptor } from '../../../lint/external';\n\nimport { createEslintAnnotations } from './eslint';\nimport { createPrettierAnnotations } from './prettier';\nimport { createTscAnnotations } from './tsc';\n\nexport const createGitHubAnnotations = async (\n eslint: ESLintOutput,\n prettier: PrettierOutput,\n tscOk: boolean,\n tscOutputStream: StreamInterceptor,\n) => {\n if (!enabledFromEnvironment()) {\n return;\n }\n\n const annotations: GitHub.Annotation[] = [\n ...createEslintAnnotations(eslint),\n ...createPrettierAnnotations(prettier),\n ...createTscAnnotations(tscOk, tscOutputStream),\n ];\n\n const isOk = eslint.ok && prettier.ok && tscOk;\n\n const summary = isOk\n ? '`skuba lint` passed.'\n : '`skuba lint` found issues that require triage.';\n\n const build = buildNameFromEnvironment();\n\n await GitHub.createCheckRun({\n name: 'skuba/lint',\n summary,\n annotations,\n conclusion: isOk ? 'success' : 'failure',\n title: `${build} ${isOk ? 'passed' : 'failed'}`,\n });\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,yBAGO;
|
|
4
|
+
"sourcesContent": ["import * as GitHub from '../../../../api/github';\nimport {\n buildNameFromEnvironment,\n enabledFromEnvironment,\n} from '../../../../api/github/environment';\nimport type { ESLintOutput } from '../../../adapter/eslint';\nimport type { PrettierOutput } from '../../../adapter/prettier';\nimport type { StreamInterceptor } from '../../../lint/external';\nimport type { InternalLintResult } from '../../internal';\n\nimport { createEslintAnnotations } from './eslint';\nimport { createInternalAnnotations } from './internal';\nimport { createPrettierAnnotations } from './prettier';\nimport { createTscAnnotations } from './tsc';\n\nexport const createGitHubAnnotations = async (\n internal: InternalLintResult,\n eslint: ESLintOutput,\n prettier: PrettierOutput,\n tscOk: boolean,\n tscOutputStream: StreamInterceptor,\n) => {\n if (!enabledFromEnvironment()) {\n return;\n }\n\n const annotations: GitHub.Annotation[] = [\n ...createInternalAnnotations(internal),\n ...createEslintAnnotations(eslint),\n ...createPrettierAnnotations(prettier),\n ...createTscAnnotations(tscOk, tscOutputStream),\n ];\n\n const isOk = eslint.ok && prettier.ok && internal.ok && tscOk;\n\n const summary = isOk\n ? '`skuba lint` passed.'\n : '`skuba lint` found issues that require triage.';\n\n const build = buildNameFromEnvironment();\n\n await GitHub.createCheckRun({\n name: 'skuba/lint',\n summary,\n annotations,\n conclusion: isOk ? 'success' : 'failure',\n title: `${build} ${isOk ? 'passed' : 'failed'}`,\n });\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,yBAGO;AAMP,oBAAwC;AACxC,sBAA0C;AAC1C,sBAA0C;AAC1C,iBAAqC;AAE9B,MAAM,0BAA0B,OACrC,UACA,QACA,UACA,OACA,oBACG;AACH,MAAI,KAAC,2CAAuB,GAAG;AAC7B;AAAA,EACF;AAEA,QAAM,cAAmC;AAAA,IACvC,OAAG,2CAA0B,QAAQ;AAAA,IACrC,OAAG,uCAAwB,MAAM;AAAA,IACjC,OAAG,2CAA0B,QAAQ;AAAA,IACrC,OAAG,iCAAqB,OAAO,eAAe;AAAA,EAChD;AAEA,QAAM,OAAO,OAAO,MAAM,SAAS,MAAM,SAAS,MAAM;AAExD,QAAM,UAAU,OACZ,yBACA;AAEJ,QAAM,YAAQ,6CAAyB;AAEvC,QAAM,OAAO,eAAe;AAAA,IAC1B,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA,YAAY,OAAO,YAAY;AAAA,IAC/B,OAAO,GAAG,KAAK,IAAI,OAAO,WAAW,QAAQ;AAAA,EAC/C,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var internal_exports = {};
|
|
20
|
+
__export(internal_exports, {
|
|
21
|
+
createInternalAnnotations: () => createInternalAnnotations
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(internal_exports);
|
|
24
|
+
const createInternalAnnotations = (internal) => (internal.annotations ?? []).map((annotation) => ({
|
|
25
|
+
annotation_level: "failure",
|
|
26
|
+
start_line: annotation.start_line ?? 1,
|
|
27
|
+
end_line: annotation.end_line ?? annotation.start_line ?? 1,
|
|
28
|
+
path: annotation.path,
|
|
29
|
+
message: annotation.message,
|
|
30
|
+
title: "skuba lint"
|
|
31
|
+
}));
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
createInternalAnnotations
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/cli/lint/annotate/github/internal.ts"],
|
|
4
|
+
"sourcesContent": ["import type * as GitHub from '../../../../api/github';\nimport type { InternalLintResult } from '../../internal';\n\nexport const createInternalAnnotations = (\n internal: InternalLintResult,\n): GitHub.Annotation[] =>\n (internal.annotations ?? []).map((annotation) => ({\n annotation_level: 'failure',\n start_line: annotation.start_line ?? 1,\n end_line: annotation.end_line ?? annotation.start_line ?? 1,\n path: annotation.path,\n message: annotation.message,\n title: 'skuba lint',\n }));\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,4BAA4B,CACvC,cAEC,SAAS,eAAe,CAAC,GAAG,IAAI,CAAC,gBAAgB;AAAA,EAChD,kBAAkB;AAAA,EAClB,YAAY,WAAW,cAAc;AAAA,EACrC,UAAU,WAAW,YAAY,WAAW,cAAc;AAAA,EAC1D,MAAM,WAAW;AAAA,EACjB,SAAS,WAAW;AAAA,EACpB,OAAO;AACT,EAAE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { ESLintOutput } from '../../../cli/adapter/eslint';
|
|
2
|
+
import type { PrettierOutput } from '../../../cli/adapter/prettier';
|
|
1
3
|
import type { StreamInterceptor } from '../external';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export declare const createAnnotations: (eslint: ESLintOutput, prettier: PrettierOutput, tscOk: boolean, tscOutputStream: StreamInterceptor) => Promise<void>;
|
|
4
|
+
import type { InternalLintResult } from '../internal';
|
|
5
|
+
export declare const createAnnotations: (internal: InternalLintResult, eslint: ESLintOutput, prettier: PrettierOutput, tscOk: boolean, tscOutputStream: StreamInterceptor) => Promise<void>;
|
|
@@ -23,10 +23,16 @@ __export(annotate_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(annotate_exports);
|
|
24
24
|
var import_buildkite = require("./buildkite");
|
|
25
25
|
var import_github = require("./github");
|
|
26
|
-
const createAnnotations = async (eslint, prettier, tscOk, tscOutputStream) => {
|
|
26
|
+
const createAnnotations = async (internal, eslint, prettier, tscOk, tscOutputStream) => {
|
|
27
27
|
await Promise.all([
|
|
28
|
-
(0, import_github.createGitHubAnnotations)(eslint, prettier, tscOk, tscOutputStream),
|
|
29
|
-
(0, import_buildkite.createBuildkiteAnnotations)(
|
|
28
|
+
(0, import_github.createGitHubAnnotations)(internal, eslint, prettier, tscOk, tscOutputStream),
|
|
29
|
+
(0, import_buildkite.createBuildkiteAnnotations)(
|
|
30
|
+
internal,
|
|
31
|
+
eslint,
|
|
32
|
+
prettier,
|
|
33
|
+
tscOk,
|
|
34
|
+
tscOutputStream
|
|
35
|
+
)
|
|
30
36
|
]);
|
|
31
37
|
};
|
|
32
38
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/lint/annotate/index.ts"],
|
|
4
|
-
"sourcesContent": ["import type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import type { ESLintOutput } from '../../../cli/adapter/eslint';\nimport type { PrettierOutput } from '../../../cli/adapter/prettier';\nimport type { StreamInterceptor } from '../external';\nimport type { InternalLintResult } from '../internal';\n\nimport { createBuildkiteAnnotations } from './buildkite';\nimport { createGitHubAnnotations } from './github';\n\nexport const createAnnotations = async (\n internal: InternalLintResult,\n eslint: ESLintOutput,\n prettier: PrettierOutput,\n tscOk: boolean,\n tscOutputStream: StreamInterceptor,\n): Promise<void> => {\n await Promise.all([\n createGitHubAnnotations(internal, eslint, prettier, tscOk, tscOutputStream),\n createBuildkiteAnnotations(\n internal,\n eslint,\n prettier,\n tscOk,\n tscOutputStream,\n ),\n ]);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,uBAA2C;AAC3C,oBAAwC;AAEjC,MAAM,oBAAoB,OAC/B,UACA,QACA,UACA,OACA,oBACkB;AAClB,QAAM,QAAQ,IAAI;AAAA,QAChB,uCAAwB,UAAU,QAAQ,UAAU,OAAO,eAAe;AAAA,QAC1E;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as Git from '../../api/git';
|
|
2
2
|
import type { Input } from './types';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const AUTOFIX_IGNORE_FILES_BASE: Git.ChangedFile[];
|
|
4
|
+
export declare const AUTOFIX_IGNORE_FILES_NPMRC: Git.ChangedFile[];
|
|
4
5
|
interface AutofixParameters {
|
|
5
6
|
debug: Input['debug'];
|
|
6
7
|
eslint: boolean;
|
|
7
8
|
prettier: boolean;
|
|
9
|
+
internal: boolean;
|
|
8
10
|
}
|
|
9
11
|
export declare const autofix: (params: AutofixParameters) => Promise<void>;
|
|
10
12
|
export {};
|
package/lib/cli/lint/autofix.js
CHANGED
|
@@ -28,54 +28,40 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var autofix_exports = {};
|
|
30
30
|
__export(autofix_exports, {
|
|
31
|
-
|
|
31
|
+
AUTOFIX_IGNORE_FILES_BASE: () => AUTOFIX_IGNORE_FILES_BASE,
|
|
32
|
+
AUTOFIX_IGNORE_FILES_NPMRC: () => AUTOFIX_IGNORE_FILES_NPMRC,
|
|
32
33
|
autofix: () => autofix
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(autofix_exports);
|
|
35
|
-
var import_path = __toESM(require("path"));
|
|
36
36
|
var import_util = require("util");
|
|
37
|
-
var import_fs_extra = __toESM(require("fs-extra"));
|
|
38
37
|
var import_simple_git = __toESM(require("simple-git"));
|
|
39
38
|
var Buildkite = __toESM(require("../../api/buildkite"));
|
|
40
39
|
var Git = __toESM(require("../../api/git"));
|
|
41
40
|
var GitHub = __toESM(require("../../api/github"));
|
|
42
41
|
var import_env = require("../../utils/env");
|
|
43
42
|
var import_logging = require("../../utils/logging");
|
|
43
|
+
var import_npmrc = require("../../utils/npmrc");
|
|
44
44
|
var import_wait = require("../../utils/wait");
|
|
45
45
|
var import_eslint = require("../adapter/eslint");
|
|
46
46
|
var import_prettier = require("../adapter/prettier");
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var import_patchServerListener = require("../configure/patchServerListener");
|
|
50
|
-
var import_refreshIgnoreFiles = require("../configure/refreshIgnoreFiles");
|
|
47
|
+
var import_project = require("../configure/analysis/project");
|
|
48
|
+
var import_internal = require("./internal");
|
|
51
49
|
const RENOVATE_DEFAULT_PREFIX = "renovate";
|
|
52
50
|
const AUTOFIX_COMMIT_MESSAGE = "Run `skuba format`";
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
const AUTOFIX_IGNORE_FILES_BASE = [
|
|
52
|
+
{
|
|
53
|
+
path: "Dockerfile-incunabulum",
|
|
54
|
+
state: "added"
|
|
55
|
+
}
|
|
57
56
|
];
|
|
58
|
-
const
|
|
59
|
-
...AUTOFIX_DELETE_FILES,
|
|
60
|
-
...import_addEmptyExports.JEST_SETUP_FILES,
|
|
61
|
-
...import_refreshIgnoreFiles.REFRESHABLE_IGNORE_FILES,
|
|
62
|
-
...import_renovate.RENOVATE_CONFIG_FILENAMES,
|
|
63
|
-
import_patchServerListener.SERVER_LISTENER_FILENAME
|
|
64
|
-
]);
|
|
65
|
-
const AUTOFIX_IGNORE_FILES = [
|
|
57
|
+
const AUTOFIX_IGNORE_FILES_NPMRC = [
|
|
66
58
|
{
|
|
67
59
|
path: ".npmrc",
|
|
68
60
|
state: "added"
|
|
69
61
|
},
|
|
70
62
|
{
|
|
71
|
-
// This file may already exist in version control, but we shouldn't commit
|
|
72
|
-
// further changes as the CI environment may have appended an npm token.
|
|
73
63
|
path: ".npmrc",
|
|
74
64
|
state: "modified"
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
path: "Dockerfile-incunabulum",
|
|
78
|
-
state: "added"
|
|
79
65
|
}
|
|
80
66
|
];
|
|
81
67
|
const shouldPush = async ({
|
|
@@ -115,30 +101,16 @@ const shouldPush = async ({
|
|
|
115
101
|
}
|
|
116
102
|
return true;
|
|
117
103
|
};
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
(filename) => import_fs_extra.default.promises.rm(import_path.default.join(dir, filename), { force: true })
|
|
123
|
-
)
|
|
124
|
-
);
|
|
125
|
-
const changedFiles = await Git.getChangedFiles({
|
|
126
|
-
dir,
|
|
127
|
-
ignore: AUTOFIX_IGNORE_FILES
|
|
128
|
-
});
|
|
129
|
-
return changedFiles.some(
|
|
130
|
-
(changedFile) => AUTOFIX_CODEGEN_FILES.has(changedFile.path)
|
|
131
|
-
);
|
|
132
|
-
} catch (err) {
|
|
133
|
-
import_logging.log.warn(import_logging.log.bold("Failed to evaluate codegen changes."));
|
|
134
|
-
import_logging.log.subtle((0, import_util.inspect)(err));
|
|
135
|
-
return false;
|
|
104
|
+
const getIgnores = async (dir) => {
|
|
105
|
+
const contents = await (0, import_project.createDestinationFileReader)(dir)(".npmrc");
|
|
106
|
+
if ((0, import_npmrc.hasNpmrcSecret)(contents ?? "")) {
|
|
107
|
+
return [...AUTOFIX_IGNORE_FILES_BASE, ...AUTOFIX_IGNORE_FILES_NPMRC];
|
|
136
108
|
}
|
|
109
|
+
return AUTOFIX_IGNORE_FILES_BASE;
|
|
137
110
|
};
|
|
138
111
|
const autofix = async (params) => {
|
|
139
112
|
const dir = process.cwd();
|
|
140
|
-
|
|
141
|
-
if (!params.eslint && !params.prettier && !codegen) {
|
|
113
|
+
if (!params.eslint && !params.prettier && !params.internal) {
|
|
142
114
|
return;
|
|
143
115
|
}
|
|
144
116
|
let currentBranch;
|
|
@@ -151,23 +123,27 @@ const autofix = async (params) => {
|
|
|
151
123
|
}
|
|
152
124
|
try {
|
|
153
125
|
import_logging.log.newline();
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
await (0,
|
|
126
|
+
import_logging.log.warn(
|
|
127
|
+
`Attempting to autofix issues (${[
|
|
128
|
+
params.eslint ? "ESLint" : void 0,
|
|
129
|
+
params.internal ? "skuba" : void 0,
|
|
130
|
+
"Prettier"
|
|
131
|
+
// Prettier is always run
|
|
132
|
+
].filter((s) => s !== void 0).join(", ")})...`
|
|
133
|
+
);
|
|
134
|
+
const logger = (0, import_logging.createLogger)(params.debug);
|
|
135
|
+
if (params.internal) {
|
|
136
|
+
await (0, import_internal.internalLint)("format");
|
|
137
|
+
}
|
|
138
|
+
if (params.eslint) {
|
|
139
|
+
await (0, import_eslint.runESLint)("format", logger);
|
|
165
140
|
}
|
|
141
|
+
await (0, import_prettier.runPrettier)("format", logger);
|
|
166
142
|
if (process.env.GITHUB_ACTIONS) {
|
|
167
143
|
const ref2 = await Git.commitAllChanges({
|
|
168
144
|
dir,
|
|
169
145
|
message: AUTOFIX_COMMIT_MESSAGE,
|
|
170
|
-
ignore:
|
|
146
|
+
ignore: await getIgnores(dir)
|
|
171
147
|
});
|
|
172
148
|
if (!ref2) {
|
|
173
149
|
return import_logging.log.warn("No autofixes detected.");
|
|
@@ -188,7 +164,7 @@ const autofix = async (params) => {
|
|
|
188
164
|
branch: currentBranch,
|
|
189
165
|
dir,
|
|
190
166
|
messageHeadline: AUTOFIX_COMMIT_MESSAGE,
|
|
191
|
-
ignore:
|
|
167
|
+
ignore: await getIgnores(dir)
|
|
192
168
|
}),
|
|
193
169
|
{ s: 30 }
|
|
194
170
|
);
|
|
@@ -208,7 +184,8 @@ const autofix = async (params) => {
|
|
|
208
184
|
};
|
|
209
185
|
// Annotate the CommonJS export names for ESM import in node:
|
|
210
186
|
0 && (module.exports = {
|
|
211
|
-
|
|
187
|
+
AUTOFIX_IGNORE_FILES_BASE,
|
|
188
|
+
AUTOFIX_IGNORE_FILES_NPMRC,
|
|
212
189
|
autofix
|
|
213
190
|
});
|
|
214
191
|
//# sourceMappingURL=autofix.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/autofix.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { inspect } from 'util';\n\nimport simpleGit from 'simple-git';\n\nimport * as Buildkite from '../../api/buildkite';\nimport * as Git from '../../api/git';\nimport * as GitHub from '../../api/github';\nimport { isCiEnv } from '../../utils/env';\nimport { createLogger, log } from '../../utils/logging';\nimport { hasNpmrcSecret } from '../../utils/npmrc';\nimport { throwOnTimeout } from '../../utils/wait';\nimport { runESLint } from '../adapter/eslint';\nimport { runPrettier } from '../adapter/prettier';\nimport { createDestinationFileReader } from '../configure/analysis/project';\n\nimport { internalLint } from './internal';\nimport type { Input } from './types';\n\nconst RENOVATE_DEFAULT_PREFIX = 'renovate';\n\nconst AUTOFIX_COMMIT_MESSAGE = 'Run `skuba format`';\n\nexport const AUTOFIX_IGNORE_FILES_BASE: Git.ChangedFile[] = [\n {\n path: 'Dockerfile-incunabulum',\n state: 'added',\n },\n];\n\nexport const AUTOFIX_IGNORE_FILES_NPMRC: Git.ChangedFile[] = [\n {\n path: '.npmrc',\n state: 'added',\n },\n {\n path: '.npmrc',\n state: 'modified',\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 if (currentBranch?.startsWith(RENOVATE_DEFAULT_PREFIX)) {\n try {\n await GitHub.getPullRequestNumber();\n } catch (error) {\n const warning =\n 'An autofix is available, but it was not pushed because an open pull request for this Renovate branch could not be found. If a pull request has since been created, retry the lint step to push the fix.';\n log.warn(warning);\n try {\n await Buildkite.annotate(Buildkite.md.terminal(warning));\n } catch {}\n\n return false;\n }\n }\n\n let headCommitMessage;\n try {\n headCommitMessage = await Git.getHeadCommitMessage({ dir });\n } catch {}\n\n if (headCommitMessage?.startsWith(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\nconst getIgnores = async (dir: string): Promise<Git.ChangedFile[]> => {\n const contents = await createDestinationFileReader(dir)('.npmrc');\n\n // If an .npmrc has secrets, we need to ignore it\n if (hasNpmrcSecret(contents ?? '')) {\n return [...AUTOFIX_IGNORE_FILES_BASE, ...AUTOFIX_IGNORE_FILES_NPMRC];\n }\n\n return AUTOFIX_IGNORE_FILES_BASE;\n};\n\ninterface AutofixParameters {\n debug: Input['debug'];\n\n eslint: boolean;\n prettier: boolean;\n internal: boolean;\n}\n\nexport const autofix = async (params: AutofixParameters): Promise<void> => {\n const dir = process.cwd();\n\n if (!params.eslint && !params.prettier && !params.internal) {\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\n log.warn(\n `Attempting to autofix issues (${[\n params.eslint ? 'ESLint' : undefined,\n params.internal ? 'skuba' : undefined,\n 'Prettier', // Prettier is always run\n ]\n .filter((s) => s !== undefined)\n .join(', ')})...`,\n );\n\n const logger = createLogger(params.debug);\n\n if (params.internal) {\n await internalLint('format');\n }\n\n if (params.eslint) {\n await runESLint('format', logger);\n }\n\n // Unconditionally re-run Prettier; reaching here means we have pre-existing\n // format violations or may have created new ones through ESLint/internal fixes.\n await runPrettier('format', logger);\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: await getIgnores(dir),\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: await getIgnores(dir),\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": "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",
|
|
6
|
+
"names": ["ref", "simpleGit"]
|
|
7
7
|
}
|
|
@@ -7,4 +7,9 @@ export declare class StreamInterceptor extends stream.Transform {
|
|
|
7
7
|
output(): string;
|
|
8
8
|
_transform(chunk: Uint8Array, _encoding: BufferEncoding, callback: stream.TransformCallback): void;
|
|
9
9
|
}
|
|
10
|
-
export declare const externalLint: (input: Input) => Promise<
|
|
10
|
+
export declare const externalLint: (input: Input) => Promise<{
|
|
11
|
+
eslint: import("../adapter/eslint").ESLintOutput;
|
|
12
|
+
prettier: import("../adapter/prettier").PrettierOutput;
|
|
13
|
+
tscOk: boolean;
|
|
14
|
+
tscOutputStream: StreamInterceptor;
|
|
15
|
+
}>;
|
package/lib/cli/lint/external.js
CHANGED
|
@@ -33,11 +33,6 @@ __export(external_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(external_exports);
|
|
35
35
|
var import_stream = __toESM(require("stream"));
|
|
36
|
-
var import_util = require("util");
|
|
37
|
-
var import_logging = require("../../utils/logging");
|
|
38
|
-
var import_wait = require("../../utils/wait");
|
|
39
|
-
var import_annotate = require("./annotate");
|
|
40
|
-
var import_autofix = require("./autofix");
|
|
41
36
|
var import_eslint = require("./eslint");
|
|
42
37
|
var import_prettier = require("./prettier");
|
|
43
38
|
var import_tsc = require("./tsc");
|
|
@@ -84,30 +79,12 @@ const externalLint = async (input) => {
|
|
|
84
79
|
const tscOutputStream = new StreamInterceptor();
|
|
85
80
|
tscOutputStream.pipe(input.tscOutputStream ?? process.stdout);
|
|
86
81
|
const { eslint, prettier, tscOk } = await lint({ ...input, tscOutputStream });
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
import_logging.log.warn("Failed to annotate lint results.");
|
|
94
|
-
import_logging.log.subtle((0, import_util.inspect)(err));
|
|
95
|
-
}
|
|
96
|
-
if (!eslint.ok || !prettier.ok || !tscOk) {
|
|
97
|
-
const tools = [
|
|
98
|
-
...eslint.ok ? [] : ["ESLint"],
|
|
99
|
-
...prettier.ok ? [] : ["Prettier"],
|
|
100
|
-
...tscOk ? [] : ["tsc"]
|
|
101
|
-
];
|
|
102
|
-
import_logging.log.newline();
|
|
103
|
-
import_logging.log.err(`${tools.join(", ")} found issues that require triage.`);
|
|
104
|
-
process.exitCode = 1;
|
|
105
|
-
}
|
|
106
|
-
await (0, import_autofix.autofix)({
|
|
107
|
-
debug: input.debug,
|
|
108
|
-
eslint: eslint.fixable,
|
|
109
|
-
prettier: !prettier.ok
|
|
110
|
-
});
|
|
82
|
+
return {
|
|
83
|
+
eslint,
|
|
84
|
+
prettier,
|
|
85
|
+
tscOk,
|
|
86
|
+
tscOutputStream
|
|
87
|
+
};
|
|
111
88
|
};
|
|
112
89
|
// Annotate the CommonJS export names for ESM import in node:
|
|
113
90
|
0 && (module.exports = {
|