@eddeee888/gcg-typescript-resolver-files 0.18.1 → 0.18.3
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/dist/defineConfig.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export declare const defineConfig: (presetConfig?: TypedPresetConfig, context?:
|
|
|
4
4
|
baseOutputDir?: string;
|
|
5
5
|
schema?: Types.ConfiguredOutput["schema"];
|
|
6
6
|
hooks?: Types.ConfiguredOutput["hooks"];
|
|
7
|
-
}) => Pick<Types.ConfiguredOutput, "preset" | "presetConfig" | "watchPattern" | "schema" | "hooks">;
|
|
7
|
+
}) => Pick<Types.ConfiguredOutput, "preset" | "presetConfig" | "watchPattern" | "schema" | "hooks" | "overwrite">;
|
package/dist/defineConfig.js
CHANGED
|
@@ -12,5 +12,13 @@ export const defineConfig = (presetConfig = {}, context = {}) => {
|
|
|
12
12
|
watchPattern,
|
|
13
13
|
schema,
|
|
14
14
|
hooks,
|
|
15
|
+
overwrite: {
|
|
16
|
+
// Server Preset needs to update existing resolver files
|
|
17
|
+
updateExistingFiles: true,
|
|
18
|
+
// When watching, it's common to avoid sending all files to Codegen to write to fs.
|
|
19
|
+
// When that happens, previously tracked files are marked as stale and gets removed wrongly.
|
|
20
|
+
// Therefore, we don't remove stale files.
|
|
21
|
+
removeStaleFiles: false,
|
|
22
|
+
},
|
|
15
23
|
};
|
|
16
24
|
};
|
|
@@ -98,16 +98,16 @@ export const postProcessFiles = ({ config: { tsMorph: { project }, fixObjectType
|
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
});
|
|
101
|
+
// 4. Apply to result files the updated content done in step 2. and 3. above
|
|
102
|
+
sourceFilesToProcess.forEach(({ sourceFile, resolverFile }) => {
|
|
103
|
+
const normalizedRelativePath = path.posix.relative(cwd(), sourceFile.getFilePath());
|
|
104
|
+
// Overwrite existing files with fixes
|
|
105
|
+
result.files[normalizedRelativePath] = {
|
|
106
|
+
...resolverFile,
|
|
107
|
+
content: sourceFile.getText(),
|
|
108
|
+
};
|
|
109
|
+
});
|
|
101
110
|
}
|
|
102
|
-
// 4. Apply to result files the updated content done in step 2. and 3. above
|
|
103
|
-
sourceFilesToProcess.forEach(({ sourceFile, resolverFile }) => {
|
|
104
|
-
const normalizedRelativePath = path.posix.relative(cwd(), sourceFile.getFilePath());
|
|
105
|
-
// Overwrite existing files with fixes
|
|
106
|
-
result.files[normalizedRelativePath] = {
|
|
107
|
-
...resolverFile,
|
|
108
|
-
content: sourceFile.getText(),
|
|
109
|
-
};
|
|
110
|
-
});
|
|
111
111
|
};
|
|
112
112
|
/**
|
|
113
113
|
* Ensure correctly named resolvers are exported
|
package/dist/preset.js
CHANGED
|
@@ -18,6 +18,7 @@ import { validateAndMergeParsedConfigs } from './validateAndMergeParsedConfigs/i
|
|
|
18
18
|
import { normalizeAddConfigPath } from './normalizeAddConfigPath/index.js';
|
|
19
19
|
import { logger } from './utils/index.js';
|
|
20
20
|
export const presetName = '@eddeee888/gcg-typescript-resolver-files';
|
|
21
|
+
let tsMorphProject;
|
|
21
22
|
export const preset = {
|
|
22
23
|
buildGeneratesSection: async ({ schema, schemaAst, presetConfig: rawPresetConfig, baseOutputDir, config: baseConfig, profiler = createNoopProfiler(), }) => {
|
|
23
24
|
if (!schemaAst) {
|
|
@@ -35,7 +36,16 @@ export const preset = {
|
|
|
35
36
|
baseOutputDir,
|
|
36
37
|
moduleNamingMode,
|
|
37
38
|
});
|
|
38
|
-
|
|
39
|
+
if (!tsMorphProject) {
|
|
40
|
+
tsMorphProject = await profiler.run(async () => new Project(tsMorphProjectOptions), createProfilerRunName('Initialising ts-morph project'));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
await profiler.run(async () => {
|
|
44
|
+
tsMorphProject
|
|
45
|
+
.getSourceFiles()
|
|
46
|
+
.forEach((sourceFile) => sourceFile.refreshFromFileSystemSync());
|
|
47
|
+
}, createProfilerRunName('Refreshing ts-morph project files'));
|
|
48
|
+
}
|
|
39
49
|
const typeMappersMap = await profiler.run(async () => parseTypeMappers({
|
|
40
50
|
sourceMap,
|
|
41
51
|
resolverTypesPath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eddeee888/gcg-typescript-resolver-files",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/eddeee888/graphql-code-generator-plugins.git",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@graphql-codegen/add": "^7.1.0",
|
|
44
|
-
"@graphql-codegen/plugin-helpers": "^7.
|
|
44
|
+
"@graphql-codegen/plugin-helpers": "^7.2.0",
|
|
45
45
|
"@graphql-codegen/schema-ast": "^6.1.0",
|
|
46
46
|
"@graphql-codegen/typescript": "^6.1.0",
|
|
47
47
|
"@graphql-codegen/typescript-resolvers": "^6.1.0",
|