@@ -73,6 +73,8 @@ import { logger } from "../../logger";
7373const DEFAULT_BUILD_SCRIPT = [ "next build" ] ;
7474const PUBLIC_DIR = "public" ;
7575
76+ export const supportedRange = "12 - 14.0" ;
77+
7678export const name = "Next.js" ;
7779export const support = SupportLevel . Preview ;
7880export const type = FrameworkType . MetaFramework ;
@@ -90,9 +92,10 @@ function getReactVersion(cwd: string): string | undefined {
9092 */
9193export async function discover ( dir : string ) {
9294 if ( ! ( await pathExists ( join ( dir , "package.json" ) ) ) ) return ;
93- if ( ! ( await pathExists ( "next.config.js" ) ) && ! getNextVersion ( dir ) ) return ;
95+ const version = getNextVersion ( dir ) ;
96+ if ( ! ( await pathExists ( "next.config.js" ) ) && ! version ) return ;
9497
95- return { mayWantBackend : true , publicDirectory : join ( dir , PUBLIC_DIR ) } ;
98+ return { mayWantBackend : true , publicDirectory : join ( dir , PUBLIC_DIR ) , version } ;
9699}
97100
98101/**
@@ -317,9 +320,9 @@ export async function init(setup: any, config: any) {
317320 choices : [ "JavaScript" , "TypeScript" ] ,
318321 } ) ;
319322 execSync (
320- `npx --yes create-next-app@latest -e hello-world ${ setup . hosting . source } --use-npm ${
321- language === "TypeScript" ? "--ts" : "--js"
322- } `,
323+ `npx --yes create-next-app@" ${ supportedRange } " -e hello-world ${
324+ setup . hosting . source
325+ } --use-npm ${ language === "TypeScript" ? "--ts" : "--js" } `,
323326 { stdio : "inherit" , cwd : config . projectDir }
324327 ) ;
325328}
0 commit comments