diff --git a/src/frameworks/index.ts b/src/frameworks/index.ts index 3c28e112..b95829b8 100644 --- a/src/frameworks/index.ts +++ b/src/frameworks/index.ts @@ -25,7 +25,7 @@ const dynamicImport = async (getProjectPath: PathFactory) => { const packageJsonBuffer = await readFile(getProjectPath('package.json')); const packageJson = JSON.parse(packageJsonBuffer.toString()); if (packageJson.directories?.serve) return import('./express/index.js'); - if (fileExists('next.config.js')) return import('./next.js/index.js'); + if (fileExists('next.config.js') || findDependency('next', getProjectPath(), 0)) return import('./next.js/index.js'); if (fileExists('nuxt.config.js', 'nuxt.config.ts')) return import('./nuxt/index.js'); if (fileExists('angular.json')) return import('./angular/index.js'); throw UNKNOWN_FRAMEWORK; diff --git a/src/utils.ts b/src/utils.ts index 1adaaa18..b7872135 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -60,8 +60,8 @@ export type DeployConfig = { export type PathFactory = (...args: string[]) => string; -export const findDependency = (name: string, cwd=process.cwd()) => { - const result = spawnSync(Commands.NPM, ['list', name, '--json', '--omit', 'dev'], { cwd }); +export const findDependency = (name: string, cwd=process.cwd(), depth?: number) => { + const result = spawnSync(Commands.NPM, ['list', name, '--json', '--omit', 'dev', ...(depth === undefined ? [] : ['--depth', depth.toString(10)])], { cwd }); if (!result.stdout) return undefined; const json = JSON.parse(result.stdout.toString()); const search = (searchingFor: string, dependencies={}): any => {