@@ -5,6 +5,7 @@ import { join } from 'https://deno.land/
[email protected] /path/mod.ts'
5
5
import { gzipDecode } from 'https://deno.land/x/[email protected] /mod.ts'
6
6
import { ensureTextFile } from '../shared/fs.ts'
7
7
import util from '../shared/util.ts'
8
+ import { defaultReactVersion } from '../shared/constants.ts'
8
9
import { VERSION } from '../version.ts'
9
10
10
11
export const helpMessage = `
@@ -58,17 +59,17 @@ export default async function (nameArg?: string) {
58
59
]
59
60
const importMap = {
60
61
imports : {
61
- '~/' : './' , '@/' : './' ,
62
+ '~/' : './' ,
62
63
'aleph' : `https://deno.land/x/aleph@v${ VERSION } /mod.ts` ,
63
64
'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 } ` ,
66
67
} ,
67
68
scopes : { }
68
69
}
69
70
await Promise . all ( [
70
71
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 ) )
72
73
] )
73
74
74
75
if ( vscode ) {
@@ -84,8 +85,8 @@ export default async function (nameArg?: string) {
84
85
}
85
86
await ensureDir ( join ( name , '.vscode' ) )
86
87
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 ) )
89
90
] )
90
91
}
91
92
@@ -110,6 +111,6 @@ async function ask(question: string = ':', stdin = Deno.stdin, stdout = Deno.std
110
111
111
112
async function confirm ( question : string = 'are you sure?' ) {
112
113
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 ( ) ) ) { }
114
115
return a . charAt ( 0 ) . toLowerCase ( ) === 'y'
115
116
}
0 commit comments