@comet/upgrade 1.39.0 → 1.40.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.
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const promises_1 = require("fs/promises");
4
+ const format_code_util_1 = require("../util/format-code.util");
5
+ /**
6
+ * Replaces the old ExceptionInterceptor with the new ExceptionFilter
7
+ */
8
+ async function replaceExceptionInterceptorWithExceptionFilter() {
9
+ const filePath = "api/src/main.ts";
10
+ let fileContent = (await (0, promises_1.readFile)(filePath)).toString();
11
+ if (!fileContent.includes("ExceptionInterceptor")) {
12
+ console.log("ExceptionInterceptor not found in main.ts. Make sure that you use the new ExceptionFilter.");
13
+ return;
14
+ }
15
+ fileContent = fileContent.replace("app.useGlobalInterceptors(new ExceptionInterceptor(config.debug));", "app.useGlobalFilters(new ExceptionFilter(config.debug));");
16
+ fileContent = fileContent.replace("ExceptionInterceptor", "ExceptionFilter");
17
+ await (0, promises_1.writeFile)(filePath, await (0, format_code_util_1.formatCode)(fileContent, filePath));
18
+ }
19
+ exports.default = replaceExceptionInterceptorWithExceptionFilter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comet/upgrade",
3
- "version": "1.39.0",
3
+ "version": "1.40.0",
4
4
  "description": "Upgrade scripts for Comet DXP",
5
5
  "homepage": "https://github.com/vivid-planet/comet-upgrade#readme",
6
6
  "bugs": {