Skip to content

Commit 066b6c8

Browse files
committed
Optional next.config.js
1 parent a1eb7c9 commit 066b6c8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/frameworks/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const dynamicImport = async (getProjectPath: PathFactory) => {
2525
const packageJsonBuffer = await readFile(getProjectPath('package.json'));
2626
const packageJson = JSON.parse(packageJsonBuffer.toString());
2727
if (packageJson.directories?.serve) return import('./express/index.js');
28-
if (fileExists('next.config.js')) return import('./next.js/index.js');
28+
if (fileExists('next.config.js') || findDependency('next', getProjectPath(), 0)) return import('./next.js/index.js');
2929
if (fileExists('nuxt.config.js', 'nuxt.config.ts')) return import('./nuxt/index.js');
3030
if (fileExists('angular.json')) return import('./angular/index.js');
3131
throw UNKNOWN_FRAMEWORK;

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export type DeployConfig = {
6060

6161
export type PathFactory = (...args: string[]) => string;
6262

63-
export const findDependency = (name: string, cwd=process.cwd()) => {
64-
const result = spawnSync(Commands.NPM, ['list', name, '--json', '--omit', 'dev'], { cwd });
63+
export const findDependency = (name: string, cwd=process.cwd(), depth?: number) => {
64+
const result = spawnSync(Commands.NPM, ['list', name, '--json', '--omit', 'dev', ...(depth === undefined ? [] : ['--depth', depth.toString(10)])], { cwd });
6565
if (!result.stdout) return undefined;
6666
const json = JSON.parse(result.stdout.toString());
6767
const search = (searchingFor: string, dependencies={}): any => {

0 commit comments

Comments
 (0)