skuba 14.0.0-migrate-to-inquirer-20251031055743 → 14.0.0-node-24-20251204121724
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/cli/adapter/eslint.js +3 -3
- package/lib/cli/adapter/eslint.js.map +3 -3
- package/lib/cli/build/assets.d.ts +3 -2
- package/lib/cli/build/assets.js +2 -2
- package/lib/cli/build/assets.js.map +3 -3
- package/lib/cli/build/index.js +3 -13
- package/lib/cli/build/index.js.map +3 -3
- package/lib/cli/build/tsc.js +1 -2
- package/lib/cli/build/tsc.js.map +2 -2
- package/lib/cli/configure/analysis/diff.js +3 -13
- package/lib/cli/configure/analysis/diff.js.map +3 -3
- package/lib/cli/configure/ensureTemplateCompletion.js +5 -2
- package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
- package/lib/cli/configure/getEntryPoint.js +3 -3
- package/lib/cli/configure/getEntryPoint.js.map +3 -3
- package/lib/cli/configure/index.js +3 -3
- package/lib/cli/configure/index.js.map +2 -2
- package/lib/cli/format/index.js +4 -14
- package/lib/cli/format/index.js.map +3 -3
- package/lib/cli/init/getConfig.js +22 -25
- package/lib/cli/init/getConfig.js.map +3 -3
- package/lib/cli/init/prompts.d.ts +4 -4
- package/lib/cli/init/prompts.js +8 -8
- package/lib/cli/init/prompts.js.map +2 -2
- package/lib/cli/lint/eslint.js +2 -2
- package/lib/cli/lint/eslint.js.map +3 -3
- package/lib/cli/lint/index.js +1 -3
- package/lib/cli/lint/index.js.map +2 -2
- package/lib/cli/lint/internal.js +6 -14
- package/lib/cli/lint/internal.js.map +3 -3
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +1 -3
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +2 -2
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +1 -3
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/index.js +1 -3
- package/lib/cli/lint/internalLints/upgrade/index.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +14 -11
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/index.js +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/index.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/upgradeNode.js +2 -5
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +0 -5
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +2 -2
- package/lib/cli/lint/prettier.js +2 -2
- package/lib/cli/lint/prettier.js.map +3 -3
- package/lib/cli/migrate/index.d.ts +5 -0
- package/lib/cli/migrate/index.js +38 -6
- package/lib/cli/migrate/index.js.map +2 -2
- package/lib/cli/migrate/nodeVersion/checks.d.ts +1 -14
- package/lib/cli/migrate/nodeVersion/checks.js +24 -133
- package/lib/cli/migrate/nodeVersion/checks.js.map +3 -3
- package/lib/cli/migrate/nodeVersion/index.d.ts +8 -2
- package/lib/cli/migrate/nodeVersion/index.js +187 -47
- package/lib/cli/migrate/nodeVersion/index.js.map +2 -2
- package/lib/cli/migrate/nodeVersion/upgrade.d.ts +8 -0
- package/lib/cli/migrate/nodeVersion/upgrade.js +144 -0
- package/lib/cli/migrate/nodeVersion/upgrade.js.map +7 -0
- package/lib/utils/exec.d.ts +3 -2
- package/lib/utils/exec.js +1 -1
- package/lib/utils/exec.js.map +2 -2
- package/lib/utils/fs.js +1 -1
- package/lib/utils/fs.js.map +2 -2
- package/lib/utils/logging.d.ts +9 -10
- package/lib/utils/logging.js +9 -19
- package/lib/utils/logging.js.map +3 -3
- package/lib/utils/logo.js +11 -18
- package/lib/utils/logo.js.map +3 -3
- package/lib/utils/worker.d.ts +3 -3
- package/lib/wrapper/http.d.ts +0 -6
- package/lib/wrapper/http.js +4 -12
- package/lib/wrapper/http.js.map +2 -2
- package/lib/wrapper/requestListener.js +3 -2
- package/lib/wrapper/requestListener.js.map +2 -2
- package/lib/wrapper/server.d.ts +7 -0
- package/lib/wrapper/server.js +35 -0
- package/lib/wrapper/server.js.map +7 -0
- package/package.json +16 -26
- package/template/base/_pnpm-workspace.yaml +2 -0
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/.nvmrc +1 -1
- package/template/express-rest-api/package.json +6 -6
- package/template/greeter/.buildkite/pipeline.yml +1 -1
- package/template/greeter/.nvmrc +1 -1
- package/template/greeter/package.json +4 -4
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/.nvmrc +1 -1
- package/template/koa-rest-api/package.json +6 -6
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
- package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +2 -4
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
- package/template/lambda-sqs-worker-cdk/infra/config.ts +2 -4
- package/template/lambda-sqs-worker-cdk/package.json +5 -4
- package/template/lambda-sqs-worker-cdk/skuba.template.js +12 -0
- package/template/oss-npm-package/.github/workflows/release.yml +1 -1
- package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
- package/template/oss-npm-package/.nvmrc +1 -1
- package/template/private-npm-package/.nvmrc +1 -1
- package/template/private-npm-package/_package.json +1 -1
- package/template/private-npm-package/skuba.template.js +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.d.ts +0 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js +0 -144
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js.map +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +0 -7
- package/lib/eslint.d.js +0 -2
- package/lib/eslint.d.js.map +0 -7
- /package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/index.d.ts +0 -0
- /package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/upgradeNode.d.ts +0 -0
|
@@ -35,9 +35,9 @@ __export(getConfig_exports, {
|
|
|
35
35
|
runForm: () => runForm
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(getConfig_exports);
|
|
38
|
+
var import_node_util = require("node:util");
|
|
38
39
|
var import_path = __toESM(require("path"));
|
|
39
40
|
var import_prompts = require("@inquirer/prompts");
|
|
40
|
-
var import_chalk = __toESM(require("chalk"));
|
|
41
41
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
42
42
|
var import_copy = require("../../utils/copy.js");
|
|
43
43
|
var import_error = require("../../utils/error.js");
|
|
@@ -51,22 +51,21 @@ var import_types = require("./types.js");
|
|
|
51
51
|
const runForm = async (props) => {
|
|
52
52
|
const { message } = props;
|
|
53
53
|
import_logging.log.plain(message);
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
return choice.validate?.(inputText) ?? true;
|
|
54
|
+
const result = {};
|
|
55
|
+
for (const choice of props.choices) {
|
|
56
|
+
const inputValue = await (0, import_prompts.input)({
|
|
57
|
+
message: choice.message,
|
|
58
|
+
default: choice.initial,
|
|
59
|
+
validate: async (inputText) => {
|
|
60
|
+
if (!inputText || inputText === "" || inputText === choice.initial && !choice.allowInitial) {
|
|
61
|
+
return "Form is not complete";
|
|
64
62
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
return choice.validate?.(inputText) ?? true;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
result[choice.name] = inputValue;
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
70
69
|
};
|
|
71
70
|
const confirmShouldContinue = async (choices) => {
|
|
72
71
|
const fieldsList = choices.map((choice) => choice.message);
|
|
@@ -114,9 +113,7 @@ const cloneTemplate = async (templateName, destinationDir) => {
|
|
|
114
113
|
import_logging.log.warn(
|
|
115
114
|
"You may need to run",
|
|
116
115
|
import_logging.log.bold(
|
|
117
|
-
(0, import_packageManager.configForPackageManager)(templateConfig.packageManager).print.exec
|
|
118
|
-
"skuba",
|
|
119
|
-
"configure"
|
|
116
|
+
`${(0, import_packageManager.configForPackageManager)(templateConfig.packageManager).print.exec} skuba configure`
|
|
120
117
|
),
|
|
121
118
|
"once this is done."
|
|
122
119
|
);
|
|
@@ -177,7 +174,7 @@ const baseToTemplateData = async ({
|
|
|
177
174
|
};
|
|
178
175
|
const configureFromPrompt = async () => {
|
|
179
176
|
const { ownerName, platformName, repoName, defaultBranch } = await runForm(import_prompts2.BASE_PROMPT_PROPS);
|
|
180
|
-
import_logging.log.plain(
|
|
177
|
+
import_logging.log.plain((0, import_node_util.styleText)("cyan", repoName), "by", (0, import_node_util.styleText)("cyan", ownerName));
|
|
181
178
|
const templateData = await baseToTemplateData({
|
|
182
179
|
ownerName,
|
|
183
180
|
platformName,
|
|
@@ -205,7 +202,10 @@ const configureFromPrompt = async () => {
|
|
|
205
202
|
import_logging.log.newline();
|
|
206
203
|
const customAnswers2 = await runForm({
|
|
207
204
|
choices: fields,
|
|
208
|
-
message:
|
|
205
|
+
message: (0, import_node_util.styleText)(
|
|
206
|
+
"bold",
|
|
207
|
+
`Complete ${(0, import_node_util.styleText)("cyan", templateName)}:`
|
|
208
|
+
),
|
|
209
209
|
name: "customAnswers"
|
|
210
210
|
});
|
|
211
211
|
return {
|
|
@@ -220,10 +220,7 @@ const configureFromPrompt = async () => {
|
|
|
220
220
|
}
|
|
221
221
|
import_logging.log.newline();
|
|
222
222
|
import_logging.log.warn(
|
|
223
|
-
`Resume this later with ${
|
|
224
|
-
(0, import_packageManager.configForPackageManager)(packageManager).print.exec,
|
|
225
|
-
"skuba configure"
|
|
226
|
-
)}.`
|
|
223
|
+
`Resume this later with ${(0, import_node_util.styleText)("bold", `${(0, import_packageManager.configForPackageManager)(packageManager).print.exec} skuba configure`)}.`
|
|
227
224
|
);
|
|
228
225
|
const customAnswers = generatePlaceholders(fields);
|
|
229
226
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/getConfig.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport { input } from '@inquirer/prompts';\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,qBAAsB;AACtB,
|
|
6
|
-
"names": ["import_prompts", "fs", "path", "
|
|
4
|
+
"sourcesContent": ["import { styleText } from 'node:util';\nimport path from 'path';\n\nimport { input } from '@inquirer/prompts';\nimport fs from 'fs-extra';\n\nimport { copyFiles } from '../../utils/copy.js';\nimport { isErrorWithCode } from '../../utils/error.js';\nimport { log } from '../../utils/logging.js';\nimport {\n DEFAULT_PACKAGE_MANAGER,\n configForPackageManager,\n} from '../../utils/packageManager.js';\nimport { getRandomPort } from '../../utils/port.js';\nimport {\n TEMPLATE_CONFIG_FILENAME,\n TEMPLATE_DIR,\n type TemplateConfig,\n templateConfigSchema,\n} from '../../utils/template.js';\n\nimport { downloadGitHubTemplate } from './git.js';\nimport {\n BASE_PROMPT_PROPS,\n type BaseFields,\n type Choice,\n getGitPath,\n getTemplateName,\n shouldContinue,\n} from './prompts.js';\nimport { type InitConfig, initConfigInputSchema } from './types.js';\n\nexport const runForm = async <T = Record<string, string>>(props: {\n choices: readonly Choice[];\n message: string;\n name: string;\n}): Promise<T> => {\n const { message } = props;\n log.plain(message);\n\n const result: Record<string, string> = {};\n\n for (const choice of props.choices) {\n const inputValue = await input({\n message: choice.message,\n default: choice.initial,\n validate: async (inputText: string) => {\n if (\n !inputText ||\n inputText === '' ||\n (inputText === choice.initial && !choice.allowInitial)\n ) {\n return 'Form is not complete';\n }\n\n return choice.validate?.(inputText) ?? true;\n },\n });\n\n result[choice.name] = inputValue;\n }\n\n return result as T;\n};\n\nconst confirmShouldContinue = async (choices: readonly Choice[]) => {\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 shouldContinue();\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 (\n templateName: string,\n destinationDir: string,\n): Promise<TemplateConfig> => {\n const isCustomTemplate = templateName.startsWith('github:');\n\n if (isCustomTemplate) {\n const gitHubPath = templateName.slice('github:'.length);\n\n await downloadGitHubTemplate(gitHubPath, destinationDir);\n } else {\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\n const templateConfig = getTemplateConfig(\n path.join(process.cwd(), destinationDir),\n );\n\n if (isCustomTemplate) {\n log.newline();\n log.warn(\n 'You may need to run',\n log.bold(\n `${configForPackageManager(templateConfig.packageManager).print.exec} skuba configure`,\n ),\n 'once this is done.',\n );\n }\n\n return templateConfig;\n};\n\nconst selectTemplateName = async () => {\n const templateSelection = await getTemplateName();\n\n if (templateSelection === 'github \u2192') {\n const gitHubPath = await getGitPath();\n return `github:${gitHubPath}`;\n }\n\n return templateSelection;\n};\n\nconst generatePlaceholders = (choices: Choice[]) =>\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-require-imports\n const templateConfig = require(templateConfigPath) as unknown;\n\n return templateConfigSchema.parse(templateConfig);\n } catch (err) {\n if (isErrorWithCode(err, 'MODULE_NOT_FOUND')) {\n return {\n entryPoint: undefined,\n fields: [],\n packageManager: DEFAULT_PACKAGE_MANAGER,\n type: undefined,\n };\n }\n\n throw err;\n }\n};\n\nconst baseToTemplateData = async ({\n ownerName,\n platformName,\n repoName,\n defaultBranch,\n}: BaseFields) => {\n const [orgName, teamName] = ownerName.split('/');\n\n const port = String(await getRandomPort());\n\n if (!orgName) {\n throw new Error(`Invalid format for owner name: ${ownerName}`);\n }\n\n return {\n orgName,\n ownerName,\n repoName,\n defaultBranch,\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, defaultBranch } =\n await runForm<BaseFields>(BASE_PROMPT_PROPS);\n log.plain(styleText('cyan', repoName), 'by', styleText('cyan', ownerName));\n\n const templateData = await baseToTemplateData({\n ownerName,\n platformName,\n repoName,\n defaultBranch,\n });\n\n const destinationDir = repoName;\n\n await createDirectory(destinationDir);\n\n log.newline();\n const templateName = await selectTemplateName();\n\n const { entryPoint, fields, noSkip, packageManager, type } =\n await cloneTemplate(templateName, destinationDir);\n\n if (fields.length === 0) {\n return {\n destinationDir,\n entryPoint,\n packageManager,\n templateComplete: true,\n templateData,\n templateName,\n type,\n };\n }\n\n const shouldContinueWithTemplate = noSkip\n ? true\n : await confirmShouldContinue(fields);\n\n if (shouldContinueWithTemplate) {\n log.newline();\n const customAnswers = await runForm({\n choices: fields,\n message: styleText(\n 'bold',\n `Complete ${styleText('cyan', templateName)}:`,\n ),\n name: 'customAnswers',\n });\n\n return {\n destinationDir,\n entryPoint,\n packageManager,\n templateComplete: true,\n templateData: { ...templateData, ...customAnswers },\n templateName,\n type,\n };\n }\n\n log.newline();\n log.warn(\n `Resume this later with ${styleText('bold', `${configForPackageManager(packageManager).print.exec} skuba configure`)}.`,\n );\n\n const customAnswers = generatePlaceholders(fields);\n\n return {\n destinationDir,\n entryPoint,\n packageManager,\n templateComplete: false,\n templateData: { ...templateData, ...customAnswers },\n templateName,\n type,\n };\n};\n\nexport const readJSONFromStdIn = async () => {\n let text = '';\n\n await new Promise((resolve) =>\n process.stdin\n .on('data', (chunk) => (text += chunk.toString()))\n .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 return value;\n};\n\nconst configureFromPipe = async (): Promise<InitConfig> => {\n const value = await readJSONFromStdIn();\n\n const result = initConfigInputSchema.safeParse(value);\n\n if (!result.success) {\n log.err('Invalid data from stdin:');\n log.err(result.error);\n process.exit(1);\n }\n\n const { destinationDir, templateComplete, templateName } = result.data;\n\n const templateData = {\n ...(await baseToTemplateData(result.data.templateData)),\n ...result.data.templateData,\n };\n\n await createDirectory(destinationDir);\n\n const { entryPoint, fields, noSkip, packageManager, type } =\n await cloneTemplate(templateName, destinationDir);\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.data,\n entryPoint,\n packageManager,\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.data,\n entryPoint,\n packageManager,\n templateData,\n type,\n };\n};\n\nexport const getConfig = () =>\n process.stdin.isTTY ? configureFromPrompt() : configureFromPipe();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAC1B,kBAAiB;AAEjB,qBAAsB;AACtB,sBAAe;AAEf,kBAA0B;AAC1B,mBAAgC;AAChC,qBAAoB;AACpB,4BAGO;AACP,kBAA8B;AAC9B,sBAKO;AAEP,iBAAuC;AACvC,IAAAA,kBAOO;AACP,mBAAuD;AAEhD,MAAM,UAAU,OAAmC,UAIxC;AAChB,QAAM,EAAE,QAAQ,IAAI;AACpB,qBAAI,MAAM,OAAO;AAEjB,QAAM,SAAiC,CAAC;AAExC,aAAW,UAAU,MAAM,SAAS;AAClC,UAAM,aAAa,UAAM,sBAAM;AAAA,MAC7B,SAAS,OAAO;AAAA,MAChB,SAAS,OAAO;AAAA,MAChB,UAAU,OAAO,cAAsB;AACrC,YACE,CAAC,aACD,cAAc,MACb,cAAc,OAAO,WAAW,CAAC,OAAO,cACzC;AACA,iBAAO;AAAA,QACT;AAEA,eAAO,OAAO,WAAW,SAAS,KAAK;AAAA,MACzC;AAAA,IACF,CAAC;AAED,WAAO,OAAO,IAAI,IAAI;AAAA,EACxB;AAEA,SAAO;AACT;AAEA,MAAM,wBAAwB,OAAO,YAA+B;AAClE,QAAM,aAAa,QAAQ,IAAI,CAAC,WAAW,OAAO,OAAO;AAEzD,qBAAI,QAAQ;AACZ,qBAAI,MAAM,+CAA+C;AACzD,qBAAI,QAAQ;AACZ,aAAW,QAAQ,CAAC,YAAY,mBA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AAW,IAAI,IAAI,OAAO,KAAK,YAAY,CAAC;AAElD,QAAM,UAAU,SAAS,OAAO,CAAC,SAAS,CAAC,SAAS,IAAI,IAAI,CAAC;AAE7D,MAAI,QAAQ,SAAS,GAAG;AACtB,uBAAI,IAAI,+CAA+C;AACvD,uBAAI,QAAQ;AACZ,YAAQ,QAAQ,CAAC,SAAS,mBAAI,IAAI,KAAK,IAAI,EAAE,CAAC;AAC9C,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,SAAO;AAAA,IACL,GAAG,OAAO;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,YAAY,MACvB,QAAQ,MAAM,QAAQ,oBAAoB,IAAI,kBAAkB;",
|
|
6
|
+
"names": ["import_prompts", "fs", "path", "customAnswers"]
|
|
7
7
|
}
|
|
@@ -18,7 +18,7 @@ declare const BASE_CHOICES: readonly [{
|
|
|
18
18
|
readonly name: "ownerName";
|
|
19
19
|
readonly message: "Owner";
|
|
20
20
|
readonly initial: "SEEK-Jobs/my-team";
|
|
21
|
-
readonly validate: (value: unknown) => true | "
|
|
21
|
+
readonly validate: (value: unknown) => true | "Required" | "Must contain a valid GitHub org name" | "Must contain a valid GitHub team name";
|
|
22
22
|
}, {
|
|
23
23
|
readonly name: "repoName";
|
|
24
24
|
readonly message: "Repo";
|
|
@@ -35,14 +35,14 @@ declare const BASE_CHOICES: readonly [{
|
|
|
35
35
|
readonly message: "Default Branch";
|
|
36
36
|
readonly initial: "main";
|
|
37
37
|
readonly allowInitial: true;
|
|
38
|
-
readonly validate: (value: unknown) => true | "
|
|
38
|
+
readonly validate: (value: unknown) => true | "Required";
|
|
39
39
|
}];
|
|
40
40
|
export declare const BASE_PROMPT_PROPS: {
|
|
41
41
|
choices: readonly [{
|
|
42
42
|
readonly name: "ownerName";
|
|
43
43
|
readonly message: "Owner";
|
|
44
44
|
readonly initial: "SEEK-Jobs/my-team";
|
|
45
|
-
readonly validate: (value: unknown) => true | "
|
|
45
|
+
readonly validate: (value: unknown) => true | "Required" | "Must contain a valid GitHub org name" | "Must contain a valid GitHub team name";
|
|
46
46
|
}, {
|
|
47
47
|
readonly name: "repoName";
|
|
48
48
|
readonly message: "Repo";
|
|
@@ -59,7 +59,7 @@ export declare const BASE_PROMPT_PROPS: {
|
|
|
59
59
|
readonly message: "Default Branch";
|
|
60
60
|
readonly initial: "main";
|
|
61
61
|
readonly allowInitial: true;
|
|
62
|
-
readonly validate: (value: unknown) => true | "
|
|
62
|
+
readonly validate: (value: unknown) => true | "Required";
|
|
63
63
|
}];
|
|
64
64
|
message: string;
|
|
65
65
|
name: string;
|
package/lib/cli/init/prompts.js
CHANGED
|
@@ -35,13 +35,13 @@ const BASE_CHOICES = [
|
|
|
35
35
|
initial: "SEEK-Jobs/my-team",
|
|
36
36
|
validate: (value) => {
|
|
37
37
|
if (typeof value !== "string") {
|
|
38
|
-
return "
|
|
38
|
+
return "Required";
|
|
39
39
|
}
|
|
40
40
|
const [org, team] = value.split("/");
|
|
41
41
|
if (!org || !(0, import_validation.isGitHubOrg)(org)) {
|
|
42
|
-
return "
|
|
42
|
+
return "Must contain a valid GitHub org name";
|
|
43
43
|
}
|
|
44
|
-
return team === void 0 || (0, import_validation.isGitHubTeam)(team) || "
|
|
44
|
+
return team === void 0 || (0, import_validation.isGitHubTeam)(team) || "Must contain a valid GitHub team name";
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
{
|
|
@@ -50,10 +50,10 @@ const BASE_CHOICES = [
|
|
|
50
50
|
initial: "my-repo",
|
|
51
51
|
validate: async (value) => {
|
|
52
52
|
if (typeof value !== "string") {
|
|
53
|
-
return "
|
|
53
|
+
return "Required";
|
|
54
54
|
}
|
|
55
55
|
if (!(0, import_validation.isGitHubRepo)(value)) {
|
|
56
|
-
return "
|
|
56
|
+
return "Must be a valid GitHub repo name";
|
|
57
57
|
}
|
|
58
58
|
const exists = await (0, import_fs.pathExists)(value);
|
|
59
59
|
return !exists || `'${value}' is an existing directory`;
|
|
@@ -64,14 +64,14 @@ const BASE_CHOICES = [
|
|
|
64
64
|
message: "Platform",
|
|
65
65
|
initial: "arm64",
|
|
66
66
|
allowInitial: true,
|
|
67
|
-
validate: (value) => (0, import_validation.isPlatform)(value) || `
|
|
67
|
+
validate: (value) => (0, import_validation.isPlatform)(value) || `Must be ${import_validation.PLATFORM_OPTIONS}`
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
name: "defaultBranch",
|
|
71
71
|
message: "Default Branch",
|
|
72
72
|
initial: "main",
|
|
73
73
|
allowInitial: true,
|
|
74
|
-
validate: (value) => typeof value === "string" && value.length > 0 ? true : "
|
|
74
|
+
validate: (value) => typeof value === "string" && value.length > 0 ? true : "Required"
|
|
75
75
|
}
|
|
76
76
|
];
|
|
77
77
|
const BASE_PROMPT_PROPS = {
|
|
@@ -89,7 +89,7 @@ const shouldContinue = async () => (0, import_prompts.select)({
|
|
|
89
89
|
const getGitPath = async () => (0, import_prompts.input)({
|
|
90
90
|
message: "Git path",
|
|
91
91
|
default: "seek-oss/skuba",
|
|
92
|
-
validate: (value) => /[^/]+\/[^/]+/.test(value) || "
|
|
92
|
+
validate: (value) => /[^/]+\/[^/]+/.test(value) || "Must be a valid path"
|
|
93
93
|
});
|
|
94
94
|
const getTemplateName = async () => (0, import_prompts.select)({
|
|
95
95
|
message: "Select a template:",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/prompts.ts"],
|
|
4
|
-
"sourcesContent": ["import { input, select } from '@inquirer/prompts';\n\nimport { pathExists } from '../../utils/fs.js';\nimport { TEMPLATE_NAMES_WITH_BYO } from '../../utils/template.js';\n\nimport {\n PLATFORM_OPTIONS,\n type Platform,\n isGitHubOrg,\n isGitHubRepo,\n isGitHubTeam,\n isPlatform,\n} from './validation.js';\n\nexport interface Choice {\n name: string;\n message: string;\n initial?: string;\n validate?: (value: string) => boolean | string | Promise<boolean | string>;\n /**\n * Whether the user is allowed to skip field entry and use the initial value.\n *\n * Defaults to `false`.\n */\n allowInitial?: boolean;\n}\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 '
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA8B;AAE9B,gBAA2B;AAC3B,sBAAwC;AAExC,wBAOO;AAsBP,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,CAAC,OAAO,KAAC,+BAAY,GAAG,GAAG;AAC7B,eAAO;AAAA,MACT;AAEA,aACE,SAAS,
|
|
4
|
+
"sourcesContent": ["import { input, select } from '@inquirer/prompts';\n\nimport { pathExists } from '../../utils/fs.js';\nimport { TEMPLATE_NAMES_WITH_BYO } from '../../utils/template.js';\n\nimport {\n PLATFORM_OPTIONS,\n type Platform,\n isGitHubOrg,\n isGitHubRepo,\n isGitHubTeam,\n isPlatform,\n} from './validation.js';\n\nexport interface Choice {\n name: string;\n message: string;\n initial?: string;\n validate?: (value: string) => boolean | string | Promise<boolean | string>;\n /**\n * Whether the user is allowed to skip field entry and use the initial value.\n *\n * Defaults to `false`.\n */\n allowInitial?: boolean;\n}\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 (!org || !isGitHubOrg(org)) {\n return 'Must contain a valid GitHub org name';\n }\n\n return (\n team === undefined ||\n isGitHubTeam(team) ||\n 'Must contain a valid GitHub team name'\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 'Must be a valid GitHub repo name';\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: 'arm64',\n allowInitial: true,\n validate: (value: unknown) =>\n isPlatform(value) || `Must be ${PLATFORM_OPTIONS}`,\n },\n {\n name: 'defaultBranch',\n message: 'Default Branch',\n initial: 'main',\n allowInitial: true,\n validate: (value: unknown) =>\n typeof value === 'string' && value.length > 0 ? true : 'Required',\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 shouldContinue = async () =>\n select({\n message: 'Fill this in now?',\n choices: [\n { name: 'Yes', value: 'yes' },\n { name: 'No', value: 'no' },\n ],\n });\n\nexport const getGitPath = async () =>\n input({\n message: 'Git path',\n default: 'seek-oss/skuba',\n validate: (value: string) =>\n /[^/]+\\/[^/]+/.test(value) || 'Must be a valid path',\n });\n\nexport const getTemplateName = async () =>\n select({\n message: 'Select a template:',\n choices: TEMPLATE_NAMES_WITH_BYO.map((name) => ({ name, value: name })),\n });\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA8B;AAE9B,gBAA2B;AAC3B,sBAAwC;AAExC,wBAOO;AAsBP,MAAM,eAAe;AAAA,EACnB;AAAA,IACE,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A,EACJ,SAAS;AAAA,EACT,SAAS;AAAA,EACT,UAAU,CAAC,UACT,eAAe,KAAK,KAAK,KAAK;AAClC,CAAC;AAEI,MAAM,kBAAkB,gBAC7B,uBAAO;AAAA,EACL,SAAS;AAAA,EACT,SAAS,wCAAwB,IAAI,CAAC,UAAU,EAAE,MAAM,OAAO,KAAK,EAAE;AACxE,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/lint/eslint.js
CHANGED
|
@@ -32,13 +32,13 @@ __export(eslint_exports, {
|
|
|
32
32
|
runESLintInWorkerThread: () => runESLintInWorkerThread
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(eslint_exports);
|
|
35
|
+
var import_node_util = require("node:util");
|
|
35
36
|
var import_path = __toESM(require("path"));
|
|
36
37
|
var import_worker_threads = require("worker_threads");
|
|
37
|
-
var import_chalk = __toESM(require("chalk"));
|
|
38
38
|
var import_logging = require("../../utils/logging.js");
|
|
39
39
|
var import_worker = require("../../utils/worker.js");
|
|
40
40
|
var import_eslint = require("../adapter/eslint.js");
|
|
41
|
-
const LOG_PREFIX =
|
|
41
|
+
const LOG_PREFIX = (0, import_node_util.styleText)("magenta", "ESLint \u2502");
|
|
42
42
|
const runESLintInCurrentThread = ({ debug, eslintConfigFile }) => (0, import_eslint.runESLint)(
|
|
43
43
|
"lint",
|
|
44
44
|
(0, import_logging.createLogger)({ debug, prefixes: [LOG_PREFIX] }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/eslint.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\nimport { isMainThread } from 'worker_threads';\n\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,4BAA6B;AAE7B,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { styleText } from 'node:util';\nimport path from 'path';\nimport { isMainThread } from 'worker_threads';\n\nimport { createLogger } from '../../utils/logging.js';\nimport { execWorkerThread, postWorkerOutput } from '../../utils/worker.js';\nimport { type ESLintOutput, runESLint } from '../adapter/eslint.js';\n\nimport type { Input } from './types.js';\n\nconst LOG_PREFIX = styleText('magenta', 'ESLint \u2502');\n\nexport const runESLintInCurrentThread = ({ debug, eslintConfigFile }: Input) =>\n runESLint(\n 'lint',\n createLogger({ debug, prefixes: [LOG_PREFIX] }),\n eslintConfigFile,\n );\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(\n runESLintInCurrentThread,\n createLogger({ debug: false, prefixes: [LOG_PREFIX] }),\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAC1B,kBAAiB;AACjB,4BAA6B;AAE7B,qBAA6B;AAC7B,oBAAmD;AACnD,oBAA6C;AAI7C,MAAM,iBAAa,4BAAU,WAAW,iBAAY;AAE7C,MAAM,2BAA2B,CAAC,EAAE,OAAO,iBAAiB,UACjE;AAAA,EACE;AAAA,MACA,6BAAa,EAAE,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;AAAA,EAC9C;AACF;AAEK,MAAM,0BAA0B,CAAC,cACtC;AAAA,EACE,YAAAA,QAAK,MAAM,KAAK,WAAW,WAAW;AAAA,EACtC;AACF;AAEF,IAAI,CAAC,oCAAc;AACjB;AAAA,IACE;AAAA,QACA,6BAAa,EAAE,OAAO,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;AAAA,EACvD;AACF;",
|
|
6
|
+
"names": ["path"]
|
|
7
7
|
}
|
package/lib/cli/lint/index.js
CHANGED
|
@@ -62,9 +62,7 @@ const lint = async (args = process.argv.slice(2), tscWriteable = void 0, workerT
|
|
|
62
62
|
import_logging.log.newline();
|
|
63
63
|
import_logging.log.warn(
|
|
64
64
|
`Try running ${import_logging.log.bold(
|
|
65
|
-
packageManager.print.exec
|
|
66
|
-
"skuba",
|
|
67
|
-
"format"
|
|
65
|
+
`${packageManager.print.exec} skuba format`
|
|
68
66
|
)} to fix them.`
|
|
69
67
|
);
|
|
70
68
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/index.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Writable } from 'stream';\nimport { inspect } from 'util';\n\nimport { hasDebugFlag, hasSerialFlag } from '../../utils/args.js';\nimport { log } from '../../utils/logging.js';\nimport { detectPackageManager } from '../../utils/packageManager.js';\nimport { throwOnTimeout } from '../../utils/wait.js';\n\nimport { createAnnotations } from './annotate/index.js';\nimport { autofix } from './autofix.js';\nimport { externalLint } from './external.js';\nimport { internalLint } from './internal.js';\nimport type { Input } from './types.js';\n\nexport const lint = async (\n args = process.argv.slice(2),\n tscWriteable: Writable | undefined = undefined,\n workerThreads = true,\n) => {\n const opts: Input = {\n debug: hasDebugFlag(args),\n serial: hasSerialFlag(args),\n tscOutputStream: tscWriteable,\n workerThreads,\n };\n\n const { eslint, prettier, tscOk, tscOutputStream } = await externalLint(opts);\n const internal = await internalLint('lint', opts);\n\n try {\n await throwOnTimeout(\n createAnnotations(internal, eslint, prettier, tscOk, tscOutputStream),\n { s: 30 },\n );\n } catch (err) {\n log.warn('Failed to annotate lint results.');\n log.subtle(inspect(err));\n }\n\n if (!internal.ok || !eslint.ok || !prettier.ok || !tscOk) {\n process.exitCode = 1;\n\n const tools = [\n ...(internal.ok ? [] : ['skuba']),\n ...(eslint.ok ? [] : ['ESLint']),\n ...(prettier.ok ? [] : ['Prettier']),\n ...(tscOk ? [] : ['tsc']),\n ];\n\n log.err(`${tools.join(', ')} found issues that require triage.`);\n\n if (internal.fixable || eslint.fixable || !prettier.ok) {\n const packageManager = await detectPackageManager();\n log.newline();\n log.warn(\n `Try running ${log.bold(\n packageManager.print.exec
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAwB;AAExB,kBAA4C;AAC5C,qBAAoB;AACpB,4BAAqC;AACrC,kBAA+B;AAE/B,sBAAkC;AAClC,qBAAwB;AACxB,sBAA6B;AAC7B,sBAA6B;AAGtB,MAAM,OAAO,OAClB,OAAO,QAAQ,KAAK,MAAM,CAAC,GAC3B,eAAqC,QACrC,gBAAgB,SACb;AACH,QAAM,OAAc;AAAA,IAClB,WAAO,0BAAa,IAAI;AAAA,IACxB,YAAQ,2BAAc,IAAI;AAAA,IAC1B,iBAAiB;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,EAAE,QAAQ,UAAU,OAAO,gBAAgB,IAAI,UAAM,8BAAa,IAAI;AAC5E,QAAM,WAAW,UAAM,8BAAa,QAAQ,IAAI;AAEhD,MAAI;AACF,cAAM;AAAA,UACJ,mCAAkB,UAAU,QAAQ,UAAU,OAAO,eAAe;AAAA,MACpE,EAAE,GAAG,GAAG;AAAA,IACV;AAAA,EACF,SAAS,KAAK;AACZ,uBAAI,KAAK,kCAAkC;AAC3C,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AAAA,EACzB;AAEA,MAAI,CAAC,SAAS,MAAM,CAAC,OAAO,MAAM,CAAC,SAAS,MAAM,CAAC,OAAO;AACxD,YAAQ,WAAW;AAEnB,UAAM,QAAQ;AAAA,MACZ,GAAI,SAAS,KAAK,CAAC,IAAI,CAAC,OAAO;AAAA,MAC/B,GAAI,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ;AAAA,MAC9B,GAAI,SAAS,KAAK,CAAC,IAAI,CAAC,UAAU;AAAA,MAClC,GAAI,QAAQ,CAAC,IAAI,CAAC,KAAK;AAAA,IACzB;AAEA,uBAAI,IAAI,GAAG,MAAM,KAAK,IAAI,CAAC,oCAAoC;AAE/D,QAAI,SAAS,WAAW,OAAO,WAAW,CAAC,SAAS,IAAI;AACtD,YAAM,iBAAiB,UAAM,4CAAqB;AAClD,yBAAI,QAAQ;AACZ,yBAAI;AAAA,QACF,eAAe,mBAAI;AAAA,UACjB,eAAe,MAAM
|
|
4
|
+
"sourcesContent": ["import type { Writable } from 'stream';\nimport { inspect } from 'util';\n\nimport { hasDebugFlag, hasSerialFlag } from '../../utils/args.js';\nimport { log } from '../../utils/logging.js';\nimport { detectPackageManager } from '../../utils/packageManager.js';\nimport { throwOnTimeout } from '../../utils/wait.js';\n\nimport { createAnnotations } from './annotate/index.js';\nimport { autofix } from './autofix.js';\nimport { externalLint } from './external.js';\nimport { internalLint } from './internal.js';\nimport type { Input } from './types.js';\n\nexport const lint = async (\n args = process.argv.slice(2),\n tscWriteable: Writable | undefined = undefined,\n workerThreads = true,\n) => {\n const opts: Input = {\n debug: hasDebugFlag(args),\n serial: hasSerialFlag(args),\n tscOutputStream: tscWriteable,\n workerThreads,\n };\n\n const { eslint, prettier, tscOk, tscOutputStream } = await externalLint(opts);\n const internal = await internalLint('lint', opts);\n\n try {\n await throwOnTimeout(\n createAnnotations(internal, eslint, prettier, tscOk, tscOutputStream),\n { s: 30 },\n );\n } catch (err) {\n log.warn('Failed to annotate lint results.');\n log.subtle(inspect(err));\n }\n\n if (!internal.ok || !eslint.ok || !prettier.ok || !tscOk) {\n process.exitCode = 1;\n\n const tools = [\n ...(internal.ok ? [] : ['skuba']),\n ...(eslint.ok ? [] : ['ESLint']),\n ...(prettier.ok ? [] : ['Prettier']),\n ...(tscOk ? [] : ['tsc']),\n ];\n\n log.err(`${tools.join(', ')} found issues that require triage.`);\n\n if (internal.fixable || eslint.fixable || !prettier.ok) {\n const packageManager = await detectPackageManager();\n log.newline();\n log.warn(\n `Try running ${log.bold(\n `${packageManager.print.exec} skuba format`,\n )} to fix them.`,\n );\n }\n }\n\n await autofix({\n debug: opts.debug,\n eslint: eslint.fixable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AO,WAAW,CAAC,SAAS,IAAI;AACtD,YAAM,iBAAiB,UAAM,4CAAqB;AAClD,yBAAI,QAAQ;AACZ,yBAAI;AAAA,QACF,eAAe,mBAAI;AAAA,UACjB,GAAG,eAAe,MAAM,IAAI;AAAA,QAC9B,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,YAAM,wBAAQ;AAAA,IACZ,OAAO,KAAK;AAAA,IACZ,QAAQ,OAAO;AAAA,IACf,UAAU,CAAC,SAAS;AAAA,IACpB,UAAU,SAAS;AAAA,EACrB,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/lint/internal.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,22 +15,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var internal_exports = {};
|
|
30
20
|
__export(internal_exports, {
|
|
31
21
|
internalLint: () => internalLint
|
|
32
22
|
});
|
|
33
23
|
module.exports = __toCommonJS(internal_exports);
|
|
24
|
+
var import_node_util = require("node:util");
|
|
34
25
|
var import_util = require("util");
|
|
35
|
-
var import_chalk = __toESM(require("chalk"));
|
|
36
26
|
var import_logging = require("../../utils/logging.js");
|
|
37
27
|
var import_detectBadCodeowners = require("./internalLints/detectBadCodeowners.js");
|
|
38
28
|
var import_noSkubaTemplateJs = require("./internalLints/noSkubaTemplateJs.js");
|
|
@@ -54,7 +44,7 @@ const lintSerially = async (mode, logger, additionalFlags) => {
|
|
|
54
44
|
results.push(
|
|
55
45
|
await lint(
|
|
56
46
|
mode,
|
|
57
|
-
(0, import_logging.childLogger)(logger, { suffixes: [
|
|
47
|
+
(0, import_logging.childLogger)(logger, { suffixes: [(0, import_node_util.styleText)("dim", name)] }),
|
|
58
48
|
additionalFlags
|
|
59
49
|
)
|
|
60
50
|
);
|
|
@@ -70,7 +60,7 @@ const lintConcurrently = async (mode, logger, additionalFlags) => {
|
|
|
70
60
|
lintGroup.map(
|
|
71
61
|
async ({ name, lint }) => lint(
|
|
72
62
|
mode,
|
|
73
|
-
(0, import_logging.childLogger)(logger, { suffixes: [
|
|
63
|
+
(0, import_logging.childLogger)(logger, { suffixes: [(0, import_node_util.styleText)("dim", name)] }),
|
|
74
64
|
additionalFlags
|
|
75
65
|
)
|
|
76
66
|
)
|
|
@@ -87,7 +77,9 @@ const internalLint = async (mode, input) => {
|
|
|
87
77
|
const start = process.hrtime.bigint();
|
|
88
78
|
const logger = (0, import_logging.createLogger)({
|
|
89
79
|
debug: input?.debug ?? false,
|
|
90
|
-
prefixes: [
|
|
80
|
+
prefixes: [
|
|
81
|
+
...mode === "lint" ? [(0, import_node_util.styleText)("blueBright", "skuba \u2502")] : []
|
|
82
|
+
]
|
|
91
83
|
});
|
|
92
84
|
try {
|
|
93
85
|
const lint = selectLintFunction(input);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/internal.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import { styleText } from 'node:util';\nimport { inspect } from 'util';\n\nimport { type Logger, childLogger, createLogger } from '../../utils/logging.js';\n\nimport { tryDetectBadCodeowners } from './internalLints/detectBadCodeowners.js';\nimport { noSkubaTemplateJs } from './internalLints/noSkubaTemplateJs.js';\nimport { tryRefreshConfigFiles } from './internalLints/refreshConfigFiles.js';\nimport { upgradeSkuba } from './internalLints/upgrade/index.js';\nimport type { Input } from './types.js';\n\nexport type InternalLintResult = {\n ok: boolean;\n fixable: boolean;\n annotations?: Array<{\n start_line?: number;\n end_line?: number;\n path: string;\n message: string;\n }>;\n};\n\nconst lints: Array<\n Array<{\n name: string;\n lint: (\n mode: 'format' | 'lint',\n logger: Logger,\n additionalFlags: string[],\n ) => Promise<InternalLintResult>;\n }>\n> = [\n // Run upgradeSkuba first, in particular before refreshConfigFiles, for npmrc handling\n [{ name: 'upgrade-skuba', lint: upgradeSkuba }],\n [\n { name: 'no-skuba-template-js', lint: noSkubaTemplateJs },\n { name: 'refresh-config-files', lint: tryRefreshConfigFiles },\n { name: 'detect-bad-codeowners', lint: tryDetectBadCodeowners },\n ],\n];\n\nconst lintSerially = async (\n mode: 'format' | 'lint',\n logger: Logger,\n additionalFlags: string[],\n) => {\n const results: InternalLintResult[] = [];\n for (const lintGroup of lints) {\n for (const { lint, name } of lintGroup) {\n results.push(\n await lint(\n mode,\n childLogger(logger, { suffixes: [styleText('dim', name)] }),\n additionalFlags,\n ),\n );\n }\n }\n return results;\n};\n\nconst lintConcurrently = async (\n mode: 'format' | 'lint',\n logger: Logger,\n additionalFlags: string[],\n) => {\n const results: InternalLintResult[] = [];\n\n for (const lintGroup of lints) {\n results.push(\n ...(await Promise.all(\n lintGroup.map(async ({ name, lint }) =>\n lint(\n mode,\n childLogger(logger, { suffixes: [styleText('dim', name)] }),\n additionalFlags,\n ),\n ),\n )),\n );\n }\n\n return results;\n};\n\nconst selectLintFunction = (input?: Input) => {\n const isSerial = input?.debug || input?.serial;\n return isSerial ? lintSerially : lintConcurrently;\n};\n\nexport const internalLint = async (\n mode: 'format' | 'lint',\n input?: Input,\n): Promise<InternalLintResult> => {\n const start = process.hrtime.bigint();\n const logger = createLogger({\n debug: input?.debug ?? false,\n prefixes: [\n ...(mode === 'lint' ? [styleText('blueBright', 'skuba \u2502')] : []),\n ],\n });\n\n try {\n const lint = selectLintFunction(input);\n const results = await lint(mode, logger, input?.additionalFlags ?? []);\n const result = combineResults(results);\n const end = process.hrtime.bigint();\n logger.plain(`Processed skuba lints in ${logger.timing(start, end)}.`);\n return result;\n } catch (err) {\n logger.err(logger.bold('Failed to run skuba lints.'));\n logger.subtle(inspect(err));\n\n process.exitCode = 1;\n\n return { ok: false, fixable: false, annotations: [] };\n }\n};\n\nconst combineResults = (results: InternalLintResult[]): InternalLintResult =>\n results.reduce(\n (cur, next) => ({\n ok: cur.ok && next.ok,\n fixable: cur.fixable || next.fixable,\n annotations: [...(cur.annotations ?? []), ...(next.annotations ?? [])],\n }),\n { ok: true, fixable: false },\n );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAC1B,kBAAwB;AAExB,qBAAuD;AAEvD,iCAAuC;AACvC,+BAAkC;AAClC,gCAAsC;AACtC,qBAA6B;AAc7B,MAAM,QASF;AAAA;AAAA,EAEF,CAAC,EAAE,MAAM,iBAAiB,MAAM,4BAAa,CAAC;AAAA,EAC9C;AAAA,IACE,EAAE,MAAM,wBAAwB,MAAM,2CAAkB;AAAA,IACxD,EAAE,MAAM,wBAAwB,MAAM,gDAAsB;AAAA,IAC5D,EAAE,MAAM,yBAAyB,MAAM,kDA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,QAAQ,OAAO,OAAO;AAClC,WAAO,MAAM,4BAA4B,OAAO,OAAO,OAAO,GAAG,CAAC,GAAG;AACrE,WAAO;AAAA,EACT,SAAS,KAAK;AACZ,WAAO,IAAI,OAAO,KAAK,4BAA4B,CAAC;AACpD,WAAO,WAAO,qBAAQ,GAAG,CAAC;AAE1B,YAAQ,WAAW;AAEnB,WAAO,EAAE,IAAI,OAAO,SAAS,OAAO,aAAa,CAAC,EAAE;AAAA,EACtD;AACF;AAEA,MAAM,iBAAiB,CAAC,YACtB,QAAQ;AAAA,EACN,CAAC,KAAK,UAAU;AAAA,IACd,IAAI,IAAI,MAAM,KAAK;AAAA,IACnB,SAAS,IAAI,WAAW,KAAK;AAAA,IAC7B,aAAa,CAAC,GAAI,IAAI,eAAe,CAAC,GAAI,GAAI,KAAK,eAAe,CAAC,CAAE;AAAA,EACvE;AAAA,EACA,EAAE,IAAI,MAAM,SAAS,MAAM;AAC7B;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -50,9 +50,7 @@ const noSkubaTemplateJs = async (_mode, logger) => {
|
|
|
50
50
|
if (await (0, import_fs.pathExists)(templateConfigPath)) {
|
|
51
51
|
logger.err(
|
|
52
52
|
`Template is incomplete; run ${logger.bold(
|
|
53
|
-
packageManager.print.exec
|
|
54
|
-
"skuba",
|
|
55
|
-
"configure"
|
|
53
|
+
`${packageManager.print.exec} skuba configure`
|
|
56
54
|
)}. ${logger.dim("no-skuba-template-js")}`
|
|
57
55
|
);
|
|
58
56
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/lint/internalLints/noSkubaTemplateJs.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport { pathExists } from '../../../utils/fs.js';\nimport type { Logger } from '../../../utils/logging.js';\nimport { getConsumerManifest } from '../../../utils/manifest.js';\nimport { detectPackageManager } from '../../../utils/packageManager.js';\nimport type { InternalLintResult } from '../internal.js';\n\nexport const noSkubaTemplateJs = async (\n _mode: 'format' | 'lint',\n logger: Logger,\n): Promise<InternalLintResult> => {\n const [manifest, packageManager] = await Promise.all([\n getConsumerManifest(),\n detectPackageManager(),\n ]);\n\n if (!manifest) {\n // This will throw elsewhere\n return { ok: true, fixable: false };\n }\n\n const templateConfigPath = path.join(\n path.dirname(manifest.path),\n 'skuba.template.js',\n );\n\n if (await pathExists(templateConfigPath)) {\n logger.err(\n `Template is incomplete; run ${logger.bold(\n packageManager.print.exec
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,gBAA2B;AAE3B,sBAAoC;AACpC,4BAAqC;AAG9B,MAAM,oBAAoB,OAC/B,OACA,WACgC;AAChC,QAAM,CAAC,UAAU,cAAc,IAAI,MAAM,QAAQ,IAAI;AAAA,QACnD,qCAAoB;AAAA,QACpB,4CAAqB;AAAA,EACvB,CAAC;AAED,MAAI,CAAC,UAAU;AAEb,WAAO,EAAE,IAAI,MAAM,SAAS,MAAM;AAAA,EACpC;AAEA,QAAM,qBAAqB,YAAAA,QAAK;AAAA,IAC9B,YAAAA,QAAK,QAAQ,SAAS,IAAI;AAAA,IAC1B;AAAA,EACF;AAEA,MAAI,UAAM,sBAAW,kBAAkB,GAAG;AACxC,WAAO;AAAA,MACL,+BAA+B,OAAO;AAAA,QACpC,eAAe,MAAM
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport { pathExists } from '../../../utils/fs.js';\nimport type { Logger } from '../../../utils/logging.js';\nimport { getConsumerManifest } from '../../../utils/manifest.js';\nimport { detectPackageManager } from '../../../utils/packageManager.js';\nimport type { InternalLintResult } from '../internal.js';\n\nexport const noSkubaTemplateJs = async (\n _mode: 'format' | 'lint',\n logger: Logger,\n): Promise<InternalLintResult> => {\n const [manifest, packageManager] = await Promise.all([\n getConsumerManifest(),\n detectPackageManager(),\n ]);\n\n if (!manifest) {\n // This will throw elsewhere\n return { ok: true, fixable: false };\n }\n\n const templateConfigPath = path.join(\n path.dirname(manifest.path),\n 'skuba.template.js',\n );\n\n if (await pathExists(templateConfigPath)) {\n logger.err(\n `Template is incomplete; run ${logger.bold(\n `${packageManager.print.exec} skuba configure`,\n )}. ${logger.dim('no-skuba-template-js')}`,\n );\n\n return {\n ok: false,\n fixable: false,\n annotations: [\n {\n path: 'skuba.template.js',\n message: `Template is incomplete; run ${packageManager.print.exec} skuba configure.`,\n },\n ],\n };\n }\n\n return { ok: true, fixable: false };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,gBAA2B;AAE3B,sBAAoC;AACpC,4BAAqC;AAG9B,MAAM,oBAAoB,OAC/B,OACA,WACgC;AAChC,QAAM,CAAC,UAAU,cAAc,IAAI,MAAM,QAAQ,IAAI;AAAA,QACnD,qCAAoB;AAAA,QACpB,4CAAqB;AAAA,EACvB,CAAC;AAED,MAAI,CAAC,UAAU;AAEb,WAAO,EAAE,IAAI,MAAM,SAAS,MAAM;AAAA,EACpC;AAEA,QAAM,qBAAqB,YAAAA,QAAK;AAAA,IAC9B,YAAAA,QAAK,QAAQ,SAAS,IAAI;AAAA,IAC1B;AAAA,EACF;AAEA,MAAI,UAAM,sBAAW,kBAAkB,GAAG;AACxC,WAAO;AAAA,MACL,+BAA+B,OAAO;AAAA,QACpC,GAAG,eAAe,MAAM,IAAI;AAAA,MAC9B,CAAC,KAAK,OAAO,IAAI,sBAAsB,CAAC;AAAA,IAC1C;AAEA,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,aAAa;AAAA,QACX;AAAA,UACE,MAAM;AAAA,UACN,SAAS,+BAA+B,eAAe,MAAM,IAAI;AAAA,QACnE;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,IAAI,MAAM,SAAS,MAAM;AACpC;",
|
|
6
6
|
"names": ["path"]
|
|
7
7
|
}
|
|
@@ -122,9 +122,7 @@ const refreshConfigFiles = async (mode, logger) => {
|
|
|
122
122
|
msg: `The ${logger.bold(
|
|
123
123
|
filename
|
|
124
124
|
)} file is out of date. Run \`${logger.bold(
|
|
125
|
-
packageManager.print.exec
|
|
126
|
-
"skuba",
|
|
127
|
-
"format"
|
|
125
|
+
`${packageManager.print.exec} skuba format`
|
|
128
126
|
)}\` to update it.`,
|
|
129
127
|
filename
|
|
130
128
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/lint/internalLints/refreshConfigFiles.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\nimport { inspect, stripVTControlCharacters as stripAnsi } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { Git } from '../../../index.js';\nimport {\n findCurrentWorkspaceProjectRoot,\n findWorkspaceRoot,\n} from '../../../utils/dir.js';\nimport type { Logger } from '../../../utils/logging.js';\nimport {\n type PackageManagerConfig,\n detectPackageManager,\n} from '../../../utils/packageManager.js';\nimport { readBaseTemplateFile } from '../../../utils/template.js';\nimport { getDestinationManifest } from '../../configure/analysis/package.js';\nimport { createDestinationFileReader } from '../../configure/analysis/project.js';\nimport { mergeWithConfigFile } from '../../configure/processing/configFile.js';\nimport type { InternalLintResult } from '../internal.js';\n\ntype ConditionOptions = {\n packageManager: PackageManagerConfig;\n isInWorkspaceRoot: boolean;\n};\n\ntype RefreshableConfigFile = {\n name: string;\n type: 'ignore' | 'pnpm-workspace';\n additionalMapping?: (\n s: string,\n packageManager: PackageManagerConfig,\n ) => string;\n if?: (options: ConditionOptions) => boolean;\n};\n\nconst OLD_IGNORE_WARNING = `# Ignore .npmrc. This is no longer managed by skuba as pnpm projects use a managed .npmrc.\n# IMPORTANT: if migrating to pnpm, remove this line and add an .npmrc IN THE SAME COMMIT.\n# You can use \\`skuba format\\` to generate the file or otherwise commit an empty file.\n# Doing so will conflict with a local .npmrc and make it more difficult to unintentionally commit auth secrets.\n.npmrc\n`;\n\nconst removeOldWarning = (contents: string) =>\n contents.includes(OLD_IGNORE_WARNING)\n ? `${contents.replace(OLD_IGNORE_WARNING, '').trim()}\\n`\n : contents;\n\nexport const REFRESHABLE_CONFIG_FILES: RefreshableConfigFile[] = [\n {\n name: '.gitignore',\n type: 'ignore',\n additionalMapping: removeOldWarning,\n },\n { name: '.prettierignore', type: 'ignore' },\n {\n name: 'pnpm-workspace.yaml',\n type: 'pnpm-workspace',\n if: ({ packageManager, isInWorkspaceRoot }) =>\n isInWorkspaceRoot && packageManager.command === 'pnpm',\n },\n {\n name: '.dockerignore',\n type: 'ignore',\n additionalMapping: removeOldWarning,\n },\n];\n\nexport const refreshConfigFiles = async (\n mode: 'format' | 'lint',\n logger: Logger,\n) => {\n const [manifest, gitRoot, workspaceRoot, currentWorkspaceProjectRoot] =\n await Promise.all([\n getDestinationManifest(),\n Git.findRoot({ dir: process.cwd() }),\n findWorkspaceRoot(),\n findCurrentWorkspaceProjectRoot(),\n ]);\n\n const destinationRoot = path.dirname(manifest.path);\n\n const readDestinationFile = createDestinationFileReader(destinationRoot);\n\n const refreshConfigFile = async (\n {\n name: filename,\n type: fileType,\n additionalMapping = (s) => s,\n if: condition = () => true,\n }: RefreshableConfigFile,\n conditionOptions: ConditionOptions,\n ) => {\n if (!condition(conditionOptions)) {\n return { needsChange: false };\n }\n\n const maybeReadPackageJson = async (type: RefreshableConfigFile['type']) =>\n type === 'pnpm-workspace'\n ? await readDestinationFile('package.json')\n : undefined;\n\n const [inputFile, templateFile, isGitIgnored, packageJson] =\n await Promise.all([\n readDestinationFile(filename),\n readBaseTemplateFile(`_${filename}`),\n gitRoot\n ? Git.isFileGitIgnored({\n gitRoot,\n absolutePath: path.join(destinationRoot, filename),\n })\n : false,\n maybeReadPackageJson(fileType),\n ]);\n\n // If the file is gitignored and doesn't exist, don't make it\n if (inputFile === undefined && isGitIgnored) {\n return { needsChange: false };\n }\n\n const data = additionalMapping(\n inputFile\n ? mergeWithConfigFile(templateFile, fileType, packageJson)(inputFile)\n : templateFile,\n packageManager,\n );\n\n const filepath = path.join(destinationRoot, filename);\n\n if (mode === 'format') {\n if (data === inputFile) {\n return { needsChange: false };\n }\n\n await fs.writeFile(filepath, data);\n return {\n needsChange: false,\n msg: `Refreshed ${logger.bold(filename)}.`,\n filename,\n };\n }\n\n if (data !== inputFile) {\n return {\n needsChange: true,\n msg: `The ${logger.bold(\n filename,\n )} file is out of date. Run \\`${logger.bold(\n packageManager.print.exec
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAA+D;AAE/D,sBAAe;AAEf,eAAoB;AACpB,iBAGO;AAEP,4BAGO;AACP,sBAAqC;AACrC,qBAAuC;AACvC,qBAA4C;AAC5C,wBAAoC;AAkBpC,MAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAO3B,MAAM,mBAAmB,CAAC,aACxB,SAAS,SAAS,kBAAkB,IAChC,GAAG,SAAS,QAAQ,oBAAoB,EAAE,EAAE,KAAK,CAAC;AAAA,IAClD;AAEC,MAAM,2BAAoD;AAAA,EAC/D;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,mBAAmB;AAAA,EACrB;AAAA,EACA,EAAE,MAAM,mBAAmB,MAAM,SAAS;AAAA,EAC1C;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,IAAI,CAAC,EAAE,gBAAgB,kBAAkB,MACvC,qBAAqB,eAAe,YAAY;AAAA,EACpD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,mBAAmB;AAAA,EACrB;AACF;AAEO,MAAM,qBAAqB,OAChC,MACA,WACG;AACH,QAAM,CAAC,UAAU,SAAS,eAAe,2BAA2B,IAClE,MAA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,aAAa;AAAA,QACb,KAAK,aAAa,OAAO,KAAK,QAAQ,CAAC;AAAA,QACvC;AAAA,MACF;AAAA,IACF;AAEA,QAAI,SAAS,WAAW;AACtB,aAAO;AAAA,QACL,aAAa;AAAA,QACb,KAAK,OAAO,OAAO;AAAA,UACjB;AAAA,QACF,CAAC,+BAA+B,OAAO;AAAA,UACrC,eAAe,MAAM
|
|
4
|
+
"sourcesContent": ["import path from 'path';\nimport { inspect, stripVTControlCharacters as stripAnsi } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { Git } from '../../../index.js';\nimport {\n findCurrentWorkspaceProjectRoot,\n findWorkspaceRoot,\n} from '../../../utils/dir.js';\nimport type { Logger } from '../../../utils/logging.js';\nimport {\n type PackageManagerConfig,\n detectPackageManager,\n} from '../../../utils/packageManager.js';\nimport { readBaseTemplateFile } from '../../../utils/template.js';\nimport { getDestinationManifest } from '../../configure/analysis/package.js';\nimport { createDestinationFileReader } from '../../configure/analysis/project.js';\nimport { mergeWithConfigFile } from '../../configure/processing/configFile.js';\nimport type { InternalLintResult } from '../internal.js';\n\ntype ConditionOptions = {\n packageManager: PackageManagerConfig;\n isInWorkspaceRoot: boolean;\n};\n\ntype RefreshableConfigFile = {\n name: string;\n type: 'ignore' | 'pnpm-workspace';\n additionalMapping?: (\n s: string,\n packageManager: PackageManagerConfig,\n ) => string;\n if?: (options: ConditionOptions) => boolean;\n};\n\nconst OLD_IGNORE_WARNING = `# Ignore .npmrc. This is no longer managed by skuba as pnpm projects use a managed .npmrc.\n# IMPORTANT: if migrating to pnpm, remove this line and add an .npmrc IN THE SAME COMMIT.\n# You can use \\`skuba format\\` to generate the file or otherwise commit an empty file.\n# Doing so will conflict with a local .npmrc and make it more difficult to unintentionally commit auth secrets.\n.npmrc\n`;\n\nconst removeOldWarning = (contents: string) =>\n contents.includes(OLD_IGNORE_WARNING)\n ? `${contents.replace(OLD_IGNORE_WARNING, '').trim()}\\n`\n : contents;\n\nexport const REFRESHABLE_CONFIG_FILES: RefreshableConfigFile[] = [\n {\n name: '.gitignore',\n type: 'ignore',\n additionalMapping: removeOldWarning,\n },\n { name: '.prettierignore', type: 'ignore' },\n {\n name: 'pnpm-workspace.yaml',\n type: 'pnpm-workspace',\n if: ({ packageManager, isInWorkspaceRoot }) =>\n isInWorkspaceRoot && packageManager.command === 'pnpm',\n },\n {\n name: '.dockerignore',\n type: 'ignore',\n additionalMapping: removeOldWarning,\n },\n];\n\nexport const refreshConfigFiles = async (\n mode: 'format' | 'lint',\n logger: Logger,\n) => {\n const [manifest, gitRoot, workspaceRoot, currentWorkspaceProjectRoot] =\n await Promise.all([\n getDestinationManifest(),\n Git.findRoot({ dir: process.cwd() }),\n findWorkspaceRoot(),\n findCurrentWorkspaceProjectRoot(),\n ]);\n\n const destinationRoot = path.dirname(manifest.path);\n\n const readDestinationFile = createDestinationFileReader(destinationRoot);\n\n const refreshConfigFile = async (\n {\n name: filename,\n type: fileType,\n additionalMapping = (s) => s,\n if: condition = () => true,\n }: RefreshableConfigFile,\n conditionOptions: ConditionOptions,\n ) => {\n if (!condition(conditionOptions)) {\n return { needsChange: false };\n }\n\n const maybeReadPackageJson = async (type: RefreshableConfigFile['type']) =>\n type === 'pnpm-workspace'\n ? await readDestinationFile('package.json')\n : undefined;\n\n const [inputFile, templateFile, isGitIgnored, packageJson] =\n await Promise.all([\n readDestinationFile(filename),\n readBaseTemplateFile(`_${filename}`),\n gitRoot\n ? Git.isFileGitIgnored({\n gitRoot,\n absolutePath: path.join(destinationRoot, filename),\n })\n : false,\n maybeReadPackageJson(fileType),\n ]);\n\n // If the file is gitignored and doesn't exist, don't make it\n if (inputFile === undefined && isGitIgnored) {\n return { needsChange: false };\n }\n\n const data = additionalMapping(\n inputFile\n ? mergeWithConfigFile(templateFile, fileType, packageJson)(inputFile)\n : templateFile,\n packageManager,\n );\n\n const filepath = path.join(destinationRoot, filename);\n\n if (mode === 'format') {\n if (data === inputFile) {\n return { needsChange: false };\n }\n\n await fs.writeFile(filepath, data);\n return {\n needsChange: false,\n msg: `Refreshed ${logger.bold(filename)}.`,\n filename,\n };\n }\n\n if (data !== inputFile) {\n return {\n needsChange: true,\n msg: `The ${logger.bold(\n filename,\n )} file is out of date. Run \\`${logger.bold(\n `${packageManager.print.exec} skuba format`,\n )}\\` to update it.`,\n filename,\n };\n }\n\n return { needsChange: false };\n };\n\n const packageManager = await detectPackageManager(destinationRoot);\n\n const results = await Promise.all(\n REFRESHABLE_CONFIG_FILES.map((conf) =>\n refreshConfigFile(conf, {\n packageManager,\n isInWorkspaceRoot: workspaceRoot === currentWorkspaceProjectRoot,\n }),\n ),\n );\n\n // Log after for reproducible test output ordering\n results.forEach((result) => {\n if (result.msg) {\n logger.warn(result.msg);\n }\n });\n\n const anyNeedChanging = results.some(({ needsChange }) => needsChange);\n\n return {\n ok: !anyNeedChanging,\n fixable: anyNeedChanging,\n annotations: results.flatMap(({ needsChange, filename, msg }) =>\n needsChange && msg\n ? [\n {\n path: filename,\n message: stripAnsi(msg),\n },\n ]\n : [],\n ),\n };\n};\n\nexport const tryRefreshConfigFiles = async (\n mode: 'format' | 'lint',\n logger: Logger,\n): Promise<InternalLintResult> => {\n try {\n return await refreshConfigFiles(mode, logger);\n } catch (err) {\n logger.warn('Failed to refresh config files.');\n logger.subtle(inspect(err));\n\n return {\n ok: false,\n fixable: false,\n annotations: [],\n };\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAA+D;AAE/D,sBAAe;AAEf,eAAoB;AACpB,iBAGO;AAEP,4BAGO;AACP,sBAAqC;AACrC,qBAAuC;AACvC,qBAA4C;AAC5C,wBAAoC;AAkBpC,MAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAO3B,MAAM,mBAAmB,CAAC,aACxB,SAAS,SAAS,kBAAkB,IAChC,GAAG,SAAS,QAAQ,oBAAoB,EAA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ACL,IAAI,CAAC;AAAA,IACL,SAAS;AAAA,IACT,aAAa,QAAQ;AAAA,MAAQ,CAAC,EAAE,aAAa,UAAU,IAAI,MACzD,eAAe,MACX;AAAA,QACE;AAAA,UACE,MAAM;AAAA,UACN,aAAS,YAAAC,0BAAU,GAAG;AAAA,QACxB;AAAA,MACF,IACA,CAAC;AAAA,IACP;AAAA,EACF;AACF;AAEO,MAAM,wBAAwB,OACnC,MACA,WACgC;AAChC,MAAI;AACF,WAAO,MAAM,mBAAmB,MAAM,MAAM;AAAA,EAC9C,SAAS,KAAK;AACZ,WAAO,KAAK,iCAAiC;AAC7C,WAAO,WAAO,qBAAQ,GAAG,CAAC;AAE1B,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,aAAa,CAAC;AAAA,IAChB;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["path", "fs", "stripAnsi"]
|
|
7
7
|
}
|
|
@@ -96,9 +96,7 @@ const upgradeSkuba = async (mode, logger, additionalFlags = []) => {
|
|
|
96
96
|
}
|
|
97
97
|
logger.warn(
|
|
98
98
|
`skuba has patches to apply. Run ${logger.bold(
|
|
99
|
-
packageManager.print.exec
|
|
100
|
-
"skuba",
|
|
101
|
-
"format"
|
|
99
|
+
`${packageManager.print.exec} skuba format`
|
|
102
100
|
)} to run them.`
|
|
103
101
|
);
|
|
104
102
|
return {
|