Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
fix: adopt forward-compatible approach to builder:watch (#247)
Browse files Browse the repository at this point in the history
* fix: adopt forward-compatible approach to `builder:watch`

* fix: lint issues

* Apply suggestions from code review
  • Loading branch information
danielroe authored Mar 28, 2024
1 parent 78dc6b8 commit b5e225a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/nuxt/src/runtime/modules/drizzle/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { join } from 'node:path'
import { join, relative, resolve } from 'node:path'
import { execSync } from 'node:child_process'
import { addServerImportsDir, createResolver } from '@nuxt/kit'
import { camelCase } from 'scule'
Expand Down Expand Up @@ -169,6 +169,7 @@ export default definePergelModule<DrizzleConfig, ResolvedDrizzleConfig>({
if (nuxt.options.dev) {
// Watch for changes
nuxt.hook('builder:watch', async (event, path) => {
path = relative(nuxt.options.srcDir, resolve(nuxt.options.srcDir, path))
const match = globsBuilderWatch(
nuxt,
path,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { join } from 'node:path'
import { join, relative, resolve } from 'node:path'
import { matchGlobs } from '../utils'
import type { ResolvedGraphQLYogaConfig } from '../types'
import type { NuxtPergel } from '../../../core/types/nuxtModule'
Expand All @@ -22,6 +22,7 @@ export function generateGraphQLTemplate(data: {

if (data.nuxt.options.dev) {
data.nuxt.hook('builder:watch', async (event, path) => {
path = relative(data.nuxt.options.srcDir, resolve(data.nuxt.options.srcDir, path))
const test = globsBuilderWatch(data.nuxt, path, '.graphql')
if (!test)
return
Expand Down

0 comments on commit b5e225a

Please sign in to comment.