@@ -15,16 +15,24 @@ import * as common from '../common.js';
1515import { runAddCommand } from './add/index.ts' ;
1616import { detectSync , type AgentName } from 'package-manager-detector' ;
1717
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+ } ;
1924const 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>' , 'add type checking' ) . choices ( langs ) ;
2126const templateOption = new Option ( '--template <type>' , 'template to scaffold' ) . choices (
2227 templateChoices
2328) ;
2429
2530const ProjectPathSchema = v . string ( ) ;
2631const 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+ ) ,
2836 integrations : v . boolean ( ) ,
2937 install : v . boolean ( ) ,
3038 template : v . optional ( v . picklist ( templateChoices ) )
@@ -34,10 +42,11 @@ type Options = v.InferOutput<typeof OptionsSchema>;
3442export const create = new Command ( 'create' )
3543 . description ( 'scaffolds a new SvelteKit project' )
3644 . argument ( '[path]' , 'where the project will be created' , process . cwd ( ) )
37- . addOption ( langOption )
3845 . addOption ( templateOption )
39- . option ( '--no-integrations' , 'skips interactive integration installer' )
40- . option ( '--no-install' , 'skips installing dependencies' )
46+ . addOption ( langOption )
47+ . option ( '--no-types' )
48+ . option ( '--no-integrations' , 'skip interactive integration installer' )
49+ . option ( '--no-install' , 'skip installing dependencies' )
4150 . configureHelp ( common . helpConfig )
4251 . action ( ( projectPath , opts ) => {
4352 const cwd = v . parse ( ProjectPathSchema , projectPath ) ;
@@ -113,7 +122,7 @@ async function createProject(cwd: string, options: Options) {
113122 } ) ;
114123 } ,
115124 language : ( ) => {
116- if ( options . checkTypes ) return Promise . resolve ( options . checkTypes ) ;
125+ if ( options . types ) return Promise . resolve ( options . types ) ;
117126 return p . select < LanguageType > ( {
118127 message : 'Add type checking with Typescript?' ,
119128 initialValue : 'typescript' ,
0 commit comments