feat(new-project): add Expo, Electron and create-vue generators (#6351)

New Project gains three JavaScript generators that run the official packages through the chosen package manager: Vue (create-vue) with TypeScript, Vue Router, Pinia, Vitest and ESLint options; Expo (React Native) with blank, blank TypeScript and tabs templates; and Electron (Electron Forge) with Vite, Vite + TypeScript and webpack + TypeScript. create-vue gets a kebab-case folder renamed to the project name and a no-op flag when every option is off so it never prompts. Electron always installs, since Forge writes the dependencies by installing them. Static Website moves to the end of the group. Brand icons and en/zh strings added.

Closes #6338

Co-authored-by: wildcatDownstairs <[email protected]>
Цей коміт міститься в:
LU XIANGRUIтаwildcatDownstairs authored and GitHub committed 2026-11-27 15:21:11 +08:00
1 джерело cae7c05fb1
коміт 5e2deed81e
15 files changed
+251 -1

No files matched your search

+3
Переглянути файл
@@ -35,6 +35,9 @@ pub(crate) const SOURCES: &[(&str, &str)] = generators![
"astro",
"nestjs",
"express",
"vue",
"expo",
"electron",
// Systems
"go",
"rust",
+8
Переглянути файл
@@ -20,8 +20,13 @@ dotnet:
- "dotnet new console --name my-app --output my-app --language C#"
- dotnet sln add my-app
- dotnet new gitignore
electron:
- npx --yes create-electron-app@latest init my-app --skip-git --package-manager npm --template vite --typescript
elixir:
- mix new . --app my_app
expo:
- npx --yes create-expo-app@latest my-app --template blank-typescript --no-install --yes
- npm install
express:
- npm install
fastapi:
@@ -77,5 +82,8 @@ symfony:
vite:
- npx --yes create-vite@latest my-app --template react-ts --no-interactive
- npm install
vue:
- npx --yes create-vue@latest my-app --ts
- npm install
zig:
- zig init
+14
Переглянути файл
@@ -130,6 +130,20 @@ fn package_steps_use_the_chosen_runner() {
assert_eq!(argv(step, &values)[..2], ["bunx", "create-vite@latest"]);
}
#[test]
fn create_vue_runs_without_prompting() {
let def = def("vue").unwrap();
let mut values = with_defaults(def, "My App", &Values::new());
// A valid package name, or create-vue asks for one.
assert_eq!(argv(&def.steps[0], &values)[2..], ["create-vue@latest", "my-app", "--ts"]);
values.insert("ts".into(), "false".into());
assert!(argv(&def.steps[0], &values).ends_with(&["--oxlint".to_owned()]));
for flag in ["router", "pinia", "vitest", "eslint"] {
values.insert(flag.into(), "true".into());
}
assert!(argv(&def.steps[0], &values).ends_with(&["--router", "--pinia", "--vitest", "--eslint"].map(String::from)));
}
#[test]
fn conditional_arguments() {
let def = def("python").unwrap();
+4
Переглянути файл
@@ -72,6 +72,10 @@ smoke! {
astro: "astro", [], ["npm", "run", "build"];
nestjs: "nestjs", [], ["npm", "run", "build"];
express: "express", [], ["node", "--check", "index.js"];
vue: "vue", [("router", "true"), ("pinia", "true"), ("vitest", "true"), ("eslint", "true")], ["npm", "run", "build"];
expo: "expo", [], ["npx", "tsc", "--noEmit"];
electron: "electron", [], ["npx", "tsc", "--noEmit"];
electron_pnpm: "electron", [("pm", "pnpm")], ["pnpm", "exec", "tsc", "--noEmit"];
html: "html", [], [];
go: "go", [], ["go", "build", "./..."];
rust: "rust", [], ["cargo", "build", "-q"];
+47
Переглянути файл
@@ -0,0 +1,47 @@
id = "electron"
name = "Electron"
group = "JavaScript"
icon = "project-electron"
order = 11
description = "A desktop app on Electron from Electron Forge's create-electron-app."
[[requires]]
program = "node"
min = "20.19"
hint = "Install Node.js 20.19 or later: https://nodejs.org"
[[requires]]
program = "{{pm}}"
when = { pm = ["pnpm", "yarn"] }
hint = "Install it, or choose npm."
[[fields]]
id = "template"
label = "Template:"
type = "choice"
options = [
{ value = "vite-ts", label = "Vite + TypeScript" },
{ value = "vite", label = "Vite" },
{ value = "webpack-ts", label = "webpack + TypeScript" },
]
default = "vite-ts"
[[fields]]
id = "pm"
label = "Package manager:"
type = "choice"
segmented = true
options = ["npm", "pnpm", "yarn"]
default = "npm"
# Forge installs the dependencies itself: it adds them to package.json by installing them.
[[steps]]
label = "Running create-electron-app"
package = "create-electron-app@latest"
cwd = "parent"
args = [
"init", "{{name}}", "--skip-git", "--package-manager", "{{pm}}",
{ when = { template = ["vite", "vite-ts"] }, args = ["--template", "vite"] },
{ when = { template = "webpack-ts" }, args = ["--template", "webpack"] },
{ when = { template = ["vite-ts", "webpack-ts"] }, args = ["--typescript"] },
]
+53
Переглянути файл
@@ -0,0 +1,53 @@
id = "expo"
name = "Expo (React Native)"
group = "JavaScript"
icon = "project-expo"
order = 10
description = "A React Native app on Expo from create-expo-app."
[[requires]]
program = "node"
min = "20.19"
hint = "Install Node.js 20.19 or later: https://nodejs.org"
[[requires]]
program = "{{pm}}"
when = { pm = ["pnpm", "yarn", "bun"] }
hint = "Install it, or choose npm."
[[fields]]
id = "template"
label = "Template:"
type = "choice"
options = [
{ value = "blank-typescript", label = "Blank (TypeScript)" },
{ value = "blank", label = "Blank" },
{ value = "tabs", label = "Tabs (Expo Router)" },
]
default = "blank-typescript"
[[fields]]
id = "pm"
label = "Package manager:"
type = "choice"
segmented = true
options = ["npm", "pnpm", "yarn", "bun"]
default = "npm"
[[fields]]
id = "install"
label = "Install dependencies"
type = "checkbox"
default = "true"
[[steps]]
label = "Running create-expo-app"
package = "create-expo-app@latest"
cwd = "parent"
args = ["{{name}}", "--template", "{{template}}", "--no-install", "--yes"]
[[after]]
label = "Installing dependencies"
program = "{{pm}}"
args = ["install"]
when = { install = "true" }
+1 -1
Переглянути файл
@@ -2,7 +2,7 @@ id = "html"
name = "Static Website"
group = "JavaScript"
icon = "project-html"
order = 9
order = 12
description = "An HTML page with a stylesheet and a script."
[[files]]
+83
Переглянути файл
@@ -0,0 +1,83 @@
id = "vue"
name = "Vue (create-vue)"
group = "JavaScript"
icon = "project-vue"
order = 9
description = "A Vue app from create-vue, with optional router, Pinia, Vitest and ESLint."
[[requires]]
program = "node"
min = "20.19"
hint = "Install Node.js 20.19 or later: https://nodejs.org"
[[requires]]
program = "{{pm}}"
when = { pm = ["pnpm", "yarn", "bun"] }
hint = "Install it, or choose npm."
[[fields]]
id = "ts"
label = "TypeScript"
type = "checkbox"
default = "true"
[[fields]]
id = "router"
label = "Vue Router"
type = "checkbox"
default = "false"
[[fields]]
id = "pinia"
label = "Pinia"
type = "checkbox"
default = "false"
[[fields]]
id = "vitest"
label = "Vitest"
type = "checkbox"
default = "false"
[[fields]]
id = "eslint"
label = "ESLint"
type = "checkbox"
default = "false"
[[fields]]
id = "pm"
label = "Package manager:"
type = "choice"
segmented = true
options = ["npm", "pnpm", "yarn", "bun"]
default = "npm"
[[fields]]
id = "install"
label = "Install dependencies"
type = "checkbox"
default = "true"
# create-vue prompts unless a feature flag is given and the folder is a valid package name.
[[steps]]
label = "Running create-vue"
package = "create-vue@latest"
cwd = "parent"
creates = "{{name|kebab}}"
args = [
"{{name|kebab}}",
{ when = { ts = "true" }, args = ["--ts"] },
{ when = { router = "true" }, args = ["--router"] },
{ when = { pinia = "true" }, args = ["--pinia"] },
{ when = { vitest = "true" }, args = ["--vitest"] },
{ when = { eslint = "true" }, args = ["--eslint"] },
# No flag means "nothing extra" without prompting; `--default` would add TypeScript.
{ when = { ts = "false", router = "false", pinia = "false", vitest = "false", eslint = "false" }, args = ["--oxlint"] },
]
[[after]]
label = "Installing dependencies"
program = "{{pm}}"
args = ["install"]
when = { install = "true" }
+4
Переглянути файл
@@ -331,6 +331,10 @@ describe("catalogs", () => {
"psql",
"JavaScript",
"TypeScript",
"Vue Router",
"Pinia",
"Vitest",
"ESLint",
"HTML",
"CSS",
"JSON",
+14
Переглянути файл
@@ -2271,6 +2271,20 @@
"Adding the web application packages": "Adding the web application packages",
"A front-end app from create-vite: React, Vue, Svelte, Solid and more.": "A front-end app from create-vite: React, Vue, Svelte, Solid and more.",
"Running create-vite": "Running create-vite",
"A Vue app from create-vue, with optional router, Pinia, Vitest and ESLint.": "A Vue app from create-vue, with optional router, Pinia, Vitest and ESLint.",
"TypeScript": "TypeScript",
"Vue Router": "Vue Router",
"Pinia": "Pinia",
"Vitest": "Vitest",
"ESLint": "ESLint",
"Running create-vue": "Running create-vue",
"A React Native app on Expo from create-expo-app.": "A React Native app on Expo from create-expo-app.",
"Blank (TypeScript)": "Blank (TypeScript)",
"Blank": "Blank",
"Tabs (Expo Router)": "Tabs (Expo Router)",
"Running create-expo-app": "Running create-expo-app",
"A desktop app on Electron from Electron Forge's create-electron-app.": "A desktop app on Electron from Electron Forge's create-electron-app.",
"Running create-electron-app": "Running create-electron-app",
"A Zig package from zig init.": "A Zig package from zig init.",
"Only build.zig and build.zig.zon, without sample code.": "Only build.zig and build.zig.zon, without sample code.",
"Install Zig 0.14 or later: https://ziglang.org/download/": "Install Zig 0.14 or later: https://ziglang.org/download/",
+14
Переглянути файл
@@ -8848,6 +8848,20 @@
"Adding the web application packages": "正在添加 Web 应用相关包",
"A front-end app from create-vite: React, Vue, Svelte, Solid and more.": "用 create-vite 创建的前端应用:React、Vue、Svelte、Solid 等。",
"Running create-vite": "正在运行 create-vite",
"A Vue app from create-vue, with optional router, Pinia, Vitest and ESLint.": "用 create-vue 创建的 Vue 应用,可选路由、Pinia、Vitest 和 ESLint。",
"TypeScript": "TypeScript",
"Vue Router": "Vue Router",
"Pinia": "Pinia",
"Vitest": "Vitest",
"ESLint": "ESLint",
"Running create-vue": "正在运行 create-vue",
"A React Native app on Expo from create-expo-app.": "用 create-expo-app 创建的 Expo React Native 应用。",
"Blank (TypeScript)": "空白(TypeScript)",
"Blank": "空白",
"Tabs (Expo Router)": "标签页(Expo Router)",
"Running create-expo-app": "正在运行 create-expo-app",
"A desktop app on Electron from Electron Forge's create-electron-app.": "用 Electron Forge 的 create-electron-app 创建的 Electron 桌面应用。",
"Running create-electron-app": "正在运行 create-electron-app",
"A Zig package from zig init.": "用 zig init 创建的 Zig 包。",
"Only build.zig and build.zig.zon, without sample code.": "只生成 build.zig 和 build.zig.zon,不含示例代码。",
"Install Zig 0.14 or later: https://ziglang.org/download/": "请安装 Zig 0.14 或更高版本: https://ziglang.org/download/",
+1
Переглянути файл
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="#6C707E" d="M12.0111 0c-.85 0-1.5392.6891-1.5392 1.5392 0 .8501.6891 1.5393 1.5392 1.5393.595 0 1.11-.338 1.3662-.832 2.2208 1.2675 3.847 5.4728 3.847 10.3623 0 2.0715-.2891 4.056-.825 5.7685a.3215.3215 0 0 0 .2107.403.322.322 0 0 0 .4033-.2111c.5558-1.7763.8542-3.8251.8542-5.9604 0-5.1927-1.7717-9.686-4.3206-11.0027.001-.0223.0035-.0443.0035-.0669 0-.85-.6891-1.5392-1.5393-1.5392zm0 .6432a.896.896 0 1 1 0 1.792.896.896 0 1 1 0-1.792zm-5.486 4.3052c-2.067.0074-3.6473.6646-4.3885 1.9485-.7375 1.2774-.5267 2.971.5113 4.7813a.3217.3217 0 0 0 .558-.32C2.271 9.7274 2.089 8.266 2.6938 7.2185c.821-1.422 3.033-1.9552 5.9321-1.4271a.3216.3216 0 0 0 .1153-.6329c-.784-.1428-1.5271-.2125-2.216-.21zm11.0522.0176a.3216.3216 0 0 0-.0084.6432c1.8337.0239 3.1556.5956 3.7502 1.6256.8192 1.419.1798 3.5947-1.7182 5.837a.322.322 0 0 0 .0377.4535.3215.3215 0 0 0 .4532-.0377c2.0535-2.426 2.7708-4.8661 1.7845-6.5744-.7257-1.257-2.26-1.9207-4.299-1.9472zm-2.6984.2924a.3225.3225 0 0 0-.0647.0072c-1.8568.3979-3.8333 1.1755-5.7314 2.2714-4.5699 2.6384-7.5924 6.4948-7.3601 9.3717-.4726.2628-.7928.7664-.7928 1.3455 0 .85.6892 1.5392 1.5393 1.5392.85 0 1.5392-.6891 1.5392-1.5392 0-.8501-.6891-1.5393-1.5392-1.5393-.038 0-.0754.003-.1128.0057-.1002-2.5597 2.7434-6.1412 7.048-8.6265 1.8413-1.063 3.7551-1.8163 5.5445-2.1997a.3217.3217 0 0 0-.07-.636zm-2.8787 6.2364a1.1192 1.1192 0 0 0-.2243.0255c-.6012.1301-.983.7225-.8533 1.3238.1302.6012.7226.9832 1.3238.8533.6012-.1302.9832-.7226.8533-1.3238-.1139-.526-.5816-.8844-1.0995-.8788zM4.532 13.341a.321.321 0 0 0-.2318.0835.3214.3214 0 0 0-.0214.4542c1.2682 1.3936 2.9157 2.701 4.7946 3.7857 4.4146 2.5489 9.1056 3.2849 11.5608 1.8392a1.53 1.53 0 0 0 .8966.2899c.8501 0 1.5392-.6891 1.5392-1.5392 0-.8501-.689-1.5393-1.5392-1.5393-.85 0-1.5392.6892-1.5392 1.5393 0 .276.0737.5344.201.7584-2.2448 1.214-6.631.5002-10.7976-1.9054-1.8228-1.0524-3.418-2.3181-4.6404-3.6614a.3206.3206 0 0 0-.2226-.1049zm-2.0628 4.0172a.896.896 0 1 1 0 1.792.896.896 0 1 1 0-1.792zm19.0616 0a.896.896 0 1 1 0 1.792.891.891 0 0 1-.5864-.2194c-.0025-.004-.0039-.0083-.0066-.0123a.3195.3195 0 0 0-.0957-.0914.896.896 0 0 1 .6887-1.4689zm-14.0045 1.368a.3215.3215 0 0 0-.3207.4296C8.2793 22.154 10.036 24 12.0111 24c1.4406 0 2.7735-.9822 3.8128-2.711a.3215.3215 0 0 0-.11-.4413.3219.3219 0 0 0-.4415.11c-.934 1.5537-2.0812 2.399-3.2613 2.399-1.6407 0-3.2075-1.6465-4.2-4.4179a.3216.3216 0 0 0-.2848-.2126z"/></svg>

Після

Ширина:  |  Висота:  |  Розмір: 2.5 KiB

+1
Переглянути файл
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="#6C707E" d="M0 20.084c.043.53.23 1.063.718 1.778.58.849 1.576 1.315 2.303.567.49-.505 5.794-9.776 8.35-13.29a.761.761 0 011.248 0c2.556 3.514 7.86 12.785 8.35 13.29.727.748 1.723.282 2.303-.567.57-.835.728-1.42.728-2.046 0-.426-8.26-15.798-9.092-17.078-.8-1.23-1.044-1.498-2.397-1.542h-1.032c-1.353.044-1.597.311-2.398 1.542C8.267 3.991.33 18.758 0 19.77Z"/></svg>

Після

Ширина:  |  Висота:  |  Розмір: 461 B

+1
Переглянути файл
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="#4FC08D" d="M24,1.61H14.06L12,5.16,9.94,1.61H0L12,22.39ZM12,14.08,5.16,2.23H9.59L12,6.41l2.41-4.18h4.43Z"/></svg>

Після

Ширина:  |  Висота:  |  Розмір: 210 B

+3
Переглянути файл
@@ -41,7 +41,9 @@ const ICONS = {
"project-dart": "brands/dart",
"project-django": "brands/django",
"project-dotnet": "brands/dotnet",
"project-electron": "brands/electron",
"project-elixir": "brands/elixir",
"project-expo": "brands/expo",
"project-express": "brands/express",
"project-fastapi": "brands/fastapi",
"project-flask": "brands/flask",
@@ -68,6 +70,7 @@ const ICONS = {
"project-sveltekit": "brands/sveltekit",
"project-swift": "brands/swift",
"project-symfony": "brands/symfony",
"project-vue": "brands/vue",
"project-zig": "brands/zig",
// Files & folders
folder: "nodes/folder",