@@ -15,16 +15,24 @@ import * as common from '../common.js';
15
15
import { runAddCommand } from './add/index.ts' ;
16
16
import { detectSync , type AgentName } from 'package-manager-detector' ;
17
17
18
- const langs = [ 'typescript' , 'checkjs' , 'none' ] as const ;
18
+ const langs = [ 'ts' , 'jsdoc' ] as const ;
19
+ const langMap : Record < string , LanguageType | undefined > = {
20
+ ts : 'typescript' ,
21
+ jsdoc : 'checkjs' ,
22
+ false : 'none'
23
+ } ;
19
24
const templateChoices = templates . map ( ( t ) => t . name ) ;
20
- const langOption = new Option ( '--check- types <lang>' , 'add type checking' ) . choices ( langs ) ;
25
+ const langOption = new Option ( '--types <lang>' , 'adds type checking' ) . choices ( langs ) ;
21
26
const templateOption = new Option ( '--template <type>' , 'template to scaffold' ) . choices (
22
27
templateChoices
23
28
) ;
24
29
25
30
const ProjectPathSchema = v . string ( ) ;
26
31
const OptionsSchema = v . strictObject ( {
27
- checkTypes : v . optional ( v . picklist ( langs ) ) ,
32
+ types : v . pipe (
33
+ v . optional ( v . union ( [ v . picklist ( langs ) , v . boolean ( ) ] ) ) ,
34
+ v . transform ( ( lang ) => langMap [ String ( lang ) ] )
35
+ ) ,
28
36
integrations : v . boolean ( ) ,
29
37
install : v . boolean ( ) ,
30
38
template : v . optional ( v . picklist ( templateChoices ) )
@@ -34,8 +42,9 @@ type Options = v.InferOutput<typeof OptionsSchema>;
34
42
export const create = new Command ( 'create' )
35
43
. description ( 'scaffolds a new SvelteKit project' )
36
44
. argument ( '[path]' , 'where the project will be created' , process . cwd ( ) )
37
- . addOption ( langOption )
38
45
. addOption ( templateOption )
46
+ . addOption ( langOption )
47
+ . option ( '--no-types' )
39
48
. option ( '--no-integrations' , 'skips interactive integration installer' )
40
49
. option ( '--no-install' , 'skips installing dependencies' )
41
50
. configureHelp ( common . helpConfig )
@@ -113,7 +122,7 @@ async function createProject(cwd: string, options: Options) {
113
122
} ) ;
114
123
} ,
115
124
language : ( ) => {
116
- if ( options . checkTypes ) return Promise . resolve ( options . checkTypes ) ;
125
+ if ( options . types ) return Promise . resolve ( options . types ) ;
117
126
return p . select < LanguageType > ( {
118
127
message : 'Add type checking with Typescript?' ,
119
128
initialValue : 'typescript' ,
0 commit comments