@@ -63,6 +63,22 @@ function emptyDir(dir) {
6363 )
6464}
6565
66+ // get now user runtime
67+ function detectRuntime ( ) {
68+ // @ts -ignore
69+ if ( typeof Bun !== 'undefined' ) {
70+ return 'bun'
71+ }
72+ if ( typeof process !== 'undefined' && process . versions && process . versions . node ) {
73+ return 'node'
74+ }
75+ // @ts -ignore
76+ if ( typeof Deno !== 'undefined' ) {
77+ return 'deno'
78+ }
79+ return 'unknown'
80+ }
81+
6682const helpMessage = `\
6783Usage: create-vue [FEATURE_FLAGS...] [OPTIONS...] [DIRECTORY]
6884
@@ -105,6 +121,9 @@ Available feature flags:
105121 --eslint-with-prettier
106122 Add Prettier for code formatting in addition to ESLint.
107123
124+ --runtime
125+ Show runtime environment selection prompt.
126+
108127Unstable feature flags:
109128 --tests, --with-tests
110129 Add both unit testing and end-to-end testing support.
@@ -123,6 +142,7 @@ async function init() {
123142 tests : { type : 'boolean' } ,
124143 'vue-router' : { type : 'boolean' } ,
125144 router : { type : 'boolean' } ,
145+ runtime : { type : 'boolean' } ,
126146 } as const
127147
128148 const { values : argv , positionals } = parseArgs ( {
@@ -209,7 +229,7 @@ async function init() {
209229 [
210230 {
211231 name : 'runtime' ,
212- type : ( ) => ( isFeatureFlagsUsed ? null : 'select' ) ,
232+ type : ( ) => ( argv . runtime ? 'select' : null ) ,
213233 message : language . needsRuntime . message ,
214234 initial : 0 ,
215235 choices : [
@@ -391,7 +411,7 @@ async function init() {
391411 needsPinia = argv . pinia ,
392412 needsVitest = argv . vitest || argv . tests ,
393413 needsPrettier = argv [ 'eslint-with-prettier' ] ,
394- runtime = 'node' ,
414+ runtime = detectRuntime ( ) ,
395415 } = result
396416
397417 const needsEslint = Boolean ( argv . eslint || argv [ 'eslint-with-prettier' ] || result . needsEslint )
0 commit comments