skuba 5.1.1 → 5.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/git/commit.js +4 -0
- package/lib/api/git/commit.js.map +1 -1
- package/lib/api/git/commitAllChanges.js +4 -0
- package/lib/api/git/commitAllChanges.js.map +1 -1
- package/lib/api/git/currentBranch.js +4 -0
- package/lib/api/git/currentBranch.js.map +1 -1
- package/lib/api/git/getChangedFiles.js +4 -0
- package/lib/api/git/getChangedFiles.js.map +1 -1
- package/lib/api/git/log.js +4 -0
- package/lib/api/git/log.js.map +1 -1
- package/lib/api/git/pull.js +4 -0
- package/lib/api/git/pull.js.map +1 -1
- package/lib/api/git/push.js +4 -0
- package/lib/api/git/push.js.map +1 -1
- package/lib/api/git/remote.js +4 -0
- package/lib/api/git/remote.js.map +1 -1
- package/lib/api/git/reset.js +4 -0
- package/lib/api/git/reset.js.map +1 -1
- package/lib/api/github/checkRun.js +4 -0
- package/lib/api/github/checkRun.js.map +1 -1
- package/lib/api/github/environment.js +5 -1
- package/lib/api/github/environment.js.map +1 -1
- package/lib/api/github/issueComment.js +4 -0
- package/lib/api/github/issueComment.js.map +1 -1
- package/lib/api/github/pullRequest.js +4 -0
- package/lib/api/github/pullRequest.js.map +1 -1
- package/lib/api/github/push.js +4 -0
- package/lib/api/github/push.js.map +1 -1
- package/lib/api/jest/index.d.ts +1 -1
- package/lib/api/jest/index.js +4 -0
- package/lib/api/jest/index.js.map +1 -1
- package/lib/api/net/socket.js +4 -0
- package/lib/api/net/socket.js.map +1 -1
- package/lib/cli/adapter/eslint.js +11 -2
- package/lib/cli/adapter/eslint.js.map +2 -2
- package/lib/cli/adapter/prettier.js +4 -0
- package/lib/cli/adapter/prettier.js.map +1 -1
- package/lib/cli/build/args.js +4 -0
- package/lib/cli/build/args.js.map +1 -1
- package/lib/cli/build/esbuild.js +5 -0
- package/lib/cli/build/esbuild.js.map +1 -1
- package/lib/cli/build/index.js +4 -0
- package/lib/cli/build/index.js.map +1 -1
- package/lib/cli/configure/addEmptyExports.d.ts +1 -0
- package/lib/cli/configure/addEmptyExports.js +12 -3
- package/lib/cli/configure/addEmptyExports.js.map +2 -2
- package/lib/cli/configure/analyseConfiguration.js +4 -0
- package/lib/cli/configure/analyseConfiguration.js.map +1 -1
- package/lib/cli/configure/analyseDependencies.js +4 -0
- package/lib/cli/configure/analyseDependencies.js.map +1 -1
- package/lib/cli/configure/analysis/diff.js +4 -0
- package/lib/cli/configure/analysis/diff.js.map +1 -1
- package/lib/cli/configure/analysis/files.js +4 -0
- package/lib/cli/configure/analysis/files.js.map +1 -1
- package/lib/cli/configure/analysis/git.js +4 -0
- package/lib/cli/configure/analysis/git.js.map +1 -1
- package/lib/cli/configure/analysis/package.js +4 -0
- package/lib/cli/configure/analysis/package.js.map +1 -1
- package/lib/cli/configure/analysis/project.js +4 -0
- package/lib/cli/configure/analysis/project.js.map +1 -1
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
- package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
- package/lib/cli/configure/dependencies/skuba.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDeps.js +2 -0
- package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
- package/lib/cli/configure/ensureTemplateCompletion.js +4 -0
- package/lib/cli/configure/ensureTemplateCompletion.js.map +1 -1
- package/lib/cli/configure/getEntryPoint.js +4 -0
- package/lib/cli/configure/getEntryPoint.js.map +1 -1
- package/lib/cli/configure/getProjectType.js.map +1 -1
- package/lib/cli/configure/index.js +4 -0
- package/lib/cli/configure/index.js.map +1 -1
- package/lib/cli/configure/modules/eslint.js +1 -0
- package/lib/cli/configure/modules/eslint.js.map +1 -1
- package/lib/cli/configure/modules/jest.js.map +1 -1
- package/lib/cli/configure/modules/package.js.map +1 -1
- package/lib/cli/configure/modules/prettier.js +1 -0
- package/lib/cli/configure/modules/prettier.js.map +1 -1
- package/lib/cli/configure/modules/renovate.d.ts +1 -0
- package/lib/cli/configure/modules/renovate.js +12 -0
- package/lib/cli/configure/modules/renovate.js.map +2 -2
- package/lib/cli/configure/modules/skubaDive.js +4 -0
- package/lib/cli/configure/modules/skubaDive.js.map +1 -1
- package/lib/cli/configure/modules/tsconfig.js.map +1 -1
- package/lib/cli/configure/patchRenovateConfig.d.ts +1 -0
- package/lib/cli/configure/patchRenovateConfig.js +132 -0
- package/lib/cli/configure/patchRenovateConfig.js.map +7 -0
- package/lib/cli/configure/processing/package.js +4 -0
- package/lib/cli/configure/processing/package.js.map +1 -1
- package/lib/cli/configure/processing/prettier.js +4 -0
- package/lib/cli/configure/processing/prettier.js.map +1 -1
- package/lib/cli/configure/processing/record.js +4 -0
- package/lib/cli/configure/processing/record.js.map +1 -1
- package/lib/cli/configure/processing/typescript.js +4 -3
- package/lib/cli/configure/processing/typescript.js.map +2 -2
- package/lib/cli/configure/refreshIgnoreFiles.d.ts +1 -0
- package/lib/cli/configure/refreshIgnoreFiles.js +12 -5
- package/lib/cli/configure/refreshIgnoreFiles.js.map +2 -2
- package/lib/cli/format.js +10 -1
- package/lib/cli/format.js.map +2 -2
- package/lib/cli/init/getConfig.js +7 -0
- package/lib/cli/init/getConfig.js.map +1 -1
- package/lib/cli/init/git.js +5 -0
- package/lib/cli/init/git.js.map +1 -1
- package/lib/cli/init/index.js +8 -0
- package/lib/cli/init/index.js.map +2 -2
- package/lib/cli/init/prompts.d.ts +1 -1
- package/lib/cli/init/prompts.js.map +2 -2
- package/lib/cli/init/types.js +6 -0
- package/lib/cli/init/types.js.map +1 -1
- package/lib/cli/init/validation.d.ts +1 -1
- package/lib/cli/init/validation.js.map +1 -1
- package/lib/cli/init/writePackageJson.js +4 -0
- package/lib/cli/init/writePackageJson.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/eslint.d.ts +1 -1
- package/lib/cli/lint/annotate/buildkite/eslint.js +4 -0
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/index.d.ts +3 -3
- package/lib/cli/lint/annotate/buildkite/index.js +4 -0
- package/lib/cli/lint/annotate/buildkite/index.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/prettier.d.ts +1 -1
- package/lib/cli/lint/annotate/buildkite/prettier.js +4 -0
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/tsc.d.ts +1 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js +4 -0
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +2 -2
- package/lib/cli/lint/annotate/github/eslint.d.ts +1 -1
- package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/github/index.d.ts +3 -3
- package/lib/cli/lint/annotate/github/index.js +4 -0
- package/lib/cli/lint/annotate/github/index.js.map +2 -2
- package/lib/cli/lint/annotate/github/prettier.d.ts +1 -1
- package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/github/tsc.d.ts +1 -1
- package/lib/cli/lint/annotate/github/tsc.js +4 -0
- package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
- package/lib/cli/lint/autofix.js +54 -11
- package/lib/cli/lint/autofix.js.map +3 -3
- package/lib/cli/lint/eslint.js +4 -0
- package/lib/cli/lint/eslint.js.map +1 -1
- package/lib/cli/lint/external.js +4 -0
- package/lib/cli/lint/external.js.map +1 -1
- package/lib/cli/lint/index.js +6 -1
- package/lib/cli/lint/index.js.map +2 -2
- package/lib/cli/lint/internal.js +4 -0
- package/lib/cli/lint/internal.js.map +1 -1
- package/lib/cli/lint/prettier.js +4 -0
- package/lib/cli/lint/prettier.js.map +1 -1
- package/lib/cli/node.js +6 -0
- package/lib/cli/node.js.map +1 -1
- package/lib/cli/start.js +4 -0
- package/lib/cli/start.js.map +1 -1
- package/lib/cli/test/reporters/github/annotations.js +4 -0
- package/lib/cli/test/reporters/github/annotations.js.map +1 -1
- package/lib/cli/test/reporters/github/index.js +4 -0
- package/lib/cli/test/reporters/github/index.js.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/skuba.js +4 -0
- package/lib/skuba.js.map +1 -1
- package/lib/utils/args.js +6 -0
- package/lib/utils/args.js.map +1 -1
- package/lib/utils/command.d.ts +1 -1
- package/lib/utils/command.js +4 -0
- package/lib/utils/command.js.map +2 -2
- package/lib/utils/copy.js +4 -0
- package/lib/utils/copy.js.map +1 -1
- package/lib/utils/dir.js +4 -0
- package/lib/utils/dir.js.map +1 -1
- package/lib/utils/error.js +4 -0
- package/lib/utils/error.js.map +1 -1
- package/lib/utils/exec.js +7 -1
- package/lib/utils/exec.js.map +1 -1
- package/lib/utils/logging.js +4 -0
- package/lib/utils/logging.js.map +1 -1
- package/lib/utils/logo.js +4 -0
- package/lib/utils/logo.js.map +1 -1
- package/lib/utils/manifest.js +4 -0
- package/lib/utils/manifest.js.map +1 -1
- package/lib/utils/port.js +4 -0
- package/lib/utils/port.js.map +1 -1
- package/lib/utils/template.d.ts +1 -1
- package/lib/utils/template.js +4 -0
- package/lib/utils/template.js.map +2 -2
- package/lib/utils/validation.js.map +1 -1
- package/lib/utils/version.js +4 -0
- package/lib/utils/version.js.map +1 -1
- package/lib/wrapper/functionHandler.js +4 -0
- package/lib/wrapper/functionHandler.js.map +1 -1
- package/lib/wrapper/http.d.ts +6 -0
- package/lib/wrapper/http.js +15 -8
- package/lib/wrapper/http.js.map +2 -2
- package/lib/wrapper/index.js.map +1 -1
- package/lib/wrapper/main.js +4 -0
- package/lib/wrapper/main.js.map +1 -1
- package/lib/wrapper/requestListener.js +19 -5
- package/lib/wrapper/requestListener.js.map +3 -3
- package/package.json +14 -12
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/package.json +1 -1
- package/template/express-rest-api/src/config.ts +1 -1
- package/template/express-rest-api/src/listen.ts +7 -0
- package/template/greeter/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/package.json +5 -5
- package/template/koa-rest-api/src/config.ts +1 -1
- package/template/koa-rest-api/src/listen.ts +7 -0
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +3 -3
- package/template/lambda-sqs-worker/package.json +5 -4
- package/template/lambda-sqs-worker/src/config.ts +1 -1
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +3 -3
package/lib/cli/format.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
|
));
|
|
@@ -33,9 +37,14 @@ var import_logging = require("../utils/logging");
|
|
|
33
37
|
var import_eslint = require("./adapter/eslint");
|
|
34
38
|
var import_prettier = require("./adapter/prettier");
|
|
35
39
|
var import_addEmptyExports = require("./configure/addEmptyExports");
|
|
40
|
+
var import_patchRenovateConfig = require("./configure/patchRenovateConfig");
|
|
36
41
|
var import_refreshIgnoreFiles = require("./configure/refreshIgnoreFiles");
|
|
37
42
|
const format = async (args = process.argv.slice(2)) => {
|
|
38
|
-
await Promise.all([
|
|
43
|
+
await Promise.all([
|
|
44
|
+
(0, import_addEmptyExports.tryAddEmptyExports)(),
|
|
45
|
+
(0, import_patchRenovateConfig.tryPatchRenovateConfig)(),
|
|
46
|
+
(0, import_refreshIgnoreFiles.tryRefreshIgnoreFiles)()
|
|
47
|
+
]);
|
|
39
48
|
const debug = (0, import_args.hasDebugFlag)(args);
|
|
40
49
|
const logger = (0, import_logging.createLogger)(debug);
|
|
41
50
|
import_logging.log.plain(import_chalk.default.magenta("ESLint"));
|
package/lib/cli/format.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/cli/format.ts"],
|
|
4
|
-
"sourcesContent": ["import chalk from 'chalk';\n\nimport { hasDebugFlag } from '../utils/args';\nimport { createLogger, log } from '../utils/logging';\n\nimport { runESLint } from './adapter/eslint';\nimport { runPrettier } from './adapter/prettier';\nimport { tryAddEmptyExports } from './configure/addEmptyExports';\nimport { tryRefreshIgnoreFiles } from './configure/refreshIgnoreFiles';\n\nexport const format = async (args = process.argv.slice(2)): Promise<void> => {\n await Promise.all([tryAddEmptyExports()
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import chalk from 'chalk';\n\nimport { hasDebugFlag } from '../utils/args';\nimport { createLogger, log } from '../utils/logging';\n\nimport { runESLint } from './adapter/eslint';\nimport { runPrettier } from './adapter/prettier';\nimport { tryAddEmptyExports } from './configure/addEmptyExports';\nimport { tryPatchRenovateConfig } from './configure/patchRenovateConfig';\nimport { tryRefreshIgnoreFiles } from './configure/refreshIgnoreFiles';\n\nexport const format = async (args = process.argv.slice(2)): Promise<void> => {\n await Promise.all([\n tryAddEmptyExports(),\n tryPatchRenovateConfig(),\n tryRefreshIgnoreFiles(),\n ]);\n\n const debug = hasDebugFlag(args);\n const logger = createLogger(debug);\n\n log.plain(chalk.magenta('ESLint'));\n\n const eslint = await runESLint('format', logger);\n\n log.newline();\n log.plain(chalk.cyan('Prettier'));\n\n const prettier = await runPrettier('format', logger);\n\n if (eslint.ok && prettier.ok) {\n return;\n }\n\n const tools = [\n ...(eslint.ok ? [] : ['ESLint']),\n ...(prettier.ok ? [] : ['Prettier']),\n ];\n\n log.newline();\n log.err(tools.join(', '), 'found issues that require triage.');\n\n process.exitCode = 1;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,kBAA6B;AAC7B,qBAAkC;AAElC,oBAA0B;AAC1B,sBAA4B;AAC5B,6BAAmC;AACnC,iCAAuC;AACvC,gCAAsC;AAE/B,MAAM,SAAS,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAqB;AAC3E,QAAM,QAAQ,IAAI;AAAA,QAChB,2CAAmB;AAAA,QACnB,mDAAuB;AAAA,QACvB,iDAAsB;AAAA,EACxB,CAAC;AAED,QAAM,YAAQ,0BAAa,IAAI;AAC/B,QAAM,aAAS,6BAAa,KAAK;AAEjC,qBAAI,MAAM,aAAAA,QAAM,QAAQ,QAAQ,CAAC;AAEjC,QAAM,SAAS,UAAM,yBAAU,UAAU,MAAM;AAE/C,qBAAI,QAAQ;AACZ,qBAAI,MAAM,aAAAA,QAAM,KAAK,UAAU,CAAC;AAEhC,QAAM,WAAW,UAAM,6BAAY,UAAU,MAAM;AAEnD,MAAI,OAAO,MAAM,SAAS,IAAI;AAC5B;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,GAAI,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ;AAAA,IAC9B,GAAI,SAAS,KAAK,CAAC,IAAI,CAAC,UAAU;AAAA,EACpC;AAEA,qBAAI,QAAQ;AACZ,qBAAI,IAAI,MAAM,KAAK,IAAI,GAAG,mCAAmC;AAE7D,UAAQ,WAAW;AACrB;",
|
|
6
6
|
"names": ["chalk"]
|
|
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
|
));
|
|
@@ -94,10 +98,12 @@ const cloneTemplate = async (templateName, destinationDir) => {
|
|
|
94
98
|
}
|
|
95
99
|
const templateDir = import_path.default.join(import_template.TEMPLATE_DIR, templateName);
|
|
96
100
|
await (0, import_copy.copyFiles)({
|
|
101
|
+
// assume built-in templates have no extraneous files
|
|
97
102
|
include: () => true,
|
|
98
103
|
sourceRoot: templateDir,
|
|
99
104
|
destinationRoot: destinationDir,
|
|
100
105
|
processors: [],
|
|
106
|
+
// built-in templates have files like _package.json
|
|
101
107
|
stripUnderscorePrefix: true
|
|
102
108
|
});
|
|
103
109
|
};
|
|
@@ -139,6 +145,7 @@ const baseToTemplateData = async ({
|
|
|
139
145
|
orgName,
|
|
140
146
|
ownerName,
|
|
141
147
|
repoName,
|
|
148
|
+
// Use standalone username in `teamName` contexts
|
|
142
149
|
teamName: teamName ?? orgName,
|
|
143
150
|
port,
|
|
144
151
|
platformName,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/getConfig.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nimport chalk from 'chalk';\nimport fs from 'fs-extra';\n\nimport { copyFiles } from '../../utils/copy';\nimport { isErrorWithCode } from '../../utils/error';\nimport { log } from '../../utils/logging';\nimport { getRandomPort } from '../../utils/port';\nimport {\n TEMPLATE_CONFIG_FILENAME,\n TEMPLATE_DIR,\n TemplateConfig,\n} from '../../utils/template';\n\nimport { downloadGitHubTemplate } from './git';\nimport type { BaseFields } from './prompts';\nimport {\n BASE_PROMPT_PROPS,\n GIT_PATH_PROMPT,\n SHOULD_CONTINUE_PROMPT,\n TEMPLATE_PROMPT,\n} from './prompts';\nimport type { InitConfig } from './types';\nimport { InitConfigInput } from './types';\n\nimport { Form } from 'enquirer';\nimport type { FormChoice } from 'enquirer';\n\nexport const runForm = <T = Record<string, string>>(props: {\n choices: Readonly<FormChoice[]>;\n message: string;\n name: string;\n}) => {\n const { message, name } = props;\n\n const choices = props.choices.map((choice) => ({\n ...choice,\n validate: (value: string) => {\n if (value === '' || value === choice.initial) {\n return 'Form is not complete';\n }\n\n return choice.validate?.(value) ?? true;\n },\n }));\n\n const form = new Form<T>({\n choices,\n message,\n name,\n validate: async (values) => {\n const results = await Promise.all(\n choices.map((choice) => choice.validate(values[choice.name])),\n );\n\n return (\n results.find((result) => typeof result === 'string') ??\n results.every((result) => result === true)\n );\n },\n });\n\n return form.run();\n};\n\nconst confirmShouldContinue = async (choices: Readonly<FormChoice[]>) => {\n const fieldsList = choices.map((choice) => choice.message);\n\n log.newline();\n log.plain('This template uses the following information:');\n log.newline();\n fieldsList.forEach((message) => log.subtle(`- ${message}`));\n\n log.newline();\n const result = await SHOULD_CONTINUE_PROMPT.run();\n\n return result === 'yes';\n};\n\nconst createDirectory = async (dir: string) => {\n try {\n await fs.promises.mkdir(dir);\n } catch (err) {\n if (isErrorWithCode(err, 'EEXIST')) {\n log.err(`The directory '${dir}' already exists.`);\n process.exit(1);\n }\n\n throw err;\n }\n};\n\nconst cloneTemplate = async (templateName: string, destinationDir: string) => {\n if (templateName.startsWith('github:')) {\n const gitHubPath = templateName.slice('github:'.length);\n return downloadGitHubTemplate(gitHubPath, destinationDir);\n }\n\n const templateDir = path.join(TEMPLATE_DIR, templateName);\n\n await copyFiles({\n // assume built-in templates have no extraneous files\n include: () => true,\n sourceRoot: templateDir,\n destinationRoot: destinationDir,\n processors: [],\n // built-in templates have files like _package.json\n stripUnderscorePrefix: true,\n });\n};\n\nconst getTemplateName = async () => {\n const templateSelection = await TEMPLATE_PROMPT.run();\n\n if (templateSelection === 'github \u2192') {\n const gitHubPath = await GIT_PATH_PROMPT.run();\n return `github:${gitHubPath}`;\n }\n\n return templateSelection;\n};\n\nconst generatePlaceholders = (choices: FormChoice[]) =>\n Object.fromEntries(\n choices.map(({ name }) => [name, `<%- ${name} %>`] as const),\n );\n\nexport const getTemplateConfig = (dir: string): TemplateConfig => {\n const templateConfigPath = path.join(dir, TEMPLATE_CONFIG_FILENAME);\n\n try {\n /* eslint-disable-next-line @typescript-eslint/no-var-requires */\n const templateConfig = require(templateConfigPath) as unknown;\n\n return TemplateConfig.check(templateConfig);\n } catch (err) {\n if (isErrorWithCode(err, 'MODULE_NOT_FOUND')) {\n return {\n entryPoint: undefined,\n fields: [],\n type: undefined,\n };\n }\n\n throw err;\n }\n};\n\nconst baseToTemplateData = async ({\n ownerName,\n platformName,\n repoName,\n}: BaseFields) => {\n const [orgName, teamName] = ownerName.split('/');\n\n const port = String(await getRandomPort());\n\n return {\n orgName,\n ownerName,\n repoName,\n // Use standalone username in `teamName` contexts\n teamName: teamName ?? orgName,\n\n port,\n\n platformName,\n lambdaCdkArchitecture: platformName === 'amd64' ? 'X86_64' : 'ARM_64',\n lambdaServerlessArchitecture:\n platformName === 'amd64' ? 'x86_64' : platformName,\n };\n};\n\nexport const configureFromPrompt = async (): Promise<InitConfig> => {\n const { ownerName, platformName, repoName } = await runForm<BaseFields>(\n BASE_PROMPT_PROPS,\n );\n log.plain(chalk.cyan(repoName), 'by', chalk.cyan(ownerName));\n\n const templateData = await baseToTemplateData({\n ownerName,\n platformName,\n repoName,\n });\n\n const destinationDir = repoName;\n\n await createDirectory(destinationDir);\n\n log.newline();\n const templateName = await getTemplateName();\n\n await cloneTemplate(templateName, destinationDir);\n\n const { entryPoint, fields, noSkip, type } = getTemplateConfig(\n path.join(process.cwd(), destinationDir),\n );\n\n if (fields.length === 0) {\n return {\n destinationDir,\n entryPoint,\n templateComplete: true,\n templateData,\n templateName,\n type,\n };\n }\n\n const shouldContinue = noSkip ? true : await confirmShouldContinue(fields);\n\n if (shouldContinue) {\n log.newline();\n const customAnswers = await runForm({\n choices: fields,\n message: chalk.bold(`Complete ${chalk.cyan(templateName)}:`),\n name: 'customAnswers',\n });\n\n return {\n destinationDir,\n entryPoint,\n templateComplete: true,\n templateData: { ...templateData, ...customAnswers },\n templateName,\n type,\n };\n }\n\n log.newline();\n log.warn(`Resume this later with ${chalk.bold('yarn skuba configure')}.`);\n\n const customAnswers = generatePlaceholders(fields);\n\n return {\n destinationDir,\n entryPoint,\n templateComplete: false,\n templateData: { ...templateData, ...customAnswers },\n templateName,\n type,\n };\n};\n\nconst configureFromPipe = async (): Promise<InitConfig> => {\n let text = '';\n\n await new Promise((resolve) =>\n process.stdin.on('data', (chunk) => (text += chunk)).once('end', resolve),\n );\n\n text = text.trim();\n\n if (text === '') {\n log.err('No data from stdin.');\n process.exit(1);\n }\n\n let value: unknown;\n\n try {\n value = JSON.parse(text) as unknown;\n } catch {\n log.err('Invalid JSON from stdin.');\n process.exit(1);\n }\n\n const result = InitConfigInput.validate(value);\n\n if (!result.success) {\n log.err('Invalid data from stdin:');\n log.err(result.message);\n process.exit(1);\n }\n\n const { destinationDir, templateComplete, templateName } = result.value;\n\n const templateData = {\n ...(await baseToTemplateData(result.value.templateData)),\n ...result.value.templateData,\n };\n\n await createDirectory(destinationDir);\n\n await cloneTemplate(templateName, destinationDir);\n\n const { entryPoint, fields, noSkip, type } = getTemplateConfig(\n path.join(process.cwd(), destinationDir),\n );\n\n if (!templateComplete) {\n if (noSkip) {\n log.err('Templating for', log.bold(templateName), 'cannot be skipped.');\n process.exit(1);\n }\n\n return {\n ...result.value,\n entryPoint,\n templateData: {\n ...templateData,\n ...generatePlaceholders(fields),\n },\n type,\n };\n }\n\n const required = fields.map(({ name }) => name);\n\n const provided = new Set(Object.keys(templateData));\n\n const missing = required.filter((name) => !provided.has(name));\n\n if (missing.length > 0) {\n log.err('This template uses the following information:');\n log.newline();\n missing.forEach((name) => log.err(`- ${name}`));\n process.exit(1);\n }\n\n return {\n ...result.value,\n entryP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]
|
|
7
7
|
}
|
package/lib/cli/init/git.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
|
));
|
|
@@ -36,6 +40,7 @@ var Git = __toESM(require("../../api/git"));
|
|
|
36
40
|
var import_logging = require("../../utils/logging");
|
|
37
41
|
const initialiseRepo = async (dir, { orgName, repoName }) => {
|
|
38
42
|
await import_isomorphic_git.default.init({
|
|
43
|
+
// TODO: support main as an alternative.
|
|
39
44
|
defaultBranch: "master",
|
|
40
45
|
dir,
|
|
41
46
|
fs: import_fs_extra.default
|
package/lib/cli/init/git.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/git.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport git from 'isomorphic-git';\nimport simpleGit from 'simple-git';\n\nimport * as Git from '../../api/git';\nimport { log } from '../../utils/logging';\n\ninterface GitHubProject {\n orgName: string;\n repoName: string;\n}\n\nexport const initialiseRepo = async (\n dir: string,\n { orgName, repoName }: GitHubProject,\n) => {\n await git.init({\n // TODO: support main as an alternative.\n defaultBranch: 'master',\n dir,\n fs,\n });\n\n await Git.commit({\n dir,\n message: 'Initial commit',\n });\n\n await git.addRemote({\n dir,\n fs,\n remote: 'origin',\n url: `git@github.com:${orgName}/${repoName}.git`,\n });\n};\n\nexport const downloadGitHubTemplate = async (\n gitHubPath: string,\n destinationDir: string,\n) => {\n log.newline();\n log.plain('Downloading', log.bold(gitHubPath), 'from GitHub...');\n\n await simpleGit().clone(`git@github.com:${gitHubPath}.git`, destinationDir, [\n '--depth=1',\n '--quiet',\n ]);\n\n await fs.promises.rm(path.join(destinationDir, '.git'), {\n force: true,\n recursive: true,\n });\n\n log.newline();\n log.warn(\n 'You may need to run',\n log.bold('yarn skuba configure'),\n 'once this is done.',\n );\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AACf,4BAAgB;AAChB,wBAAsB;AAEtB,UAAqB;AACrB,qBAAoB;AAOb,MAAM,iBAAiB,OAC5B,KACA,EAAE,SAAS,SAAS,MACjB;AACH,QAAM,sBAAAA,QAAI,KAAK;AAAA;AAAA,IAEb,eAAe;AAAA,IACf;AAAA,IACA,oBAAAC;AAAA,EACF,CAAC;AAED,QAAM,IAAI,OAAO;AAAA,IACf;AAAA,IACA,SAAS;AAAA,EACX,CAAC;AAED,QAAM,sBAAAD,QAAI,UAAU;AAAA,IAClB;AAAA,IACA,oBAAAC;AAAA,IACA,QAAQ;AAAA,IACR,KAAK,kBAAkB,WAAW;AAAA,EACpC,CAAC;AACH;AAEO,MAAM,yBAAyB,OACpC,YACA,mBACG;AACH,qBAAI,QAAQ;AACZ,qBAAI,MAAM,eAAe,mBAAI,KAAK,UAAU,GAAG,gBAAgB;AAE/D,YAAM,kBAAAC,SAAU,EAAE,MAAM,kBAAkB,kBAAkB,gBAAgB;AAAA,IAC1E;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,gBAAAD,QAAG,SAAS,GAAG,YAAAE,QAAK,KAAK,gBAAgB,MAAM,GAAG;AAAA,IACtD,OAAO;AAAA,IACP,WAAW;AAAA,EACb,CAAC;AAED,qBAAI,QAAQ;AACZ,qBAAI;AAAA,IACF;AAAA,IACA,mBAAI,KAAK,sBAAsB;AAAA,IAC/B;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["git", "fs", "simpleGit", "path"]
|
|
7
7
|
}
|
package/lib/cli/init/index.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -35,6 +39,7 @@ var import_exec = require("../../utils/exec");
|
|
|
35
39
|
var import_logging = require("../../utils/logging");
|
|
36
40
|
var import_logo = require("../../utils/logo");
|
|
37
41
|
var import_template = require("../../utils/template");
|
|
42
|
+
var import_patchRenovateConfig = require("../configure/patchRenovateConfig");
|
|
38
43
|
var import_getConfig = require("./getConfig");
|
|
39
44
|
var import_git2 = require("./git");
|
|
40
45
|
var import_writePackageJson = require("./writePackageJson");
|
|
@@ -58,8 +63,10 @@ const init = async () => {
|
|
|
58
63
|
sourceRoot: import_template.BASE_TEMPLATE_DIR,
|
|
59
64
|
destinationRoot: destinationDir,
|
|
60
65
|
include,
|
|
66
|
+
// prefer template-specific files
|
|
61
67
|
overwrite: false,
|
|
62
68
|
processors,
|
|
69
|
+
// base template has files like _.eslintrc.js
|
|
63
70
|
stripUnderscorePrefix: true
|
|
64
71
|
});
|
|
65
72
|
await (0, import_copy.copyFiles)({
|
|
@@ -85,6 +92,7 @@ const init = async () => {
|
|
|
85
92
|
});
|
|
86
93
|
import_logging.log.newline();
|
|
87
94
|
await (0, import_git2.initialiseRepo)(destinationDir, templateData);
|
|
95
|
+
await (0, import_patchRenovateConfig.tryPatchRenovateConfig)(destinationDir);
|
|
88
96
|
const skubaSlug = `skuba@${skubaVersionInfo.local}`;
|
|
89
97
|
let depsInstalled = false;
|
|
90
98
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/index.ts"],
|
|
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": "
|
|
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';\nimport { tryPatchRenovateConfig } from '../configure/patchRenovateConfig';\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 // Patch in a baseline Renovate preset based on the configured Git owner.\n await tryPatchRenovateConfig(destinationDir);\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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,iBAAiC;AACjC,kBAA6C;AAC7C,iBAAsC;AACtC,kBAA2C;AAC3C,qBAAoB;AACpB,kBAAuC;AACvC,sBAGO;AACP,iCAAuC;AAEvC,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,EAC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F;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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li/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
|
));
|