skuba 14.0.0-migrate-to-inquirer-20251031060542 → 14.0.0-node-24-20251204121724
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli/adapter/eslint.js +3 -3
- package/lib/cli/adapter/eslint.js.map +3 -3
- package/lib/cli/build/assets.d.ts +3 -2
- package/lib/cli/build/assets.js +2 -2
- package/lib/cli/build/assets.js.map +3 -3
- package/lib/cli/build/index.js +3 -13
- package/lib/cli/build/index.js.map +3 -3
- package/lib/cli/build/tsc.js +1 -2
- package/lib/cli/build/tsc.js.map +2 -2
- package/lib/cli/configure/analysis/diff.js +3 -13
- package/lib/cli/configure/analysis/diff.js.map +3 -3
- package/lib/cli/configure/ensureTemplateCompletion.js +5 -2
- package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
- package/lib/cli/configure/getEntryPoint.js +3 -3
- package/lib/cli/configure/getEntryPoint.js.map +3 -3
- package/lib/cli/configure/index.js +3 -3
- package/lib/cli/configure/index.js.map +2 -2
- package/lib/cli/format/index.js +4 -14
- package/lib/cli/format/index.js.map +3 -3
- package/lib/cli/init/getConfig.js +8 -10
- package/lib/cli/init/getConfig.js.map +3 -3
- package/lib/cli/init/prompts.d.ts +4 -4
- package/lib/cli/init/prompts.js +8 -8
- package/lib/cli/init/prompts.js.map +2 -2
- package/lib/cli/lint/eslint.js +2 -2
- package/lib/cli/lint/eslint.js.map +3 -3
- package/lib/cli/lint/index.js +1 -3
- package/lib/cli/lint/index.js.map +2 -2
- package/lib/cli/lint/internal.js +6 -14
- package/lib/cli/lint/internal.js.map +3 -3
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +1 -3
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +2 -2
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +1 -3
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/index.js +1 -3
- package/lib/cli/lint/internalLints/upgrade/index.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +14 -11
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/index.js +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/index.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/upgradeNode.js +2 -5
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +0 -5
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +2 -2
- package/lib/cli/lint/prettier.js +2 -2
- package/lib/cli/lint/prettier.js.map +3 -3
- package/lib/cli/migrate/index.d.ts +5 -0
- package/lib/cli/migrate/index.js +38 -6
- package/lib/cli/migrate/index.js.map +2 -2
- package/lib/cli/migrate/nodeVersion/checks.d.ts +1 -14
- package/lib/cli/migrate/nodeVersion/checks.js +24 -133
- package/lib/cli/migrate/nodeVersion/checks.js.map +3 -3
- package/lib/cli/migrate/nodeVersion/index.d.ts +8 -2
- package/lib/cli/migrate/nodeVersion/index.js +187 -47
- package/lib/cli/migrate/nodeVersion/index.js.map +2 -2
- package/lib/cli/migrate/nodeVersion/upgrade.d.ts +8 -0
- package/lib/cli/migrate/nodeVersion/upgrade.js +144 -0
- package/lib/cli/migrate/nodeVersion/upgrade.js.map +7 -0
- package/lib/utils/exec.d.ts +3 -2
- package/lib/utils/exec.js +1 -1
- package/lib/utils/exec.js.map +2 -2
- package/lib/utils/fs.js +1 -1
- package/lib/utils/fs.js.map +2 -2
- package/lib/utils/logging.d.ts +9 -10
- package/lib/utils/logging.js +9 -19
- package/lib/utils/logging.js.map +3 -3
- package/lib/utils/logo.js +11 -18
- package/lib/utils/logo.js.map +3 -3
- package/lib/utils/worker.d.ts +3 -3
- package/lib/wrapper/http.d.ts +0 -6
- package/lib/wrapper/http.js +4 -12
- package/lib/wrapper/http.js.map +2 -2
- package/lib/wrapper/requestListener.js +3 -2
- package/lib/wrapper/requestListener.js.map +2 -2
- package/lib/wrapper/server.d.ts +7 -0
- package/lib/wrapper/server.js +35 -0
- package/lib/wrapper/server.js.map +7 -0
- package/package.json +16 -26
- package/template/base/_pnpm-workspace.yaml +2 -0
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/.nvmrc +1 -1
- package/template/express-rest-api/package.json +6 -6
- package/template/greeter/.buildkite/pipeline.yml +1 -1
- package/template/greeter/.nvmrc +1 -1
- package/template/greeter/package.json +4 -4
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/.nvmrc +1 -1
- package/template/koa-rest-api/package.json +6 -6
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
- package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +2 -4
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
- package/template/lambda-sqs-worker-cdk/infra/config.ts +2 -4
- package/template/lambda-sqs-worker-cdk/package.json +5 -4
- package/template/lambda-sqs-worker-cdk/skuba.template.js +12 -0
- package/template/oss-npm-package/.github/workflows/release.yml +1 -1
- package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
- package/template/oss-npm-package/.nvmrc +1 -1
- package/template/private-npm-package/.nvmrc +1 -1
- package/template/private-npm-package/_package.json +1 -1
- package/template/private-npm-package/skuba.template.js +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.d.ts +0 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js +0 -144
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js.map +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +0 -7
- package/lib/eslint.d.js +0 -2
- package/lib/eslint.d.js.map +0 -7
- /package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/index.d.ts +0 -0
- /package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/upgradeNode.d.ts +0 -0
|
@@ -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(
|
|
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) => {
|
package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map
CHANGED
|
@@ -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
|
|
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;
|
|
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.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": "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",
|
|
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
|
|
28
|
+
description: "Upgrade Node.js version to 24 and ECMAScript version to ES2025"
|
|
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/
|
|
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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA+B;AAExB,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,
|
|
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 ECMAScript version to ES2025',\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
|
|
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 (
|
|
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';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,wCAA8C;AAC9C,6BAAmC;AACnC,gCAA2C;AAC3C,+BAAqC;
|
|
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
|
}
|
package/lib/cli/lint/prettier.js
CHANGED
|
@@ -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 =
|
|
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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,4BAA6B;AAE7B,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { styleText } from 'node:util';\nimport path from 'path';\nimport { isMainThread } from 'worker_threads';\n\nimport { createLogger } from '../../utils/logging.js';\nimport { execWorkerThread, postWorkerOutput } from '../../utils/worker.js';\nimport { type 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
|
}
|
package/lib/cli/migrate/index.js
CHANGED
|
@@ -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\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AAEpB,yBAAqC;
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
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 (
|
|
91
|
-
|
|
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
|
-
|
|
97
|
-
|
|
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.
|
|
116
|
-
|
|
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
|
-
|
|
122
|
-
|
|
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 (
|
|
129
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
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:
|
|
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>;
|