From 30977a9dda2cfebad5163523d165869b430b1df9 Mon Sep 17 00:00:00 2001 From: Christian Preston Date: Thu, 8 Dec 2022 10:19:00 -0500 Subject: [PATCH 1/2] fix: codegen error on layers extend --- src/module.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/module.ts b/src/module.ts index e4a7987a..080675ea 100644 --- a/src/module.ts +++ b/src/module.ts @@ -280,10 +280,13 @@ export default defineNuxtModule({ if (config.watch) { nuxt.hook('builder:watch', async (event, path) => { - if (!path.match(/\.(gql|graphql)$/)) { return } + // Ignore paths with `../` for nuxt layers & non gql files + if (!path.match(/\.(gql|graphql)$/) || path.match(/^\.\.\//)) { return } - if (event !== 'unlink' && !allowDocument(path)) { return } + // Ignore schema files & `unlink` events + if (event !== 'unlink' && !allowDocument(path) || event === 'unlink') { return } + // Start Codegen Generation const start = Date.now() await generateGqlTypes(path) await nuxt.callHook('builder:generateApp') From 25525e0a65cdbd8462348e5f50f957ac4cc7006b Mon Sep 17 00:00:00 2001 From: Christian Preston Date: Thu, 8 Dec 2022 10:29:20 -0500 Subject: [PATCH 2/2] chore: lint --- src/module.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module.ts b/src/module.ts index 080675ea..64ff3457 100644 --- a/src/module.ts +++ b/src/module.ts @@ -284,7 +284,7 @@ export default defineNuxtModule({ if (!path.match(/\.(gql|graphql)$/) || path.match(/^\.\.\//)) { return } // Ignore schema files & `unlink` events - if (event !== 'unlink' && !allowDocument(path) || event === 'unlink') { return } + if ((event !== 'unlink' && !allowDocument(path)) || (event === 'unlink')) { return } // Start Codegen Generation const start = Date.now()