@lewebsimple/nuxt-graphql 0.1.13 → 0.1.14
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/module.json +1 -1
- package/dist/module.mjs +9 -5
- package/package.json +2 -2
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -175,7 +175,7 @@ function formatDefinitions(defs) {
|
|
|
175
175
|
return defs.map((def) => `${colorOf(def)}${def.name}${reset}`).join(`${dim} / ${reset}`);
|
|
176
176
|
}
|
|
177
177
|
async function runCodegen(options) {
|
|
178
|
-
const {
|
|
178
|
+
const { schema, documents, operationsFile, schemasFile, scalars, generates: customGenerates } = options;
|
|
179
179
|
if (documents.length === 0) {
|
|
180
180
|
logger.warn("No GraphQL documents found");
|
|
181
181
|
return;
|
|
@@ -202,6 +202,8 @@ async function runCodegen(options) {
|
|
|
202
202
|
try {
|
|
203
203
|
const generates = {
|
|
204
204
|
[operationsFile]: {
|
|
205
|
+
schema,
|
|
206
|
+
documents,
|
|
205
207
|
plugins: ["typescript", "typescript-operations", "typed-document-node"],
|
|
206
208
|
config: {
|
|
207
209
|
useTypeImports: true,
|
|
@@ -217,6 +219,8 @@ async function runCodegen(options) {
|
|
|
217
219
|
};
|
|
218
220
|
if (schemasFile) {
|
|
219
221
|
generates[schemasFile] = {
|
|
222
|
+
schema,
|
|
223
|
+
documents,
|
|
220
224
|
plugins: ["typescript-validation-schema"],
|
|
221
225
|
config: {
|
|
222
226
|
schema: "zodv4",
|
|
@@ -236,7 +240,7 @@ async function runCodegen(options) {
|
|
|
236
240
|
Object.assign(generates, customGenerates);
|
|
237
241
|
}
|
|
238
242
|
}
|
|
239
|
-
await generate({
|
|
243
|
+
await generate({ generates, silent: true, errorsOnly: true }, true);
|
|
240
244
|
logger.success(`Generated types for ${documents.length} document(s)`);
|
|
241
245
|
} catch (error) {
|
|
242
246
|
logger.error("GraphQL codegen failed:", error instanceof Error ? error.message : error);
|
|
@@ -308,7 +312,7 @@ const module$1 = defineNuxtModule({
|
|
|
308
312
|
}
|
|
309
313
|
const schemaFile = join(rootDir, schemaOutput);
|
|
310
314
|
const generate = async () => {
|
|
311
|
-
const [
|
|
315
|
+
const [schema, documents] = await Promise.all([
|
|
312
316
|
loadGraphQLSchema(schemaPath),
|
|
313
317
|
findMultipleFiles(layerRootDirs, codegenPattern)
|
|
314
318
|
]);
|
|
@@ -320,14 +324,14 @@ const module$1 = defineNuxtModule({
|
|
|
320
324
|
logger.info(`${cyan}${relativePath}${reset} [${formatDefinitions(defs)}]`);
|
|
321
325
|
}
|
|
322
326
|
await runCodegen({
|
|
323
|
-
|
|
327
|
+
schema,
|
|
324
328
|
documents,
|
|
325
329
|
operationsFile,
|
|
326
330
|
schemasFile,
|
|
327
331
|
scalars: options.codegen?.scalars,
|
|
328
332
|
generates: options.codegen?.generates
|
|
329
333
|
});
|
|
330
|
-
if (writeFileIfChanged(schemaFile,
|
|
334
|
+
if (writeFileIfChanged(schemaFile, schema)) {
|
|
331
335
|
logger.info(`GraphQL schema saved to ${cyan}${schemaOutput}${reset}`);
|
|
332
336
|
}
|
|
333
337
|
const graphqlrc = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lewebsimple/nuxt-graphql",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Opinionated Nuxt module for using GraphQL",
|
|
5
5
|
"repository": "lewebsimple/nuxt-graphql",
|
|
6
6
|
"license": "MIT",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@nuxt/eslint-config": "^1.12.1",
|
|
58
58
|
"@nuxt/module-builder": "^1.0.2",
|
|
59
59
|
"@nuxt/schema": "^4.2.2",
|
|
60
|
-
"@nuxt/test-utils": "^3.
|
|
60
|
+
"@nuxt/test-utils": "^3.22.0",
|
|
61
61
|
"@types/node": "latest",
|
|
62
62
|
"@vitest/coverage-v8": "^4.0.16",
|
|
63
63
|
"changelogen": "^0.6.2",
|