@comet/upgrade 1.38.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;
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* Add peer dependencies defined by NestJS to the project.
|
|
9
|
+
*/
|
|
10
|
+
async function addNestPeerDependencies() {
|
|
11
|
+
if (!(0, fs_1.existsSync)("api/package.json")) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const packageJson = new package_json_util_1.PackageJson("api/package.json");
|
|
15
|
+
packageJson.addDependency("class-transformer", "^0.5.1");
|
|
16
|
+
packageJson.addDependency("reflect-metadata", "^0.2.2");
|
|
17
|
+
packageJson.addDependency("rxjs", "^7.8.1");
|
|
18
|
+
packageJson.save();
|
|
19
|
+
}
|
|
20
|
+
exports.default = addNestPeerDependencies;
|