11import { resolveLayout } from '@wavegrid/layout' ;
2- import { writeFileSync } from 'fs' ;
32import type { Inquirerer , Question } from 'inquirerer' ;
4- import { join } from 'path' ;
53import c from 'yanse' ;
64
7- import {
8- buildConfig ,
9- CONFIG_FILENAME ,
10- type InitAnswers ,
11- knownPresets ,
12- serializeConfig ,
13- type ShapeKind
14- } from '../config-file' ;
5+ import { buildConfig , type InitAnswers , knownPresets , type ShapeKind } from '../config-file' ;
156import { getStore } from '../project' ;
167
178interface RawArgv {
@@ -23,16 +14,15 @@ interface FullInitAnswers extends InitAnswers {
2314 createUser ?: boolean ;
2415 username ?: string ;
2516 password ?: string ;
26- writeLocal ?: boolean ;
2717}
2818
2919/**
3020 * `wavegrid init [name]` — create a project in the centralized store, generate
31- * its secrets ONCE, and optionally add a first UI user + a local wavegrid.json.
32- * Everything the CLI produces is plain configuration + generated secrets; there
33- * is no shape-specific executable code .
21+ * its secrets ONCE, and optionally add a first UI user. Everything the CLI
22+ * produces lives in the store; there is no shape-specific executable code and
23+ * no duplicate local config file .
3424 */
35- export async function runInit ( argv : RawArgv , prompter : Inquirerer , cwd = process . cwd ( ) ) : Promise < string > {
25+ export async function runInit ( argv : RawArgv , prompter : Inquirerer ) : Promise < string > {
3626 const defaultName = typeof argv . project === 'string' ? argv . project : 'default' ;
3727
3828 const questions : Question [ ] = [
@@ -114,12 +104,6 @@ export async function runInit(argv: RawArgv, prompter: Inquirerer, cwd = process
114104 name : 'password' ,
115105 message : 'Password' ,
116106 when : ( a : Partial < FullInitAnswers > ) => a . createUser === true
117- } ,
118- {
119- type : 'confirm' ,
120- name : 'writeLocal' ,
121- message : 'Also write a local wavegrid.json here?' ,
122- default : false
123107 }
124108 ] ;
125109
@@ -142,12 +126,6 @@ export async function runInit(argv: RawArgv, prompter: Inquirerer, cwd = process
142126 store . addUser ( projectName , answers . username , answers . password ) ;
143127 }
144128
145- let localPath : string | undefined ;
146- if ( answers . writeLocal ) {
147- localPath = join ( cwd , CONFIG_FILENAME ) ;
148- writeFileSync ( localPath , serializeConfig ( config ) ) ;
149- }
150-
151129 console . log ( '' ) ;
152130 console . log ( c . green ( ` ✓ Created project ${ c . bold ( projectName ) } ` ) ) ;
153131 console . log ( ` → Layout: ${ c . cyan ( layout . name ) } (${ layout . topology } , ${ layout . count } cannons)` ) ;
@@ -161,7 +139,6 @@ export async function runInit(argv: RawArgv, prompter: Inquirerer, cwd = process
161139 if ( answers . createUser && answers . username ) {
162140 console . log ( ` → User: ${ c . cyan ( answers . username ) } ` ) ;
163141 }
164- if ( localPath ) console . log ( ` → Wrote: ${ c . cyan ( localPath ) } ` ) ;
165142 console . log ( '' ) ;
166143 console . log ( ` Start it with ${ c . bold ( `wavegrid start${ projectName === 'default' ? '' : ` --project ${ projectName } ` } ` ) } ` ) ;
167144 console . log ( '' ) ;
0 commit comments