Skip to content

[feat] Added support for Bun #630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
自动判断运行时,更新依赖
  • Loading branch information
mchao123 committed Feb 6, 2025
commit 505bbc14cf96f7617cf46bbbff13d715c74a793a
24 changes: 22 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ function emptyDir(dir) {
)
}

// get now user runtime
function detectRuntime() {
// @ts-ignore
if (typeof Bun !== 'undefined') {
return 'bun'
}
if (typeof process !== 'undefined' && process.versions && process.versions.node) {
return 'node'
}
// @ts-ignore
if (typeof Deno !== 'undefined') {
return 'deno'
}
return 'unknown'
}

const helpMessage = `\
Usage: create-vue [FEATURE_FLAGS...] [OPTIONS...] [DIRECTORY]

Expand Down Expand Up @@ -105,6 +121,9 @@ Available feature flags:
--eslint-with-prettier
Add Prettier for code formatting in addition to ESLint.

--runtime
Show runtime environment selection prompt.

Unstable feature flags:
--tests, --with-tests
Add both unit testing and end-to-end testing support.
Expand All @@ -123,6 +142,7 @@ async function init() {
tests: { type: 'boolean' },
'vue-router': { type: 'boolean' },
router: { type: 'boolean' },
runtime: { type: 'boolean' },
} as const

const { values: argv, positionals } = parseArgs({
Expand Down Expand Up @@ -209,7 +229,7 @@ async function init() {
[
{
name: 'runtime',
type: () => (isFeatureFlagsUsed ? null : 'select'),
type: () => (argv.runtime ? 'select' : null),
message: language.needsRuntime.message,
initial: 0,
choices: [
Expand Down Expand Up @@ -391,7 +411,7 @@ async function init() {
needsPinia = argv.pinia,
needsVitest = argv.vitest || argv.tests,
needsPrettier = argv['eslint-with-prettier'],
runtime = 'node',
runtime = detectRuntime(),
} = result

const needsEslint = Boolean(argv.eslint || argv['eslint-with-prettier'] || result.needsEslint)
Expand Down
1 change: 1 addition & 0 deletions template/others-runtime/bun/config/typescript/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
6 changes: 3 additions & 3 deletions template/others-runtime/bun/config/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
},
"devDependencies": {
"@types/bun": "^1.1.13",
"npm-run-all2": "^7.0.1",
"typescript": "~5.6.3",
"vue-tsc": "^2.1.10"
"npm-run-all2": "^7.0.2",
"typescript": "~5.7.3",
"vue-tsc": "^2.2.0"
}
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy