skuba 9.2.0-wat-20250115035523 → 10.0.0-main-20250312042528

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.
Files changed (105) hide show
  1. package/lib/cli/configure/analyseDependencies.js +4 -1
  2. package/lib/cli/configure/analyseDependencies.js.map +2 -2
  3. package/lib/cli/init/index.js +2 -2
  4. package/lib/cli/init/index.js.map +2 -2
  5. package/lib/cli/init/prompts.d.ts +1 -1
  6. package/lib/cli/lint/internal.js +2 -1
  7. package/lib/cli/lint/internal.js.map +2 -2
  8. package/lib/cli/lint/internalLints/detectBadCodeowners.d.ts +4 -0
  9. package/lib/cli/lint/internalLints/detectBadCodeowners.js +72 -0
  10. package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +7 -0
  11. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.d.ts +2 -0
  12. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +35 -0
  13. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +7 -0
  14. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.d.ts +2 -0
  15. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +59 -0
  16. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +7 -0
  17. package/lib/cli/migrate/index.js +10 -1
  18. package/lib/cli/migrate/index.js.map +2 -2
  19. package/lib/cli/migrate/nodeVersion/checks.d.ts +14 -0
  20. package/lib/cli/migrate/nodeVersion/checks.js +165 -0
  21. package/lib/cli/migrate/nodeVersion/checks.js.map +7 -0
  22. package/lib/cli/migrate/nodeVersion/getNodeTypesVersion.d.ts +6 -0
  23. package/lib/cli/migrate/nodeVersion/getNodeTypesVersion.js +58 -0
  24. package/lib/cli/migrate/nodeVersion/getNodeTypesVersion.js.map +7 -0
  25. package/lib/cli/migrate/nodeVersion/index.d.ts +5 -1
  26. package/lib/cli/migrate/nodeVersion/index.js +119 -36
  27. package/lib/cli/migrate/nodeVersion/index.js.map +2 -2
  28. package/lib/index.js +3 -3
  29. package/lib/utils/copy.d.ts +1 -1
  30. package/lib/utils/copy.js +11 -3
  31. package/lib/utils/copy.js.map +2 -2
  32. package/lib/utils/template.d.ts +2 -2
  33. package/lib/utils/template.js +0 -5
  34. package/lib/utils/template.js.map +2 -2
  35. package/lib/utils/version.d.ts +17 -1
  36. package/lib/utils/version.js +48 -18
  37. package/lib/utils/version.js.map +3 -3
  38. package/package.json +17 -19
  39. package/template/base/tsconfig.json +2 -2
  40. package/template/express-rest-api/.buildkite/pipeline.yml +4 -4
  41. package/template/express-rest-api/.gantry/common.yml +1 -3
  42. package/template/express-rest-api/.nvmrc +1 -1
  43. package/template/express-rest-api/Dockerfile +1 -1
  44. package/template/express-rest-api/Dockerfile.dev-deps +2 -2
  45. package/template/express-rest-api/package.json +4 -4
  46. package/template/greeter/.buildkite/pipeline.yml +1 -1
  47. package/template/greeter/.nvmrc +1 -1
  48. package/template/greeter/Dockerfile +2 -2
  49. package/template/greeter/README.md +1 -1
  50. package/template/greeter/package.json +4 -4
  51. package/template/koa-rest-api/.buildkite/pipeline.yml +4 -4
  52. package/template/koa-rest-api/.gantry/common.yml +1 -3
  53. package/template/koa-rest-api/.nvmrc +1 -1
  54. package/template/koa-rest-api/Dockerfile +1 -1
  55. package/template/koa-rest-api/Dockerfile.dev-deps +2 -2
  56. package/template/koa-rest-api/package.json +3 -3
  57. package/template/koa-rest-api/tsconfig.json +2 -2
  58. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
  59. package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
  60. package/template/lambda-sqs-worker-cdk/Dockerfile +3 -3
  61. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +2 -2
  62. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +4 -4
  63. package/template/lambda-sqs-worker-cdk/infra/config.ts +1 -1
  64. package/template/lambda-sqs-worker-cdk/infra/index.ts +3 -5
  65. package/template/lambda-sqs-worker-cdk/package.json +6 -6
  66. package/template/lambda-sqs-worker-cdk/tsconfig.json +2 -2
  67. package/template/oss-npm-package/.github/workflows/release.yml +1 -1
  68. package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
  69. package/template/oss-npm-package/.nvmrc +1 -1
  70. package/template/oss-npm-package/_package.json +1 -1
  71. package/template/private-npm-package/.nvmrc +1 -1
  72. package/template/private-npm-package/_package.json +2 -2
  73. package/template/lambda-sqs-worker/.buildkite/pipeline.yml +0 -108
  74. package/template/lambda-sqs-worker/.env +0 -1
  75. package/template/lambda-sqs-worker/.nvmrc +0 -1
  76. package/template/lambda-sqs-worker/Dockerfile +0 -17
  77. package/template/lambda-sqs-worker/README.md +0 -132
  78. package/template/lambda-sqs-worker/_.npmrc +0 -13
  79. package/template/lambda-sqs-worker/docker-compose.yml +0 -10
  80. package/template/lambda-sqs-worker/package.json +0 -45
  81. package/template/lambda-sqs-worker/serverless.yml +0 -213
  82. package/template/lambda-sqs-worker/skuba.template.js +0 -33
  83. package/template/lambda-sqs-worker/src/app.test.ts +0 -116
  84. package/template/lambda-sqs-worker/src/app.ts +0 -57
  85. package/template/lambda-sqs-worker/src/config.ts +0 -62
  86. package/template/lambda-sqs-worker/src/framework/handler.test.ts +0 -61
  87. package/template/lambda-sqs-worker/src/framework/handler.ts +0 -43
  88. package/template/lambda-sqs-worker/src/framework/logging.ts +0 -27
  89. package/template/lambda-sqs-worker/src/framework/metrics.ts +0 -14
  90. package/template/lambda-sqs-worker/src/framework/validation.test.ts +0 -84
  91. package/template/lambda-sqs-worker/src/framework/validation.ts +0 -10
  92. package/template/lambda-sqs-worker/src/hooks.ts +0 -95
  93. package/template/lambda-sqs-worker/src/mapping/jobScorer.ts +0 -22
  94. package/template/lambda-sqs-worker/src/services/aws.ts +0 -5
  95. package/template/lambda-sqs-worker/src/services/jobScorer.test.ts +0 -44
  96. package/template/lambda-sqs-worker/src/services/jobScorer.ts +0 -59
  97. package/template/lambda-sqs-worker/src/services/pipelineEventSender.test.ts +0 -40
  98. package/template/lambda-sqs-worker/src/services/pipelineEventSender.ts +0 -33
  99. package/template/lambda-sqs-worker/src/testing/handler.ts +0 -13
  100. package/template/lambda-sqs-worker/src/testing/logging.ts +0 -19
  101. package/template/lambda-sqs-worker/src/testing/services.ts +0 -28
  102. package/template/lambda-sqs-worker/src/testing/types.ts +0 -33
  103. package/template/lambda-sqs-worker/src/types/jobScorer.ts +0 -15
  104. package/template/lambda-sqs-worker/src/types/pipelineEvents.ts +0 -21
  105. package/template/lambda-sqs-worker/tsconfig.json +0 -13
