@comet/upgrade 1.74.0 → 1.76.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,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stage = void 0;
|
|
4
|
+
const ts_morph_1 = require("ts-morph");
|
|
5
|
+
exports.stage = "never";
|
|
6
|
+
async function ignoreRestrictedImportsAdmin() {
|
|
7
|
+
const project = new ts_morph_1.Project({ tsConfigFilePath: "./admin/tsconfig.json" });
|
|
8
|
+
const sourceFiles = project.getSourceFiles("admin/src/**/*.tsx");
|
|
9
|
+
for (const sourceFile of sourceFiles) {
|
|
10
|
+
const imports = sourceFile.getImportDeclarations();
|
|
11
|
+
for (const imp of imports) {
|
|
12
|
+
const module = imp.getModuleSpecifierValue();
|
|
13
|
+
if (module === "@mui/material") {
|
|
14
|
+
const namedImports = imp.getNamedImports().map((ni) => ni.getName());
|
|
15
|
+
if (namedImports.includes("Button") || namedImports.includes("Dialog")) {
|
|
16
|
+
// Check for existing comments above
|
|
17
|
+
const statements = imp.getLeadingCommentRanges().map((r) => r.getText());
|
|
18
|
+
const hasEslintComment = statements.some((s) => s.includes("eslint-disable-next-line no-restricted-imports"));
|
|
19
|
+
if (!hasEslintComment) {
|
|
20
|
+
imp.replaceWithText(`// TODO v8: remove eslint-disable-next-line\n// eslint-disable-next-line no-restricted-imports\n${imp.getText()}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
await project.save();
|
|
27
|
+
}
|
|
28
|
+
exports.default = ignoreRestrictedImportsAdmin;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stage = void 0;
|
|
4
|
+
const ts_morph_1 = require("ts-morph");
|
|
5
|
+
exports.stage = "never";
|
|
6
|
+
async function removeV8EslintDisableCommentsAdmin() {
|
|
7
|
+
const project = new ts_morph_1.Project({ tsConfigFilePath: "./admin/tsconfig.json" });
|
|
8
|
+
const sourceFiles = project.getSourceFiles("admin/src/**/*.tsx");
|
|
9
|
+
for (const sourceFile of sourceFiles) {
|
|
10
|
+
const imports = sourceFile.getImportDeclarations();
|
|
11
|
+
// Store comments to remove as [start, end] tuples
|
|
12
|
+
const commentRangesToRemove = [];
|
|
13
|
+
for (const imp of imports) {
|
|
14
|
+
const leadingComments = imp.getLeadingCommentRanges();
|
|
15
|
+
for (let i = 0; i < leadingComments.length - 1; i++) {
|
|
16
|
+
const first = leadingComments[i];
|
|
17
|
+
const second = leadingComments[i + 1];
|
|
18
|
+
const firstText = first.getText();
|
|
19
|
+
const secondText = second.getText();
|
|
20
|
+
if (firstText.includes("TODO v8: remove eslint-disable-next-line") &&
|
|
21
|
+
secondText.includes("eslint-disable-next-line no-restricted-imports")) {
|
|
22
|
+
// Mark both comments for removal
|
|
23
|
+
commentRangesToRemove.push([second.getPos(), second.getEnd()]);
|
|
24
|
+
commentRangesToRemove.push([first.getPos(), first.getEnd()]);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// Remove all comments from the file, in reverse order
|
|
29
|
+
commentRangesToRemove
|
|
30
|
+
.sort((a, b) => b[0] - a[0]) // Sort descending by start index
|
|
31
|
+
.forEach(([start, end]) => {
|
|
32
|
+
sourceFile.removeText(start, end);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
await project.save();
|
|
36
|
+
}
|
|
37
|
+
exports.default = removeV8EslintDisableCommentsAdmin;
|
|
@@ -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
|
|
16
|
-
packageJson.updateDependency("@nestjs/common", "^11.
|
|
17
|
-
packageJson.updateDependency("@nestjs/core", "^11.
|
|
18
|
-
packageJson.updateDependency("@nestjs/graphql", "^13.0
|
|
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.
|
|
21
|
-
packageJson.updateDependency("@nestjs/cli", "^11.0.
|
|
22
|
-
packageJson.updateDependency("@nestjs/schematics", "^11.0.
|
|
23
|
-
packageJson.updateDependency("@nestjs/testing", "^11.
|
|
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");
|