skuba 14.0.0-migrate-to-inquirer-20251031060542 → 14.0.0-node-24-20251204234639

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 (109) hide show
  1. package/lib/cli/adapter/eslint.js +3 -3
  2. package/lib/cli/adapter/eslint.js.map +3 -3
  3. package/lib/cli/build/assets.d.ts +3 -2
  4. package/lib/cli/build/assets.js +2 -2
  5. package/lib/cli/build/assets.js.map +3 -3
  6. package/lib/cli/build/index.js +3 -13
  7. package/lib/cli/build/index.js.map +3 -3
  8. package/lib/cli/build/tsc.js +1 -2
  9. package/lib/cli/build/tsc.js.map +2 -2
  10. package/lib/cli/configure/analysis/diff.js +3 -13
  11. package/lib/cli/configure/analysis/diff.js.map +3 -3
  12. package/lib/cli/configure/ensureTemplateCompletion.js +5 -2
  13. package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
  14. package/lib/cli/configure/getEntryPoint.js +3 -3
  15. package/lib/cli/configure/getEntryPoint.js.map +3 -3
  16. package/lib/cli/configure/index.js +3 -3
  17. package/lib/cli/configure/index.js.map +2 -2
  18. package/lib/cli/format/index.js +4 -14
  19. package/lib/cli/format/index.js.map +3 -3
  20. package/lib/cli/init/getConfig.js +8 -10
  21. package/lib/cli/init/getConfig.js.map +3 -3
  22. package/lib/cli/init/prompts.d.ts +4 -4
  23. package/lib/cli/init/prompts.js +8 -8
  24. package/lib/cli/init/prompts.js.map +2 -2
  25. package/lib/cli/lint/eslint.js +2 -2
  26. package/lib/cli/lint/eslint.js.map +3 -3
  27. package/lib/cli/lint/index.js +1 -3
  28. package/lib/cli/lint/index.js.map +2 -2
  29. package/lib/cli/lint/internal.js +6 -14
  30. package/lib/cli/lint/internal.js.map +3 -3
  31. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +1 -3
  32. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +2 -2
  33. package/lib/cli/lint/internalLints/refreshConfigFiles.js +1 -3
  34. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +2 -2
  35. package/lib/cli/lint/internalLints/upgrade/index.js +1 -3
  36. package/lib/cli/lint/internalLints/upgrade/index.js.map +2 -2
  37. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +14 -11
  38. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +2 -2
  39. package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/index.js +1 -1
  40. package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/index.js.map +3 -3
  41. package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/upgradeNode.js +2 -5
  42. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js.map +7 -0
  43. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +0 -5
  44. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +2 -2
  45. package/lib/cli/lint/prettier.js +2 -2
  46. package/lib/cli/lint/prettier.js.map +3 -3
  47. package/lib/cli/migrate/index.d.ts +5 -0
  48. package/lib/cli/migrate/index.js +38 -6
  49. package/lib/cli/migrate/index.js.map +2 -2
  50. package/lib/cli/migrate/nodeVersion/checks.d.ts +1 -14
  51. package/lib/cli/migrate/nodeVersion/checks.js +24 -133
  52. package/lib/cli/migrate/nodeVersion/checks.js.map +3 -3
  53. package/lib/cli/migrate/nodeVersion/index.d.ts +8 -2
  54. package/lib/cli/migrate/nodeVersion/index.js +193 -49
  55. package/lib/cli/migrate/nodeVersion/index.js.map +2 -2
  56. package/lib/cli/migrate/nodeVersion/upgrade.d.ts +8 -0
  57. package/lib/cli/migrate/nodeVersion/upgrade.js +144 -0
  58. package/lib/cli/migrate/nodeVersion/upgrade.js.map +7 -0
  59. package/lib/utils/exec.d.ts +3 -2
  60. package/lib/utils/exec.js +1 -1
  61. package/lib/utils/exec.js.map +2 -2
  62. package/lib/utils/fs.js +1 -1
  63. package/lib/utils/fs.js.map +2 -2
  64. package/lib/utils/logging.d.ts +9 -10
  65. package/lib/utils/logging.js +9 -19
  66. package/lib/utils/logging.js.map +3 -3
  67. package/lib/utils/logo.js +11 -18
  68. package/lib/utils/logo.js.map +3 -3
  69. package/lib/utils/worker.d.ts +3 -3
  70. package/lib/wrapper/http.d.ts +0 -6
  71. package/lib/wrapper/http.js +4 -12
  72. package/lib/wrapper/http.js.map +2 -2
  73. package/lib/wrapper/requestListener.js +3 -2
  74. package/lib/wrapper/requestListener.js.map +2 -2
  75. package/lib/wrapper/server.d.ts +7 -0
  76. package/lib/wrapper/server.js +35 -0
  77. package/lib/wrapper/server.js.map +7 -0
  78. package/package.json +16 -26
  79. package/template/base/_pnpm-workspace.yaml +2 -0
  80. package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
  81. package/template/express-rest-api/.nvmrc +1 -1
  82. package/template/express-rest-api/package.json +6 -6
  83. package/template/greeter/.buildkite/pipeline.yml +1 -1
  84. package/template/greeter/.nvmrc +1 -1
  85. package/template/greeter/package.json +4 -4
  86. package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
  87. package/template/koa-rest-api/.nvmrc +1 -1
  88. package/template/koa-rest-api/package.json +6 -6
  89. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
  90. package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
  91. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +2 -4
  92. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
  93. package/template/lambda-sqs-worker-cdk/infra/config.ts +2 -4
  94. package/template/lambda-sqs-worker-cdk/package.json +5 -4
  95. package/template/lambda-sqs-worker-cdk/skuba.template.js +12 -0
  96. package/template/oss-npm-package/.github/workflows/release.yml +1 -1
  97. package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
  98. package/template/oss-npm-package/.nvmrc +1 -1
  99. package/template/private-npm-package/.nvmrc +1 -1
  100. package/template/private-npm-package/_package.json +1 -1
  101. package/template/private-npm-package/skuba.template.js +1 -1
  102. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.d.ts +0 -2
  103. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js +0 -144
  104. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js.map +0 -7
  105. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +0 -7
  106. package/lib/eslint.d.js +0 -2
  107. package/lib/eslint.d.js.map +0 -7
  108. /package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/index.d.ts +0 -0
  109. /package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/upgradeNode.d.ts +0 -0
@@ -41,7 +41,7 @@ var import_npmrc = require("../../../../../../utils/npmrc.js");
41
41
  var import_configFile = require("../../../../../configure/processing/configFile.js");
42
42
  const NPMRC = ".npmrc";
