@comet/upgrade 1.116.0 → 1.118.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/bin/index.js +1 -1
- package/lib/index.js +33 -73
- package/lib/util/execute-command.util.js +3 -6
- package/lib/util/format-code.util.js +3 -6
- package/lib/util/get-latest-package-version.js +3 -9
- package/lib/util/package-json.util.js +5 -9
- package/lib/util/update-dependency-version.util.js +5 -8
- package/lib/v4/remove-clear-types-script.js +7 -13
- package/lib/v6/rename-build-runtime.js +7 -10
- package/lib/v6/rename-job-status-enum.js +7 -10
- package/lib/v6/rename-subject-entity-decorator.js +7 -10
- package/lib/v7/add-site-preview-secret.js +26 -65
- package/lib/v7/hide-graphql-field-suggestions.js +6 -9
- package/lib/v7/import-admin-theme-types.js +7 -13
- package/lib/v7/rename-date-filter-to-date-time-filter.js +7 -10
- package/lib/v7/replace-exception-interceptor-with-exception-filter.js +8 -11
- package/lib/v7/replace-gridcoldef-import.js +7 -10
- package/lib/v7/replace-roboto-with-roboto-flex.js +11 -14
- package/lib/v7/use-graphql-scalars.js +11 -14
- package/lib/v8/admin/after-install/add-dialog-content-to-edit-dialog.js +14 -17
- package/lib/v8/admin/after-install/clipboard-helpers.js +7 -10
- package/lib/v8/admin/after-install/comet-config-provider.js +66 -69
- package/lib/v8/admin/after-install/merge-admin-theme-into-admin.js +10 -13
- package/lib/v8/admin/after-install/merge-blocks-admin-into-cms-admin.js +8 -11
- package/lib/v8/admin/after-install/mui-codemods.js +9 -12
- package/lib/v8/admin/after-install/mui-data-grid-remove-error-prop.js +6 -9
- package/lib/v8/admin/after-install/mui-grid-sort-to-gql.js +6 -9
- package/lib/v8/admin/after-install/mui-x-codemods.js +4 -7
- package/lib/v8/admin/after-install/rename-menu-components-in-admin.js +7 -10
- package/lib/v8/admin/after-install/replace-mui-button-with-comet-admin-button.js +3 -6
- package/lib/v8/admin/after-install/tooltip-1-update-import.js +5 -8
- package/lib/v8/admin/after-install/tooltip-2-remove-trigger-prop.js +6 -9
- package/lib/v8/admin/after-install/update-import-of-dialog.js +5 -8
- package/lib/v8/admin/before-install/remove-admin-theme-package.js +6 -10
- package/lib/v8/admin/before-install/remove-blocks-packages-admin.js +6 -10
- package/lib/v8/admin/before-install/remove-comet-admin-react-select-dependency.js +6 -10
- package/lib/v8/admin/before-install/remove-v8-eslint-disable-comments-admin.js +4 -8
- package/lib/v8/admin/before-install/update-graphql-admin.js +6 -10
- package/lib/v8/admin/before-install/update-mui-dependencies.js +6 -10
- package/lib/v8/admin/before-install/update-mui-x-dependencies.js +6 -10
- package/lib/v8/admin/before-install/update-react-dependencies.js +6 -10
- package/lib/v8/admin/before-install/update-swc-dependencies.js +6 -10
- package/lib/v8/admin/before-install/use-mui-date-picker-in-grid.js +10 -14
- package/lib/v8/api/after-install/merge-blocks-api-into-cms-api.js +8 -11
- package/lib/v8/api/after-install/mikro-orm-base-entity-generic.js +6 -9
- package/lib/v8/api/after-install/mikro-orm-create-request-context.js +7 -10
- package/lib/v8/api/after-install/mikro-orm-custom-type.js +6 -9
- package/lib/v8/api/after-install/mikro-orm-delete-rule.js +6 -9
- package/lib/v8/api/after-install/mikro-orm-dotenv.js +5 -8
- package/lib/v8/api/after-install/mikro-orm-imports.js +6 -9
- package/lib/v8/api/after-install/mikro-orm-ormconfig.js +5 -8
- package/lib/v8/api/after-install/move-maxSrcResolution-in-comet-config.js +7 -13
- package/lib/v8/api/after-install/replace-playground-with-graphiql.js +12 -15
- package/lib/v8/api/after-install/update-dam-configuration.js +13 -16
- package/lib/v8/api/after-install/update-graphql-format-error.js +4 -7
- package/lib/v8/api/after-install/update-s3-config.js +8 -11
- package/lib/v8/api/before-install/nest-peer-dependencies.js +6 -10
- package/lib/v8/api/before-install/remove-blocks-packages-api.js +6 -10
- package/lib/v8/api/before-install/remove-passport.js +6 -10
- package/lib/v8/api/before-install/replace-nestjs-console-with-nest-commander.js +6 -10
- package/lib/v8/api/before-install/update-class-validator.js +7 -11
- package/lib/v8/api/before-install/update-kubernetes-client-node.js +6 -10
- package/lib/v8/api/before-install/update-mikro-orm-dependencies.js +6 -10
- package/lib/v8/api/before-install/update-nest-dependencies.js +6 -10
- package/lib/v8/api/before-install/update-sentry.js +9 -13
- package/lib/v8/eslint-dev-dependencies.js +22 -26
- package/lib/v8/ignore-restricted-imports-admin.js +4 -8
- package/lib/v8/prettier-dev-dependencies.js +12 -16
- package/lib/v8/remove-react-barrel-imports-admin.js +5 -8
- package/lib/v8/remove-react-barrel-imports-site.js +5 -8
- package/lib/v8/replace-node-with-v22-in-gitlab-ci-files.js +6 -43
- package/lib/v8/replace-node-with-v22-locally.js +9 -13
- package/lib/v8/site/after-install/remove-graphql-client-from-site-preview-handlers.js +7 -10
- package/lib/v8/site/before-install/update-graphql-site.js +6 -10
- package/lib/v9/admin/after-install/tooltip-replace-variant-prop.js +13 -16
- package/lib/v9/site/before-install/update-next-dependencies.js +6 -10
- package/package.json +3 -2
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = updateGraphQLFormatError;
|
|
4
|
-
const ts_morph_1 = require("ts-morph");
|
|
1
|
+
import { Project, SyntaxKind } from "ts-morph";
|
|
5
2
|
/**
|
|
6
3
|
* From
|
|
7
4
|
*
|
|
@@ -15,8 +12,8 @@ const ts_morph_1 = require("ts-morph");
|
|
|
15
12
|
* return new ValidationError("Invalid request.");
|
|
16
13
|
* }
|
|
17
14
|
*/
|
|
18
|
-
async function updateGraphQLFormatError() {
|
|
19
|
-
const project = new
|
|
15
|
+
export default async function updateGraphQLFormatError() {
|
|
16
|
+
const project = new Project({ tsConfigFilePath: "./api/tsconfig.json" });
|
|
20
17
|
const sourceFile = project.getSourceFile("api/src/app.module.ts");
|
|
21
18
|
if (!sourceFile) {
|
|
22
19
|
throw new Error("app.module.ts not found");
|
|
@@ -25,7 +22,7 @@ async function updateGraphQLFormatError() {
|
|
|
25
22
|
sourceFile.getImportDeclaration((importDeclaration) => importDeclaration.getModuleSpecifierValue() === "apollo-server-express")?.remove();
|
|
26
23
|
sourceFile.addImportDeclaration({ namedImports: ["ValidationError"], moduleSpecifier: "@nestjs/apollo" });
|
|
27
24
|
// Update the if statement
|
|
28
|
-
sourceFile.getDescendantsOfKind(
|
|
25
|
+
sourceFile.getDescendantsOfKind(SyntaxKind.BinaryExpression).forEach((node) => {
|
|
29
26
|
if (node.getText() === "error instanceof ValidationError") {
|
|
30
27
|
node.replaceWithText(`error.extensions?.code === "GRAPHQL_VALIDATION_FAILED"`);
|
|
31
28
|
}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.default = updateS3Config;
|
|
4
|
-
const ts_morph_1 = require("ts-morph");
|
|
5
|
-
async function updateS3Config() {
|
|
1
|
+
import { Project, SyntaxKind } from "ts-morph";
|
|
2
|
+
export default async function updateS3Config() {
|
|
6
3
|
console.log(`🚀 Update s3 config to new structure.`);
|
|
7
4
|
const filePath = "api/src/config/config.ts";
|
|
8
|
-
const project = new
|
|
5
|
+
const project = new Project();
|
|
9
6
|
const sourceFile = project.addSourceFileAtPath(filePath);
|
|
10
7
|
// Find the createConfig function
|
|
11
8
|
const createConfigFn = sourceFile.getFunctionOrThrow("createConfig");
|
|
12
|
-
const returnStmt = createConfigFn.getBodyOrThrow().getDescendantsOfKind(
|
|
13
|
-
const returnObj = returnStmt.getExpressionIfKindOrThrow(
|
|
9
|
+
const returnStmt = createConfigFn.getBodyOrThrow().getDescendantsOfKind(SyntaxKind.ReturnStatement)[0];
|
|
10
|
+
const returnObj = returnStmt.getExpressionIfKindOrThrow(SyntaxKind.ObjectLiteralExpression);
|
|
14
11
|
// Navigate to blob.storage.s3
|
|
15
12
|
let s3Prop;
|
|
16
13
|
try {
|
|
17
|
-
const blobProp = returnObj.getPropertyOrThrow("blob").getFirstDescendantByKindOrThrow(
|
|
18
|
-
const storageProp = blobProp.getPropertyOrThrow("storage").getFirstDescendantByKindOrThrow(
|
|
19
|
-
s3Prop = storageProp.getPropertyOrThrow("s3").getFirstDescendantByKindOrThrow(
|
|
14
|
+
const blobProp = returnObj.getPropertyOrThrow("blob").getFirstDescendantByKindOrThrow(SyntaxKind.ObjectLiteralExpression);
|
|
15
|
+
const storageProp = blobProp.getPropertyOrThrow("storage").getFirstDescendantByKindOrThrow(SyntaxKind.ObjectLiteralExpression);
|
|
16
|
+
s3Prop = storageProp.getPropertyOrThrow("s3").getFirstDescendantByKindOrThrow(SyntaxKind.ObjectLiteralExpression);
|
|
20
17
|
}
|
|
21
18
|
catch {
|
|
22
19
|
console.log("☑️ No S3 configuration found in the specified file. Skipping update.");
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.default = addNestPeerDependencies;
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
const package_json_util_1 = require("../../../util/package-json.util");
|
|
7
|
-
exports.stage = "before-install";
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { PackageJson } from "../../../util/package-json.util.js";
|
|
3
|
+
export const stage = "before-install";
|
|
8
4
|
/**
|
|
9
5
|
* Add peer dependencies defined by NestJS to the project.
|
|
10
6
|
*/
|
|
11
|
-
async function addNestPeerDependencies() {
|
|
12
|
-
if (!
|
|
7
|
+
export default async function addNestPeerDependencies() {
|
|
8
|
+
if (!existsSync("api/package.json")) {
|
|
13
9
|
return;
|
|
14
10
|
}
|
|
15
|
-
const packageJson = new
|
|
11
|
+
const packageJson = new PackageJson("api/package.json");
|
|
16
12
|
packageJson.addDependency("class-transformer", "^0.5.1");
|
|
17
13
|
packageJson.addDependency("reflect-metadata", "^0.2.2");
|
|
18
14
|
packageJson.addDependency("rxjs", "^7.8.1");
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
exports.stage = "before-install";
|
|
8
|
-
async function removeBlocksPackagesApi() {
|
|
9
|
-
if ((0, fs_1.existsSync)("api/package.json")) {
|
|
10
|
-
const packageJson = new package_json_util_1.PackageJson("api/package.json");
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { PackageJson } from "../../../util/package-json.util.js";
|
|
3
|
+
export const stage = "before-install";
|
|
4
|
+
export default async function removeBlocksPackagesApi() {
|
|
5
|
+
if (existsSync("api/package.json")) {
|
|
6
|
+
const packageJson = new PackageJson("api/package.json");
|
|
11
7
|
packageJson.removeDependency("@comet/blocks-api");
|
|
12
8
|
packageJson.save();
|
|
13
9
|
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const package_json_util_1 = require("../../../util/package-json.util");
|
|
7
|
-
exports.stage = "before-install";
|
|
8
|
-
async function removePassport() {
|
|
9
|
-
if (!(0, fs_1.existsSync)("api/package.json")) {
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { PackageJson } from "../../../util/package-json.util.js";
|
|
3
|
+
export const stage = "before-install";
|
|
4
|
+
export default async function removePassport() {
|
|
5
|
+
if (!existsSync("api/package.json")) {
|
|
10
6
|
return;
|
|
11
7
|
}
|
|
12
|
-
const packageJson = new
|
|
8
|
+
const packageJson = new PackageJson("api/package.json");
|
|
13
9
|
packageJson.addDependency("@nestjs/jwt", "^11.0.0");
|
|
14
10
|
packageJson.removeDependency("@nestjs/passport");
|
|
15
11
|
packageJson.removeDependency("passport");
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.default = ReplaceNestJsConsoleWithNestCommander;
|
|
5
|
-
const node_fs_1 = require("node:fs");
|
|
6
|
-
const package_json_util_1 = require("../../../util/package-json.util");
|
|
7
|
-
exports.stage = "before-install";
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { PackageJson } from "../../../util/package-json.util.js";
|
|
3
|
+
export const stage = "before-install";
|
|
8
4
|
/**
|
|
9
5
|
* Replace the nestjs-console package with nest-commander
|
|
10
6
|
*/
|
|
11
|
-
async function ReplaceNestJsConsoleWithNestCommander() {
|
|
12
|
-
if (!
|
|
7
|
+
export default async function ReplaceNestJsConsoleWithNestCommander() {
|
|
8
|
+
if (!existsSync("api/package.json")) {
|
|
13
9
|
return;
|
|
14
10
|
}
|
|
15
|
-
const packageJson = new
|
|
11
|
+
const packageJson = new PackageJson("api/package.json");
|
|
16
12
|
packageJson.removeDependency("nestjs-console");
|
|
17
13
|
packageJson.addDependency("nest-commander", "^3.16.0");
|
|
18
14
|
packageJson.addDependency("@types/inquirer", "^8.1.3", true);
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const promises_1 = require("fs/promises");
|
|
7
|
-
exports.stage = "before-install";
|
|
8
|
-
async function updateClassValidator() {
|
|
9
|
-
if (!(0, fs_1.existsSync)("api/package.json")) {
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
export const stage = "before-install";
|
|
4
|
+
export default async function updateClassValidator() {
|
|
5
|
+
if (!existsSync("api/package.json")) {
|
|
10
6
|
return;
|
|
11
7
|
}
|
|
12
|
-
const packageJson = JSON.parse(await
|
|
8
|
+
const packageJson = JSON.parse(await readFile("api/package.json", "utf-8"));
|
|
13
9
|
if (packageJson.dependencies) {
|
|
14
10
|
packageJson.dependencies["class-validator"] = "^0.14.0";
|
|
15
11
|
}
|
|
16
|
-
await
|
|
12
|
+
await writeFile("api/package.json", JSON.stringify(packageJson, null, 4));
|
|
17
13
|
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const package_json_util_1 = require("../../../util/package-json.util");
|
|
7
|
-
exports.stage = "before-install";
|
|
8
|
-
async function updateKubernetesClientNode() {
|
|
9
|
-
if (!(0, fs_1.existsSync)("api/package.json")) {
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { PackageJson } from "../../../util/package-json.util.js";
|
|
3
|
+
export const stage = "before-install";
|
|
4
|
+
export default async function updateKubernetesClientNode() {
|
|
5
|
+
if (!existsSync("api/package.json")) {
|
|
10
6
|
return;
|
|
11
7
|
}
|
|
12
|
-
const packageJson = new
|
|
8
|
+
const packageJson = new PackageJson("api/package.json");
|
|
13
9
|
packageJson.updateDependency("@kubernetes/client-node", "^1.0.0");
|
|
14
10
|
packageJson.save();
|
|
15
11
|
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const package_json_util_1 = require("../../../util/package-json.util");
|
|
7
|
-
exports.stage = "before-install";
|
|
8
|
-
async function updateNestDependencies() {
|
|
9
|
-
if (!(0, fs_1.existsSync)("api/package.json")) {
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { PackageJson } from "../../../util/package-json.util.js";
|
|
3
|
+
export const stage = "before-install";
|
|
4
|
+
export default async function updateNestDependencies() {
|
|
5
|
+
if (!existsSync("api/package.json")) {
|
|
10
6
|
return;
|
|
11
7
|
}
|
|
12
|
-
const packageJson = new
|
|
8
|
+
const packageJson = new PackageJson("api/package.json");
|
|
13
9
|
packageJson.updateDependency("@mikro-orm/cli", "^6.0.0");
|
|
14
10
|
packageJson.updateDependency("@mikro-orm/core", "^6.0.0");
|
|
15
11
|
packageJson.updateDependency("@mikro-orm/migrations", "^6.0.0");
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const package_json_util_1 = require("../../../util/package-json.util");
|
|
7
|
-
exports.stage = "before-install";
|
|
8
|
-
async function updateNestDependencies() {
|
|
9
|
-
if (!(0, fs_1.existsSync)("api/package.json")) {
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { PackageJson } from "../../../util/package-json.util.js";
|
|
3
|
+
export const stage = "before-install";
|
|
4
|
+
export default async function updateNestDependencies() {
|
|
5
|
+
if (!existsSync("api/package.json")) {
|
|
10
6
|
return;
|
|
11
7
|
}
|
|
12
|
-
const packageJson = new
|
|
8
|
+
const packageJson = new PackageJson("api/package.json");
|
|
13
9
|
packageJson.addDependency("@apollo/server", "^4.0.0");
|
|
14
10
|
packageJson.removeDependency("apollo-server-core");
|
|
15
11
|
packageJson.removeDependency("apollo-server-express");
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const package_json_util_1 = require("../../../util/package-json.util");
|
|
8
|
-
exports.stage = "before-install";
|
|
9
|
-
async function updateSentry() {
|
|
10
|
-
if (!(0, fs_1.existsSync)("api/package.json")) {
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { Project, SyntaxKind } from "ts-morph";
|
|
3
|
+
import { PackageJson } from "../../../util/package-json.util.js";
|
|
4
|
+
export const stage = "before-install";
|
|
5
|
+
export default async function updateSentry() {
|
|
6
|
+
if (!existsSync("api/package.json")) {
|
|
11
7
|
return;
|
|
12
8
|
}
|
|
13
|
-
const packageJson = new
|
|
9
|
+
const packageJson = new PackageJson("api/package.json");
|
|
14
10
|
packageJson.updateDependency("@sentry/node", "^9.0.0");
|
|
15
11
|
packageJson.save();
|
|
16
|
-
const project = new
|
|
12
|
+
const project = new Project({ tsConfigFilePath: "./api/tsconfig.json" });
|
|
17
13
|
const sourceFile = project.getSourceFile("api/src/main.ts");
|
|
18
14
|
if (!sourceFile)
|
|
19
15
|
throw new Error("main.ts not found");
|
|
20
|
-
sourceFile.getDescendantsOfKind(
|
|
16
|
+
sourceFile.getDescendantsOfKind(SyntaxKind.ExpressionStatement).forEach((node) => {
|
|
21
17
|
if (node.getText() === "app.use(Sentry.Handlers.requestHandler());") {
|
|
22
18
|
node.replaceWithText(`Sentry.setupExpressErrorHandler(app);`);
|
|
23
19
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.default = updateEslint;
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
const ts_morph_1 = require("ts-morph");
|
|
7
|
-
const package_json_util_1 = require("../util/package-json.util");
|
|
1
|
+
import { existsSync, readFileSync, rmSync } from "node:fs";
|
|
2
|
+
import { Project, SyntaxKind } from "ts-morph";
|
|
3
|
+
import { PackageJson } from "../util/package-json.util.js";
|
|
8
4
|
const adminEslintConfig = `import eslintConfigReact from "@comet/eslint-config/react.js";
|
|
9
5
|
|
|
10
6
|
/** @type {import('eslint')} */
|
|
@@ -38,7 +34,7 @@ const config = [
|
|
|
38
34
|
];
|
|
39
35
|
|
|
40
36
|
export default config;`;
|
|
41
|
-
|
|
37
|
+
export const stage = "before-install";
|
|
42
38
|
/**
|
|
43
39
|
* This Updates script is doing following:
|
|
44
40
|
*
|
|
@@ -47,8 +43,8 @@ exports.stage = "before-install";
|
|
|
47
43
|
* - copies content from .eslint.json to new eslint.config.mjs as a comment
|
|
48
44
|
* - deletes old .eslint.json file
|
|
49
45
|
*/
|
|
50
|
-
async function updateEslint() {
|
|
51
|
-
if (
|
|
46
|
+
export default async function updateEslint() {
|
|
47
|
+
if (existsSync("admin/package.json")) {
|
|
52
48
|
updateDevDependenciesInPackageJsons({ packageJsonPath: "admin/package.json" });
|
|
53
49
|
createNewFlatConfigurationFile({
|
|
54
50
|
workingDirectory: "admin/",
|
|
@@ -56,7 +52,7 @@ async function updateEslint() {
|
|
|
56
52
|
});
|
|
57
53
|
deleteOldEslintRc({ workingDirectory: "admin/" });
|
|
58
54
|
}
|
|
59
|
-
if (
|
|
55
|
+
if (existsSync("api/package.json")) {
|
|
60
56
|
updateDevDependenciesInPackageJsons({ packageJsonPath: "api/package.json" });
|
|
61
57
|
createNewFlatConfigurationFile({
|
|
62
58
|
workingDirectory: "api/",
|
|
@@ -64,7 +60,7 @@ async function updateEslint() {
|
|
|
64
60
|
});
|
|
65
61
|
deleteOldEslintRc({ workingDirectory: "api/" });
|
|
66
62
|
}
|
|
67
|
-
if (
|
|
63
|
+
if (existsSync("site/package.json")) {
|
|
68
64
|
updateDevDependenciesInPackageJsons({ packageJsonPath: "site/package.json" });
|
|
69
65
|
createNewFlatConfigurationFile({
|
|
70
66
|
workingDirectory: "site/",
|
|
@@ -72,9 +68,9 @@ async function updateEslint() {
|
|
|
72
68
|
});
|
|
73
69
|
deleteOldEslintRc({ workingDirectory: "site/" });
|
|
74
70
|
// remove .eslintrc.cli.js
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
const packageJson = new
|
|
71
|
+
if (existsSync("site/.eslintrc.cli.js")) {
|
|
72
|
+
rmSync("site/.eslintrc.cli.js");
|
|
73
|
+
const packageJson = new PackageJson("site/package.json");
|
|
78
74
|
packageJson.removeScript("lint:eslint");
|
|
79
75
|
packageJson.addScript("lint:eslint", "eslint --max-warnings 0 src/ **/*.json --no-warn-ignored");
|
|
80
76
|
packageJson.save();
|
|
@@ -83,13 +79,13 @@ async function updateEslint() {
|
|
|
83
79
|
}
|
|
84
80
|
const updateDevDependenciesInPackageJsons = ({ packageJsonPath }) => {
|
|
85
81
|
console.log(`🚀 Update eslint to v9.18.0 in ${packageJsonPath}`);
|
|
86
|
-
const packageJson = new
|
|
82
|
+
const packageJson = new PackageJson(packageJsonPath);
|
|
87
83
|
packageJson.updateDependency("eslint", "^9.18.0");
|
|
88
84
|
packageJson.save();
|
|
89
85
|
};
|
|
90
86
|
const createNewFlatConfigurationFile = ({ workingDirectory, fileContent }) => {
|
|
91
87
|
console.log(`🚀 Create new eslint.config.mjs flat configuration .file ${workingDirectory}`);
|
|
92
|
-
const eslintConfig =
|
|
88
|
+
const eslintConfig = readFileSync(`${workingDirectory}.eslintrc.json`, "utf-8");
|
|
93
89
|
const commentedEslintConfig = eslintConfig
|
|
94
90
|
.split("\n")
|
|
95
91
|
.map((line) => `// ${line}`)
|
|
@@ -100,7 +96,7 @@ const createNewFlatConfigurationFile = ({ workingDirectory, fileContent }) => {
|
|
|
100
96
|
//
|
|
101
97
|
${commentedEslintConfig}
|
|
102
98
|
`;
|
|
103
|
-
const project = new
|
|
99
|
+
const project = new Project({ tsConfigFilePath: `./${workingDirectory}tsconfig.json` });
|
|
104
100
|
const filePath = `${workingDirectory}eslint.config.mjs`;
|
|
105
101
|
const sourceFile = project.createSourceFile(filePath, oldEslintConfigTodo + fileContent, { overwrite: true });
|
|
106
102
|
transferEslintIgnore({ workingDirectory, sourceFile });
|
|
@@ -108,22 +104,22 @@ const createNewFlatConfigurationFile = ({ workingDirectory, fileContent }) => {
|
|
|
108
104
|
};
|
|
109
105
|
const deleteOldEslintRc = ({ workingDirectory }) => {
|
|
110
106
|
console.log(`🚀 Delete old .eslintrc.json configuration file ${workingDirectory}`);
|
|
111
|
-
|
|
107
|
+
rmSync(`${workingDirectory}.eslintrc.json`);
|
|
112
108
|
};
|
|
113
109
|
const transferEslintIgnore = ({ workingDirectory, sourceFile }) => {
|
|
114
110
|
console.log(`🚀 Transfer ignores from .eslintignore to eslint.config.mjs ${workingDirectory}`);
|
|
115
|
-
if (!
|
|
111
|
+
if (!existsSync(`${workingDirectory}.eslintignore`)) {
|
|
116
112
|
return;
|
|
117
113
|
}
|
|
118
|
-
const eslintIgnore =
|
|
114
|
+
const eslintIgnore = readFileSync(`${workingDirectory}.eslintignore`, "utf-8")
|
|
119
115
|
.split("\n")
|
|
120
116
|
.filter((ignore) => ignore.length > 0);
|
|
121
|
-
const arrayLiteral = sourceFile.getVariableStatementOrThrow("config").getDescendantsOfKind(
|
|
117
|
+
const arrayLiteral = sourceFile.getVariableStatementOrThrow("config").getDescendantsOfKind(SyntaxKind.ArrayLiteralExpression)[0];
|
|
122
118
|
const firstObject = arrayLiteral.getElements()[0];
|
|
123
|
-
if (firstObject.isKind(
|
|
119
|
+
if (firstObject.isKind(SyntaxKind.ObjectLiteralExpression)) {
|
|
124
120
|
const ignoresProp = firstObject.getProperty("ignores");
|
|
125
|
-
if (ignoresProp?.isKind(
|
|
126
|
-
const ignoresArray = ignoresProp.getInitializerIfKind(
|
|
121
|
+
if (ignoresProp?.isKind(SyntaxKind.PropertyAssignment)) {
|
|
122
|
+
const ignoresArray = ignoresProp.getInitializerIfKind(SyntaxKind.ArrayLiteralExpression);
|
|
127
123
|
if (ignoresArray) {
|
|
128
124
|
eslintIgnore.forEach((ignore) => {
|
|
129
125
|
if (!ignoresArray?.getElements().some((element) => element.getText() === `"${ignore}"`)) {
|
|
@@ -134,5 +130,5 @@ const transferEslintIgnore = ({ workingDirectory, sourceFile }) => {
|
|
|
134
130
|
}
|
|
135
131
|
}
|
|
136
132
|
console.log(`🚀 Delete old .eslintignore file ${workingDirectory}`);
|
|
137
|
-
|
|
133
|
+
rmSync(`${workingDirectory}.eslintignore`);
|
|
138
134
|
};
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const ts_morph_1 = require("ts-morph");
|
|
6
|
-
exports.stage = "never";
|
|
7
|
-
async function ignoreRestrictedImportsAdmin() {
|
|
8
|
-
const project = new ts_morph_1.Project({ tsConfigFilePath: "./admin/tsconfig.json" });
|
|
1
|
+
import { Project } from "ts-morph";
|
|
2
|
+
export const stage = "never";
|
|
3
|
+
export default async function ignoreRestrictedImportsAdmin() {
|
|
4
|
+
const project = new Project({ tsConfigFilePath: "./admin/tsconfig.json" });
|
|
9
5
|
const sourceFiles = project.getSourceFiles("admin/src/**/*.tsx");
|
|
10
6
|
for (const sourceFile of sourceFiles) {
|
|
11
7
|
const imports = sourceFile.getImportDeclarations();
|
|
@@ -1,35 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.default = updatePrettier;
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
const package_json_util_1 = require("../util/package-json.util");
|
|
7
|
-
exports.stage = "before-install";
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { PackageJson } from "../util/package-json.util.js";
|
|
3
|
+
export const stage = "before-install";
|
|
8
4
|
/**
|
|
9
5
|
* Updates prettier to v3
|
|
10
6
|
*/
|
|
11
|
-
async function updatePrettier() {
|
|
12
|
-
if (
|
|
7
|
+
export default async function updatePrettier() {
|
|
8
|
+
if (existsSync("package.json")) {
|
|
13
9
|
console.log("🚀 Update prettier to v3.4.2 in root");
|
|
14
|
-
const packageJson = new
|
|
10
|
+
const packageJson = new PackageJson("package.json");
|
|
15
11
|
packageJson.updateDependency("prettier", "^3.4.2");
|
|
16
12
|
packageJson.save();
|
|
17
13
|
}
|
|
18
|
-
if (
|
|
14
|
+
if (existsSync("admin/package.json")) {
|
|
19
15
|
console.log("🚀 Update prettier to v3.4.2 in admin");
|
|
20
|
-
const packageJson = new
|
|
16
|
+
const packageJson = new PackageJson("admin/package.json");
|
|
21
17
|
packageJson.updateDependency("prettier", "^3.4.2");
|
|
22
18
|
packageJson.save();
|
|
23
19
|
}
|
|
24
|
-
if (
|
|
20
|
+
if (existsSync("api/package.json")) {
|
|
25
21
|
console.log("🚀 Update prettier to v3.4.2 in api");
|
|
26
|
-
const packageJson = new
|
|
22
|
+
const packageJson = new PackageJson("api/package.json");
|
|
27
23
|
packageJson.updateDependency("prettier", "^3.4.2");
|
|
28
24
|
packageJson.save();
|
|
29
25
|
}
|
|
30
|
-
if (
|
|
26
|
+
if (existsSync("site/package.json")) {
|
|
31
27
|
console.log("🚀 Update prettier to v3.4.2 in site");
|
|
32
|
-
const packageJson = new
|
|
28
|
+
const packageJson = new PackageJson("site/package.json");
|
|
33
29
|
packageJson.updateDependency("prettier", "^3.4.2");
|
|
34
30
|
packageJson.save();
|
|
35
31
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
async function removeReactBarrelImportsAdmin() {
|
|
7
|
-
const project = new ts_morph_1.Project({ tsConfigFilePath: "./admin/tsconfig.json" });
|
|
8
|
-
const files = glob_1.glob.sync(["admin/src/**/*.ts", "admin/src/**/*.tsx"]);
|
|
1
|
+
import { glob } from "glob";
|
|
2
|
+
import { Project } from "ts-morph";
|
|
3
|
+
export default async function removeReactBarrelImportsAdmin() {
|
|
4
|
+
const project = new Project({ tsConfigFilePath: "./admin/tsconfig.json" });
|
|
5
|
+
const files = glob.sync(["admin/src/**/*.ts", "admin/src/**/*.tsx"]);
|
|
9
6
|
for (const filePath of files) {
|
|
10
7
|
const sourceFile = project.getSourceFile(filePath);
|
|
11
8
|
if (!sourceFile)
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
async function removeReactBarrelImportsSite() {
|
|
7
|
-
const project = new ts_morph_1.Project({ tsConfigFilePath: "./site/tsconfig.json" });
|
|
8
|
-
const files = glob_1.glob.sync(["site/src/**/*.ts", "site/src/**/*.tsx"]);
|
|
1
|
+
import { glob } from "glob";
|
|
2
|
+
import { Project } from "ts-morph";
|
|
3
|
+
export default async function removeReactBarrelImportsSite() {
|
|
4
|
+
const project = new Project({ tsConfigFilePath: "./site/tsconfig.json" });
|
|
5
|
+
const files = glob.sync(["site/src/**/*.ts", "site/src/**/*.tsx"]);
|
|
9
6
|
for (const filePath of files) {
|
|
10
7
|
const sourceFile = project.getSourceFile(filePath);
|
|
11
8
|
if (!sourceFile)
|
|
@@ -1,57 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.stage = void 0;
|
|
37
|
-
exports.default = replaceNodeWithV22InNvmrc;
|
|
38
|
-
const fs_1 = require("fs");
|
|
39
|
-
const glob = __importStar(require("glob"));
|
|
40
|
-
exports.stage = "before-install";
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import * as glob from "glob";
|
|
3
|
+
export const stage = "before-install";
|
|
41
4
|
/**
|
|
42
5
|
* Replace node with version 22 in .gitlab-ci yml files
|
|
43
6
|
*/
|
|
44
|
-
async function replaceNodeWithV22InNvmrc() {
|
|
7
|
+
export default async function replaceNodeWithV22InNvmrc() {
|
|
45
8
|
const files = glob.sync("**/.gitlab-ci/*.yml", { nodir: true });
|
|
46
9
|
for (const file of files) {
|
|
47
|
-
let content = await
|
|
10
|
+
let content = await fs.readFile(file, "utf8");
|
|
48
11
|
content = content
|
|
49
12
|
.replace(/node18/g, "node22")
|
|
50
13
|
.replace(/node20/g, "node22")
|
|
51
14
|
.replace(/nodejs18/g, "nodejs22-minimal")
|
|
52
15
|
.replace(/nodejs20-minimal/g, "nodejs22-minimal")
|
|
53
16
|
.replace(/nodejs20/g, "nodejs22-minimal");
|
|
54
|
-
await
|
|
17
|
+
await fs.writeFile(file, content, "utf8");
|
|
55
18
|
}
|
|
56
19
|
console.log("Upgrade complete!");
|
|
57
20
|
}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const node_fs_1 = require("node:fs");
|
|
6
|
-
const promises_1 = require("fs/promises");
|
|
7
|
-
const package_json_util_1 = require("../util/package-json.util");
|
|
8
|
-
exports.stage = "before-install";
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { writeFile } from "node:fs/promises";
|
|
3
|
+
import { PackageJson } from "../util/package-json.util.js";
|
|
4
|
+
export const stage = "before-install";
|
|
9
5
|
/**
|
|
10
6
|
* Replace node with version 22 in .nvmrc and package.json files
|
|
11
7
|
*/
|
|
12
|
-
async function replaceNodeWithV22Locally() {
|
|
13
|
-
if (
|
|
14
|
-
await
|
|
8
|
+
export default async function replaceNodeWithV22Locally() {
|
|
9
|
+
if (existsSync(".nvmrc")) {
|
|
10
|
+
await writeFile(".nvmrc", "22\n");
|
|
15
11
|
}
|
|
16
12
|
else {
|
|
17
13
|
console.warn("Your project doesn't have a .nvmrc file. Skipping the replacement of node version.");
|
|
@@ -22,8 +18,8 @@ async function replaceNodeWithV22Locally() {
|
|
|
22
18
|
}
|
|
23
19
|
function updateTypesNode(microservice) {
|
|
24
20
|
const path = `${microservice}/package.json`;
|
|
25
|
-
if (
|
|
26
|
-
const packageJson = new
|
|
21
|
+
if (existsSync(path)) {
|
|
22
|
+
const packageJson = new PackageJson(path);
|
|
27
23
|
packageJson.updateDependency("@types/node", "^22.0.0");
|
|
28
24
|
packageJson.save();
|
|
29
25
|
}
|