Skip to content

Commit f6695b0

Browse files
committed
feat: add astro template
1 parent fee9b53 commit f6695b0

File tree

15 files changed

+217
-1
lines changed

15 files changed

+217
-1
lines changed

.scripts/generate-templates-matrix.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const nodeJsTemplates = [
1818
"preact",
1919
"preact-ts",
2020
"angular",
21+
"astro",
2122
];
2223

2324
const matrixConfig = [

node/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Currently supported template presets include:
7777
- `leptos`
7878
- `sycamore`
7979
- `blazor`
80+
- `astro`
8081

8182
You can use `.` for the project name to scaffold in the current directory.
8283

src/package_manager.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ impl PackageManager {
100100
Template::Solid,
101101
Template::Angular,
102102
Template::Preact,
103+
Template::Astro,
103104
],
104105
PackageManager::Dotnet => &[Template::Blazor],
105106
}
@@ -132,6 +133,7 @@ impl PackageManager {
132133
Template::Angular,
133134
Template::Preact,
134135
Template::PreactTs,
136+
Template::Astro,
135137
],
136138
PackageManager::Dotnet => &[Template::Blazor],
137139
}

src/template.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ pub enum Template {
6060
PreactTs,
6161
Blazor,
6262
Dioxus,
63+
Astro,
6364
}
6465

6566
impl Display for Template {
@@ -83,6 +84,7 @@ impl Display for Template {
8384
Template::PreactTs => write!(f, "preact-ts"),
8485
Template::Blazor => write!(f, "blazor"),
8586
Template::Dioxus => write!(f, "dioxus"),
87+
Template::Astro => write!(f, "astro"),
8688
}
8789
}
8890
}
@@ -109,6 +111,7 @@ impl FromStr for Template {
109111
"preact-ts" => Ok(Template::PreactTs),
110112
"blazor" => Ok(Template::Blazor),
111113
"dioxus" => Ok(Template::Dioxus),
114+
"astro" => Ok(Template::Astro),
112115
_ => Err(format!(
113116
"{YELLOW}{s}{RESET} is not a valid template. Valid templates are [{}]",
114117
Template::ALL
@@ -138,6 +141,7 @@ impl Template {
138141
"Blazor - (https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor/)"
139142
}
140143
Template::Dioxus => "Dioxus - (https://dioxuslabs.com/)",
144+
Template::Astro => "Astro - (https://astro.build/)",
141145
_ => unreachable!(),
142146
}
143147
}
@@ -163,6 +167,7 @@ impl<'a> Template {
163167
Template::PreactTs,
164168
Template::Blazor,
165169
Template::Dioxus,
170+
Template::Astro,
166171
];
167172

168173
pub fn flavors<'b>(&self, pkg_manager: PackageManager) -> Option<&'b [Flavor]> {
@@ -227,7 +232,8 @@ impl<'a> Template {
227232
| Template::SolidTs
228233
| Template::Angular
229234
| Template::Preact
230-
| Template::PreactTs => PackageManager::NODE,
235+
| Template::PreactTs
236+
| Template::Astro => PackageManager::NODE,
231237
Template::Yew | Template::Leptos | Template::Sycamore | Template::Dioxus => {
232238
&[PackageManager::Cargo]
233239
}

templates/_assets_/astro.svg

Lines changed: 18 additions & 0 deletions
Loading
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "{% package_name %}",
3+
"private": true,
4+
"version": "0.1.0",
5+
"type": "module",
6+
"scripts": {
7+
"build": "astro build",
8+
"dev": "astro dev"
9+
},
10+
"dependencies": {
11+
"@tauri-apps/api": "{% if v2 %}^2{% else %}^1{% endif %}",
12+
"astro": "^5.7.13"
13+
},
14+
"devDependencies": {
15+
"@tauri-apps/cli": "{% if v2 %}^2{% else %}^1{% endif %}"
16+
}
17+
}

templates/template-astro/.manifest

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2019-2025 Tauri Programme within The Commons Conservancy
2+
# SPDX-License-Identifier: Apache-2.0
3+
# SPDX-License-Identifier: MIT
4+
5+
beforeDevCommand = {% pkg_manager_run_command %} dev
6+
beforeBuildCommand = {% pkg_manager_run_command %} build
7+
devUrl = http://localhost:1420
8+
frontendDist = ../dist
9+
10+
[files]
11+
astro.svg = public/astro.svg
12+
tauri.svg = public/tauri.svg
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"astro-build.astro-vscode",
4+
"tauri-apps.tauri-vscode",
5+
"rust-lang.rust-analyzer"
6+
]
7+
}

templates/template-astro/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Tauri + Astro
2+
3+
This template should help get you started developing with Tauri and Astro.
4+
5+
## Recommended IDE Setup
6+
7+
[VS Code](https://code.visualstudio.com/) + [Astro](https://marketplace.visualstudio.com/items?itemName=astro-build.astro-vscode) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer).

templates/template-astro/_gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# build output
2+
dist/
3+
4+
# generated types
5+
.astro/
6+
7+
# dependencies
8+
node_modules/
9+
10+
# logs
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
pnpm-debug.log*
15+
16+
# environment variables
17+
.env
18+
.env.production
19+
20+
# macOS-specific files
21+
.DS_Store
22+
23+
# jetbrains setting folder
24+
.idea/

0 commit comments

Comments
 (0)