43
43
  const migrateCustomNpmrcSettings = async () => {
44
- const contents = await import_fs_extra.default.readFile(NPMRC, "utf-8");
44
+ const contents = await import_fs_extra.default.promises.readFile(NPMRC, "utf-8");
45
45
  const remainderLines = (0, import_configFile.replaceManagedSection)(contents, "").split("\n").map((line) => line.trim()).filter((line) => line.length > 0).filter((line) => !line.startsWith("#")).filter((line) => !(0, import_npmrc.hasNpmrcSecret)(line));
46
46
  if (remainderLines.length === 0) {
47
47
  return;
@@ -49,9 +49,12 @@ const migrateCustomNpmrcSettings = async () => {
49
49
  const pnpmWorkspaceFile = "pnpm-workspace.yaml";
50
50
  const pnpmWorkspaceExists = await (0, import_fs.pathExists)(pnpmWorkspaceFile);
51
51
  if (!pnpmWorkspaceExists) {
52
- await import_fs_extra.default.writeFile(pnpmWorkspaceFile, "");
52
+ await import_fs_extra.default.promises.writeFile(pnpmWorkspaceFile, "");
53
53
  }
54
- const pnpmWorkspaceContents = await import_fs_extra.default.readFile(pnpmWorkspaceFile, "utf-8");
54
+ const pnpmWorkspaceContents = await import_fs_extra.default.promises.readFile(
55
+ pnpmWorkspaceFile,
56
+ "utf-8"
57
+ );
55
58
  const commentedLines = remainderLines.map((line) => `# ${line}`).join("\n");
56
59
  const newContents = `# TODO: Translate these settings to the required format for pnpm-workspace.yaml.
57
60
  # skuba moved these from .npmrc, but doesn't know what they mean.
@@ -60,19 +63,19 @@ const migrateCustomNpmrcSettings = async () => {
60
63
  ${commentedLines}
61
64
 
62
65
  ${pnpmWorkspaceContents}`;
63
- await import_fs_extra.default.writeFile(pnpmWorkspaceFile, newContents);
66
+ await import_fs_extra.default.promises.writeFile(pnpmWorkspaceFile, newContents);
64
67
  };
65
68
  const fixDockerfiles = async () => {
66
69
  const fileNames = await (0, import_fast_glob.glob)(["**/Dockerfile*"]);
67
70
  await Promise.all(
68
71
  fileNames.map(async (fileName) => {
69
- const contents = await import_fs_extra.default.readFile(fileName, "utf8");
72
+ const contents = await import_fs_extra.default.promises.readFile(fileName, "utf8");
70
73
  const patched = contents.replaceAll(
71
74
  "--mount=type=bind,source=.npmrc,target=.npmrc",
72
75
  "--mount=type=bind,source=pnpm-workspace.yaml,target=pnpm-workspace.yaml"
73
76
  );
74
77
  if (patched !== contents) {
75
- await import_fs_extra.default.writeFile(fileName, patched);
78
+ await import_fs_extra.default.promises.writeFile(fileName, patched);
76
79
  }
77
80
  })
78
81
  );
@@ -81,13 +84,13 @@ const fixBuildkitePipelines = async () => {
81
84
  const fileNames = await (0, import_fast_glob.glob)(["**/.buildkite/**.{yml,yaml}"]);
82
85
  await Promise.all(
83
86
  fileNames.map(async (fileName) => {
84
- const contents = await import_fs_extra.default.readFile(fileName, "utf8");
87
+ const contents = await import_fs_extra.default.promises.readFile(fileName, "utf8");
85
88
  const patched = contents.replace(
86
89
  /(cache-on:[\s\S]*?)([ \t]+-[ \t]+\.npmrc)([\s\S]*?)(?=\n[ \t]*\S|$)/g,
87
90
  (_, before, npmrcLine, after) => before + npmrcLine.replace(".npmrc", "pnpm-workspace.yaml") + after
88
91
  );
89
92
  if (patched !== contents) {
90
- await import_fs_extra.default.writeFile(fileName, patched);
93
+ await import_fs_extra.default.promises.writeFile(fileName, patched);
91
94
  }
92
95
  })
93
96
  );
@@ -96,7 +99,7 @@ const forceUpgradeToPnpm10 = async () => {
96
99
  const fileNames = await (0, import_fast_glob.glob)(["**/package.json"]);
97
100
  await Promise.all(
98
101
  fileNames.map(async (fileName) => {
99
- const contents = await import_fs_extra.default.readFile(fileName, "utf8");
102
+ const contents = await import_fs_extra.default.promises.readFile(fileName, "utf8");
100
103
  const packageManagerMatch = /"packageManager"\s*:\s*"pnpm@([^"]+)"/.exec(
101
104
  contents
102
105
  );
@@ -110,7 +113,7 @@ const forceUpgradeToPnpm10 = async () => {
110
113
  /"packageManager"(\s*):(\s*)"pnpm@[^"]+"/,
111
114
  '"packageManager"$1:$2"pnpm@10.8.1"'
112
115
  );
113
- await import_fs_extra.default.writeFile(fileName, patched);
116
+ await import_fs_extra.default.promises.writeFile(fileName, patched);
114
117
  }
115
118
  })
116
119
  );
@@ -153,7 +156,7 @@ const migrateNpmrcToPnpmWorkspace = async ({
153
156
  fixBuildkitePipelines(),
154
157
  forceUpgradeToPnpm10()
155
158
  ]);
156
- await import_fs_extra.default.rm(NPMRC);
159
+ await import_fs_extra.default.promises.rm(NPMRC);
157
160
  return { result: "apply" };
158
161
  };
159
162
  const tryMigrateNpmrcToPnpmWorkspace = async (config) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.ts"],
