@comet/upgrade 1.96.0 → 1.98.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/index.js CHANGED
@@ -26,10 +26,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
+ const util = __importStar(require("node:util"));
29
30
  const chalk_1 = __importDefault(require("chalk"));
30
31
  const fs_1 = __importDefault(require("fs"));
31
32
  const glob_1 = require("glob");
32
- const util = __importStar(require("node:util"));
33
33
  const path_1 = __importDefault(require("path"));
34
34
  const semver_1 = __importDefault(require("semver"));
35
35
  const execute_command_util_1 = require("./util/execute-command.util");
@@ -240,7 +240,7 @@ async function runEslintFix() {
240
240
  silent: true,
241
241
  });
242
242
  }
243
- catch (err) {
243
+ catch {
244
244
  console.error(`Failed to fix ESLint errors in ${microservice}. You must fix the linting errors yourself.`);
245
245
  }
246
246
  }
@@ -23,6 +23,6 @@ async function removeClearTypesScript() {
23
23
  sitePackageJson.scripts["gql:watch"] = sitePackageJson.scripts["gql:watch"].replace("npm run clear:types && ", "");
24
24
  }
25
25
  const prettierConfig = await prettier_1.default.resolveConfig(process.cwd());
26
- fs_1.default.writeFileSync("site/package.json", prettier_1.default.format(JSON.stringify(sitePackageJson), { ...prettierConfig, parser: "json" }));
26
+ fs_1.default.writeFileSync("site/package.json", await prettier_1.default.format(JSON.stringify(sitePackageJson), { ...prettierConfig, parser: "json" }));
27
27
  }
28
28
  exports.default = removeClearTypesScript;
@@ -26,8 +26,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const fs_1 = __importDefault(require("fs"));
30
29
  const crypto = __importStar(require("node:crypto"));
30
+ const fs_1 = __importDefault(require("fs"));
31
31
  const ts_morph_1 = require("ts-morph");
32
32
  const execute_command_util_1 = require("../util/execute-command.util");
33
33
  async function addSitePreviewSecret() {
@@ -18,7 +18,7 @@ async function moveMaxSrcResolutionInCometConfig() {
18
18
  delete config.imgproxy.maxSrcResolution;
19
19
  }
20
20
  const prettierConfig = await prettier_1.default.resolveConfig(process.cwd());
21
- (0, fs_1.writeFileSync)(cometConfigPath, prettier_1.default.format(JSON.stringify(config), { ...prettierConfig, parser: "json" }));
21
+ (0, fs_1.writeFileSync)(cometConfigPath, await prettier_1.default.format(JSON.stringify(config), { ...prettierConfig, parser: "json" }));
22
22
  }
23
23
  }
24
24
  exports.default = moveMaxSrcResolutionInCometConfig;
@@ -37,10 +37,13 @@ async function updateDamConfiguration() {
37
37
  moduleSpecifier: "@comet/cms-api",
38
38
  });
39
39
  // Add ImgproxyModule configuration
40
- const importsArray = sourceFile.getDescendantsOfKind(ts_morph_1.SyntaxKind.ArrayLiteralExpression).find((array) => {
41
- const parent = array.getParent();
42
- return parent && parent.getKind() === ts_morph_1.SyntaxKind.PropertyAssignment && parent.getName() === "imports";
43
- });
40
+ const importsArray = sourceFile
41
+ .getClass("AppModule")
42
+ ?.getStaticMethod("forRoot")
43
+ ?.getFirstDescendantByKind(ts_morph_1.SyntaxKind.ReturnStatement)
44
+ ?.getFirstDescendantByKind(ts_morph_1.SyntaxKind.ObjectLiteralExpression)
45
+ ?.getProperty("imports")
46
+ ?.getFirstDescendantByKind(ts_morph_1.SyntaxKind.ArrayLiteralExpression);
44
47
  if (importsArray) {
45
48
  const imgproxyModuleCall = sourceFile.getDescendantsOfKind(ts_morph_1.SyntaxKind.CallExpression).find((call) => {
46
49
  const expression = call.getExpression();
@@ -17,7 +17,7 @@ async function updateS3Config() {
17
17
  const storageProp = blobProp.getPropertyOrThrow("storage").getFirstDescendantByKindOrThrow(ts_morph_1.SyntaxKind.ObjectLiteralExpression);
18
18
  s3Prop = storageProp.getPropertyOrThrow("s3").getFirstDescendantByKindOrThrow(ts_morph_1.SyntaxKind.ObjectLiteralExpression);
19
19
  }
20
- catch (error) {
20
+ catch {
21
21
  console.log("☑️ No S3 configuration found in the specified file. Skipping update.");
22
22
  return;
23
23
  }
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stage = void 0;
4
- const promises_1 = require("fs/promises");
5
4
  const node_fs_1 = require("node:fs");
5
+ const promises_1 = require("fs/promises");
6
6
  const package_json_util_1 = require("../util/package-json.util");
7
7
  exports.stage = "before-install";
8
8
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comet/upgrade",
3
- "version": "1.96.0",
3
+ "version": "1.98.0",
4
4
  "description": "Upgrade scripts for Comet DXP",
5
5
  "homepage": "https://github.com/vivid-planet/comet-upgrade#readme",
6
6
  "bugs": {
@@ -15,31 +15,29 @@
15
15
  "main": "lib/index.js",
16
16
  "bin": "bin/index.js",
17
17
  "files": [
18
- "bin/index.js",
19
18
  "lib/**/*.js"
20
19
  ],
21
20
  "scripts": {
22
21
  "build": "npm run clean && tsc",
23
22
  "clean": "rimraf lib/",
24
23
  "lint": "run-p lint:eslint lint:tsc",
25
- "lint:eslint": "eslint --max-warnings 0 src/",
24
+ "lint:eslint": "eslint src/ **/*.json --max-warnings 0 --no-warn-ignored",
26
25
  "lint:tsc": "tsc --noEmit",
27
26
  "prepare": "husky install",
28
27
  "start": "npm run clean && tsc --watch"
29
28
  },
30
29
  "dependencies": {
31
30
  "chalk": "^4.1.2",
32
- "eslint": "^8.57.1",
31
+ "eslint": "^9.37.0",
33
32
  "glob": "^10.4.5",
34
- "prettier": "^2.8.8",
33
+ "prettier": "^3.6.2",
35
34
  "semver": "^7.7.2",
36
35
  "ts-morph": "^22.0.0"
37
36
  },
38
37
  "devDependencies": {
39
- "@comet/eslint-config": "^3.2.7",
38
+ "@comet/eslint-config": "^8.3.0",
40
39
  "@tsconfig/node22": "^22.0.1",
41
40
  "@types/node": "^22.0.0",
42
- "@types/prettier": "^2.7.3",
43
41
  "@types/semver": "^7.7.1",
44
42
  "husky": "^8.0.3",
45
43
  "lint-staged": "^13.3.0",