Skip to content

Commit 8728b30

Browse files
committed
fix: remove fs-extra
1 parent ec9698c commit 8728b30

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/runtime/src/templates/handlerUtils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { promisify } from 'util'
77

88
import { HandlerEvent, HandlerResponse } from '@netlify/functions'
99
import { http, https } from 'follow-redirects'
10-
import { readJSON } from 'fs-extra'
1110
import NextNodeServer from 'next/dist/server/next-server'
1211
import { satisfies } from 'semver'
1312

@@ -284,16 +283,17 @@ export const resolveModuleRoot = (moduleName) => {
284283
}
285284
}
286285
// Had to copy nextPluginVersion logic from functionsMetaData for it to work within server.ts and getHandler.ts
287-
const nextPluginVersion = async (module: string) => {
288-
const moduleRoot = resolveModuleRoot(module)
286+
const nextPluginVersion = async () => {
287+
const moduleRoot = resolveModuleRoot('next')
289288
if (!existsSync(moduleRoot)) {
290289
return
291290
}
292-
const packagePlugin = await readJSON(join(moduleRoot, 'package.json'))
291+
const packagePath = join(moduleRoot, 'package.json')
292+
const packagePlugin = await fs.promises.readFile(packagePath, 'utf-8').then((contents) => JSON.parse(contents))
293293
return packagePlugin?.version
294294
}
295295

296-
export const nextVersionNum = async () => satisfies(await nextPluginVersion('next'), '13.3.3 - 13.4.9')
296+
export const nextVersionNum = async () => satisfies(await nextPluginVersion(), '13.3.3 - 13.4.9')
297297

298298
export const getMatchedRoute = (
299299
paths: string,

0 commit comments

Comments
 (0)