4
- "sourcesContent": ["import { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport {\n findCurrentWorkspaceProjectRoot,\n findWorkspaceRoot,\n} from '../../../../../../utils/dir.js';\nimport { pathExists } from '../../../../../../utils/fs.js';\nimport { log } from '../../../../../../utils/logging.js';\nimport { hasNpmrcSecret } from '../../../../../../utils/npmrc.js';\nimport { replaceManagedSection } from '../../../../../configure/processing/configFile.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst NPMRC = '.npmrc';\n\nconst migrateCustomNpmrcSettings = async () => {\n const contents = await fs.readFile(NPMRC, 'utf-8');\n\n const remainderLines = replaceManagedSection(contents, '')\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line.length > 0)\n .filter((line) => !line.startsWith('#'))\n .filter((line) => !hasNpmrcSecret(line));\n\n if (remainderLines.length === 0) {\n return;\n }\n\n const pnpmWorkspaceFile = 'pnpm-workspace.yaml';\n const pnpmWorkspaceExists = await pathExists(pnpmWorkspaceFile);\n if (!pnpmWorkspaceExists) {\n await fs.writeFile(pnpmWorkspaceFile, '');\n }\n\n // prepend the lines to the pnpm-workspace.yaml file, but commented out\n const pnpmWorkspaceContents = await fs.readFile(pnpmWorkspaceFile, 'utf-8');\n const commentedLines = remainderLines.map((line) => `# ${line}`).join('\\n');\n const newContents = `# TODO: Translate these settings to the required format for pnpm-workspace.yaml.\n# skuba moved these from .npmrc, but doesn't know what they mean.\n# See: https://pnpm.io/settings\n#\n${commentedLines}\n\n${pnpmWorkspaceContents}`;\n\n await fs.writeFile(pnpmWorkspaceFile, newContents);\n};\n\nconst fixDockerfiles = async () => {\n const fileNames = await glob(['**/Dockerfile*']);\n\n await Promise.all(\n fileNames.map(async (fileName) => {\n const contents = await fs.readFile(fileName, 'utf8');\n const patched = contents.replaceAll(\n '--mount=type=bind,source=.npmrc,target=.npmrc',\n '--mount=type=bind,source=pnpm-workspace.yaml,target=pnpm-workspace.yaml',\n );\n\n if (patched !== contents) {\n await fs.writeFile(fileName, patched);\n }\n }),\n );\n};\n\nconst fixBuildkitePipelines = async () => {\n const fileNames = await glob(['**/.buildkite/**.{yml,yaml}']);\n\n await Promise.all(\n fileNames.map(async (fileName) => {\n const contents = await fs.readFile(fileName, 'utf8');\n const patched = contents.replace(\n /(cache-on:[\\s\\S]*?)([ \\t]+-[ \\t]+\\.npmrc)([\\s\\S]*?)(?=\\n[ \\t]*\\S|$)/g,\n (_, before: string, npmrcLine: string, after: string) =>\n before + npmrcLine.replace('.npmrc', 'pnpm-workspace.yaml') + after,\n );\n\n if (patched !== contents) {\n await fs.writeFile(fileName, patched);\n }\n }),\n );\n};\n\nconst forceUpgradeToPnpm10 = async () => {\n const fileNames = await glob(['**/package.json']);\n\n await Promise.all(\n fileNames.map(async (fileName) => {\n const contents = await fs.readFile(fileName, 'utf8');\n\n const packageManagerMatch = /\"packageManager\"\\s*:\\s*\"pnpm@([^\"]+)\"/.exec(\n contents,\n );\n\n if (!packageManagerMatch) {\n return;\n }\n\n const currentVersion = packageManagerMatch[1] ?? '';\n const majorVersion = parseInt(currentVersion.split('.')?.[0] ?? '0', 10);\n\n if (!isNaN(majorVersion) && majorVersion < 10) {\n const patched = contents.replace(\n /\"packageManager\"(\\s*):(\\s*)\"pnpm@[^\"]+\"/,\n '\"packageManager\"$1:$2\"pnpm@10.8.1\"',\n );\n\n await fs.writeFile(fileName, patched);\n }\n }),\n );\n};\n\nconst migrateNpmrcToPnpmWorkspace: PatchFunction = async ({\n mode,\n packageManager,\n}): Promise<PatchReturnType> => {\n if (packageManager.command !== 'pnpm') {\n return {\n result: 'skip',\n reason: 'not using pnpm',\n };\n }\n\n const [workspaceRoot, currentWorkspaceProjectRoot] = await Promise.all([\n findWorkspaceRoot(),\n findCurrentWorkspaceProjectRoot(),\n ]);\n\n if (workspaceRoot !== currentWorkspaceProjectRoot) {\n return {\n result: 'skip',\n reason: 'not running in the workspace root',\n };\n }\n\n const npmrcExists = await pathExists(NPMRC);\n if (!npmrcExists) {\n return {\n result: 'skip',\n reason: 'no .npmrc found',\n };\n }\n\n if (mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await Promise.all([\n migrateCustomNpmrcSettings(),\n fixDockerfiles(),\n fixBuildkitePipelines(),\n forceUpgradeToPnpm10(),\n ]);\n\n await fs.rm(NPMRC);\n\n return { result: 'apply' };\n};\n\nexport const tryMigrateNpmrcToPnpmWorkspace: PatchFunction = async (config) => {\n try {\n return await migrateNpmrcToPnpmWorkspace(config);\n } catch (err) {\n log.warn('Failed to migrate .npmrc to pnpm-workspace.yaml');\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;AAExB,uBAAqB;AACrB,sBAAe;AAEf,iBAGO;AACP,gBAA2B;AAC3B,qBAAoB;AACpB,mBAA+B;AAC/B,wBAAsC;AAGtC,MAAM,QAAQ;AAEd,MAAM,6BAA6B,YAAY;AAC7C,QAAM,WAAW,MAAM,gBAAAA,QAAG,SAAS,OAAO,OAAO;AAEjD,QAAM,qBAAiB,yCAAsB,UAAU,EAAE,EACtD,MAAM,IAAI,EACV,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,EACzB,OAAO,CAAC,SAAS,KAAK,SAAS,CAAC,EAChC,OAAO,CAAC,SAAS,CAAC,KAAK,WAAW,GAAG,CAAC,EACtC,OAAO,CAAC,SAAS,KAAC,6BAAe,IAAI,CAAC;AAEzC,MAAI,eAAe,WAAW,GAAG;AAC/B;AAAA,EACF;AAEA,QAAM,oBAAoB;AAC1B,QAAM,sBAAsB,UAAM,sBAAW,iBAAiB;AAC9D,MAAI,CAAC,qBAAqB;AACxB,UAAM,gBAAAA,QAAG,UAAU,mBAAmB,EAAE;AAAA,EAC1C;AAGA,QAAM,wBAAwB,MAAM,gBAAAA,QAAG,SAAS,mBAAmB,OAAO;AAC1E,QAAM,iBAAiB,eAAe,IAAI,CAAC,SAAS,KAAK,IAAI,EAAE,EAAE,KAAK,IAAI;AAC1E,QAAM,cAAc;AAAA;AAAA;AAAA;AAAA,EAIpB,cAAc;AAAA;AAAA,EAEd,qBAAqB;AAErB,QAAM,gBAAAA,QAAG,UAAU,mBAAmB,WAA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import { glob } from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport {\n findCurrentWorkspaceProjectRoot,\n findWorkspaceRoot,\n} from '../../../../../../utils/dir.js';\nimport { pathExists } from '../../../../../../utils/fs.js';\nimport { log } from '../../../../../../utils/logging.js';\nimport { hasNpmrcSecret } from '../../../../../../utils/npmrc.js';\nimport { replaceManagedSection } from '../../../../../configure/processing/configFile.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst NPMRC = '.npmrc';\n\nconst migrateCustomNpmrcSettings = async () => {\n const contents = await fs.promises.readFile(NPMRC, 'utf-8');\n\n const remainderLines = replaceManagedSection(contents, '')\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line.length > 0)\n .filter((line) => !line.startsWith('#'))\n .filter((line) => !hasNpmrcSecret(line));\n\n if (remainderLines.length === 0) {\n return;\n }\n\n const pnpmWorkspaceFile = 'pnpm-workspace.yaml';\n const pnpmWorkspaceExists = await pathExists(pnpmWorkspaceFile);\n if (!pnpmWorkspaceExists) {\n await fs.promises.writeFile(pnpmWorkspaceFile, '');\n }\n\n // prepend the lines to the pnpm-workspace.yaml file, but commented out\n const pnpmWorkspaceContents = await fs.promises.readFile(\n pnpmWorkspaceFile,\n 'utf-8',\n );\n const commentedLines = remainderLines.map((line) => `# ${line}`).join('\\n');\n const newContents = `# TODO: Translate these settings to the required format for pnpm-workspace.yaml.\n# skuba moved these from .npmrc, but doesn't know what they mean.\n# See: https://pnpm.io/settings\n#\n${commentedLines}\n\n${pnpmWorkspaceContents}`;\n\n await fs.promises.writeFile(pnpmWorkspaceFile, newContents);\n};\n\nconst fixDockerfiles = async () => {\n const fileNames = await glob(['**/Dockerfile*']);\n\n await Promise.all(\n fileNames.map(async (fileName) => {\n const contents = await fs.promises.readFile(fileName, 'utf8');\n const patched = contents.replaceAll(\n '--mount=type=bind,source=.npmrc,target=.npmrc',\n '--mount=type=bind,source=pnpm-workspace.yaml,target=pnpm-workspace.yaml',\n );\n\n if (patched !== contents) {\n await fs.promises.writeFile(fileName, patched);\n }\n }),\n );\n};\n\nconst fixBuildkitePipelines = async () => {\n const fileNames = await glob(['**/.buildkite/**.{yml,yaml}']);\n\n await Promise.all(\n fileNames.map(async (fileName) => {\n const contents = await fs.promises.readFile(fileName, 'utf8');\n const patched = contents.replace(\n /(cache-on:[\\s\\S]*?)([ \\t]+-[ \\t]+\\.npmrc)([\\s\\S]*?)(?=\\n[ \\t]*\\S|$)/g,\n (_, before: string, npmrcLine: string, after: string) =>\n before + npmrcLine.replace('.npmrc', 'pnpm-workspace.yaml') + after,\n );\n\n if (patched !== contents) {\n await fs.promises.writeFile(fileName, patched);\n }\n }),\n );\n};\n\nconst forceUpgradeToPnpm10 = async () => {\n const fileNames = await glob(['**/package.json']);\n\n await Promise.all(\n fileNames.map(async (fileName) => {\n const contents = await fs.promises.readFile(fileName, 'utf8');\n\n const packageManagerMatch = /\"packageManager\"\\s*:\\s*\"pnpm@([^\"]+)\"/.exec(\n contents,\n );\n\n if (!packageManagerMatch) {\n return;\n }\n\n const currentVersion = packageManagerMatch[1] ?? '';\n const majorVersion = parseInt(currentVersion.split('.')?.[0] ?? '0', 10);\n\n if (!isNaN(majorVersion) && majorVersion < 10) {\n const patched = contents.replace(\n /\"packageManager\"(\\s*):(\\s*)\"pnpm@[^\"]+\"/,\n '\"packageManager\"$1:$2\"pnpm@10.8.1\"',\n );\n\n await fs.promises.writeFile(fileName, patched);\n }\n }),\n );\n};\n\nconst migrateNpmrcToPnpmWorkspace: PatchFunction = async ({\n mode,\n packageManager,\n}): Promise<PatchReturnType> => {\n if (packageManager.command !== 'pnpm') {\n return {\n result: 'skip',\n reason: 'not using pnpm',\n };\n }\n\n const [workspaceRoot, currentWorkspaceProjectRoot] = await Promise.all([\n findWorkspaceRoot(),\n findCurrentWorkspaceProjectRoot(),\n ]);\n\n if (workspaceRoot !== currentWorkspaceProjectRoot) {\n return {\n result: 'skip',\n reason: 'not running in the workspace root',\n };\n }\n\n const npmrcExists = await pathExists(NPMRC);\n if (!npmrcExists) {\n return {\n result: 'skip',\n reason: 'no .npmrc found',\n };\n }\n\n if (mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await Promise.all([\n migrateCustomNpmrcSettings(),\n fixDockerfiles(),\n fixBuildkitePipelines(),\n forceUpgradeToPnpm10(),\n ]);\n\n await fs.promises.rm(NPMRC);\n\n return { result: 'apply' };\n};\n\nexport const tryMigrateNpmrcToPnpmWorkspace: PatchFunction = async (config) => {\n try {\n return await migrateNpmrcToPnpmWorkspace(config);\n } catch (err) {\n log.warn('Failed to migrate .npmrc to pnpm-workspace.yaml');\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;AAExB,uBAAqB;AACrB,sBAAe;AAEf,iBAGO;AACP,gBAA2B;AAC3B,qBAAoB;AACpB,mBAA+B;AAC/B,wBAAsC;AAGtC,MAAM,QAAQ;AAEd,MAAM,6BAA6B,YAAY;AAC7C,QAAM,WAAW,MAAM,gBAAAA,QAAG,SAAS,SAAS,OAAO,OAAO;AAE1D,QAAM,qBAAiB,yCAAsB,UAAU,EAAE,EACtD,MAAM,IAAI,EACV,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,EACzB,OAAO,CAAC,SAAS,KAAK,SAAS,CAAC,EAChC,OAAO,CAAC,SAAS,CAAC,KAAK,WAAW,GAAG,CAAC,EACtC,OAAO,CAAC,SAAS,KAAC,6BAAe,IAAI,CAAC;AAEzC,MAAI,eAAe,WAAW,GAAG;AAC/B;AAAA,EACF;AAEA,QAAM,oBAAoB;AAC1B,QAAM,sBAAsB,UAAM,sBAAW,iBAAiB;AAC9D,MAAI,CAAC,qBAAqB;AACxB,UAAM,gBAAAA,QAAG,SAAS,UAAU,mBAAmB,EAAE;AAAA,EACnD;AAGA,QAAM,wBAAwB,MAAM,gBAAAA,QAAG,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AO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,iCAAgD,OAAO,WAAW;AAC7E,MAAI;AACF,WAAO,MAAM,4BAA4B,MAAM;AAAA,EACjD,SAAS,KAAK;AACZ,uBAAI,KAAK,iDAAiD;AAC1D,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
6
6
  "names": ["fs"]
7
7
  }
