@comet/upgrade 1.68.0 → 1.70.0
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/v8/comet-config-provider.js +0 -1
- package/lib/v8/eslint-dev-dependencies.js +32 -1
- package/lib/v8/move-maxSrcResolution-in-comet-config.js +26 -0
- package/lib/v8/mui-codemods.js +3 -0
- package/lib/v8/replace-node-with-v22-in-gitlab-ci-files.js +47 -0
- package/lib/v8/replace-node-with-v22-locally.js +30 -0
- package/lib/v8/update-kubernetes-client-node.js +15 -0
- package/lib/v8/update-mui-dependencies.js +5 -5
- package/package.json +4 -4
|
@@ -210,7 +210,6 @@ async function cometConfigProvider() {
|
|
|
210
210
|
damConfig.insertSpreadAssignment(0, { expression: "config.dam" });
|
|
211
211
|
cometConfigProviderOpeningElement.addAttribute({ name: "dam", initializer: `{${damConfig.getText()}}` });
|
|
212
212
|
}
|
|
213
|
-
cometConfigProviderOpeningElement.addAttribute({ name: "imgproxy", initializer: "{config.imgproxy}" });
|
|
214
213
|
damConfigProviderElement.replaceWithText(damConfigProviderElement
|
|
215
214
|
.getJsxChildren()
|
|
216
215
|
.map((child) => child.getText())
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.stage = void 0;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
|
+
const ts_morph_1 = require("ts-morph");
|
|
5
6
|
const package_json_util_1 = require("../util/package-json.util");
|
|
6
7
|
const adminEslintConfig = `import eslintConfigReact from "@comet/eslint-config/react.js";
|
|
7
8
|
|
|
@@ -99,9 +100,39 @@ const createNewFlatConfigurationFile = ({ workingDirectory, fileContent }) => {
|
|
|
99
100
|
//
|
|
100
101
|
${commentedEslintConfig}
|
|
101
102
|
`;
|
|
102
|
-
|
|
103
|
+
const project = new ts_morph_1.Project({ tsConfigFilePath: `./${workingDirectory}tsconfig.json` });
|
|
104
|
+
const filePath = `${workingDirectory}eslint.config.mjs`;
|
|
105
|
+
const sourceFile = project.createSourceFile(filePath, oldEslintConfigTodo + fileContent, { overwrite: true });
|
|
106
|
+
transferEslintIgnore({ workingDirectory, sourceFile });
|
|
107
|
+
sourceFile.saveSync();
|
|
103
108
|
};
|
|
104
109
|
const deleteOldEslintRc = ({ workingDirectory }) => {
|
|
105
110
|
console.log(`🚀 Delete old .eslintrc.json configuration file ${workingDirectory}`);
|
|
106
111
|
(0, fs_1.rmSync)(`${workingDirectory}.eslintrc.json`);
|
|
107
112
|
};
|
|
113
|
+
const transferEslintIgnore = ({ workingDirectory, sourceFile }) => {
|
|
114
|
+
console.log(`🚀 Transfer ignores from .eslintignore to eslint.config.mjs ${workingDirectory}`);
|
|
115
|
+
if (!(0, fs_1.existsSync)(`${workingDirectory}.eslintignore`)) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const eslintIgnore = (0, fs_1.readFileSync)(`${workingDirectory}.eslintignore`, "utf-8")
|
|
119
|
+
.split("\n")
|
|
120
|
+
.filter((ignore) => ignore.length > 0);
|
|
121
|
+
const arrayLiteral = sourceFile.getVariableStatementOrThrow("config").getDescendantsOfKind(ts_morph_1.SyntaxKind.ArrayLiteralExpression)[0];
|
|
122
|
+
const firstObject = arrayLiteral.getElements()[0];
|
|
123
|
+
if (firstObject.isKind(ts_morph_1.SyntaxKind.ObjectLiteralExpression)) {
|
|
124
|
+
const ignoresProp = firstObject.getProperty("ignores");
|
|
125
|
+
if (ignoresProp?.isKind(ts_morph_1.SyntaxKind.PropertyAssignment)) {
|
|
126
|
+
const ignoresArray = ignoresProp.getInitializerIfKind(ts_morph_1.SyntaxKind.ArrayLiteralExpression);
|
|
127
|
+
if (ignoresArray) {
|
|
128
|
+
eslintIgnore.forEach((ignore) => {
|
|
129
|
+
if (!ignoresArray?.getElements().some((element) => element.getText() === `"${ignore}"`)) {
|
|
130
|
+
ignoresArray?.addElement(`"${ignore}"`);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
console.log(`🚀 Delete old .eslintignore file ${workingDirectory}`);
|
|
137
|
+
(0, fs_1.rmSync)(`${workingDirectory}.eslintignore`);
|
|
138
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.stage = void 0;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const prettier_1 = __importDefault(require("prettier"));
|
|
9
|
+
exports.stage = "before-install";
|
|
10
|
+
/**
|
|
11
|
+
* Move the maxSrcResolution property from imgproxy to dam in comet-config.json
|
|
12
|
+
*/
|
|
13
|
+
async function moveMaxSrcResolutionInCometConfig() {
|
|
14
|
+
const cometConfigPath = "api/src/comet-config.json";
|
|
15
|
+
if ((0, fs_1.existsSync)(cometConfigPath)) {
|
|
16
|
+
const content = (0, fs_1.readFileSync)(cometConfigPath, "utf-8");
|
|
17
|
+
const config = JSON.parse(content);
|
|
18
|
+
if (config.imgproxy && config.imgproxy.maxSrcResolution !== undefined) {
|
|
19
|
+
config.dam.maxSrcResolution = config.imgproxy.maxSrcResolution;
|
|
20
|
+
delete config.imgproxy.maxSrcResolution;
|
|
21
|
+
}
|
|
22
|
+
const prettierConfig = await prettier_1.default.resolveConfig(process.cwd());
|
|
23
|
+
(0, fs_1.writeFileSync)(cometConfigPath, prettier_1.default.format(JSON.stringify(config), { ...prettierConfig, parser: "json" }));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.default = moveMaxSrcResolutionInCometConfig;
|
package/lib/v8/mui-codemods.js
CHANGED
|
@@ -6,5 +6,8 @@ async function executeMuiCodemods() {
|
|
|
6
6
|
await (0, execute_command_util_1.executeCommand)("npx", ["@mui/codemod@latest", "v6.0.0/styled", "admin/src"]);
|
|
7
7
|
await (0, execute_command_util_1.executeCommand)("npx", ["@mui/codemod@latest", "v6.0.0/sx-prop", "admin/src"]);
|
|
8
8
|
await (0, execute_command_util_1.executeCommand)("npx", ["@mui/codemod@latest", "v6.0.0/theme-v6", "admin/src/theme.ts"]);
|
|
9
|
+
await (0, execute_command_util_1.executeCommand)("npx", ["@mui/codemod@latest", "v7.0.0/grid-props", "admin/src"]);
|
|
10
|
+
await (0, execute_command_util_1.executeCommand)("npx", ["@mui/codemod@latest", "v7.0.0/input-label-size-normal-medium", "admin/src"]);
|
|
11
|
+
await (0, execute_command_util_1.executeCommand)("npx", ["@mui/codemod@latest", "v7.0.0/lab-removed-components", "admin/src"]);
|
|
9
12
|
}
|
|
10
13
|
exports.default = executeMuiCodemods;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.stage = void 0;
|
|
27
|
+
const fs_1 = require("fs");
|
|
28
|
+
const glob = __importStar(require("glob"));
|
|
29
|
+
exports.stage = "before-install";
|
|
30
|
+
/**
|
|
31
|
+
* Replace node with version 22 in .gitlab-ci yml files
|
|
32
|
+
*/
|
|
33
|
+
async function replaceNodeWithV22InNvmrc() {
|
|
34
|
+
const files = glob.sync("**/.gitlab-ci/*.yml", { nodir: true });
|
|
35
|
+
for (const file of files) {
|
|
36
|
+
let content = await fs_1.promises.readFile(file, "utf8");
|
|
37
|
+
content = content
|
|
38
|
+
.replace(/node18/g, "node22")
|
|
39
|
+
.replace(/node20/g, "node22")
|
|
40
|
+
.replace(/nodejs18/g, "nodejs22-minimal")
|
|
41
|
+
.replace(/nodejs20-minimal/g, "nodejs22-minimal")
|
|
42
|
+
.replace(/nodejs20/g, "nodejs22-minimal");
|
|
43
|
+
await fs_1.promises.writeFile(file, content, "utf8");
|
|
44
|
+
}
|
|
45
|
+
console.log("Upgrade complete!");
|
|
46
|
+
}
|
|
47
|
+
exports.default = replaceNodeWithV22InNvmrc;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stage = void 0;
|
|
4
|
+
const promises_1 = require("fs/promises");
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const package_json_util_1 = require("../util/package-json.util");
|
|
7
|
+
exports.stage = "before-install";
|
|
8
|
+
/**
|
|
9
|
+
* Replace node with version 22 in .nvmrc and package.json files
|
|
10
|
+
*/
|
|
11
|
+
async function replaceNodeWithV22Locally() {
|
|
12
|
+
if ((0, node_fs_1.existsSync)(".nvmrc")) {
|
|
13
|
+
await (0, promises_1.writeFile)(".nvmrc", "22\n");
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
console.warn("Your project doesn't have a .nvmrc file. Skipping the replacement of node version.");
|
|
17
|
+
}
|
|
18
|
+
updateTypesNode("api");
|
|
19
|
+
updateTypesNode("admin");
|
|
20
|
+
updateTypesNode("site");
|
|
21
|
+
}
|
|
22
|
+
exports.default = replaceNodeWithV22Locally;
|
|
23
|
+
function updateTypesNode(microservice) {
|
|
24
|
+
const path = `${microservice}/package.json`;
|
|
25
|
+
if ((0, node_fs_1.existsSync)(path)) {
|
|
26
|
+
const packageJson = new package_json_util_1.PackageJson(path);
|
|
27
|
+
packageJson.updateDependency("@types/node", "^22.0.0");
|
|
28
|
+
packageJson.save();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stage = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const package_json_util_1 = require("../util/package-json.util");
|
|
6
|
+
exports.stage = "before-install";
|
|
7
|
+
async function updateKubernetesClientNode() {
|
|
8
|
+
if (!(0, fs_1.existsSync)("api/package.json")) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const packageJson = new package_json_util_1.PackageJson("api/package.json");
|
|
12
|
+
packageJson.updateDependency("@kubernetes/client-node", "^1.0.0");
|
|
13
|
+
packageJson.save();
|
|
14
|
+
}
|
|
15
|
+
exports.default = updateKubernetesClientNode;
|
|
@@ -10,11 +10,11 @@ async function updateMuiDependencies() {
|
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
const packageJson = new package_json_util_1.PackageJson(adminPackageJsonPath);
|
|
13
|
-
packageJson.
|
|
14
|
-
packageJson.
|
|
15
|
-
packageJson.
|
|
16
|
-
packageJson.
|
|
17
|
-
packageJson.
|
|
13
|
+
packageJson.updateDependency("@mui/material", "^7.0.0");
|
|
14
|
+
packageJson.updateDependency("@mui/system", "^7.0.0");
|
|
15
|
+
packageJson.updateDependency("@mui/utils", "^7.0.0");
|
|
16
|
+
packageJson.updateDependency("@mui/icons-material", "^7.0.0");
|
|
17
|
+
packageJson.updateDependency("@mui/lab", "^7.0.0-beta.9");
|
|
18
18
|
packageJson.save();
|
|
19
19
|
}
|
|
20
20
|
exports.default = updateMuiDependencies;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comet/upgrade",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.70.0",
|
|
4
4
|
"description": "Upgrade scripts for Comet DXP",
|
|
5
5
|
"homepage": "https://github.com/vivid-planet/comet-upgrade#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@comet/eslint-config": "^3.2.1",
|
|
40
|
-
"@tsconfig/
|
|
41
|
-
"@types/node": "^
|
|
40
|
+
"@tsconfig/node22": "^22.0.1",
|
|
41
|
+
"@types/node": "^22.0.0",
|
|
42
42
|
"@types/prettier": "^2.7.1",
|
|
43
43
|
"@types/semver": "^7.5.8",
|
|
44
44
|
"husky": "^8.0.2",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"typescript": "~5.1.0"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
|
-
"node": "
|
|
51
|
+
"node": "22"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public",
|