diff --git a/crates/ide-scaffold/src/catalog.rs b/crates/ide-scaffold/src/catalog.rs index 07b6a569fe..1eb8636f7c 100644 --- a/crates/ide-scaffold/src/catalog.rs +++ b/crates/ide-scaffold/src/catalog.rs @@ -35,6 +35,9 @@ pub(crate) const SOURCES: &[(&str, &str)] = generators![ "astro", "nestjs", "express", + "vue", + "expo", + "electron", // Systems "go", "rust", diff --git a/crates/ide-scaffold/src/engine/snapshots/ide_scaffold__engine__tests__command_lines.snap b/crates/ide-scaffold/src/engine/snapshots/ide_scaffold__engine__tests__command_lines.snap index 8c8b15e61d..51c218c105 100644 --- a/crates/ide-scaffold/src/engine/snapshots/ide_scaffold__engine__tests__command_lines.snap +++ b/crates/ide-scaffold/src/engine/snapshots/ide_scaffold__engine__tests__command_lines.snap @@ -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 diff --git a/crates/ide-scaffold/src/engine/tests.rs b/crates/ide-scaffold/src/engine/tests.rs index 8051866c06..d7e33721b9 100644 --- a/crates/ide-scaffold/src/engine/tests.rs +++ b/crates/ide-scaffold/src/engine/tests.rs @@ -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(); diff --git a/crates/ide-scaffold/tests/scaffold_smoke.rs b/crates/ide-scaffold/tests/scaffold_smoke.rs index 76b7a171db..835c863a41 100644 --- a/crates/ide-scaffold/tests/scaffold_smoke.rs +++ b/crates/ide-scaffold/tests/scaffold_smoke.rs @@ -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"]; diff --git a/generators/electron.toml b/generators/electron.toml new file mode 100644 index 0000000000..36aec73672 --- /dev/null +++ b/generators/electron.toml @@ -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"] }, +] diff --git a/generators/expo.toml b/generators/expo.toml new file mode 100644 index 0000000000..6c6e332e67 --- /dev/null +++ b/generators/expo.toml @@ -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" } diff --git a/generators/html.toml b/generators/html.toml index 7042828be7..7b58d206f1 100644 --- a/generators/html.toml +++ b/generators/html.toml @@ -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]] diff --git a/generators/vue.toml b/generators/vue.toml new file mode 100644 index 0000000000..4d8744a04a --- /dev/null +++ b/generators/vue.toml @@ -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" } diff --git a/src/platform/i18n.test.ts b/src/platform/i18n.test.ts index b2cd1e23fe..23b55e6540 100644 --- a/src/platform/i18n.test.ts +++ b/src/platform/i18n.test.ts @@ -331,6 +331,10 @@ describe("catalogs", () => { "psql", "JavaScript", "TypeScript", + "Vue Router", + "Pinia", + "Vitest", + "ESLint", "HTML", "CSS", "JSON", diff --git a/src/platform/locales/text/en.json b/src/platform/locales/text/en.json index 577ea8655c..80f4d89d79 100644 --- a/src/platform/locales/text/en.json +++ b/src/platform/locales/text/en.json @@ -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/", diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json index 27f55c4881..6ffcf11dac 100644 --- a/src/platform/locales/text/zh.json +++ b/src/platform/locales/text/zh.json @@ -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/", diff --git a/src/ui/brands/electron.svg b/src/ui/brands/electron.svg new file mode 100644 index 0000000000..1f96576957 --- /dev/null +++ b/src/ui/brands/electron.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/ui/brands/expo.svg b/src/ui/brands/expo.svg new file mode 100644 index 0000000000..93eb8dc9b9 --- /dev/null +++ b/src/ui/brands/expo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/ui/brands/vue.svg b/src/ui/brands/vue.svg new file mode 100644 index 0000000000..3e81176da3 --- /dev/null +++ b/src/ui/brands/vue.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/ui/icons.tsx b/src/ui/icons.tsx index 5898f86340..13ab3fb1cc 100644 --- a/src/ui/icons.tsx +++ b/src/ui/icons.tsx @@ -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",