@comet/upgrade 1.74.0 → 1.75.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,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ts_morph_1 = require("ts-morph");
4
+ /**
5
+ * From
6
+ *
7
+ * GraphQLModule.forRootAsync<ApolloDriverConfig>({
8
+ * useFactory: (moduleRef: ModuleRef) => ({
9
+ * playground: config.debug,
10
+ * }),
11
+ * }),
12
+ *
13
+ * to
14
+ *
15
+ * GraphQLModule.forRootAsync<ApolloDriverConfig>({
16
+ * useFactory: (moduleRef: ModuleRef) => ({
17
+ * graphiql: config.debug ? { url: "/api/graphql" } : undefined,
18
+ * playground: false,
19
+ * }),
20
+ * }),
21
+ */
22
+ function default_1() {
23
+ const project = new ts_morph_1.Project();
24
+ const filePath = "api/src/app.module.ts";
25
+ const sourceFile = project.addSourceFileAtPath(filePath);
26
+ for (const node of sourceFile.getDescendants()) {
27
+ if (node.getKind() === ts_morph_1.SyntaxKind.CallExpression && node.getText().startsWith("GraphQLModule.forRootAsync")) {
28
+ const callExpr = node.asKindOrThrow(ts_morph_1.SyntaxKind.CallExpression);
29
+ const arg = callExpr.getArguments()[0];
30
+ if (arg && arg.getKind() === ts_morph_1.SyntaxKind.ObjectLiteralExpression) {
31
+ const obj = arg.asKindOrThrow(ts_morph_1.SyntaxKind.ObjectLiteralExpression);
32
+ const useFactoryProp = obj.getProperty("useFactory");
33
+ if (useFactoryProp && useFactoryProp.getKind() === ts_morph_1.SyntaxKind.PropertyAssignment) {
34
+ const useFactory = useFactoryProp.asKindOrThrow(ts_morph_1.SyntaxKind.PropertyAssignment);
35
+ const arrowFunc = useFactory.getInitializerIfKind(ts_morph_1.SyntaxKind.ArrowFunction);
36
+ if (arrowFunc) {
37
+ const body = arrowFunc.getBody();
38
+ if (body.getKind() === ts_morph_1.SyntaxKind.ParenthesizedExpression) {
39
+ const retObj = body.getFirstChildByKind(ts_morph_1.SyntaxKind.ObjectLiteralExpression);
40
+ if (retObj) {
41
+ if (retObj.getProperty("graphiql")) {
42
+ return; // Already has graphiql property
43
+ }
44
+ // Replace playground: config.debug with playground: false
45
+ const playgroundProp = retObj.getProperty("playground");
46
+ if (playgroundProp) {
47
+ playgroundProp.replaceWithText("playground: false");
48
+ }
49
+ const graphiqlProperty = retObj.insertPropertyAssignment(playgroundProp ? playgroundProp.getChildIndex() - 1 : 0, {
50
+ name: "graphiql",
51
+ initializer: 'config.debug ? { url: "/api/graphql" } : undefined',
52
+ });
53
+ graphiqlProperty.replaceWithText(`// eslint-disable-next-line @cspell/spellchecker\n${graphiqlProperty.getText()}`);
54
+ break;
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+ sourceFile.saveSync();
63
+ }
64
+ exports.default = default_1;
@@ -12,15 +12,15 @@ async function updateNestDependencies() {
12
12
  packageJson.addDependency("@apollo/server", "^4.0.0");
13
13
  packageJson.removeDependency("apollo-server-core");
14
14
  packageJson.removeDependency("apollo-server-express");
15
- packageJson.updateDependency("@nestjs/apollo", "^13.0.3");
16
- packageJson.updateDependency("@nestjs/common", "^11.0.10");
17
- packageJson.updateDependency("@nestjs/core", "^11.0.10");
18
- packageJson.updateDependency("@nestjs/graphql", "^13.0.3");
15
+ packageJson.updateDependency("@nestjs/apollo", "^13.1.0");
16
+ packageJson.updateDependency("@nestjs/common", "^11.1.3");
17
+ packageJson.updateDependency("@nestjs/core", "^11.1.3");
18
+ packageJson.updateDependency("@nestjs/graphql", "^13.1.0");
19
19
  packageJson.updateDependency("@nestjs/mapped-types", "^2.1.0");
20
- packageJson.updateDependency("@nestjs/platform-express", "^11.0.10");
21
- packageJson.updateDependency("@nestjs/cli", "^11.0.3");
22
- packageJson.updateDependency("@nestjs/schematics", "^11.0.1");
23
- packageJson.updateDependency("@nestjs/testing", "^11.0.0");
20
+ packageJson.updateDependency("@nestjs/platform-express", "^11.1.3");
21
+ packageJson.updateDependency("@nestjs/cli", "^11.0.7");
22
+ packageJson.updateDependency("@nestjs/schematics", "^11.0.5");
23
+ packageJson.updateDependency("@nestjs/testing", "^11.1.3");
24
24
  packageJson.updateDependency("graphql", "^16.10.0");
25
25
  packageJson.updateDependency("express", "^5.0.1");
26
26
  packageJson.updateDependency("@types/express", "^5.0.0");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comet/upgrade",
3
- "version": "1.74.0",
3
+ "version": "1.75.0",
4
4
  "description": "Upgrade scripts for Comet DXP",
5
5
  "homepage": "https://github.com/vivid-planet/comet-upgrade#readme",
6
6
  "bugs": {