File tree Expand file tree Collapse file tree 5 files changed +20
-9
lines changed
Expand file tree Collapse file tree 5 files changed +20
-9
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " kirimase" ,
3- "version" : " 0.0.44 " ,
3+ "version" : " 0.0.45 " ,
44 "description" : " A Rails-like CLI for building full-stack Next.js apps faster" ,
55 "main" : " index.js" ,
66 "type" : " module" ,
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import {
3636 askDbType ,
3737 askMiscPackages ,
3838 askOrm ,
39+ askPscale ,
3940} from "./prompts.js" ;
4041import {
4142 addContextProviderToLayout ,
@@ -73,7 +74,7 @@ const promptUser = async (options?: InitOptions): Promise<InitOptions> => {
7374 const dbType =
7475 orm === null || config . driver ? undefined : await askDbType ( options ) ;
7576
76- const dbProvider =
77+ let dbProvider =
7778 config . orm ||
7879 orm === "prisma" ||
7980 orm === null ||
@@ -82,6 +83,11 @@ const promptUser = async (options?: InitOptions): Promise<InitOptions> => {
8283 ? undefined
8384 : await askDbProvider ( options , dbType , config . preferredPackageManager ) ;
8485
86+ if ( orm === "prisma" && dbType === "mysql" ) {
87+ const usePscale = await askPscale ( options ) ;
88+ if ( usePscale ) dbProvider = "planetscale" ;
89+ }
90+
8591 const auth = config . auth || ! orm ? undefined : await askAuth ( options ) ;
8692
8793 const authProviders =
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ import {
2121 prismaGenerate ,
2222 updateTsConfigPrismaTypeAlias ,
2323} from "../utils.js" ;
24- import { consola } from "consola" ;
2524import { addToPrismaSchema } from "../../../generate/utils.js" ;
2625import { formatFilePath , getDbIndexPath } from "../../../filePaths/index.js" ;
2726import { addToInstallList } from "../../utils.js" ;
@@ -39,14 +38,10 @@ export const addPrisma = async (
3938
4039 // if mysql, ask if planetscale
4140 if ( dbType === "mysql" ) {
42- const usingPlanetscale = await confirm ( {
43- message : "Are you using PlanetScale?" ,
44- default : false ,
45- } ) ;
4641 // scaffold planetscale specific schema
4742 createFile (
4843 `prisma/schema.prisma` ,
49- generatePrismaSchema ( dbType , usingPlanetscale )
44+ generatePrismaSchema ( dbType , initOptions . dbProvider === "planetscale" )
5045 ) ;
5146 updateConfigFile ( { provider : "planetscale" } ) ;
5247 createDotEnv (
Original file line number Diff line number Diff line change @@ -76,6 +76,16 @@ export const askDbProvider = async (
7676 ) ;
7777} ;
7878
79+ export const askPscale = async ( options : InitOptions ) => {
80+ return (
81+ options . dbProvider ??
82+ ( await confirm ( {
83+ message : "Are you using PlanetScale?" ,
84+ default : false ,
85+ } ) )
86+ ) ;
87+ } ;
88+
7989export const askExampleModel = async ( options : InitOptions ) => {
8090 return (
8191 options . includeExample ??
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { buildSchema } from "./commands/generate/index.js";
66import { addPackage } from "./commands/add/index.js" ;
77
88const program = new Command ( ) ;
9- program . name ( "kirimase" ) . description ( "Kirimase CLI" ) . version ( "0.0.44 " ) ;
9+ program . name ( "kirimase" ) . description ( "Kirimase CLI" ) . version ( "0.0.45 " ) ;
1010
1111addCommonOptions ( program . command ( "init" ) )
1212 . description ( "initialise and configure kirimase within directory" )
You can’t perform that action at this time.
0 commit comments