@@ -53,7 +53,10 @@ const logDiff = (diff) => {
53
53
  const pinUnspecifiedVersions = async (dependencies) => {
54
54
  const updates = await Promise.all(
55
55
  Object.entries(dependencies).filter(([, version]) => version === "*").map(async ([name]) => {
56
- const version = await (name === "skuba" ? (0, import_version.getSkubaVersion)() : (0, import_version.latestNpmVersion)(name));
56
+ const version = await (name === "skuba" ? (0, import_version.getSkubaVersion)() : (0, import_version.getLatestNpmVersion)(name));
57
+ if (version === null) {
58
+ throw new Error(`Failed to fetch latest version of ${name}`);
59
+ }
57
60
  return [name, version];
58
61
  })
59
62
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/configure/analyseDependencies.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport type { NormalizedReadResult } from 'read-pkg-up';\n\nimport { type TextProcessor, copyFiles } from '../../utils/copy';\nimport { log } from '../../utils/logging';\nimport type { ProjectType } from '../../utils/manifest';\nimport { getSkubaVersion, latestNpmVersion } from '../../utils/version';\n\nimport { diffDependencies } from './analysis/package';\nimport * as dependencyMutators from './dependencies';\nimport { formatPackage } from './processing/package';\nimport type { DependencyDiff } from './types';\n\nconst logDiff = (diff: DependencyDiff): boolean => {\n const entries = Object.entries(diff);\n\n if (entries.length === 0) {\n log.ok('\u2714 No changes');\n\n return false;\n }\n\n Object.entries(diff)\n .sort(([nameA], [nameB]) => nameA.localeCompare(nameB))\n .forEach(([name, { operation, version }]) =>\n log.plain(operation, name, log.formatSubtle(version)),\n );\n\n return true;\n};\n\nconst pinUnspecifiedVersions = async (\n dependencies: Record<string, string>,\n): Promise<void> => {\n const updates = await Promise.all(\n Object.entries(dependencies)\n .filter(([, version]) => version === '*')\n .map(async ([name]) => {\n const version = await (name === 'skuba'\n ? getSkubaVersion()\n : latestNpmVersion(name));\n\n return [name, version] as const;\n }),\n );\n\n updates.forEach(([name, version]) => {\n dependencies[name] = version;\n });\n};\n\ninterface Props {\n destinationRoot: string;\n include: (pathname: string) => boolean;\n manifest: NormalizedReadResult;\n type: ProjectType;\n}\n\nexport const analyseDependencies = async ({\n destinationRoot,\n include,\n manifest: { packageJson },\n type,\n}: Props): Promise<undefined | (() => Promise<void>)> => {\n const input = {\n dependencies: packageJson.dependencies ?? {},\n devDependencies: packageJson.devDependencies ?? {},\n type,\n };\n\n const output = {\n dependencies: { ...input.dependencies },\n devDependencies: { ...input.devDependencies },\n type,\n };\n\n const processors = Object.values(dependencyMutators).reduce<TextProcessor[]>(\n (acc, mutate) => {\n const newProcessors = mutate(output);\n acc.push(...newProcessors);\n return acc;\n },\n [],\n );\n\n await Promise.all([\n pinUnspecifiedVersions(output.dependencies),\n pinUnspecifiedVersions(output.devDependencies),\n ]);\n\n const dependencyDiff = diffDependencies({\n old: input.dependencies,\n new: output.dependencies,\n });\n\n log.newline();\n log.plain(log.bold('Dependencies:'));\n\n log.newline();\n const hasDependencyDiff = logDiff(dependencyDiff);\n\n const devDependencyDiff = diffDependencies({\n old: input.devDependencies,\n new: output.devDependencies,\n });\n\n log.newline();\n log.plain(log.bold('Dev dependencies:'));\n\n log.newline();\n const hasDevDependencyDiff = logDiff(devDependencyDiff);\n\n const packageJsonFilepath = path.join(destinationRoot, 'package.json');\n\n if (!hasDependencyDiff && !hasDevDependencyDiff) {\n return;\n }\n\n return async () => {\n const updatedPackageJson = await formatPackage({\n ...packageJson,\n dependencies: output.dependencies,\n devDependencies: output.devDependencies,\n });\n\n await fs.promises.writeFile(packageJsonFilepath, updatedPackageJson);\n\n if (processors.length === 0) {\n return;\n }\n\n await copyFiles({\n sourceRoot: destinationRoot,\n destinationRoot,\n include,\n processors,\n });\n };\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AAGf,kBAA8C;AAC9C,qBAAoB;AAEpB,qBAAkD;AAElD,qBAAiC;AACjC,yBAAoC;AACpC,IAAAA,kBAA8B;AAG9B,MAAM,UAAU,CAAC,SAAkC;AACjD,QAAM,UAAU,OAAO,QAAQ,IAAI;AAEnC,MAAI,QAAQ,WAAW,GAAG;AACxB,uBAAI,GAAG,mBAAc;AAErB,WAAO;AAAA,EACT;AAEA,SAAO,QAAQ,IAAI,EAChB,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC,KAAK,MAAM,MAAM,cAAc,KAAK,CAAC,EACrD;AAAA,IAAQ,CAAC,CAAC,MAAM,EAAE,WAAW,QAAQ,CAAC,MACrC,mBAAI,MAAM,WAAW,MAAM,mBAAI,aAAa,OAAO,CAAC;AAAA,EACtD;AAEF,SAAO;AACT;AAEA,MAAM,yBAAyB,OAC7B,iBACkB;AAClB,QAAM,UAAU,MAAM,QAAQ;AAAA,IAC5B,OAAO,QAAQ,YAAY,EACxB,OAAO,CAAC,CAAC,EAAE,OAAO,MAAM,YAAY,GAAG,EACvC,IAAI,OAAO,CAAC,IAAI,MAAM;AACrB,YAAM,UAAU,OAAO,SAAS,cAC5B,gCAAgB,QAChB,iCAAiB,IAAI;AAEzB,aAAO,CAAC,MAAM,OAAO;AAAA,IACvB,CAAC;AAAA,EACL;AAEA,UAAQ,QAAQ,CAAC,CAAC,MAAM,OAAO,MAAM;AACnC,iBAAa,IAAI,IAAI;AAAA,EACvB,CAAC;AACH;AASO,MAAM,sBAAs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A,MAC7C,GAAG;AAAA,MACH,cAAc,OAAO;AAAA,MACrB,iBAAiB,OAAO;AAAA,IAC1B,CAAC;AAED,UAAM,gBAAAC,QAAG,SAAS,UAAU,qBAAqB,kBAAkB;AAEnE,QAAI,WAAW,WAAW,GAAG;AAC3B;AAAA,IACF;AAEA,cAAM,uBAAU;AAAA,MACd,YAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
4
+ "sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport type { NormalizedReadResult } from 'read-pkg-up';\n\nimport { type TextProcessor, copyFiles } from '../../utils/copy';\nimport { log } from '../../utils/logging';\nimport type { ProjectType } from '../../utils/manifest';\nimport { getLatestNpmVersion, getSkubaVersion } from '../../utils/version';\n\nimport { diffDependencies } from './analysis/package';\nimport * as dependencyMutators from './dependencies';\nimport { formatPackage } from './processing/package';\nimport type { DependencyDiff } from './types';\n\nconst logDiff = (diff: DependencyDiff): boolean => {\n const entries = Object.entries(diff);\n\n if (entries.length === 0) {\n log.ok('\u2714 No changes');\n\n return false;\n }\n\n Object.entries(diff)\n .sort(([nameA], [nameB]) => nameA.localeCompare(nameB))\n .forEach(([name, { operation, version }]) =>\n log.plain(operation, name, log.formatSubtle(version)),\n );\n\n return true;\n};\n\nconst pinUnspecifiedVersions = async (\n dependencies: Record<string, string>,\n): Promise<void> => {\n const updates = await Promise.all(\n Object.entries(dependencies)\n .filter(([, version]) => version === '*')\n .map(async ([name]) => {\n const version = await (name === 'skuba'\n ? getSkubaVersion()\n : getLatestNpmVersion(name));\n\n if (version === null) {\n throw new Error(`Failed to fetch latest version of ${name}`);\n }\n\n return [name, version] as const;\n }),\n );\n\n updates.forEach(([name, version]) => {\n dependencies[name] = version;\n });\n};\n\ninterface Props {\n destinationRoot: string;\n include: (pathname: string) => boolean;\n manifest: NormalizedReadResult;\n type: ProjectType;\n}\n\nexport const analyseDependencies = async ({\n destinationRoot,\n include,\n manifest: { packageJson },\n type,\n}: Props): Promise<undefined | (() => Promise<void>)> => {\n const input = {\n dependencies: packageJson.dependencies ?? {},\n devDependencies: packageJson.devDependencies ?? {},\n type,\n };\n\n const output = {\n dependencies: { ...input.dependencies },\n devDependencies: { ...input.devDependencies },\n type,\n };\n\n const processors = Object.values(dependencyMutators).reduce<TextProcessor[]>(\n (acc, mutate) => {\n const newProcessors = mutate(output);\n acc.push(...newProcessors);\n return acc;\n },\n [],\n );\n\n await Promise.all([\n pinUnspecifiedVersions(output.dependencies),\n pinUnspecifiedVersions(output.devDependencies),\n ]);\n\n const dependencyDiff = diffDependencies({\n old: input.dependencies,\n new: output.dependencies,\n });\n\n log.newline();\n log.plain(log.bold('Dependencies:'));\n\n log.newline();\n const hasDependencyDiff = logDiff(dependencyDiff);\n\n const devDependencyDiff = diffDependencies({\n old: input.devDependencies,\n new: output.devDependencies,\n });\n\n log.newline();\n log.plain(log.bold('Dev dependencies:'));\n\n log.newline();\n const hasDevDependencyDiff = logDiff(devDependencyDiff);\n\n const packageJsonFilepath = path.join(destinationRoot, 'package.json');\n\n if (!hasDependencyDiff && !hasDevDependencyDiff) {\n return;\n }\n\n return async () => {\n const updatedPackageJson = await formatPackage({\n ...packageJson,\n dependencies: output.dependencies,\n devDependencies: output.devDependencies,\n });\n\n await fs.promises.writeFile(packageJsonFilepath, updatedPackageJson);\n\n if (processors.length === 0) {\n return;\n }\n\n await copyFiles({\n sourceRoot: destinationRoot,\n destinationRoot,\n include,\n processors,\n });\n };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AAGf,kBAA8C;AAC9C,qBAAoB;AAEpB,qBAAqD;AAErD,qBAAiC;AACjC,yBAAoC;AACpC,IAAAA,kBAA8B;AAG9B,MAAM,UAAU,CAAC,SAAkC;AACjD,QAAM,UAAU,OAAO,QAAQ,IAAI;AAEnC,MAAI,QAAQ,W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AW;AACf,YAAM,gBAAgB,OAAO,MAAM;AACnC,UAAI,KAAK,GAAG,aAAa;AACzB,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AAEA,QAAM,QAAQ,IAAI;AAAA,IAChB,uBAAuB,OAAO,YAAY;AAAA,IAC1C,uBAAuB,OAAO,eAAe;AAAA,EAC/C,CAAC;AAED,QAAM,qBAAiB,iCAAiB;AAAA,IACtC,KAAK,MAAM;AAAA,IACX,KAAK,OAAO;AAAA,EACd,CAAC;AAED,qBAAI,QAAQ;AACZ,qBAAI,MAAM,mBAAI,KAAK,eAAe,CAAC;AAEnC,qBAAI,QAAQ;AACZ,QAAM,oBAAoB,QAAQ,cAAc;AAEhD,QAAM,wBAAoB,iCAAiB;AAAA,IACzC,KAAK,MAAM;AAAA,IACX,KAAK,OAAO;AAAA,EACd,CAAC;AAED,qBAAI,QAAQ;AACZ,qBAAI,MAAM,mBAAI,KAAK,mBAAmB,CAAC;AAEvC,qBAAI,QAAQ;AACZ,QAAM,uBAAuB,QAAQ,iBAAiB;AAEtD,QAAM,sBAAsB,YAAAC,QAAK,KAAK,iBAAiB,cAAc;AAErE,MAAI,CAAC,qBAAqB,CAAC,sBAAsB;AAC/C;AAAA,EACF;AAEA,SAAO,YAAY;AACjB,UAAM,qBAAqB,UAAM,+BAAc;AAAA,MAC7C,GAAG;AAAA,MACH,cAAc,OAAO;AAAA,MACrB,iBAAiB,OAAO;AAAA,IAC1B,CAAC;AAED,UAAM,gBAAAC,QAAG,SAAS,UAAU,qBAAqB,kBAAkB;AAEnE,QAAI,WAAW,WAAW,GAAG;AAC3B;AAAA,IACF;AAEA,cAAM,uBAAU;AAAA,MACd,YAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
6
6
  "names": ["import_package", "path", "fs"]
7
7
  }
@@ -102,8 +102,8 @@ const init = async (args = process.argv.slice(2)) => {
102
102
  import_logging.log.newline();
103
103
  await (0, import_git2.initialiseRepo)(destinationDir, templateData);
104
104
  const [manifest, packageManagerConfig] = await Promise.all([
105
- (0, import_manifest.getConsumerManifest)(),
106
- (0, import_packageManager.detectPackageManager)()
105
+ (0, import_manifest.getConsumerManifest)(destinationDir),
106
+ (0, import_packageManager.detectPackageManager)(destinationDir)
107
107
  ]);
108
108
  if (!manifest) {
109
109
  throw new Error("Repository doesn't contain a package.json file.");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/init/index.ts"],
4
- "sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport { commitAllChanges } from '../../api/git';\nimport { hasDebugFlag } from '../../utils/args';\nimport { copyFiles, createEjsRenderer } from '../../utils/copy';\nimport { createInclusionFilter } from '../../utils/dir';\nimport { createExec, ensureCommands } from '../../utils/exec';\nimport { createLogger, log } from '../../utils/logging';\nimport { showLogoAndVersionInfo } from '../../utils/logo';\nimport { getConsumerManifest } from '../../utils/manifest';\nimport { detectPackageManager } from '../../utils/packageManager';\nimport {\n BASE_TEMPLATE_DIR,\n ensureTemplateConfigDeletion,\n} from '../../utils/template';\nimport { runPrettier } from '../adapter/prettier';\nimport { tryPatchRenovateConfig } from '../lint/internalLints/patchRenovateConfig';\n\nimport { getConfig } from './getConfig';\nimport { initialiseRepo } from './git';\nimport type { Input } from './types';\nimport { writePackageJson } from './writePackageJson';\n\nexport const init = async (args = process.argv.slice(2)) => {\n const opts: Input = {\n debug: hasDebugFlag(args),\n };\n\n const skubaVersionInfo = await showLogoAndVersionInfo();\n\n const {\n destinationDir,\n entryPoint,\n packageManager,\n templateComplete,\n templateData,\n templateName,\n type,\n } = await getConfig();\n\n await ensureCommands(packageManager);\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 _eslint.config.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: packageManager,\n });\n\n log.newline();\n await initialiseRepo(destinationDir, templateData);\n\n const [manifest, packageManagerConfig] = await Promise.all([\n getConsumerManifest(),\n detectPackageManager(),\n ]);\n\n if (!manifest) {\n throw new Error(\"Repository doesn't contain a package.json file.\");\n }\n\n // Patch in a baseline Renovate preset based on the configured Git owner.\n await tryPatchRenovateConfig({\n mode: 'format',\n dir: destinationDir,\n manifest,\n packageManager: packageManagerConfig,\n });\n\n const skubaSlug = `skuba@${skubaVersionInfo.local}`;\n\n let depsInstalled = false;\n try {\n // The `-D` shorthand is portable across our package managers.\n await exec(packageManager, 'add', '-D', skubaSlug);\n\n // Templating can initially leave certain files in an unformatted state;\n // consider a Markdown table with columns sized based on content length.\n await runPrettier('format', createLogger(opts.debug), destinationDir);\n\n depsInstalled = true;\n } catch (err) {\n log.warn(inspect(err));\n }\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 // The `-D` shorthand is portable across our package managers.\n log.ok(packageManager, 'add', '-D', skubaSlug);\n log.ok(packageManager, 'run', 'format');\n log.ok('git add --all');\n log.ok('git commit --message', `'Pin ${skubaSlug}'`);\n log.ok(`git push --set-upstream origin ${templateData.defaultBranch}`);\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 ${templateData.defaultBranch}`);\n\n log.newline();\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAwB;AAExB,iBAAiC;AACjC,kBAA6B;AAC7B,kBAA6C;AAC7C,iBAAsC;AACtC,kBAA2C;AAC3C,qBAAkC;AAClC,kBAAuC;AACvC,sBAAoC;AACpC,4BAAqC;AACrC,sBAGO;AACP,sBAA4B;AAC5B,iCAAuC;AAEvC,uBAA0B;AAC1B,IAAAA,cAA+B;AAE/B,8BAAiC;AAE1B,MAAM,OAAO,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAC1D,QAAM,OAAc;AAAA,IAClB,WAAO,0BAAa,IAAI;AAAA,EAC1B;AAEA,QAAM,mBAAmB,UAAM,oCAAuB;AAEtD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,UAAM,4BAAU;AAEpB,YAAM,4BAAe,cAAc;AAEnC,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;A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AI,KAAK,GAAG,aAAa,OAAO,IAAI,aAAa,QAAQ,EAAE;AAAA,MAC3D;AAAA,IACF;AACA,uBAAI,GAAG,wBAAwB;AAAA,EACjC;AAEA,MAAI,CAAC,eAAe;AAClB,uBAAI,QAAQ;AACZ,uBAAI,KAAK,mBAAI,KAAK,wCAAmC,CAAC;AAEtD,uBAAI,QAAQ;AACZ,0BAAsB;AAEtB,uBAAI,QAAQ;AACZ,uBAAI,MAAM,8BAA8B;AACxC,uBAAI,GAAG,MAAM,cAAc;AAE3B,uBAAI,GAAG,gBAAgB,OAAO,MAAM,SAAS;AAC7C,uBAAI,GAAG,gBAAgB,OAAO,QAAQ;AACtC,uBAAI,GAAG,eAAe;AACtB,uBAAI,GAAG,wBAAwB,QAAQ,SAAS,GAAG;AACnD,uBAAI,GAAG,kCAAkC,aAAa,aAAa,EAAE;AAErE,uBAAI,QAAQ;AACZ,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,qBAAI,QAAQ;AACZ,qBAAI,GAAG,mBAAI,KAAK,6BAAwB,CAAC;AAEzC,qBAAI,QAAQ;AACZ,wBAAsB;AAEtB,qBAAI,QAAQ;AACZ,qBAAI,MAAM,gCAAgC;AAC1C,qBAAI,GAAG,MAAM,cAAc;AAC3B,qBAAI,GAAG,kCAAkC,aAAa,aAAa,EAAE;AAErE,qBAAI,QAAQ;AACd;",
4
+ "sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport { commitAllChanges } from '../../api/git';\nimport { hasDebugFlag } from '../../utils/args';\nimport { copyFiles, createEjsRenderer } from '../../utils/copy';\nimport { createInclusionFilter } from '../../utils/dir';\nimport { createExec, ensureCommands } from '../../utils/exec';\nimport { createLogger, log } from '../../utils/logging';\nimport { showLogoAndVersionInfo } from '../../utils/logo';\nimport { getConsumerManifest } from '../../utils/manifest';\nimport { detectPackageManager } from '../../utils/packageManager';\nimport {\n BASE_TEMPLATE_DIR,\n ensureTemplateConfigDeletion,\n} from '../../utils/template';\nimport { runPrettier } from '../adapter/prettier';\nimport { tryPatchRenovateConfig } from '../lint/internalLints/patchRenovateConfig';\n\nimport { getConfig } from './getConfig';\nimport { initialiseRepo } from './git';\nimport type { Input } from './types';\nimport { writePackageJson } from './writePackageJson';\n\nexport const init = async (args = process.argv.slice(2)) => {\n const opts: Input = {\n debug: hasDebugFlag(args),\n };\n\n const skubaVersionInfo = await showLogoAndVersionInfo();\n\n const {\n destinationDir,\n entryPoint,\n packageManager,\n templateComplete,\n templateData,\n templateName,\n type,\n } = await getConfig();\n\n await ensureCommands(packageManager);\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 _eslint.config.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: packageManager,\n });\n\n log.newline();\n await initialiseRepo(destinationDir, templateData);\n\n const [manifest, packageManagerConfig] = await Promise.all([\n getConsumerManifest(destinationDir),\n detectPackageManager(destinationDir),\n ]);\n\n if (!manifest) {\n throw new Error(\"Repository doesn't contain a package.json file.\");\n }\n\n // Patch in a baseline Renovate preset based on the configured Git owner.\n await tryPatchRenovateConfig({\n mode: 'format',\n dir: destinationDir,\n manifest,\n packageManager: packageManagerConfig,\n });\n\n const skubaSlug = `skuba@${skubaVersionInfo.local}`;\n\n let depsInstalled = false;\n try {\n // The `-D` shorthand is portable across our package managers.\n await exec(packageManager, 'add', '-D', skubaSlug);\n\n // Templating can initially leave certain files in an unformatted state;\n // consider a Markdown table with columns sized based on content length.\n await runPrettier('format', createLogger(opts.debug), destinationDir);\n\n depsInstalled = true;\n } catch (err) {\n log.warn(inspect(err));\n }\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 // The `-D` shorthand is portable across our package managers.\n log.ok(packageManager, 'add', '-D', skubaSlug);\n log.ok(packageManager, 'run', 'format');\n log.ok('git add --all');\n log.ok('git commit --message', `'Pin ${skubaSlug}'`);\n log.ok(`git push --set-upstream origin ${templateData.defaultBranch}`);\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 ${templateData.defaultBranch}`);\n\n log.newline();\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAwB;AAExB,iBAAiC;AACjC,kBAA6B;AAC7B,kBAA6C;AAC7C,iBAAsC;AACtC,kBAA2C;AAC3C,qBAAkC;AAClC,kBAAuC;AACvC,sBAAoC;AACpC,4BAAqC;AACrC,sBAGO;AACP,sBAA4B;AAC5B,iCAAuC;AAEvC,uBAA0B;AAC1B,IAAAA,cAA+B;AAE/B,8BAAiC;AAE1B,MAAM,OAAO,OAAO,OAAO,QAAQ,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AAsB;AAEtB,qBAAI,QAAQ;AACZ,qBAAI,MAAM,gCAAgC;AAC1C,qBAAI,GAAG,MAAM,cAAc;AAC3B,qBAAI,GAAG,kCAAkC,aAAa,aAAa,EAAE;AAErE,qBAAI,QAAQ;AACd;",
6
6
  "names": ["import_git", "path"]
7
7
  }
@@ -63,5 +63,5 @@ export declare const BASE_PROMPT_PROPS: {
63
63
  };
64
64
  export declare const SHOULD_CONTINUE_PROMPT: Select<"yes" | "no">;
65
65
  export declare const GIT_PATH_PROMPT: Input;
66
- export declare const TEMPLATE_PROMPT: Select<"express-rest-api" | "greeter" | "koa-rest-api" | "lambda-sqs-worker" | "lambda-sqs-worker-cdk" | "oss-npm-package" | "private-npm-package" | "github →">;
66
+ export declare const TEMPLATE_PROMPT: Select<"express-rest-api" | "greeter" | "koa-rest-api" | "lambda-sqs-worker-cdk" | "oss-npm-package" | "private-npm-package" | "github →">;
67
67
  export {};
@@ -34,12 +34,13 @@ module.exports = __toCommonJS(internal_exports);
34
34
  var import_util = require("util");
35
35
  var import_chalk = __toESM(require("chalk"));
36
36
  var import_logging = require("../../utils/logging");
37
+ var import_detectBadCodeowners = require("./internalLints/detectBadCodeowners");
37
38
  var import_noSkubaTemplateJs = require("./internalLints/noSkubaTemplateJs");
38
39
  var import_refreshConfigFiles = require("./internalLints/refreshConfigFiles");
39
40
  var import_upgrade = require("./internalLints/upgrade");
40
41
  const lints = [
41
42
  // Run upgradeSkuba before refreshConfigFiles for npmrc handling
42
- [import_upgrade.upgradeSkuba],
43
+ [import_upgrade.upgradeSkuba, import_detectBadCodeowners.tryDetectBadCodeowners],
43
44
  [import_noSkubaTemplateJs.noSkubaTemplateJs, import_refreshConfigFiles.tryRefreshConfigFiles]
44
45
  ];
45
46
  const lintSerially = async (mode, logger) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/lint/internal.ts"],
4
- "sourcesContent": ["import { inspect } from 'util';\n\nimport chalk from 'chalk';\n\nimport { type Logger, createLogger } from '../../utils/logging';\n\nimport { noSkubaTemplateJs } from './internalLints/noSkubaTemplateJs';\nimport { tryRefreshConfigFiles } from './internalLints/refreshConfigFiles';\nimport { upgradeSkuba } from './internalLints/upgrade';\nimport type { Input } from './types';\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 (mode: 'format' | 'lint', logger: Logger) => Promise<InternalLintResult>\n >\n> = [\n // Run upgradeSkuba before refreshConfigFiles for npmrc handling\n [upgradeSkuba],\n [noSkubaTemplateJs, tryRefreshConfigFiles],\n];\n\nconst lintSerially = async (mode: 'format' | 'lint', logger: Logger) => {\n const results: InternalLintResult[] = [];\n for (const lintGroup of lints) {\n for (const lint of lintGroup) {\n results.push(await lint(mode, logger));\n }\n }\n return results;\n};\n\nconst lintConcurrently = async (mode: 'format' | 'lint', logger: Logger) => {\n const results: InternalLintResult[] = [];\n\n for (const lintGroup of lints) {\n results.push(\n ...(await Promise.all(lintGroup.map((lint) => lint(mode, logger)))),\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 input?.debug ?? false,\n ...(mode === 'lint' ? [chalk.blueBright('skuba \u2502')] : []),\n );\n\n try {\n const lint = selectLintFunction(input);\n const results = await lint(mode, logger);\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,kBAAwB;AAExB,mBAAkB;AAElB,qBAA0C;AAE1C,+BAAkC;AAClC,gCAAsC;AACtC,qBAA6B;AAc7B,MAAM,QAIF;AAAA;AAAA,EAEF,CAAC,2BAAY;AAAA,EACb,CAAC,4CAAmB,+CAAqB;AAC3C;AAEA,MAAM,eAAe,OAAO,MAAyB,WAAmB;AACtE,QAAM,UAAgC,CAAC;AACvC,aAAW,aAAa,OAAO;AAC7B,eAAW,QAAQ,WAAW;AAC5B,cAAQ,KAAK,MAAM,KAAK,MAAM,MAAM,CAAC;AAAA,IACvC;AAAA,EACF;AACA,SAAO;AACT;AAEA,MAAM,mBAAmB,OAAO,MAAyB,WAAmB;AAC1E,QAAM,UAAgC,CAAC;AAEvC,aAAW,aAAa,OAAO;AAC7B,YAAQ;AAAA,MACN,GAAI,MAAM,QAAQ,IAAI,UAAU,IAAI,CAAC,SAAS,KAAK,MAAM,MAAM,CAAC,CAAC;AAAA,IACnE;AAAA,EACF;AAEA,SAAO;AACT;AAEA,MAAM,qBAAqB,CAAC,UAAkB;AAC5C,QAAM,WAAW,OAAO,SAAS,OAAO;AACxC,SAAO,WAAW,eAAe;AACnC;AAEO,MAAM,eAAe,OAC1B,MACA,UACgC;AAChC,QAAM,QAAQ,QAAQ,OAAO,OAAO;AACpC,QAAM,aAAS;AAAA,IACb,OAAO,SAAS;AAAA,IAChB,GAAI,SAAS,SAAS,CAAC,aAAAA,QAAM,WAAW,iBAAY,CAAC,IAAI,CAAC;AAAA,EAC5D;AAEA,MAAI;AACF,UAAM,OAAO,mBAAmB,KAAK;AACrC,UAAM,UAAU,MAAM,KAAK,MAAM,MAAM;AACvC,UAAM,SAAS,eAAe,OAAO;AACrC,UAAM,MAAM,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;",
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport chalk from 'chalk';\n\nimport { type Logger, createLogger } from '../../utils/logging';\n\nimport { tryDetectBadCodeowners } from './internalLints/detectBadCodeowners';\nimport { noSkubaTemplateJs } from './internalLints/noSkubaTemplateJs';\nimport { tryRefreshConfigFiles } from './internalLints/refreshConfigFiles';\nimport { upgradeSkuba } from './internalLints/upgrade';\nimport type { Input } from './types';\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 (mode: 'format' | 'lint', logger: Logger) => Promise<InternalLintResult>\n >\n> = [\n // Run upgradeSkuba before refreshConfigFiles for npmrc handling\n [upgradeSkuba, tryDetectBadCodeowners],\n [noSkubaTemplateJs, tryRefreshConfigFiles],\n];\n\nconst lintSerially = async (mode: 'format' | 'lint', logger: Logger) => {\n const results: InternalLintResult[] = [];\n for (const lintGroup of lints) {\n for (const lint of lintGroup) {\n results.push(await lint(mode, logger));\n }\n }\n return results;\n};\n\nconst lintConcurrently = async (mode: 'format' | 'lint', logger: Logger) => {\n const results: InternalLintResult[] = [];\n\n for (const lintGroup of lints) {\n results.push(\n ...(await Promise.all(lintGroup.map((lint) => lint(mode, logger)))),\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 input?.debug ?? false,\n ...(mode === 'lint' ? [chalk.blueBright('skuba \u2502')] : []),\n );\n\n try {\n const lint = selectLintFunction(input);\n const results = await lint(mode, logger);\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,kBAAwB;AAExB,mBAAkB;AAElB,qBAA0C;AAE1C,iCAAuC;AACvC,+BAAkC;AAClC,gCAAsC;AACtC,qBAA6B;AAc7B,MAAM,QAIF;AAAA;AAAA,EAEF,CAAC,6BAAc,iDAAsB;AAAA,EACrC,CAAC,4CAAmB,+CAAqB;AAC3C;AAEA,MAAM,eAAe,OAAO,MAAyB,WAAmB;AACtE,QAAM,UAAgC,CA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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
6
  "names": ["chalk"]
7
7
  }
@@ -0,0 +1,4 @@
1
+ import type { Logger } from '../../../utils/logging';
2
+ import type { InternalLintResult } from '../internal';
3
+ export declare const detectBadCodeowners: () => Promise<InternalLintResult>;
4
+ export declare const tryDetectBadCodeowners: (_mode: "format" | "lint", logger: Logger) => Promise<InternalLintResult>;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var detectBadCodeowners_exports = {};
20
+ __export(detectBadCodeowners_exports, {
21
+ detectBadCodeowners: () => detectBadCodeowners,
22
+ tryDetectBadCodeowners: () => tryDetectBadCodeowners
23
+ });
24
+ module.exports = __toCommonJS(detectBadCodeowners_exports);
25
+ var import_util = require("util");
26
+ var import__ = require("../../..");
27
+ var import_project = require("../../configure/analysis/project");
28
+ const detectBadCodeowners = async () => {
29
+ const gitRoot = await import__.Git.findRoot({ dir: process.cwd() });
30
+ const reader = (0, import_project.createDestinationFileReader)(gitRoot ?? process.cwd());
31
+ const annotations = (await Promise.all(
32
+ [".github/CODEOWNERS", "CODEOWNERS", "docs/CODEOWNERS"].map(
33
+ async (filename) => {
34
+ const lines = (await reader(filename))?.split("\n");
35
+ if (lines?.some((line) => line.startsWith("- "))) {
36
+ return [
37
+ {
38
+ message: "CODEOWNERS file has a line starting with `- `. This is probably an autoformatting mistake, where your editor thinks this file is a markdown file and is trying to format a list item. Did you mean to use `*` instead?",
39
+ path: filename
40
+ }
41
+ ];
42
+ }
43
+ return [];
44
+ }
45
+ )
46
+ )).flat();
47
+ annotations.sort((a, b) => a.path.localeCompare(b.path));
48
+ return {
49
+ ok: annotations.length === 0,
50
+ fixable: false,
51
+ annotations
52
+ };
53
+ };
54
+ const tryDetectBadCodeowners = async (_mode, logger) => {
55
+ try {
56
+ return await detectBadCodeowners();
57
+ } catch (err) {
58
+ logger.warn("Failed to detect bad CODEOWNERS.");
59
+ logger.subtle((0, import_util.inspect)(err));
60
+ return {
61
+ ok: false,
62
+ fixable: false,
63
+ annotations: []
64
+ };
65
+ }
66
+ };
67
+ // Annotate the CommonJS export names for ESM import in node:
68
+ 0 && (module.exports = {
69
+ detectBadCodeowners,
70
+ tryDetectBadCodeowners
71
+ });
72
+ //# sourceMappingURL=detectBadCodeowners.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/cli/lint/internalLints/detectBadCodeowners.ts"],
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport { Git } from '../../..';\nimport type { Logger } from '../../../utils/logging';\nimport { createDestinationFileReader } from '../../configure/analysis/project';\nimport type { InternalLintResult } from '../internal';\n\nexport const detectBadCodeowners = async (): Promise<InternalLintResult> => {\n const gitRoot = await Git.findRoot({ dir: process.cwd() });\n const reader = createDestinationFileReader(gitRoot ?? process.cwd());\n\n const annotations = (\n await Promise.all(\n ['.github/CODEOWNERS', 'CODEOWNERS', 'docs/CODEOWNERS'].map(\n async (filename) => {\n const lines = (await reader(filename))?.split('\\n');\n\n if (lines?.some((line) => line.startsWith('- '))) {\n return [\n {\n message:\n 'CODEOWNERS file has a line starting with `- `. This is probably an autoformatting mistake, where your editor thinks this file is a markdown file and is trying to format a list item. Did you mean to use `*` instead?',\n path: filename,\n },\n ];\n }\n\n return [];\n },\n ),\n )\n ).flat();\n\n // TODO: Use `toSorted` once we drop support for Node 18.\n annotations.sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n ok: annotations.length === 0,\n fixable: false,\n annotations,\n };\n};\n\nexport const tryDetectBadCodeowners = async (\n _mode: 'format' | 'lint',\n logger: Logger,\n): Promise<InternalLintResult> => {\n try {\n return await detectBadCodeowners();\n } catch (err) {\n logger.warn('Failed to detect bad CODEOWNERS.');\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,kBAAwB;AAExB,eAAoB;AAEpB,qBAA4C;AAGrC,MAAM,sBAAsB,YAAyC;AAC1E,QAAM,UAAU,MAAM,aAAI,SAAS,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC;AACzD,QAAM,aAAS,4CAA4B,WAAW,QAAQ,IAAI,CAAC;AAEnE,QAAM,eACJ,MAAM,QAAQ;AAAA,IACZ,CAAC,sBAAsB,cAAc,iBAAiB,EAAE;AAAA,MACtD,OAAO,aAAa;AAClB,cAAM,SAAS,MAAM,OAAO,QAAQ,IAAI,MAAM,IAAI;AAElD,YAAI,OAAO,KAAK,CAAC,SAAS,KAAK,WAAW,IAAI,CAAC,GAAG;AAChD,iBAAO;AAAA,YACL;AAAA,cACE,SACE;AAAA,cACF,MAAM;AAAA,YACR;AAAA,UACF;AAAA,QACF;AAEA,eAAO,CAAC;AAAA,MACV;AAAA,IACF;AAAA,EACF,GACA,KAAK;AAGP,cAAY,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;AAEvD,SAAO;AAAA,IACL,IAAI,YAAY,WAAW;AAAA,IAC3B,SAAS;AAAA,IACT;AAAA,EACF;AACF;AAEO,MAAM,yBAAyB,OACpC,OACA,WACgC;AAChC,MAAI;AACF,WAAO,MAAM,oBAAoB;AAAA,EACnC,SAAS,KAAK;AACZ,WAAO,KAAK,kCAAkC;AAC9C,WAAO,WAAO,qBAAQ,GAAG,CAAC;AAE1B,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,aAAa,CAAC;AAAA,IAChB;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import type { Patches } from '../..';
2
+ export declare const patches: Patches;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var __exports = {};
20
+ __export(__exports, {
21
+ patches: () => patches
22
+ });
23
+ module.exports = __toCommonJS(__exports);
24
+ var import_upgradeNode = require("./upgradeNode");
25
+ const patches = [
26
+ {
27
+ apply: import_upgradeNode.tryUpgradeNode,
28
+ description: "Upgrade Node.js to version 22"
29
+ }
30
+ ];
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ patches
34
+ });
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/9.1.0/index.ts"],
4
+ "sourcesContent": ["import type { Patches } from '../..';\n\nimport { tryUpgradeNode } from './upgradeNode';\n\nexport const patches: Patches = [\n {\n apply: tryUpgradeNode,\n description: 'Upgrade Node.js to version 22',\n },\n];\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA+B;AAExB,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import type { PatchFunction } from '../..';
2
+ export declare const tryUpgradeNode: PatchFunction;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var upgradeNode_exports = {};
20
+ __export(upgradeNode_exports, {
21
+ tryUpgradeNode: () => tryUpgradeNode
22
+ });
23
+ module.exports = __toCommonJS(upgradeNode_exports);
24
+ var import_util = require("util");
25
+ var import_logging = require("../../../../../../utils/logging");
26
+ var import_nodeVersion = require("../../../../../migrate/nodeVersion");
27
+ const upgradeNode = async ({
28
+ mode
29
+ }) => {
30
+ if (process.env.SKIP_NODE_UPGRADE) {
31
+ return {
32
+ result: "skip",
33
+ reason: "SKIP_NODE_UPGRADE environment variable set"
34
+ };
35
+ }
36
+ if (mode === "lint") {
37
+ return { result: "apply" };
38
+ }
39
+ await (0, import_nodeVersion.nodeVersionMigration)({
40
+ nodeVersion: 22,
41
+ ECMAScriptVersion: "ES2024",
42
+ defaultNodeTypesVersion: "22.9.0"
43
+ });
44
+ return { result: "apply" };
45
+ };
46
+ const tryUpgradeNode = async (config) => {
47
+ try {
48
+ return await upgradeNode(config);
49
+ } catch (err) {
50
+ import_logging.log.warn("Failed to upgrade node version");
51
+ import_logging.log.subtle((0, import_util.inspect)(err));
52
+ return { result: "skip", reason: "due to an error" };
53
+ }
54
+ };
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ tryUpgradeNode
58
+ });
59
+ //# sourceMappingURL=upgradeNode.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.ts"],
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport type { PatchFunction, PatchReturnType } from '../..';\nimport { log } from '../../../../../../utils/logging';\nimport { nodeVersionMigration } from '../../../../../migrate/nodeVersion';\n\nconst upgradeNode: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n if (process.env.SKIP_NODE_UPGRADE) {\n return {\n result: 'skip',\n reason: 'SKIP_NODE_UPGRADE environment variable set',\n };\n }\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n await nodeVersionMigration({\n nodeVersion: 22,\n ECMAScriptVersion: 'ES2024',\n defaultNodeTypesVersion: '22.9.0',\n });\n\n return { result: 'apply' };\n};\n\nexport const tryUpgradeNode: PatchFunction = async (config) => {\n try {\n return await upgradeNode(config);\n } catch (err) {\n log.warn('Failed to upgrade node version');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAGxB,qBAAoB;AACpB,yBAAqC;AAErC,MAAM,cAA6B,OAAO;AAAA,EACxC;AACF,MAAgC;AAC9B,MAAI,QAAQ,IAAI,mBAAmB;AACjC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AACA,MAAI,SAAS,QAAQ;AACnB,WAAO,EAAE,QAAQ,QAAQ;AAAA,EAC3B;AAEA,YAAM,yCAAqB;AAAA,IACzB,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB,yBAAyB;AAAA,EAC3B,CAAC;AAED,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,iBAAgC,OAAO,WAAW;AAC7D,MAAI;AACF,WAAO,MAAM,YAAY,MAAM;AAAA,EACjC,SAAS,KAAK;AACZ,uBAAI,KAAK,gCAAgC;AACzC,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
6
+ "names": []
7
+ }
@@ -24,7 +24,16 @@ module.exports = __toCommonJS(migrate_exports);
24
24
  var import_logging = require("../../utils/logging");
25
25
  var import_nodeVersion = require("./nodeVersion");
26
26
  const migrations = {
27
- node20: () => (0, import_nodeVersion.nodeVersionMigration)(20)
27
+ node20: () => (0, import_nodeVersion.nodeVersionMigration)({
28
+ nodeVersion: 20,
29
+ ECMAScriptVersion: "ES2023",
30
+ defaultNodeTypesVersion: "20.14.8"
31
+ }),
32
+ node22: () => (0, import_nodeVersion.nodeVersionMigration)({
33
+ nodeVersion: 22,
34
+ ECMAScriptVersion: "ES2024",
35
+ defaultNodeTypesVersion: "22.9.0"
36
+ })
28
37
  };
29
38
  const logAvailableMigrations = () => {
30
39
  import_logging.log.ok("Available migrations:");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/migrate/index.ts"],
4
- "sourcesContent": ["import { log } from '../../utils/logging';\n\nimport { nodeVersionMigration } from './nodeVersion';\n\nconst migrations: Record<string, () => Promise<void>> = {\n node20: () => nodeVersionMigration(20),\n};\n\nconst logAvailableMigrations = () => {\n log.ok('Available migrations:');\n Object.keys(migrations).forEach((migration) => {\n log.ok(`- ${migration}`);\n });\n};\n\nexport const migrate = async (args = process.argv.slice(2)) => {\n if (!args[0]) {\n log.err('Provide a migration to run.');\n logAvailableMigrations();\n process.exitCode = 1;\n return;\n }\n\n if (args.includes('--help') || args.includes('-h') || args[0] === 'help') {\n logAvailableMigrations();\n return;\n }\n\n const migration = migrations[args[0]];\n\n if (!migration) {\n log.err(`Migration \"${args[0]}\" is not a valid option.`);\n logAvailableMigrations();\n process.exitCode = 1;\n return;\n }\n\n await migration();\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AAEpB,yBAAqC;AAErC,MAAM,aAAkD;AAAA,EACtD,QAAQ,UAAM,yCAAqB,EAAE;AACvC;AAEA,MAAM,yBAAyB,MAAM;AACnC,qBAAI,GAAG,uBAAuB;AAC9B,SAAO,KAAK,UAAU,EAAE,QAAQ,CAAC,cAAc;AAC7C,uBAAI,GAAG,KAAK,SAAS,EAAE;AAAA,EACzB,CAAC;AACH;AAEO,MAAM,UAAU,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAC7D,MAAI,CAAC,KAAK,CAAC,GAAG;AACZ,uBAAI,IAAI,6BAA6B;AACrC,2BAAuB;AACvB,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,MAAI,KAAK,SAAS,QAAQ,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,CAAC,MAAM,QAAQ;AACxE,2BAAuB;AACvB;AAAA,EACF;AAEA,QAAM,YAAY,WAAW,KAAK,CAAC,CAAC;AAEpC,MAAI,CAAC,WAAW;AACd,uBAAI,IAAI,cAAc,KAAK,CAAC,CAAC,0BAA0B;AACvD,2BAAuB;AACvB,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,QAAM,UAAU;AAClB;",
4
+ "sourcesContent": ["import { log } from '../../utils/logging';\n\nimport { nodeVersionMigration } from './nodeVersion';\n\nconst migrations: Record<string, () => Promise<void>> = {\n node20: () =>\n nodeVersionMigration({\n nodeVersion: 20,\n ECMAScriptVersion: 'ES2023',\n defaultNodeTypesVersion: '20.14.8',\n }),\n node22: () =>\n nodeVersionMigration({\n nodeVersion: 22,\n ECMAScriptVersion: 'ES2024',\n defaultNodeTypesVersion: '22.9.0',\n }),\n};\n\nconst logAvailableMigrations = () => {\n log.ok('Available migrations:');\n Object.keys(migrations).forEach((migration) => {\n log.ok(`- ${migration}`);\n });\n};\n\nexport const migrate = async (args = process.argv.slice(2)) => {\n if (!args[0]) {\n log.err('Provide a migration to run.');\n logAvailableMigrations();\n process.exitCode = 1;\n return;\n }\n\n if (args.includes('--help') || args.includes('-h') || args[0] === 'help') {\n logAvailableMigrations();\n return;\n }\n\n const migration = migrations[args[0]];\n\n if (!migration) {\n log.err(`Migration \"${args[0]}\" is not a valid option.`);\n logAvailableMigrations();\n process.exitCode = 1;\n return;\n }\n\n await migration();\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AAEpB,yBAAqC;AAErC,MAAM,aAAkD;AAAA,EACtD,QAAQ,UACN,yCAAqB;AAAA,IACnB,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB,yBAAyB;AAAA,EAC3B,CAAC;AAAA,EACH,QAAQ,UACN,yCAAqB;AAAA,IACnB,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB,yBAAyB;AAAA,EAC3B,CAAC;AACL;AAEA,MAAM,yBAAyB,MAAM;AACnC,qBAAI,GAAG,uBAAuB;AAC9B,SAAO,KAAK,UAAU,EAAE,QAAQ,CAAC,cAAc;AAC7C,uBAAI,GAAG,KAAK,SAAS,EAAE;AAAA,EACzB,CAAC;AACH;AAEO,MAAM,UAAU,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAC7D,MAAI,CAAC,KAAK,CAAC,GAAG;AACZ,uBAAI,IAAI,6BAA6B;AACrC,2BAAuB;AACvB,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,MAAI,KAAK,SAAS,QAAQ,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,CAAC,MAAM,QAAQ;AACxE,2BAAuB;AACvB;AAAA,EACF;AAEA,QAAM,YAAY,WAAW,KAAK,CAAC,CAAC;AAEpC,MAAI,CAAC,WAAW;AACd,uBAAI,IAAI,cAAc,KAAK,CAAC,CAAC,0BAA0B;AACvD,2BAAuB;AACvB,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,QAAM,UAAU;AAClB;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,14 @@
1
+ import { type ZodRawShape, z } from 'zod';
2
+ export declare const extractFromParentPackageJson: <T extends ZodRawShape>(schema: z.ZodObject<T>) => Promise<{
3
+ packageJson: undefined;
4
+ packageJsonRelativePath: undefined;
5
+ } | {
6
+ packageJson: undefined;
7
+ packageJsonRelativePath: string;
8
+ } | {
9
+ packageJson: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any>[k]; } : never;
10
+ packageJsonRelativePath: string;
11
+ }>;
12
+ export declare const isPatchableServerlessVersion: () => Promise<boolean>;
13
+ export declare const isPatchableSkubaType: () => Promise<boolean>;
14
+ export declare const isPatchableNodeVersion: (targetNodeVersion: number) => Promise<boolean>;
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var checks_exports = {};
30
+ __export(checks_exports, {
31
+ extractFromParentPackageJson: () => extractFromParentPackageJson,
32
+ isPatchableNodeVersion: () => isPatchableNodeVersion,
33
+ isPatchableServerlessVersion: () => isPatchableServerlessVersion,
34
+ isPatchableSkubaType: () => isPatchableSkubaType
35
+ });
36
+ module.exports = __toCommonJS(checks_exports);
37
+ var import_find_up = __toESM(require("find-up"));
38
+ var import_fs_extra = __toESM(require("fs-extra"));
39
+ var import_semver = require("semver");
40
+ var import_zod = require("zod");
41
+ var import_logging = require("../../../utils/logging");
42
+ const getParentFile = async (file) => {
43
+ const path = await (0, import_find_up.default)(file, { cwd: process.cwd() });
44
+ if (!path) {
45
+ return void 0;
46
+ }
47
+ return {
48
+ fileContent: await import_fs_extra.default.readFile(path, "utf-8"),
49
+ path
50
+ };
51
+ };
52
+ const extractFromParentPackageJson = async (schema) => {
53
+ const file = await getParentFile("package.json");
54
+ if (!file) {
55
+ return { packageJson: void 0, packageJsonRelativePath: void 0 };
56
+ }
57
+ const { fileContent: packageJson, path } = file;
58
+ let rawJSON;
59
+ try {
60
+ rawJSON = JSON.parse(packageJson);
61
+ } catch {
62
+ throw new Error(`${path} is not valid JSON`);
63
+ }
64
+ const result = schema.safeParse(rawJSON);
65
+ if (!result.success) {
66
+ return { packageJson: void 0, packageJsonRelativePath: path };
67
+ }
68
+ return { packageJson: result.data, packageJsonRelativePath: path };
69
+ };
70
+ const isPatchableServerlessVersion = async () => {
71
+ const { packageJson, packageJsonRelativePath } = await extractFromParentPackageJson(
72
+ import_zod.z.object({
73
+ devDependencies: import_zod.z.object({
74
+ serverless: import_zod.z.string().optional()
75
+ })
76
+ })
77
+ );
78
+ if (!packageJson) {
79
+ throw new Error(
80
+ "package.json not found, ensure it is in the correct location"
81
+ );
82
+ }
83
+ const serverlessVersion = packageJson?.devDependencies.serverless;
84
+ if (!serverlessVersion) {
85
+ import_logging.log.subtle(
86
+ `Serverless version not found in ${packageJsonRelativePath}, assuming it is not a dependency`
87
+ );
88
+ return true;
89
+ }
90
+ if (!(0, import_semver.satisfies)(serverlessVersion, "4.x.x")) {
91
+ import_logging.log.warn(
92
+ `Serverless version ${serverlessVersion} cannot be migrated; use Serverless 4.x to automatically migrate Serverless files`
93
+ );
94
+ return false;
95
+ }
96
+ import_logging.log.ok(
97
+ `Proceeding with migration of Serverless version ${serverlessVersion}`
98
+ );
99
+ return true;
100
+ };
101
+ const isPatchableSkubaType = async () => {
102
+ const { packageJson, packageJsonRelativePath } = await extractFromParentPackageJson(
103
+ import_zod.z.object({
104
+ skuba: import_zod.z.object({
105
+ type: import_zod.z.string().optional()
106
+ })
107
+ })
108
+ );
109
+ if (!packageJson) {
110
+ throw new Error(
111
+ "package.json not found, ensure it is in the correct location"
112
+ );
113
+ }
114
+ const type = packageJson?.skuba.type;
115
+ if (!type) {
116
+ import_logging.log.warn(
117
+ `skuba project type not found in ${packageJsonRelativePath}; add a package.json#/skuba/type to ensure the correct migration can be applied`
118
+ );
119
+ return false;
120
+ }
121
+ if (type === "package") {
122
+ import_logging.log.warn(
123
+ "Migrations are not supported for packages; update manually to ensure major runtime deprecations are intended"
124
+ );
125
+ return false;
126
+ }
127
+ import_logging.log.ok(`Proceeding with migration of skuba project type ${type}`);
128
+ return true;
129
+ };
130
+ const isPatchableNodeVersion = async (targetNodeVersion) => {
131
+ const nvmrcFile = await getParentFile(".nvmrc");
132
+ const nodeVersionFile = await getParentFile(".node-version");
133
+ const { packageJson } = await extractFromParentPackageJson(
134
+ import_zod.z.object({
135
+ engines: import_zod.z.object({
136
+ node: import_zod.z.string()
137
+ })
138
+ })
139
+ );
140
+ const nvmrcNodeVersion = nvmrcFile?.fileContent;
141
+ const nodeVersion = nodeVersionFile?.fileContent;
142
+ const engineVersion = packageJson?.engines.node;
143
+ const currentNodeVersion = nvmrcNodeVersion || nodeVersion || engineVersion;
144
+ const coercedTargetVersion = (0, import_semver.coerce)(targetNodeVersion.toString())?.version;
145
+ const coercedCurrentVersion = (0, import_semver.coerce)(currentNodeVersion)?.version;
146
+ const isNodeVersionValid = coercedTargetVersion && coercedCurrentVersion && (0, import_semver.lte)(coercedCurrentVersion, coercedTargetVersion);
147
+ if (!isNodeVersionValid) {
148
+ import_logging.log.warn(
149
+ `Node.js version ${coercedCurrentVersion ?? "unknown"} cannot be migrated to ${coercedTargetVersion}`
150
+ );
151
+ return false;
152
+ }
153
+ import_logging.log.ok(
154
+ `Proceeding with migration from Node.js ${coercedCurrentVersion} to ${coercedTargetVersion}`
155
+ );
156
+ return true;
157
+ };
158
+ // Annotate the CommonJS export names for ESM import in node:
159
+ 0 && (module.exports = {
160
+ extractFromParentPackageJson,
161
+ isPatchableNodeVersion,
162
+ isPatchableServerlessVersion,
163
+ isPatchableSkubaType
164
+ });
165
+ //# sourceMappingURL=checks.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/cli/migrate/nodeVersion/checks.ts"],
4
+ "sourcesContent": ["import findUp from 'find-up';\nimport fs from 'fs-extra';\nimport { coerce, lte, satisfies } from 'semver';\nimport { type ZodRawShape, z } from 'zod';\n\nimport { log } from '../../../utils/logging';\n\nconst getParentFile = async (file: string) => {\n const path = await findUp(file, { cwd: process.cwd() });\n if (!path) {\n return undefined;\n }\n return {\n fileContent: await fs.readFile(path, 'utf-8'),\n path,\n };\n};\n\nexport const extractFromParentPackageJson = async <T extends ZodRawShape>(\n schema: z.ZodObject<T>,\n) => {\n const file = await getParentFile('package.json');\n if (!file) {\n return { packageJson: undefined, packageJsonRelativePath: undefined };\n }\n const { fileContent: packageJson, path } = file;\n let rawJSON;\n try {\n rawJSON = JSON.parse(packageJson) as unknown;\n } catch {\n throw new Error(`${path} is not valid JSON`);\n }\n const result = schema.safeParse(rawJSON);\n if (!result.success) {\n return { packageJson: undefined, packageJsonRelativePath: path };\n }\n\n return { packageJson: result.data, packageJsonRelativePath: path };\n};\n\nexport const isPatchableServerlessVersion = async (): Promise<boolean> => {\n const { packageJson, packageJsonRelativePath } =\n await extractFromParentPackageJson(\n z.object({\n devDependencies: z.object({\n serverless: z.string().optional(),\n }),\n }),\n );\n if (!packageJson) {\n throw new Error(\n 'package.json not found, ensure it is in the correct location',\n );\n }\n\n const serverlessVersion = packageJson?.devDependencies.serverless;\n\n if (!serverlessVersion) {\n log.subtle(\n `Serverless version not found in ${packageJsonRelativePath}, assuming it is not a dependency`,\n );\n return true;\n }\n\n if (!satisfies(serverlessVersion, '4.x.x')) {\n log.warn(\n `Serverless version ${serverlessVersion} cannot be migrated; use Serverless 4.x to automatically migrate Serverless files`,\n );\n return false;\n }\n\n log.ok(\n `Proceeding with migration of Serverless version ${serverlessVersion}`,\n );\n return true;\n};\n\nexport const isPatchableSkubaType = async (): Promise<boolean> => {\n const { packageJson, packageJsonRelativePath } =\n await extractFromParentPackageJson(\n z.object({\n skuba: z.object({\n type: z.string().optional(),\n }),\n }),\n );\n\n if (!packageJson) {\n throw new Error(\n 'package.json not found, ensure it is in the correct location',\n );\n }\n\n const type = packageJson?.skuba.type;\n\n if (!type) {\n log.warn(\n `skuba project type not found in ${packageJsonRelativePath}; add a package.json#/skuba/type to ensure the correct migration can be applied`,\n );\n return false;\n }\n if (type === 'package') {\n log.warn(\n 'Migrations are not supported for packages; update manually to ensure major runtime deprecations are intended',\n );\n return false;\n }\n\n log.ok(`Proceeding with migration of skuba project type ${type}`);\n return true;\n};\n\nexport const isPatchableNodeVersion = async (\n targetNodeVersion: number,\n): Promise<boolean> => {\n const nvmrcFile = await getParentFile('.nvmrc');\n const nodeVersionFile = await getParentFile('.node-version');\n const { packageJson } = await extractFromParentPackageJson(\n z.object({\n engines: z.object({\n node: z.string(),\n }),\n }),\n );\n\n const nvmrcNodeVersion = nvmrcFile?.fileContent;\n const nodeVersion = nodeVersionFile?.fileContent;\n const engineVersion = packageJson?.engines.node;\n\n const currentNodeVersion = nvmrcNodeVersion || nodeVersion || engineVersion;\n\n const coercedTargetVersion = coerce(targetNodeVersion.toString())?.version;\n const coercedCurrentVersion = coerce(currentNodeVersion)?.version;\n\n const isNodeVersionValid =\n coercedTargetVersion &&\n coercedCurrentVersion &&\n lte(coercedCurrentVersion, coercedTargetVersion);\n\n if (!isNodeVersionValid) {\n log.warn(\n `Node.js version ${coercedCurrentVersion ?? 'unknown'} cannot be migrated to ${coercedTargetVersion}`,\n );\n return false;\n }\n\n log.ok(\n `Proceeding with migration from Node.js ${coercedCurrentVersion} to ${coercedTargetVersion}`,\n );\n return true;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAmB;AACnB,sBAAe;AACf,oBAAuC;AACvC,iBAAoC;AAEpC,qBAAoB;AAEpB,MAAM,gBAAgB,OAAO,SAAiB;AAC5C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AoB;AACvB,uBAAI;AAAA,MACF,mBAAmB,yBAAyB,SAAS,0BAA0B,oBAAoB;AAAA,IACrG;AACA,WAAO;AAAA,EACT;AAEA,qBAAI;AAAA,IACF,0CAA0C,qBAAqB,OAAO,oBAAoB;AAAA,EAC5F;AACA,SAAO;AACT;",
6
+ "names": ["findUp", "fs"]
7
+ }
@@ -0,0 +1,6 @@
1
+ type VersionResult = {
2
+ version: string;
3
+ err?: string;
4
+ };
5
+ export declare const getNodeTypesVersion: (major: number, defaultVersion: string) => Promise<VersionResult>;
6
+ export {};