@@ -35,6 +35,7 @@ import { maybeSetupDeployProject } from './deploy-setup.ts';
3535import { maybeScaffoldEnvTs } from './env-scaffold.ts' ;
3636import { migrateFrameworkAdapterPaths } from './framework-config-migrate.ts' ;
3737import { initialCommitCommand , setupGit } from './init-git.ts' ;
38+ import { commandInProject } from './init-shell.ts' ;
3839import { configureVitePlusScaffold } from './init-vite-plus.ts' ;
3940import { migrateLegacyVoidConfig } from './migrate.ts' ;
4041import { formatUrl , note , printSuccess } from './output.ts' ;
@@ -1423,19 +1424,27 @@ function writeDatabaseDialect(root: string, config: VoidConfig, dialect: Databas
14231424 writeVoidProjectConfig ( root , next ) ;
14241425}
14251426
1427+ /** `quiet` is for a new starter, whose prompt already showed the database. */
1428+ type DatabaseDialectOptions = { quiet ?: boolean } ;
1429+
14261430function clearConfiguredDatabase (
14271431 root : string ,
14281432 messages : { unchanged : string ; updated : string } ,
1433+ options : DatabaseDialectOptions ,
14291434) : void {
14301435 const config = readConfig ( root ) ;
14311436
14321437 if ( getDatabaseDialect ( config ) === 'sqlite' ) {
1433- log . info ( messages . unchanged ) ;
1438+ if ( ! options . quiet ) {
1439+ log . info ( messages . unchanged ) ;
1440+ }
14341441 return ;
14351442 }
14361443
14371444 writeDatabaseDialect ( root , config , 'sqlite' ) ;
1438- log . step ( messages . updated ) ;
1445+ if ( ! options . quiet ) {
1446+ log . step ( messages . updated ) ;
1447+ }
14391448}
14401449
14411450/** Remove `database` entirely: its casing alone still makes Void serve `void/db`. */
@@ -1451,35 +1460,51 @@ function removeDatabaseConfig(root: string): void {
14511460 log . step ( 'Removed database config from void.config.ts' ) ;
14521461}
14531462
1454- function applyDatabaseDialect ( root : string , dialect : DatabaseDialect ) : void {
1463+ function applyDatabaseDialect (
1464+ root : string ,
1465+ dialect : DatabaseDialect ,
1466+ options : DatabaseDialectOptions = { } ,
1467+ ) : void {
14551468 const config = readConfig ( root ) ;
14561469
14571470 if ( dialect === 'postgresql' ) {
14581471 if ( getDatabaseDialect ( config ) === 'postgresql' ) {
1459- log . info ( 'PostgreSQL already configured in void.config.ts' ) ;
1472+ if ( ! options . quiet ) {
1473+ log . info ( 'PostgreSQL already configured in void.config.ts' ) ;
1474+ }
14601475 return ;
14611476 }
14621477
14631478 writeDatabaseDialect ( root , config , 'postgresql' ) ;
1464- log . step ( 'Configured PostgreSQL in void.config.ts' ) ;
1479+ if ( ! options . quiet ) {
1480+ log . step ( 'Configured PostgreSQL in void.config.ts' ) ;
1481+ }
14651482 return ;
14661483 }
14671484
14681485 if ( dialect === 'mysql' ) {
14691486 if ( getDatabaseDialect ( config ) === 'mysql' ) {
1470- log . info ( 'MySQL already configured in void.config.ts' ) ;
1487+ if ( ! options . quiet ) {
1488+ log . info ( 'MySQL already configured in void.config.ts' ) ;
1489+ }
14711490 return ;
14721491 }
14731492
14741493 writeDatabaseDialect ( root , config , 'mysql' ) ;
1475- log . step ( 'Configured MySQL in void.config.ts' ) ;
1494+ if ( ! options . quiet ) {
1495+ log . step ( 'Configured MySQL in void.config.ts' ) ;
1496+ }
14761497 return ;
14771498 }
14781499
1479- clearConfiguredDatabase ( root , {
1480- unchanged : 'Using default D1 (SQLite) configuration' ,
1481- updated : 'Updated void.config.ts to use the default D1 (SQLite) configuration' ,
1482- } ) ;
1500+ clearConfiguredDatabase (
1501+ root ,
1502+ {
1503+ unchanged : 'Using default D1 (SQLite) configuration' ,
1504+ updated : 'Updated void.config.ts to use the default D1 (SQLite) configuration' ,
1505+ } ,
1506+ options ,
1507+ ) ;
14831508}
14841509
14851510function detectDatabaseSetup ( root : string ) : DatabaseSetupChoice {
@@ -2330,7 +2355,7 @@ function scaffoldPagesApp(
23302355
23312356 ensureGitignore ( root ) ;
23322357 if ( starterMode !== 'static' ) {
2333- applyDatabaseDialect ( root , starterMode ) ;
2358+ applyDatabaseDialect ( root , starterMode , { quiet : true } ) ;
23342359 }
23352360
23362361 if ( starterMode === 'postgresql' ) {
@@ -2768,7 +2793,7 @@ export async function runInitCommand(root: string, initArgs?: InitArgs): Promise
27682793 }
27692794
27702795 if ( ! targeted && ! framework && isScaffoldableEmptyProject ( root ) ) {
2771- log . info ( 'Empty project detected. Scaffolding a Pages starter.. .' ) ;
2796+ log . info ( 'Empty project detected. Creating a Pages starter.' ) ;
27722797 const scaffoldToolchain = await promptScaffoldToolchain ( initArgs ?. toolchain ) ;
27732798 if ( detectedPagesFramework ) {
27742799 scaffoldedPagesFramework = detectedPagesFramework ;
@@ -2891,10 +2916,11 @@ export async function runInitCommand(root: string, initArgs?: InitArgs): Promise
28912916 log . info ( 'Bundled Void docs: node_modules/void/docs/' ) ;
28922917 }
28932918
2894- // Demo code only in the full flow, and not for meta-frameworks.
2895- if ( ! targeted && ! framework ) {
2919+ // Demo code only in the full flow, and not for meta-frameworks or a new
2920+ // starter, which already has its own pages.
2921+ if ( ! targeted && ! framework && ! didScaffoldStarter ) {
28962922 const existingDemoFiles = Object . values ( demoFiles ( root ) ) . filter ( ( file ) => existsSync ( file ) ) ;
2897- if ( didScaffoldStarter || state . hasRoutes || state . hasMigrations || state . hasPages ) {
2923+ if ( state . hasRoutes || state . hasMigrations || state . hasPages ) {
28982924 log . info ( 'Project already has pages, routes, or migrations, skipping demo' ) ;
28992925 } else if ( hasDrizzleSchema ( root ) ) {
29002926 log . info ( 'Project already has a database schema, skipping demo' ) ;
@@ -3038,8 +3064,7 @@ export async function runInitCommand(root: string, initArgs?: InitArgs): Promise
30383064 printSuccess ( 'Project initialized. Run your workspace install to finish setup.' ) ;
30393065 }
30403066 } else {
3041- printSuccess (
3042- `Project initialized. Run \`${ getDevCommand ( root , framework ) } \` to start developing.` ,
3043- ) ;
3067+ const devCommand = commandInProject ( root , getDevCommand ( root , framework ) ) ;
3068+ printSuccess ( `Project initialized. Run \`${ devCommand } \` to start developing.` ) ;
30443069 }
30453070}
0 commit comments