mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-09-11 07:55:34 +03:00
feat(cli): detect SvelteKit and Vite (#5742)
This commit is contained in:
parent
b6027b2dd2
commit
9d872ab872
6
.changes/add-frameworks.md
Normal file
6
.changes/add-frameworks.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"cli.rs": patch
|
||||
"cli.js": patch
|
||||
---
|
||||
|
||||
Detect SvelteKit and Vite for the init and info commands.
|
42
tooling/cli/Cargo.lock
generated
42
tooling/cli/Cargo.lock
generated
@ -667,15 +667,6 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deflate"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c86f7e25f518f4b81808a2cf1c50996a61f5c2eb394b2393bd87f2a4780a432f"
|
||||
dependencies = [
|
||||
"adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_more"
|
||||
version = "0.99.17"
|
||||
@ -806,7 +797,7 @@ dependencies = [
|
||||
"flume",
|
||||
"half",
|
||||
"lebe",
|
||||
"miniz_oxide",
|
||||
"miniz_oxide 0.5.4",
|
||||
"smallvec",
|
||||
"threadpool",
|
||||
]
|
||||
@ -855,7 +846,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
"miniz_oxide 0.5.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1276,9 +1267,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "image"
|
||||
version = "0.24.4"
|
||||
version = "0.24.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd8e4fb07cf672b1642304e731ef8a6a4c7891d67bb4fd4f5ce58cd6ed86803c"
|
||||
checksum = "69b7ea949b537b0fd0af141fff8c77690f2ce96f4f41f042ccb6c69c6c965945"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"byteorder",
|
||||
@ -1407,9 +1398,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "jpeg-decoder"
|
||||
version = "0.2.6"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9478aa10f73e7528198d75109c8be5cd7d15fb530238040148d5f9a22d4c5b3b"
|
||||
checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e"
|
||||
dependencies = [
|
||||
"rayon",
|
||||
]
|
||||
@ -1674,6 +1665,15 @@ dependencies = [
|
||||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"
|
||||
dependencies = [
|
||||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.8.4"
|
||||
@ -2279,14 +2279,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.17.5"
|
||||
version = "0.17.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc38c0ad57efb786dd57b9864e5b18bae478c00c824dc55a38bbc9da95dde3ba"
|
||||
checksum = "5d708eaf860a19b19ce538740d2b4bdeeb8337fa53f7738455e706623ad5c638"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"crc32fast",
|
||||
"deflate",
|
||||
"miniz_oxide",
|
||||
"flate2",
|
||||
"miniz_oxide 0.6.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3316,9 +3316,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tiff"
|
||||
version = "0.7.2"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7cfada0986f446a770eca461e8c6566cb879682f7d687c8348aa0c857bd52286"
|
||||
checksum = "f17def29300a156c19ae30814710d9c63cd50288a49c6fd3a10ccfbe4cf886fd"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"jpeg-decoder",
|
||||
|
@ -7,10 +7,10 @@ use std::fmt;
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Framework {
|
||||
Svelte,
|
||||
SvelteKit,
|
||||
Angular,
|
||||
React,
|
||||
Nextjs,
|
||||
|
||||
Gatsby,
|
||||
Nuxt,
|
||||
Quasar,
|
||||
@ -22,6 +22,7 @@ impl Framework {
|
||||
pub fn dev_path(&self) -> String {
|
||||
match self {
|
||||
Self::Svelte => "http://localhost:8080",
|
||||
Self::SvelteKit => "http://localhost:5173",
|
||||
Self::Angular => "http://localhost:4200",
|
||||
Self::React => "http://localhost:3000",
|
||||
Self::Nextjs => "http://localhost:3000",
|
||||
@ -37,6 +38,7 @@ impl Framework {
|
||||
pub fn dist_dir(&self) -> String {
|
||||
match self {
|
||||
Self::Svelte => "../public",
|
||||
Self::SvelteKit => "../build",
|
||||
Self::Angular => "../dist",
|
||||
Self::React => "../build",
|
||||
Self::Nextjs => "../out",
|
||||
@ -54,6 +56,7 @@ impl fmt::Display for Framework {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::Svelte => write!(f, "Svelte"),
|
||||
Self::SvelteKit => write!(f, "SvelteKit"),
|
||||
Self::Angular => write!(f, "Angular"),
|
||||
Self::React => write!(f, "React"),
|
||||
Self::Nextjs => write!(f, "React (Next.js)"),
|
||||
@ -70,6 +73,7 @@ impl fmt::Display for Framework {
|
||||
pub enum Bundler {
|
||||
Webpack,
|
||||
Rollup,
|
||||
Vite,
|
||||
}
|
||||
|
||||
impl fmt::Display for Bundler {
|
||||
@ -77,13 +81,15 @@ impl fmt::Display for Bundler {
|
||||
match self {
|
||||
Self::Webpack => write!(f, "Webpack"),
|
||||
Self::Rollup => write!(f, "Rollup"),
|
||||
Self::Vite => write!(f, "Vite"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn infer_from_package_json(package_json: &str) -> (Option<Framework>, Option<Bundler>) {
|
||||
let framework_map = [
|
||||
("svelte", Framework::Svelte, None),
|
||||
("svelte", Framework::Svelte, Some(Bundler::Rollup)),
|
||||
("@sveltejs/kit", Framework::SvelteKit, Some(Bundler::Vite)),
|
||||
("@angular", Framework::Angular, Some(Bundler::Webpack)),
|
||||
(r#""next""#, Framework::Nextjs, Some(Bundler::Webpack)),
|
||||
("gatsby", Framework::Gatsby, Some(Bundler::Webpack)),
|
||||
@ -91,9 +97,13 @@ pub fn infer_from_package_json(package_json: &str) -> (Option<Framework>, Option
|
||||
("nuxt", Framework::Nuxt, Some(Bundler::Webpack)),
|
||||
("quasar", Framework::Quasar, Some(Bundler::Webpack)),
|
||||
("@vue/cli", Framework::VueCli, Some(Bundler::Webpack)),
|
||||
("vue", Framework::Vue, None),
|
||||
("vue", Framework::Vue, Some(Bundler::Vite)),
|
||||
];
|
||||
let bundler_map = [
|
||||
("webpack", Bundler::Webpack),
|
||||
("rollup", Bundler::Rollup),
|
||||
("vite", Bundler::Vite),
|
||||
];
|
||||
let bundler_map = [("webpack", Bundler::Webpack), ("rollup", Bundler::Rollup)];
|
||||
|
||||
let (framework, framework_bundler) = framework_map
|
||||
.iter()
|
||||
|
Loading…
Reference in New Issue
Block a user