skuba 5.1.1 → 5.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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.js +6 -0
- package/lib/cli/configure/modules/renovate.js.map +1 -1
- 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/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 +4 -0
- package/lib/cli/format.js.map +1 -1
- 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 +6 -0
- package/lib/cli/init/index.js.map +1 -1
- 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/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 +12 -11
- package/template/express-rest-api/src/config.ts +1 -1
- package/template/koa-rest-api/package.json +4 -4
- package/template/koa-rest-api/src/config.ts +1 -1
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +1 -1
- package/template/lambda-sqs-worker/package.json +4 -3
- package/template/lambda-sqs-worker/src/config.ts +1 -1
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +1 -1
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/index.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nimport { commitAllChanges } from '../../api/git';\nimport { copyFiles, createEjsRenderer } from '../../utils/copy';\nimport { createInclusionFilter } from '../../utils/dir';\nimport { createExec, ensureCommands } from '../../utils/exec';\nimport { log } from '../../utils/logging';\nimport { showLogoAndVersionInfo } from '../../utils/logo';\nimport {\n BASE_TEMPLATE_DIR,\n ensureTemplateConfigDeletion,\n} from '../../utils/template';\n\nimport { getConfig } from './getConfig';\nimport { initialiseRepo } from './git';\nimport { writePackageJson } from './writePackageJson';\n\nexport const init = async () => {\n const skubaVersionInfo = await showLogoAndVersionInfo();\n\n await ensureCommands('yarn');\n\n const {\n destinationDir,\n entryPoint,\n templateComplete,\n templateData,\n templateName,\n type,\n } = await getConfig();\n\n const include = await createInclusionFilter([\n path.join(destinationDir, '.gitignore'),\n path.join(BASE_TEMPLATE_DIR, '_.gitignore'),\n ]);\n\n const processors = [createEjsRenderer(templateData)];\n\n await copyFiles({\n sourceRoot: BASE_TEMPLATE_DIR,\n destinationRoot: destinationDir,\n include,\n // prefer template-specific files\n overwrite: false,\n processors,\n // base template has files like _.eslintrc.js\n stripUnderscorePrefix: true,\n });\n\n await copyFiles({\n sourceRoot: destinationDir,\n destinationRoot: destinationDir,\n include,\n processors,\n });\n\n await Promise.all([\n templateComplete\n ? ensureTemplateConfigDeletion(destinationDir)\n : Promise.resolve(),\n\n writePackageJson({\n cwd: destinationDir,\n entryPoint,\n template: templateName,\n type,\n version: skubaVersionInfo.local,\n }),\n ]);\n\n const exec = createExec({\n cwd: destinationDir,\n stdio: 'pipe',\n streamStdio: 'yarn',\n });\n\n log.newline();\n await initialiseRepo(destinationDir, templateData);\n\n const skubaSlug = `skuba@${skubaVersionInfo.local}`;\n\n let depsInstalled = false;\n try {\n await exec('yarn', 'add', '--dev', skubaSlug);\n depsInstalled = true;\n await exec('npx', 'yarn-deduplicate', '--strategy=highest');\n } catch {}\n\n await commitAllChanges({\n dir: destinationDir,\n message: `Clone ${templateName}`,\n });\n\n const logGitHubRepoCreation = () => {\n log.plain(\n 'Next, create an empty',\n log.bold(`${templateData.orgName}/${templateData.repoName}`),\n 'repository:',\n );\n log.ok('https://github.com/new');\n };\n\n if (!depsInstalled) {\n log.newline();\n log.warn(log.bold('\u2717 Failed to install dependencies.'));\n\n log.newline();\n logGitHubRepoCreation();\n\n log.newline();\n log.plain('Then, resume initialisation:');\n log.ok('cd', destinationDir);\n log.ok('yarn add --dev', skubaSlug);\n log.ok('git add --all');\n log.ok('git commit --message', `'Pin ${skubaSlug}'`);\n log.ok('git push --set-upstream origin master');\n\n log.newline();\n process.exitCode = 1;\n return;\n }\n\n log.newline();\n log.ok(log.bold('\u2714 Project initialised!'));\n\n log.newline();\n logGitHubRepoCreation();\n\n log.newline();\n log.plain('Then, push your local changes:');\n log.ok('cd', destinationDir);\n log.ok('git push --set-upstream origin master');\n\n log.newline();\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,iBAAiC;AACjC,kBAA6C;AAC7C,iBAAsC;AACtC,kBAA2C;AAC3C,qBAAoB;AACpB,kBAAuC;AACvC,sBAGO;AAEP,uBAA0B;AAC1B,IAAAA,cAA+B;AAC/B,8BAAiC;AAE1B,MAAM,OAAO,YAAY;AAC9B,QAAM,mBAAmB,UAAM,oCAAuB;AAEtD,YAAM,4BAAe,MAAM;AAE3B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,UAAM,4BAAU;AAEpB,QAAM,UAAU,UAAM,kCAAsB;AAAA,IAC1C,YAAAC,QAAK,KAAK,gBAAgB,YAAY;AAAA,IACtC,YAAAA,QAAK,KAAK,mCAAmB,aAAa;AAAA,EAC5C,CAAC;AAED,QAAM,aAAa,KAAC,+BAAkB,YAAY,CAAC;AAEnD,YAAM,uBAAU;AAAA,IACd,YAAY;AAAA,IACZ,iBAAiB;AAAA,IACjB;AAAA;AAAA,IAEA,WAAW;AAAA,IACX;AAAA;AAAA,IAEA,uBAAuB;AAAA,EACzB,CAAC;AAED,YAAM,uBAAU;AAAA,IACd,YAAY;AAAA,IACZ,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,QAAQ,IAAI;AAAA,IAChB,uBACI,8CAA6B,cAAc,IAC3C,QAAQ,QAAQ;AAAA,QAEpB,0CAAiB;AAAA,MACf,KAAK;AAAA,MACL;AAAA,MACA,UAAU;AAAA,MACV;AAAA,MACA,SAAS,iBAAiB;AAAA,IAC5B,CAAC;AAAA,EACH,CAAC;AAED,QAAM,WAAO,wBAAW;AAAA,IACtB,KAAK;AAAA,IACL,OAAO;AAAA,IACP,aAAa;AAAA,EACf,CAAC;AAED,qBAAI,QAAQ;AACZ,YAAM,4BAAe,gBAAgB,YAAY;AAEjD,QAAM,YAAY,SAAS,iBAAiB;AAE5C,MAAI,gBAAgB;AACpB,MAAI;AACF,UAAM,KAAK,QAAQ,OAAO,SAAS,SAAS;AAC5C,oBAAgB;AAChB,UAAM,KAAK,OAAO,oBAAoB,oBAAoB;AAAA,EAC5D,QAAE;AAAA,EAAO;AAET,YAAM,6BAAiB;AAAA,IACrB,KAAK;AAAA,IACL,SAAS,SAAS;AAAA,EACpB,CAAC;AAED,QAAM,wBAAwB,MAAM;AAClC,uBAAI;AAAA,MACF;AAAA,MACA,mBAAI,KAAK,GAAG,aAAa,WAAW,aAAa,UAAU;AAAA,MAC3D;AAAA,IACF;AACA,uBAAI,GAAG,wBAAwB;AAAA,EACjC;AAEA,MAAI,CAAC,eAAe;AAClB,uBAAI,QAAQ;AACZ,uBAAI,KAAK,mBAAI,KAAK,wCAAmC,CAAC;AAEtD,uBAAI,QAAQ;AACZ,0BAAsB;AAEtB,uBAAI,QAAQ;AACZ,uBAAI,MAAM,8BAA8B;AACxC,uBAAI,GAAG,MAAM,cAAc;AAC3B,uBAAI,GAAG,kBAAkB,SAAS;AAClC,uBAAI,GAAG,eAAe;AACtB,uBAAI,GAAG,wBAAwB,QAAQ,YAAY;AACnD,uBAAI,GAAG,uCAAuC;AAE9C,uBAAI,QAAQ;AACZ,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,qBAAI,QAAQ;AACZ,qBAAI,GAAG,mBAAI,KAAK,6BAAwB,CAAC;AAEzC,qBAAI,QAAQ;AACZ,wBAAsB;AAEtB,qBAAI,QAAQ;AACZ,qBAAI,MAAM,gCAAgC;AAC1C,qBAAI,GAAG,MAAM,cAAc;AAC3B,qBAAI,GAAG,uCAAuC;AAE9C,qBAAI,QAAQ;AACd;",
|
|
6
6
|
"names": ["import_git", "path"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Platform } from './validation';
|
|
2
2
|
import { Input, Select } from 'enquirer';
|
|
3
|
-
export type BaseFields = Record<typeof BASE_CHOICES[number]['name'], string> & {
|
|
3
|
+
export type BaseFields = Record<(typeof BASE_CHOICES)[number]['name'], string> & {
|
|
4
4
|
platformName: Platform;
|
|
5
5
|
};
|
|
6
6
|
declare const BASE_CHOICES: readonly [{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/prompts.ts"],
|
|
4
|
-
"sourcesContent": ["import { pathExists } from 'fs-extra';\n\nimport { TEMPLATE_NAMES_WITH_BYO } from '../../utils/template';\n\nimport type { Platform } from './validation';\nimport {\n PLATFORM_OPTIONS,\n isGitHubOrg,\n isGitHubRepo,\n isGitHubTeam,\n isPlatform,\n} from './validation';\n\nimport { Input, Select } from 'enquirer';\n\nexport type BaseFields = Record
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA2B;AAE3B,sBAAwC;AAGxC,wBAMO;AAEP,sBAA8B;
|
|
4
|
+
"sourcesContent": ["import { pathExists } from 'fs-extra';\n\nimport { TEMPLATE_NAMES_WITH_BYO } from '../../utils/template';\n\nimport type { Platform } from './validation';\nimport {\n PLATFORM_OPTIONS,\n isGitHubOrg,\n isGitHubRepo,\n isGitHubTeam,\n isPlatform,\n} from './validation';\n\nimport { Input, Select } from 'enquirer';\n\nexport type BaseFields = Record<\n (typeof BASE_CHOICES)[number]['name'],\n string\n> & {\n platformName: Platform;\n};\n\nconst BASE_CHOICES = [\n {\n name: 'ownerName',\n message: 'Owner',\n initial: 'SEEK-Jobs/my-team',\n validate: (value: unknown) => {\n if (typeof value !== 'string') {\n return 'required';\n }\n\n const [org, team] = value.split('/');\n\n if (!isGitHubOrg(org)) {\n return 'fails GitHub validation';\n }\n\n return (\n team === undefined || isGitHubTeam(team) || 'fails GitHub validation'\n );\n },\n },\n {\n name: 'repoName',\n message: 'Repo',\n initial: 'my-repo',\n validate: async (value: unknown) => {\n if (typeof value !== 'string') {\n return 'required';\n }\n\n if (!isGitHubRepo(value)) {\n return 'fails GitHub validation';\n }\n\n const exists = await pathExists(value);\n\n return !exists || `'${value}' is an existing directory`;\n },\n },\n {\n name: 'platformName',\n message: 'Platform',\n initial: PLATFORM_OPTIONS,\n validate: (value: unknown) =>\n isPlatform(value) || `must be ${PLATFORM_OPTIONS}`,\n },\n] as const;\n\nexport const BASE_PROMPT_PROPS = {\n choices: BASE_CHOICES,\n message: 'For starters, some project details:',\n name: 'baseAnswers',\n};\n\nexport const SHOULD_CONTINUE_PROMPT = new Select({\n choices: ['yes', 'no'] as const,\n message: 'Fill this in now?',\n name: 'shouldContinue',\n});\n\nexport const GIT_PATH_PROMPT = new Input({\n message: 'Git path',\n name: 'gitPath',\n initial: 'seek-oss/skuba',\n validate: (value) => /[^/]+\\/[^/]+/.test(value) || 'Path is not valid',\n});\n\nexport const TEMPLATE_PROMPT = new Select({\n choices: TEMPLATE_NAMES_WITH_BYO,\n message: 'Select a template:',\n name: 'templateName',\n});\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA2B;AAE3B,sBAAwC;AAGxC,wBAMO;AAEP,sBAA8B;AAS9B,MAAM,eAAe;AAAA,EACnB;AAAA,IACE,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,UAAU,CAAC,UAAmB;AAC5B,UAAI,OAAO,UAAU,UAAU;AAC7B,eAAO;AAAA,MACT;AAEA,YAAM,CAAC,KAAK,IAAI,IAAI,MAAM,MAAM,GAAG;AAEnC,UAAI,KAAC,+BAAY,GAAG,GAAG;AACrB,eAAO;AAAA,MACT;AAEA,aACE,SAAS,cAAa,gCAAa,IAAI,KAAK;AAAA,IAEhD;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,UAAU,OAAO,UAAmB;AAClC,UAAI,OAAO,UAAU,UAAU;AAC7B,eAAO;AAAA,MACT;AAEA,UAAI,KAAC,gCAAa,KAAK,GAAG;AACxB,eAAO;AAAA,MACT;AAEA,YAAM,SAAS,UAAM,4BAAW,KAAK;AAErC,aAAO,CAAC,UAAU,IAAI;AAAA,IACxB;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,UAAU,CAAC,cACT,8BAAW,KAAK,KAAK,WAAW;AAAA,EACpC;AACF;AAEO,MAAM,oBAAoB;AAAA,EAC/B,SAAS;AAAA,EACT,SAAS;AAAA,EACT,MAAM;AACR;AAEO,MAAM,yBAAyB,IAAI,uBAAO;AAAA,EAC/C,SAAS,CAAC,OAAO,IAAI;AAAA,EACrB,SAAS;AAAA,EACT,MAAM;AACR,CAAC;AAEM,MAAM,kBAAkB,IAAI,sBAAM;AAAA,EACvC,SAAS;AAAA,EACT,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU,CAAC,UAAU,eAAe,KAAK,KAAK,KAAK;AACrD,CAAC;AAEM,MAAM,kBAAkB,IAAI,uBAAO;AAAA,EACxC,SAAS;AAAA,EACT,SAAS;AAAA,EACT,MAAM;AACR,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/init/types.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
|
));
|
|
@@ -45,8 +49,10 @@ const InitConfig = t.Record({
|
|
|
45
49
|
templateData: t.Record({
|
|
46
50
|
ownerName: t.String,
|
|
47
51
|
repoName: t.String,
|
|
52
|
+
// Derived from ownerName
|
|
48
53
|
orgName: t.String,
|
|
49
54
|
teamName: t.String,
|
|
55
|
+
// Generated by init command
|
|
50
56
|
port: t.String
|
|
51
57
|
}).And(t.Dictionary(t.String, t.String)),
|
|
52
58
|
entryPoint: t.String.optional(),
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/types.ts"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable new-cap */\n\nimport * as t from 'runtypes';\n\nimport { ProjectType } from '../../utils/manifest';\n\nconst INIT_CONFIG_INPUT_FIELDS = {\n destinationDir: t.String,\n templateComplete: t.Boolean,\n templateData: t\n .Record({\n ownerName: t.String,\n repoName: t.String,\n platformName: t.Union(t.Literal('amd64'), t.Literal('arm64')),\n })\n .And(t.Dictionary(t.String, t.String)),\n templateName: t.String,\n};\n\nexport type InitConfigInput = t.Static<typeof InitConfigInput>;\n\nexport const InitConfigInput = t.Record(INIT_CONFIG_INPUT_FIELDS);\n\nexport type InitConfig = t.Static<typeof InitConfig>;\n\nconst InitConfig = t.Record({\n ...INIT_CONFIG_INPUT_FIELDS,\n\n templateData: t\n .Record({\n ownerName: t.String,\n repoName: t.String,\n\n // Derived from ownerName\n orgName: t.String,\n teamName: t.String,\n\n // Generated by init command\n port: t.String,\n })\n .And(t.Dictionary(t.String, t.String)),\n\n entryPoint: t.String.optional(),\n type: ProjectType.optional(),\n});\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,QAAmB;AAEnB,sBAA4B;AAE5B,MAAM,2BAA2B;AAAA,EAC/B,gBAAgB,EAAE;AAAA,EAClB,kBAAkB,EAAE;AAAA,EACpB,cAAc,EACX,OAAO;AAAA,IACN,WAAW,EAAE;AAAA,IACb,UAAU,EAAE;AAAA,IACZ,cAAc,EAAE,MAAM,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,CAAC;AAAA,EAC9D,CAAC,EACA,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC;AAAA,EACvC,cAAc,EAAE;AAClB;AAIO,MAAM,kBAAkB,EAAE,OAAO,wBAAwB;AAIhE,MAAM,aAAa,EAAE,OAAO;AAAA,EAC1B,GAAG;AAAA,EAEH,cAAc,EACX,OAAO;AAAA,IACN,WAAW,EAAE;AAAA,IACb,UAAU,EAAE;AAAA;AAAA,IAGZ,SAAS,EAAE;AAAA,IACX,UAAU,EAAE;AAAA;AAAA,IAGZ,MAAM,EAAE;AAAA,EACV,CAAC,EACA,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC;AAAA,EAEvC,YAAY,EAAE,OAAO,SAAS;AAAA,EAC9B,MAAM,4BAAY,SAAS;AAC7B,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,7 +2,7 @@ export declare const isGitHubOrg: (value: string) => boolean;
|
|
|
2
2
|
export declare const isGitHubRepo: (value: string) => boolean;
|
|
3
3
|
export declare const isGitHubTeam: (value: string) => boolean;
|
|
4
4
|
declare const PLATFORMS: readonly ["amd64", "arm64"];
|
|
5
|
-
export type Platform = typeof PLATFORMS[number];
|
|
5
|
+
export type Platform = (typeof PLATFORMS)[number];
|
|
6
6
|
export declare const PLATFORM_OPTIONS: string;
|
|
7
7
|
export declare const isPlatform: (value: unknown) => boolean;
|
|
8
8
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/validation.ts"],
|
|
4
|
-
"sourcesContent": ["export const isGitHubOrg = (value: string) =>\n /^[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?$/.test(value) &&\n !value.includes('--');\n\nexport const isGitHubRepo = (value: string) =>\n /^[A-Za-z0-9_.-]+$/.test(value) && value !== '.' && value !== '..';\n\nexport const isGitHubTeam = (value: string) =>\n /^[A-Za-z0-9_](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?$/.test(value) &&\n !value.endsWith('-') &&\n !value.includes('--');\n\nconst PLATFORMS = ['amd64', 'arm64'] as const;\n\nexport type Platform = typeof PLATFORMS[number];\n\nexport const PLATFORM_OPTIONS = PLATFORMS.join(' | ');\n\nconst platformSet = new Set<unknown>(PLATFORMS);\n\nexport const isPlatform = (value: unknown) => platformSet.has(value);\n"],
|
|
4
|
+
"sourcesContent": ["export const isGitHubOrg = (value: string) =>\n /^[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?$/.test(value) &&\n !value.includes('--');\n\nexport const isGitHubRepo = (value: string) =>\n /^[A-Za-z0-9_.-]+$/.test(value) && value !== '.' && value !== '..';\n\nexport const isGitHubTeam = (value: string) =>\n /^[A-Za-z0-9_](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?$/.test(value) &&\n !value.endsWith('-') &&\n !value.includes('--');\n\nconst PLATFORMS = ['amd64', 'arm64'] as const;\n\nexport type Platform = (typeof PLATFORMS)[number];\n\nexport const PLATFORM_OPTIONS = PLATFORMS.join(' | ');\n\nconst platformSet = new Set<unknown>(PLATFORMS);\n\nexport const isPlatform = (value: unknown) => platformSet.has(value);\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc,CAAC,UAC1B,6CAA6C,KAAK,KAAK,KACvD,CAAC,MAAM,SAAS,IAAI;AAEf,MAAM,eAAe,CAAC,UAC3B,oBAAoB,KAAK,KAAK,KAAK,UAAU,OAAO,UAAU;AAEzD,MAAM,eAAe,CAAC,UAC3B,gDAAgD,KAAK,KAAK,KAC1D,CAAC,MAAM,SAAS,GAAG,KACnB,CAAC,MAAM,SAAS,IAAI;AAEtB,MAAM,YAAY,CAAC,SAAS,OAAO;AAI5B,MAAM,mBAAmB,UAAU,KAAK,KAAK;AAEpD,MAAM,cAAc,IAAI,IAAa,SAAS;AAEvC,MAAM,aAAa,CAAC,UAAmB,YAAY,IAAI,KAAK;",
|
|
6
6
|
"names": []
|
|
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/init/writePackageJson.ts"],
|
|
4
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 = formatPackage(manifest.packageJson);\n\n await fs.promises.writeFile(manifest.path, updatedPackageJson);\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAe;AAGf,qBAAuC;AACvC,IAAAA,kBAA8B;AAavB,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,yBAAqB,+BAAc,SAAS,WAAW;AAE7D,QAAM,gBAAAC,QAAG,SAAS,UAAU,SAAS,MAAM,kBAAkB;AAC/D;",
|
|
6
6
|
"names": ["import_package", "fs"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ESLintOutput } from '
|
|
1
|
+
import type { ESLintOutput } from '../../../adapter/eslint';
|
|
2
2
|
export declare const createEslintAnnotations: (eslint: ESLintOutput) => string[];
|
|
@@ -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
|
));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/cli/lint/annotate/buildkite/eslint.ts"],
|
|
4
|
-
"sourcesContent": ["import * as Buildkite from '../../../../api/buildkite';\nimport type { ESLintOutput } from '
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import * as Buildkite from '../../../../api/buildkite';\nimport type { ESLintOutput } from '../../../adapter/eslint';\n\nexport const createEslintAnnotations = (eslint: ESLintOutput): string[] =>\n !eslint.ok ? ['**ESLint**', Buildkite.md.terminal(eslint.output.trim())] : [];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAGpB,MAAM,0BAA0B,CAAC,WACtC,CAAC,OAAO,KAAK,CAAC,cAAc,UAAU,GAAG,SAAS,OAAO,OAAO,KAAK,CAAC,CAAC,IAAI,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ESLintOutput } from '
|
|
2
|
-
import type { PrettierOutput } from '
|
|
3
|
-
import type { StreamInterceptor } from '
|
|
1
|
+
import type { ESLintOutput } from '../../../adapter/eslint';
|
|
2
|
+
import type { PrettierOutput } from '../../../adapter/prettier';
|
|
3
|
+
import type { StreamInterceptor } from '../../../lint/external';
|
|
4
4
|
export declare const createBuildkiteAnnotations: (eslint: ESLintOutput, prettier: PrettierOutput, tscOk: boolean, tscOutputStream: StreamInterceptor) => Promise<void>;
|
|
@@ -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
|
));
|
|
@@ -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 '
|
|
5
|
-
"mappings": "
|
|
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-external',\n scopeContextToStep: true,\n style: 'error',\n });\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAK3B,oBAAwC;AACxC,sBAA0C;AAC1C,iBAAqC;AAE9B,MAAM,6BAA6B,OACxC,QACA,UACA,OACA,oBACkB;AAClB,MAAI,OAAO,MAAM,SAAS,MAAM,OAAO;AACrC;AAAA,EACF;AAEA,QAAM,kBAAkB;AAAA,IACtB;AAAA,IACA,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
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PrettierOutput } from '
|
|
1
|
+
import type { PrettierOutput } from '../../../adapter/prettier';
|
|
2
2
|
export declare const createPrettierAnnotations: (prettier: PrettierOutput) => string[];
|
|
@@ -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
|
));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/cli/lint/annotate/buildkite/prettier.ts"],
|
|
4
|
-
"sourcesContent": ["import * as Buildkite from '../../../../api/buildkite';\nimport type { PrettierOutput } from '
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import * as Buildkite from '../../../../api/buildkite';\nimport type { PrettierOutput } from '../../../adapter/prettier';\n\nexport const createPrettierAnnotations = (prettier: PrettierOutput): string[] =>\n !prettier.ok\n ? [\n '**Prettier**',\n Buildkite.md.terminal(\n prettier.result.errored\n .map(({ err, filepath }) =>\n [filepath, ...(err ? [String(err)] : [])].join(' '),\n )\n .join('\\n'),\n ),\n ]\n : [];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAGpB,MAAM,4BAA4B,CAAC,aACxC,CAAC,SAAS,KACN;AAAA,EACE;AAAA,EACA,UAAU,GAAG;AAAA,IACX,SAAS,OAAO,QACb;AAAA,MAAI,CAAC,EAAE,KAAK,SAAS,MACpB,CAAC,UAAU,GAAI,MAAM,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,CAAE,EAAE,KAAK,GAAG;AAAA,IACpD,EACC,KAAK,IAAI;AAAA,EACd;AACF,IACA,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { StreamInterceptor } from '
|
|
1
|
+
import type { StreamInterceptor } from '../../../lint/external';
|
|
2
2
|
export declare const createTscAnnotations: (tscOk: boolean, tscOutputStream: StreamInterceptor) => string[];
|
|
@@ -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
|
));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/cli/lint/annotate/buildkite/tsc.ts"],
|
|
4
|
-
"sourcesContent": ["import * as Buildkite from '../../../../api/buildkite';\nimport type { StreamInterceptor } from '
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import * as Buildkite from '../../../../api/buildkite';\nimport type { StreamInterceptor } from '../../../lint/external';\n\nexport const createTscAnnotations = (\n tscOk: boolean,\n tscOutputStream: StreamInterceptor,\n): string[] =>\n !tscOk\n ? [\n '**tsc**',\n Buildkite.md.terminal(\n tscOutputStream\n .output()\n .split('\\n')\n .filter(Boolean)\n .filter((line) => !line.startsWith('TSFILE: '))\n .join('\\n')\n .trim(),\n ),\n ]\n : [];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAGpB,MAAM,uBAAuB,CAClC,OACA,oBAEA,CAAC,QACG;AAAA,EACE;AAAA,EACA,UAAU,GAAG;AAAA,IACX,gBACG,OAAO,EACP,MAAM,IAAI,EACV,OAAO,OAAO,EACd,OAAO,CAAC,SAAS,CAAC,KAAK,WAAW,UAAU,CAAC,EAC7C,KAAK,IAAI,EACT,KAAK;AAAA,EACV;AACF,IACA,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type * as GitHub from '../../../../api/github';
|
|
2
|
-
import type { ESLintOutput } from '
|
|
2
|
+
import type { ESLintOutput } from '../../../adapter/eslint';
|
|
3
3
|
export declare const createEslintAnnotations: (eslint: ESLintOutput) => GitHub.Annotation[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/cli/lint/annotate/github/eslint.ts"],
|
|
4
|
-
"sourcesContent": ["import type * as GitHub from '../../../../api/github';\nimport type { ESLintOutput } from '
|
|
4
|
+
"sourcesContent": ["import type * as GitHub from '../../../../api/github';\nimport type { ESLintOutput } from '../../../adapter/eslint';\n\nexport const createEslintAnnotations = (\n eslint: ESLintOutput,\n): GitHub.Annotation[] =>\n [...eslint.errors, ...eslint.warnings].flatMap<GitHub.Annotation>((result) =>\n result.messages.map((message): GitHub.Annotation => {\n // Annotations only support start_column and end_column on the same line.\n const isSameLine = message.line === message.endLine;\n const startColumn = isSameLine && message.column;\n const endColumn = (isSameLine && message.endColumn) || startColumn;\n\n return {\n annotation_level: message.severity === 2 ? 'failure' : 'warning',\n start_line: message.line ?? 1,\n end_line: message.endLine ?? message.line ?? 1,\n ...(startColumn && { start_column: startColumn }),\n ...(endColumn && { end_column: endColumn }),\n message: message.message,\n path: result.filePath,\n title: `ESLint${message.ruleId ? ` (${message.ruleId})` : ''}`,\n };\n }),\n );\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,0BAA0B,CACrC,WAEA,CAAC,GAAG,OAAO,QAAQ,GAAG,OAAO,QAAQ,EAAE;AAAA,EAA2B,CAAC,WACjE,OAAO,SAAS,IAAI,CAAC,YAA+B;AAElD,UAAM,aAAa,QAAQ,SAAS,QAAQ;AAC5C,UAAM,cAAc,cAAc,QAAQ;AAC1C,UAAM,YAAa,cAAc,QAAQ,aAAc;AAEvD,WAAO;AAAA,MACL,kBAAkB,QAAQ,aAAa,IAAI,YAAY;AAAA,MACvD,YAAY,QAAQ,QAAQ;AAAA,MAC5B,UAAU,QAAQ,WAAW,QAAQ,QAAQ;AAAA,MAC7C,GAAI,eAAe,EAAE,cAAc,YAAY;AAAA,MAC/C,GAAI,aAAa,EAAE,YAAY,UAAU;AAAA,MACzC,SAAS,QAAQ;AAAA,MACjB,MAAM,OAAO;AAAA,MACb,OAAO,SAAS,QAAQ,SAAS,KAAK,QAAQ,YAAY;AAAA,IAC5D;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ESLintOutput } from '
|
|
2
|
-
import type { PrettierOutput } from '
|
|
3
|
-
import type { StreamInterceptor } from '
|
|
1
|
+
import type { ESLintOutput } from '../../../adapter/eslint';
|
|
2
|
+
import type { PrettierOutput } from '../../../adapter/prettier';
|
|
3
|
+
import type { StreamInterceptor } from '../../../lint/external';
|
|
4
4
|
export declare const createGitHubAnnotations: (eslint: ESLintOutput, prettier: PrettierOutput, tscOk: boolean, tscOutputStream: StreamInterceptor) => Promise<void>;
|
|
@@ -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
|
));
|
|
@@ -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 '
|
|
5
|
-
"mappings": "
|
|
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;AAKP,oBAAwC;AACxC,sBAA0C;AAC1C,iBAAqC;AAE9B,MAAM,0BAA0B,OACrC,QACA,UACA,OACA,oBACG;AACH,MAAI,KAAC,2CAAuB,GAAG;AAC7B;AAAA,EACF;AAEA,QAAM,cAAmC;AAAA,IACvC,OAAG,uCAAwB,MAAM;AAAA,IACjC,OAAG,2CAA0B,QAAQ;AAAA,IACrC,OAAG,iCAAqB,OAAO,eAAe;AAAA,EAChD;AAEA,QAAM,OAAO,OAAO,MAAM,SAAS,MAAM;AAEzC,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,SAAS,OAAO,WAAW;AAAA,EACvC,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type * as GitHub from '../../../../api/github';
|
|
2
|
-
import type { PrettierOutput } from '
|
|
2
|
+
import type { PrettierOutput } from '../../../adapter/prettier';
|
|
3
3
|
export declare const createPrettierAnnotations: (prettier: PrettierOutput) => GitHub.Annotation[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/cli/lint/annotate/github/prettier.ts"],
|
|
4
|
-
"sourcesContent": ["import type * as GitHub from '../../../../api/github';\nimport type { PrettierOutput } from '
|
|
4
|
+
"sourcesContent": ["import type * as GitHub from '../../../../api/github';\nimport type { PrettierOutput } from '../../../adapter/prettier';\n\nexport const createPrettierAnnotations = (\n prettier: PrettierOutput,\n): GitHub.Annotation[] =>\n prettier.result.errored.map((result) => {\n const message =\n result.err instanceof Error ? result.err.message : result.err;\n\n return {\n annotation_level: 'failure',\n start_line: 1,\n end_line: 1,\n path: result.filepath,\n message: message ? String(message) : 'This file has not been formatted.',\n title: 'Prettier',\n };\n });\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,4BAA4B,CACvC,aAEA,SAAS,OAAO,QAAQ,IAAI,CAAC,WAAW;AACtC,QAAM,UACJ,OAAO,eAAe,QAAQ,OAAO,IAAI,UAAU,OAAO;AAE5D,SAAO;AAAA,IACL,kBAAkB;AAAA,IAClB,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,MAAM,OAAO;AAAA,IACb,SAAS,UAAU,OAAO,OAAO,IAAI;AAAA,IACrC,OAAO;AAAA,EACT;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type * as GitHub from '../../../../api/github';
|
|
2
|
-
import type { StreamInterceptor } from '
|
|
2
|
+
import type { StreamInterceptor } from '../../../lint/external';
|
|
3
3
|
export declare const createTscAnnotations: (tscOk: boolean, tscOutputStream: StreamInterceptor) => GitHub.Annotation[];
|
|
@@ -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
|
));
|
|
@@ -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": "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",
|
|
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
|
));
|