@@ -25,7 +25,7 @@ var import_upgradeNode = require("./upgradeNode.js");
25
25
  const patches = [
26
26
  {
27
27
  apply: import_upgradeNode.tryUpgradeNode,
28
- description: "Upgrade Node.js to version 22"
28
+ description: "Upgrade Node.js version to 24 and package targets to Node.js 20"
29
29
  }
30
30
  ];
31
31
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/9.1.0/index.ts"],
4
- "sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryUpgradeNode } from './upgradeNode.js';\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;",
3
+ "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/13.1.1/index.ts"],
4
+ "sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryUpgradeNode } from './upgradeNode.js';\n\nexport const patches: Patches = [\n {\n apply: tryUpgradeNode,\n description:\n 'Upgrade Node.js version to 24 and package targets to Node.js 20',\n },\n];\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA+B;AAExB,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AACF;",
6
6
  "names": []
7
7
  }
@@ -23,7 +23,7 @@ __export(upgradeNode_exports, {
23
23
  module.exports = __toCommonJS(upgradeNode_exports);
24
24
  var import_util = require("util");
25
25
  var import_logging = require("../../../../../../utils/logging.js");
26
- var import_nodeVersion = require("../../../../../migrate/nodeVersion/index.js");
26
+ var import_migrate = require("../../../../../migrate/index.js");
27
27
  const upgradeNode = async ({
28
28
  mode
29
29
  }) => {
@@ -36,10 +36,7 @@ const upgradeNode = async ({
36
36
  if (mode === "lint") {
37
37
  return { result: "apply" };
38
38
  }
39
- await (0, import_nodeVersion.nodeVersionMigration)({
40
- nodeVersion: 22,
41
- ECMAScriptVersion: "ES2024"
42
- });
39
+ await import_migrate.migrations.node24();
43
40
  return { result: "apply" };
44
41
  };
45
42
  const tryUpgradeNode = async (config) => {
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.ts"],
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport { migrations } from '../../../../../migrate/index.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\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 migrations.node24();\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;AAExB,qBAAoB;AACpB,qBAA2B;AAG3B,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,QAAM,0BAAW,OAAO;AAExB,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
+ }
@@ -25,16 +25,11 @@ var import_collapseDuplicateMergeKeys = require("./collapseDuplicateMergeKeys.js
25
25
  var import_moveNpmrcMounts = require("./moveNpmrcMounts.js");
26
26
  var import_patchDockerCompose = require("./patchDockerCompose.js");
27
27
  var import_patchDockerImages = require("./patchDockerImages.js");
28
- var import_upgradeESLint = require("./upgradeESLint.js");
29
28
  const patches = [
30
29
  {
31
30
  apply: import_collapseDuplicateMergeKeys.tryCollapseDuplicateMergeKeys,
32
31
  description: "Collapse duplicate merge keys in .buildkite files"
33
32
  },
34
- {
35
- apply: import_upgradeESLint.tryUpgradeESLint,
36
- description: "Upgrade to ESLint flat config"
37
- },
38
33
  {
39
34
  apply: import_patchDockerCompose.tryPatchDockerComposeFiles,
40
35
  description: "Remove version field from docker-compose files"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/8.2.1/index.ts"],
4
- "sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryCollapseDuplicateMergeKeys } from './collapseDuplicateMergeKeys.js';\nimport { tryMoveNpmrcMounts } from './moveNpmrcMounts.js';\nimport { tryPatchDockerComposeFiles } from './patchDockerCompose.js';\nimport { tryPatchDockerImages } from './patchDockerImages.js';\nimport { tryUpgradeESLint } from './upgradeESLint.js';\n\nexport const patches: Patches = [\n {\n apply: tryCollapseDuplicateMergeKeys,\n description: 'Collapse duplicate merge keys in .buildkite files',\n },\n {\n apply: tryUpgradeESLint,\n description: 'Upgrade to ESLint flat config',\n },\n {\n apply: tryPatchDockerComposeFiles,\n description: 'Remove version field from docker-compose files',\n },\n {\n apply: tryPatchDockerImages,\n description:\n 'Update docker image references to use public.ecr.aws and remove --platform flag',\n },\n {\n apply: tryMoveNpmrcMounts,\n description: 'Move .npmrc mounts from tmp/.npmrc to /tmp/.npmrc',\n },\n];\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,wCAA8C;AAC9C,6BAAmC;AACnC,gCAA2C;AAC3C,+BAAqC;AACrC,2BAAiC;AAE1B,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
4
+ "sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryCollapseDuplicateMergeKeys } from './collapseDuplicateMergeKeys.js';\nimport { tryMoveNpmrcMounts } from './moveNpmrcMounts.js';\nimport { tryPatchDockerComposeFiles } from './patchDockerCompose.js';\nimport { tryPatchDockerImages } from './patchDockerImages.js';\n\nexport const patches: Patches = [\n {\n apply: tryCollapseDuplicateMergeKeys,\n description: 'Collapse duplicate merge keys in .buildkite files',\n },\n {\n apply: tryPatchDockerComposeFiles,\n description: 'Remove version field from docker-compose files',\n },\n {\n apply: tryPatchDockerImages,\n description:\n 'Update docker image references to use public.ecr.aws and remove --platform flag',\n },\n {\n apply: tryMoveNpmrcMounts,\n description: 'Move .npmrc mounts from tmp/.npmrc to /tmp/.npmrc',\n },\n];\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,wCAA8C;AAC9C,6BAAmC;AACnC,gCAA2C;AAC3C,+BAAqC;AAE9B,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
6
6
  "names": []
7
7
  }
@@ -32,13 +32,13 @@ __export(prettier_exports, {
32
32
  runPrettierInWorkerThread: () => runPrettierInWorkerThread
33
33
  });
34
34
  module.exports = __toCommonJS(prettier_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_prettier = require("../adapter/prettier.js");
41
- const LOG_PREFIX = import_chalk.default.cyan("Prettier \u2502");
41
+ const LOG_PREFIX = (0, import_node_util.styleText)("cyan", "Prettier \u2502");
42
42
  const runPrettierInCurrentThread = ({ debug }) => (0, import_prettier.runPrettier)("lint", (0, import_logging.createLogger)({ debug, prefixes: [LOG_PREFIX] }));
43
43
  const runPrettierInWorkerThread = (input) => (0, import_worker.execWorkerThread)(
44
44
  import_path.default.posix.join(__dirname, "prettier.js"),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/lint/prettier.ts"],
4
- "sourcesContent": ["import path from 'path';\nimport { isMainThread } from 'worker_threads';\n\nimport chalk from 'chalk';\n\nimport { createLogger } from '../../utils/logging.js';\nimport { execWorkerThread, postWorkerOutput } from '../../utils/worker.js';\nimport { type PrettierOutput, runPrettier } from '../adapter/prettier.js';\n\nimport type { Input } from './types.js';\n\nconst LOG_PREFIX = chalk.cyan('Prettier \u2502');\n\nexport const runPrettierInCurrentThread = ({ debug }: Input) =>\n runPrettier('lint', createLogger({ debug, prefixes: [LOG_PREFIX] }));\n\nexport const runPrettierInWorkerThread = (input: Input) =>\n execWorkerThread<Input, PrettierOutput>(\n path.posix.join(__dirname, 'prettier.js'),\n input,\n );\n\nif (!isMainThread) {\n postWorkerOutput(\n runPrettierInCurrentThread,\n createLogger({ debug: false, prefixes: [LOG_PREFIX] }),\n );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,4BAA6B;AAE7B,mBAAkB;AAElB,qBAA6B;AAC7B,oBAAmD;AACnD,sBAAiD;AAIjD,MAAM,aAAa,aAAAA,QAAM,KAAK,iBAAY;AAEnC,MAAM,6BAA6B,CAAC,EAAE,MAAM,UACjD,6BAAY,YAAQ,6BAAa,EAAE,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC;AAE9D,MAAM,4BAA4B,CAAC,cACxC;AAAA,EACE,YAAAC,QAAK,MAAM,KAAK,WAAW,aAAa;AAAA,EACxC;AACF;AAEF,IAAI,CAAC,oCAAc;AACjB;AAAA,IACE;AAAA,QACA,6BAAa,EAAE,OAAO,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;AAAA,EACvD;AACF;",
6
- "names": ["chalk", "path"]
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 PrettierOutput, runPrettier } from '../adapter/prettier.js';\n\nimport type { Input } from './types.js';\n\nconst LOG_PREFIX = styleText('cyan', 'Prettier \u2502');\n\nexport const runPrettierInCurrentThread = ({ debug }: Input) =>\n runPrettier('lint', createLogger({ debug, prefixes: [LOG_PREFIX] }));\n\nexport const runPrettierInWorkerThread = (input: Input) =>\n execWorkerThread<Input, PrettierOutput>(\n path.posix.join(__dirname, 'prettier.js'),\n input,\n );\n\nif (!isMainThread) {\n postWorkerOutput(\n runPrettierInCurrentThread,\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,sBAAiD;AAIjD,MAAM,iBAAa,4BAAU,QAAQ,iBAAY;AAE1C,MAAM,6BAA6B,CAAC,EAAE,MAAM,UACjD,6BAAY,YAAQ,6BAAa,EAAE,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC;AAE9D,MAAM,4BAA4B,CAAC,cACxC;AAAA,EACE,YAAAA,QAAK,MAAM,KAAK,WAAW,aAAa;AAAA,EACxC;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
  }
@@ -1 +1,6 @@
1
+ export declare const migrations: {
2
+ node20: () => Promise<void>;
3
+ node22: () => Promise<void>;
4
+ node24: () => Promise<void>;
5
+ };
1
6
  export declare const migrate: (args?: string[]) => Promise<void>;
@@ -18,19 +18,50 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var migrate_exports = {};
20
20
  __export(migrate_exports, {
21
- migrate: () => migrate
21
+ migrate: () => migrate,
22
+ migrations: () => migrations
22
23
  });
23
24
  module.exports = __toCommonJS(migrate_exports);
24
25
  var import_logging = require("../../utils/logging.js");
25
26
  var import_nodeVersion = require("./nodeVersion/index.js");
26
27
  const migrations = {
27
28
  node20: () => (0, import_nodeVersion.nodeVersionMigration)({
28
- nodeVersion: 20,
29
- ECMAScriptVersion: "ES2023"
29
+ nodeVersion: "20",
30
+ ECMAScriptVersion: "ES2023",
31
+ packageNodeVersion: "16",
32
+ packageEMCAScriptVersion: "ES2021",
33
+ infraPackages: []
30
34
  }),
31
35
  node22: () => (0, import_nodeVersion.nodeVersionMigration)({
32
- nodeVersion: 22,
33
- ECMAScriptVersion: "ES2024"
36
+ nodeVersion: "22",
37
+ ECMAScriptVersion: "ES2024",
38
+ packageNodeVersion: "18",
39
+ packageEMCAScriptVersion: "ES2022",
40
+ infraPackages: []
41
+ }),
42
+ node24: () => (0, import_nodeVersion.nodeVersionMigration)({
43
+ nodeVersion: "24",
44
+ ECMAScriptVersion: "ES2024",
45
+ packageNodeVersion: "20",
46
+ packageEMCAScriptVersion: "ES2023",
47
+ infraPackages: [
48
+ {
49
+ name: "aws-cdk-lib",
50
+ version: "2.224.0"
51
+ },
52
+ {
53
+ name: "serverless",
54
+ version: "4.25.0"
55
+ },
56
+ {
57
+ name: "osls",
58
+ version: "3.61.0"
59
+ },
60
+ {
61
+ name: "@types/node",
62
+ version: "24.10.1"
63
+ }
64
+ ]
34
65
  })
35
66
  };
36
67
  const logAvailableMigrations = () => {
@@ -61,6 +92,7 @@ const migrate = async (args = process.argv.slice(2)) => {
61
92
  };
62
93
  // Annotate the CommonJS export names for ESM import in node:
63
94
  0 && (module.exports = {
64
- migrate
95
+ migrate,
96
+ migrations
65
97
  });
66
98
  //# sourceMappingURL=index.js.map
@@ -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.js';\n\nimport { nodeVersionMigration } from './nodeVersion/index.js';\n\nconst migrations: Record<string, () => Promise<void>> = {\n node20: () =>\n nodeVersionMigration({\n nodeVersion: 20,\n ECMAScriptVersion: 'ES2023',\n }),\n node22: () =>\n nodeVersionMigration({\n nodeVersion: 22,\n ECMAScriptVersion: 'ES2024',\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,EACrB,CAAC;AAAA,EACH,QAAQ,UACN,yCAAqB;AAAA,IACnB,aAAa;AAAA,IACb,mBAAmB;AAAA,EACrB,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;",
4
+ "sourcesContent": ["import { log } from '../../utils/logging.js';\n\nimport { nodeVersionMigration } from './nodeVersion/index.js';\n\nexport const migrations = {\n node20: () =>\n nodeVersionMigration({\n nodeVersion: '20',\n ECMAScriptVersion: 'ES2023',\n packageNodeVersion: '16',\n packageEMCAScriptVersion: 'ES2021',\n infraPackages: [],\n }),\n node22: () =>\n nodeVersionMigration({\n nodeVersion: '22',\n ECMAScriptVersion: 'ES2024',\n packageNodeVersion: '18',\n packageEMCAScriptVersion: 'ES2022',\n infraPackages: [],\n }),\n node24: () =>\n nodeVersionMigration({\n nodeVersion: '24',\n ECMAScriptVersion: 'ES2024',\n packageNodeVersion: '20',\n packageEMCAScriptVersion: 'ES2023',\n infraPackages: [\n {\n name: 'aws-cdk-lib',\n version: '2.224.0',\n },\n {\n name: 'serverless',\n version: '4.25.0',\n },\n {\n name: 'osls',\n version: '3.61.0',\n },\n {\n name: '@types/node',\n version: '24.10.1',\n },\n ],\n }),\n} satisfies Record<string, () => Promise<void>>;\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] as keyof typeof migrations];\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;AAAA,qBAAoB;AAEpB,yBAAqC;AAE9B,MAAM,aAAa;AAAA,EACxB,QAAQ,UACN,yCAAqB;AAAA,IACnB,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB,oBAAoB;AAAA,IACpB,0BAA0B;AAAA,IAC1B,eAAe,CAAC;AAAA,EAClB,CAAC;AAAA,EACH,QAAQ,UACN,yCAAqB;AAAA,IACnB,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB,oBAAoB;AAAA,IACpB,0BAA0B;AAAA,IAC1B,eAAe,CAAC;AAAA,EAClB,CAAC;AAAA,EACH,QAAQ,UACN,yCAAqB;AAAA,IACnB,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB,oBAAoB;AAAA,IACpB,0BAA0B;AAAA,IAC1B,eAAe;AAAA,MACb;AAAA,QACE,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF,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,CAA4B;AAE/D,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
  }
@@ -1,14 +1 @@
1
- import * as z from 'zod/v4';
2
- export declare const extractFromParentPackageJson: <T extends z.ZodRawShape>(schema: z.ZodObject<T>, currentPath: string) => Promise<{
3
- packageJson: undefined;
4
- packageJsonRelativePath: undefined;
5
- } | {
6
- packageJson: undefined;
7
- packageJsonRelativePath: string;
8
- } | {
9
- packageJson: z.core.$InferObjectOutput<T, {}>;
10
- packageJsonRelativePath: string;
11
- }>;
12
- export declare const isPatchableServerlessVersion: (currentPath: string) => Promise<boolean>;
13
- export declare const isPatchableSkubaType: (currentPath: string) => Promise<boolean>;
14
- export declare const isPatchableNodeVersion: (targetNodeVersion: number, currentPath: string) => Promise<boolean>;
1
+ export declare const isLikelyPackage: (currentPath: string) => Promise<boolean>;
@@ -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,157 +15,50 @@ 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 checks_exports = {};
30
20
  __export(checks_exports, {
31
- extractFromParentPackageJson: () => extractFromParentPackageJson,
32
- isPatchableNodeVersion: () => isPatchableNodeVersion,
33
- isPatchableServerlessVersion: () => isPatchableServerlessVersion,
34
- isPatchableSkubaType: () => isPatchableSkubaType
21
+ isLikelyPackage: () => isLikelyPackage
35
22
  });
36
23
  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 z = __toESM(require("zod/v4"));
41
24
  var import_logging = require("../../../utils/logging.js");
42
- const getParentFile = async (file, cwd = process.cwd()) => {
43
- const path = await (0, import_find_up.default)(file, { 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, currentPath) => {
53
- const file = await getParentFile("package.json", currentPath);
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 };
25
+ var import_manifest = require("../../../utils/manifest.js");
26
+ const isLikelyPackage = async (currentPath) => {
27
+ const nearestPackageJsonResult = await (0, import_manifest.getConsumerManifest)(currentPath);
28
+ if (!nearestPackageJsonResult) {
29
+ import_logging.log.warn("package.json not found");
30
+ return false;
67
31
  }
68
- return { packageJson: result.data, packageJsonRelativePath: path };
69
- };
70
- const isPatchableServerlessVersion = async (currentPath) => {
71
- const { packageJson, packageJsonRelativePath } = await extractFromParentPackageJson(
72
- z.object({
73
- devDependencies: z.object({
74
- serverless: z.string().optional()
75
- })
76
- }),
77
- currentPath
78
- );
79
- if (!packageJson) {
80
- import_logging.log.warn("package.json not found, ensure it is in the correct location");
32
+ const { packageJson } = nearestPackageJsonResult;
33
+ const type = packageJson.skuba?.type;
34
+ if (type === "application") {
81
35
  return false;
82
36
  }
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
- );
37
+ if (type === "package") {
88
38
  return true;
89
39
  }
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;
40
+ if (typeof packageJson.sideEffects === "boolean") {
41
+ return true;
95
42
  }
96
- import_logging.log.ok(
97
- `Proceeding with migration of Serverless version ${serverlessVersion}`
98
- );
99
- return true;
100
- };
101
- const isPatchableSkubaType = async (currentPath) => {
102
- const { packageJson, packageJsonRelativePath } = await extractFromParentPackageJson(
103
- z.object({
104
- skuba: z.object({
105
- type: z.string().optional()
106
- }).optional(),
107
- files: z.string().array().optional()
108
- }),
109
- currentPath
110
- );
111
- if (!packageJson) {
112
- import_logging.log.warn("package.json not found, ensure it is in the correct location");
113
- return false;
43
+ if (typeof packageJson.types === "string" && typeof packageJson.module === "string" && typeof packageJson.main === "string") {
44
+ return true;
114
45
  }
115
- if (packageJson.files) {
116
- import_logging.log.warn(
117
- "Migrations are not supported for packages; update manually to ensure major runtime deprecations are intended"
118
- );
119
- return false;
46
+ if (typeof packageJson.exports === "object") {
47
+ return true;
120
48
  }
121
- const type = packageJson?.skuba?.type;
122
- if (!type) {
123
- import_logging.log.warn(
124
- `skuba project type not found in ${packageJsonRelativePath}; add a package.json#/skuba/type to ensure the correct migration can be applied`
125
- );
126
- return false;
49
+ if (typeof packageJson.types === "string") {
50
+ return true;
127
51
  }
128
- if (type === "package") {
129
- import_logging.log.warn(
130
- "Migrations are not supported for packages; update manually to ensure major runtime deprecations are intended"
131
- );
132
- return false;
52
+ if (typeof packageJson.module === "string") {
53
+ return true;
133
54
  }
134
- import_logging.log.ok(`Proceeding with migration of skuba project type ${type}`);
135
- return true;
136
- };
137
- const isPatchableNodeVersion = async (targetNodeVersion, currentPath) => {
138
- const nvmrcFile = await getParentFile(".nvmrc");
139
- const nodeVersionFile = await getParentFile(".node-version");
140
- const { packageJson } = await extractFromParentPackageJson(
141
- z.object({
142
- engines: z.object({
143
- node: z.string()
144
- })
145
- }),
146
- currentPath
147
- );
148
- const nvmrcNodeVersion = nvmrcFile?.fileContent;
149
- const nodeVersion = nodeVersionFile?.fileContent;
150
- const engineVersion = packageJson?.engines.node;
151
- const currentNodeVersion = nvmrcNodeVersion || nodeVersion || engineVersion;
152
- const coercedTargetVersion = (0, import_semver.coerce)(targetNodeVersion.toString())?.version;
153
- const coercedCurrentVersion = (0, import_semver.coerce)(currentNodeVersion)?.version;
154
- const isNodeVersionValid = coercedTargetVersion && coercedCurrentVersion && (0, import_semver.lte)(coercedCurrentVersion, coercedTargetVersion);
155
- if (!isNodeVersionValid) {
156
- import_logging.log.warn(
157
- `Node.js version ${coercedCurrentVersion ?? "unknown"} cannot be migrated to ${coercedTargetVersion}`
158
- );
55
+ if (packageJson.private === true) {
159
56
  return false;
160
57
  }
161
- import_logging.log.ok(
162
- `Proceeding with migration from Node.js ${coercedCurrentVersion} to ${coercedTargetVersion}`
163
- );
164
- return true;
58
+ return false;
165
59
  };
166
60
  // Annotate the CommonJS export names for ESM import in node:
167
61
  0 && (module.exports = {
168
- extractFromParentPackageJson,
169
- isPatchableNodeVersion,
170
- isPatchableServerlessVersion,
171
- isPatchableSkubaType
62
+ isLikelyPackage
172
63
  });
173
64
  //# sourceMappingURL=checks.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 * as z from 'zod/v4';\n\nimport { log } from '../../../utils/logging.js';\n\nconst getParentFile = async (file: string, cwd: string = process.cwd()) => {\n const path = await findUp(file, { 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 z.ZodRawShape>(\n schema: z.ZodObject<T>,\n currentPath: string,\n) => {\n const file = await getParentFile('package.json', currentPath);\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 (\n currentPath: string,\n): Promise<boolean> => {\n const { packageJson, packageJsonRelativePath } =\n await extractFromParentPackageJson(\n z.object({\n devDependencies: z.object({\n serverless: z.string().optional(),\n }),\n }),\n currentPath,\n );\n if (!packageJson) {\n log.warn('package.json not found, ensure it is in the correct location');\n return false;\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 (\n currentPath: string,\n): Promise<boolean> => {\n const { packageJson, packageJsonRelativePath } =\n await extractFromParentPackageJson(\n z.object({\n skuba: z\n .object({\n type: z.string().optional(),\n })\n .optional(),\n files: z.string().array().optional(),\n }),\n currentPath,\n );\n\n if (!packageJson) {\n log.warn('package.json not found, ensure it is in the correct location');\n return false;\n }\n\n if (packageJson.files) {\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 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 currentPath: string,\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 currentPath,\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,QAAmB;AAEnB,qBAAoB;AAEpB,MAAM,gBAAgB,OAAO,MAAc,MAAc,QAAQ,IAAI,MAAM;AACzE,QAAM,OAAO,UAAM,eAAAA,SAAO,MAAM,EAAE,IAAI,CAAC;AACvC,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AACA,SAAO;AAAA,IACL,aAAa,MAAM,gBAAAC,QAAG,SAAS,MAAM,OAAO;AAAA,IAC5C;AAAA,EACF;AACF;AAEO,MAAM,+BAA+B,OAC1C,QACA,gBACG;AACH,QAAM,OAAO,MAAM,cAAc,gBAAgB,WAAW;AAC5D,MAAI,CAAC,MAAM;AACT,WAAO,EAAE,aAAa,QAAW,yBAAyB,OAAU;AAAA,EACtE;AACA,QAAM,EAAE,aAAa,aAAa,KAAK,IAAI;AAC3C,MAAI;AACJ,MAAI;AACF,cAAU,KAAK,MAAM,WAAW;AAAA,EAClC,QAAQ;AACN,UAAM,IAAI,MAAM,GAAG,IAAI,oBAAoB;AAAA,EAC7C;AACA,QAAM,SAAS,OAAO,UAAU,OAAO;AACvC,MAAI,CAAC,OAAO,SAAS;AACnB,WAAO,EAAE,aAAa,QAAW,yBAAyB,KAAK;AAAA,EACjE;AAEA,SAAO,EAAE,aAAa,OAAO,MAAM,yBAAyB,KAAK;AACnE;AAEO,MAAM,+BAA+B,OAC1C,gBACqB;AACrB,QAAM,EAAE,aAAa,wBAAwB,IAC3C,MAAM;AAAA,IACJ,EAAE,OAAO;AAAA,MACP,iBAAiB,EAAE,OAAO;AAAA,QACxB,YAAY,EAAE,OAAO,EAA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AAM,YAAY,MAAM,cAAc,QAAQ;AAC9C,QAAM,kBAAkB,MAAM,cAAc,eAAe;AAC3D,QAAM,EAAE,YAAY,IAAI,MAAM;AAAA,IAC5B,EAAE,OAAO;AAAA,MACP,SAAS,EAAE,OAAO;AAAA,QAChB,MAAM,EAAE,OAAO;AAAA,MACjB,CAAC;AAAA,IACH,CAAC;AAAA,IACD;AAAA,EACF;AAEA,QAAM,mBAAmB,WAAW;AACpC,QAAM,cAAc,iBAAiB;AACrC,QAAM,gBAAgB,aAAa,QAAQ;AAE3C,QAAM,qBAAqB,oBAAoB,eAAe;AAE9D,QAAM,2BAAuB,sBAAO,kBAAkB,SAAS,CAAC,GAAG;AACnE,QAAM,4BAAwB,sBAAO,kBAAkB,GAAG;AAE1D,QAAM,qBACJ,wBACA,6BACA,mBAAI,uBAAuB,oBAAoB;AAEjD,MAAI,CAAC,oBAAoB;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"]
4
+ "sourcesContent": ["import { log } from '../../../utils/logging.js';\nimport { getConsumerManifest } from '../../../utils/manifest.js';\nimport type { SkubaPackageJson } from '../../init/writePackageJson.js';\n\nexport const isLikelyPackage = async (\n currentPath: string,\n): Promise<boolean> => {\n const nearestPackageJsonResult = await getConsumerManifest(currentPath);\n if (!nearestPackageJsonResult) {\n log.warn('package.json not found');\n return false;\n }\n\n const { packageJson } = nearestPackageJsonResult;\n\n const type = (packageJson.skuba as SkubaPackageJson)?.type;\n\n if (type === 'application') {\n return false;\n }\n\n if (type === 'package') {\n return true;\n }\n\n if (typeof packageJson.sideEffects === 'boolean') {\n return true;\n }\n\n if (\n typeof packageJson.types === 'string' &&\n typeof packageJson.module === 'string' &&\n typeof packageJson.main === 'string'\n ) {\n return true;\n }\n\n if (typeof packageJson.exports === 'object') {\n return true;\n }\n\n if (typeof packageJson.types === 'string') {\n return true;\n }\n\n if (typeof packageJson.module === 'string') {\n return true;\n }\n\n // private true would imply this is either an internal package or application\n // either way internal packages would normally be not published or bundled in by an application within the repo\n // so we can safely assume it is a package for migration purposes\n if (packageJson.private === true) {\n return false;\n }\n\n return false;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AACpB,sBAAoC;AAG7B,MAAM,kBAAkB,OAC7B,gBACqB;AACrB,QAAM,2BAA2B,UAAM,qCAAoB,WAAW;AACtE,MAAI,CAAC,0BAA0B;AAC7B,uBAAI,KAAK,wBAAwB;AACjC,WAAO;AAAA,EACT;AAEA,QAAM,EAAE,YAAY,IAAI;AAExB,QAAM,OAAQ,YAAY,OAA4B;AAEtD,MAAI,SAAS,eAAe;AAC1B,WAAO;AAAA,EACT;AAEA,MAAI,SAAS,WAAW;AACtB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,gBAAgB,WAAW;AAChD,WAAO;AAAA,EACT;AAEA,MACE,OAAO,YAAY,UAAU,YAC7B,OAAO,YAAY,WAAW,YAC9B,OAAO,YAAY,SAAS,UAC5B;AACA,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,YAAY,UAAU;AAC3C,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,UAAU,UAAU;AACzC,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,WAAW,UAAU;AAC1C,WAAO;AAAA,EACT;AAKA,MAAI,YAAY,YAAY,MAAM;AAChC,WAAO;AAAA,EACT;AAEA,SAAO;AACT;",
6
+ "names": []
7
7
  }
@@ -1,4 +1,10 @@
1
- export declare const nodeVersionMigration: ({ nodeVersion, ECMAScriptVersion, }: {
2
- nodeVersion: number;
1
+ export declare const nodeVersionMigration: ({ nodeVersion, ECMAScriptVersion, packageNodeVersion, packageEMCAScriptVersion, infraPackages, }: {
2
+ nodeVersion: string;
3
3
  ECMAScriptVersion: string;
4
+ packageNodeVersion: string;
5
+ packageEMCAScriptVersion: string;
6
+ infraPackages: Array<{
7
+ name: string;
8
+ version: string;
9
+ }>;
4
10
  }, dir?: string) => Promise<void>;