@@ -5,6 +5,7 @@ import { join } from 'https://deno.land/std@0.90.0/path/mod.ts'
55import { gzipDecode } from 'https://deno.land/x/wasm_gzip@v1.0.0/mod.ts'
66import { ensureTextFile } from '../shared/fs.ts'
77import util from '../shared/util.ts'
8+ import { defaultReactVersion } from '../shared/constants.ts'
89import { VERSION } from '../version.ts'
910
1011export const helpMessage = `
@@ -58,17 +59,17 @@ export default async function (nameArg?: string) {
5859 ]
5960 const importMap = {
6061 imports : {
61- '~/' : './' , '@/' : './' ,
62+ '~/' : './' ,
6263 'aleph' : `https://deno.land/x/aleph@v${ VERSION } /mod.ts` ,
6364 'aleph/' : `https://deno.land/x/aleph@v${ VERSION } /` ,
64- 'react' : ' https://esm.sh/react@17.0.1' ,
65- 'react-dom' : ' https://esm.sh/react-dom@17.0.1' ,
65+ 'react' : ` https://esm.sh/react@${ defaultReactVersion } ` ,
66+ 'react-dom' : ` https://esm.sh/react-dom@${ defaultReactVersion } ` ,
6667 } ,
6768 scopes : { }
6869 }
6970 await Promise . all ( [
7071 Deno . writeTextFile ( join ( cwd , name , '.gitignore' ) , gitignore . join ( '\n' ) ) ,
71- Deno . writeTextFile ( join ( cwd , name , 'import_map.json' ) , JSON . stringify ( importMap , undefined , 4 ) )
72+ Deno . writeTextFile ( join ( cwd , name , 'import_map.json' ) , JSON . stringify ( importMap , undefined , 2 ) )
7273 ] )
7374
7475 if ( vscode ) {
@@ -84,8 +85,8 @@ export default async function (nameArg?: string) {
8485 }
8586 await ensureDir ( join ( name , '.vscode' ) )
8687 await Promise . all ( [
87- Deno . writeTextFile ( join ( name , '.vscode' , 'extensions.json' ) , JSON . stringify ( extensions , undefined , 4 ) ) ,
88- Deno . writeTextFile ( join ( name , '.vscode' , 'settings.json' ) , JSON . stringify ( settigns , undefined , 4 ) )
88+ Deno . writeTextFile ( join ( name , '.vscode' , 'extensions.json' ) , JSON . stringify ( extensions , undefined , 2 ) ) ,
89+ Deno . writeTextFile ( join ( name , '.vscode' , 'settings.json' ) , JSON . stringify ( settigns , undefined , 2 ) )
8990 ] )
9091 }
9192
@@ -110,6 +111,6 @@ async function ask(question: string = ':', stdin = Deno.stdin, stdout = Deno.std
110111
111112async function confirm ( question : string = 'are you sure?' ) {
112113 let a : string
113- while ( ! / ^ ( y ( e s ) ? | n o ? ) $ / i. test ( a = ( await ask ( question + ' [y/n]' ) ) . trim ( ) ) ) { }
114+ while ( ! / ^ ( y ( e s ) ? | n o ? ) $ / i. test ( a = ( await ask ( question + ' ' + dim ( ' [y/n]') ) ) . trim ( ) ) ) { }
114115 return a . charAt ( 0 ) . toLowerCase ( ) === 'y'
115116}
0 commit comments