@ionyx-apps/cli 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/bin/ionyx.exe +0 -0
  2. package/ionyx-cli/Cargo.toml +40 -40
  3. package/ionyx-cli/src/templates/basic/frontend/dist/index.html +1 -0
  4. package/ionyx-cli/src/templates/basic/src-ionyx/Cargo.toml +3 -1
  5. package/ionyx-cli/src/templates/basic/src-ionyx/build.rs +11 -0
  6. package/ionyx-cli/src/templates/basic/src-ionyx/src/protocol.rs +6 -11
  7. package/ionyx-cli/src/templates/frontend/dist/index.html +1 -0
  8. package/ionyx-cli/src/templates/leptos/Cargo.toml +2 -1
  9. package/ionyx-cli/src/templates/leptos/frontend/dist/index.html +1 -0
  10. package/ionyx-cli/src/templates/leptos/src-ionyx/Cargo.toml +5 -1
  11. package/ionyx-cli/src/templates/leptos/src-ionyx/build.rs +11 -0
  12. package/ionyx-cli/src/templates/leptos/src-ionyx/src/protocol.rs +5 -11
  13. package/ionyx-cli/src/templates/react/frontend/dist/index.html +1 -0
  14. package/ionyx-cli/src/templates/react/src-ionyx/Cargo.toml +3 -1
  15. package/ionyx-cli/src/templates/react/src-ionyx/build.rs +11 -0
  16. package/ionyx-cli/src/templates/react/src-ionyx/src/protocol.rs +6 -11
  17. package/ionyx-cli/src/templates/src-ionyx/Cargo.toml +3 -1
  18. package/ionyx-cli/src/templates/src-ionyx/build.rs +11 -0
  19. package/ionyx-cli/src/templates/svelte/frontend/dist/index.html +1 -0
  20. package/ionyx-cli/src/templates/svelte/src-ionyx/Cargo.toml +3 -1
  21. package/ionyx-cli/src/templates/svelte/src-ionyx/build.rs +11 -0
  22. package/ionyx-cli/src/templates/svelte/src-ionyx/src/protocol.rs +6 -11
  23. package/ionyx-cli/src/templates/vanilla/frontend/dist/index.html +1 -0
  24. package/ionyx-cli/src/templates/vanilla/src-ionyx/Cargo.toml +3 -1
  25. package/ionyx-cli/src/templates/vanilla/src-ionyx/build.rs +11 -0
  26. package/ionyx-cli/src/templates/vanilla/src-ionyx/src/protocol.rs +6 -11
  27. package/ionyx-cli/src/templates/vue/frontend/dist/index.html +1 -0
  28. package/ionyx-cli/src/templates/vue/src-ionyx/Cargo.toml +3 -1
  29. package/ionyx-cli/src/templates/vue/src-ionyx/build.rs +11 -0
  30. package/ionyx-cli/src/templates/vue/src-ionyx/src/protocol.rs +4 -10
  31. package/package.json +1 -1
package/bin/ionyx.exe CHANGED
Binary file
@@ -1,40 +1,40 @@
1
- [package]
2
- name = "ionyx-cli"
3
- version = "0.3.1"
4
- edition = "2021"
5
- description = "Ionyx Framework CLI Tool"
6
- authors = ["Ionyx Team"]
7
- license = "MIT"
8
- repository = "https://github.com/ionyx-framework/ionyx-cli"
9
-
10
- [[bin]]
11
- name = "ionyx"
12
- path = "src/main.rs"
13
-
14
- [dependencies]
15
- clap = { version = "4.4", features = ["derive"] }
16
- serde = { version = "1.0", features = ["derive"] }
17
- serde_json = "1.0"
18
- tokio = { version = "1.0", features = ["full"] }
19
- anyhow = "1.0"
20
- colored = "2.0"
21
- dirs = "5.0"
22
- handlebars = "4.5"
23
- zip = "0.6"
24
- reqwest = { version = "0.11", features = ["json"] }
25
- futures = "0.3"
26
- include_dir = "0.7"
27
- dialoguer = "0.11"
28
- os_info = "3.8"
29
- toml = "0.8"
30
- [workspace]
31
- exclude = [
32
- "src/templates/basic/src-ionyx",
33
- "src/templates/leptos",
34
- "src/templates/leptos/src-ionyx",
35
- "src/templates/react/src-ionyx",
36
- "src/templates/src-ionyx",
37
- "src/templates/svelte/src-ionyx",
38
- "src/templates/vanilla/src-ionyx",
39
- "src/templates/vue/src-ionyx"
40
- ]
1
+ [package]
2
+ name = "ionyx-cli"
3
+ version = "0.3.3"
4
+ edition = "2021"
5
+ description = "Ionyx Framework CLI Tool"
6
+ authors = ["Ionyx Team"]
7
+ license = "MIT"
8
+ repository = "https://github.com/ionyx-framework/ionyx-cli"
9
+
10
+ [[bin]]
11
+ name = "ionyx"
12
+ path = "src/main.rs"
13
+
14
+ [dependencies]
15
+ clap = { version = "4.4", features = ["derive"] }
16
+ serde = { version = "1.0", features = ["derive"] }
17
+ serde_json = "1.0"
18
+ tokio = { version = "1.0", features = ["full"] }
19
+ anyhow = "1.0"
20
+ colored = "2.0"
21
+ dirs = "5.0"
22
+ handlebars = "4.5"
23
+ zip = "0.6"
24
+ reqwest = { version = "0.11", features = ["json"] }
25
+ futures = "0.3"
26
+ include_dir = "0.7"
27
+ dialoguer = "0.11"
28
+ os_info = "3.8"
29
+ toml = "0.8"
30
+ [workspace]
31
+ exclude = [
32
+ "src/templates/basic/src-ionyx",
33
+ "src/templates/leptos",
34
+ "src/templates/leptos/src-ionyx",
35
+ "src/templates/react/src-ionyx",
36
+ "src/templates/src-ionyx",
37
+ "src/templates/svelte/src-ionyx",
38
+ "src/templates/vanilla/src-ionyx",
39
+ "src/templates/vue/src-ionyx"
40
+ ]
@@ -0,0 +1 @@
1
+ <html><body><h1>Placeholder</h1></body></html>
@@ -1,6 +1,7 @@
1
1
  [package]
2
+ build = "build.rs"
2
3
  name = "my-ionyx-app"
3
- version = "0.3.1"
4
+ version = "0.3.3"
4
5
  edition = "2021"
5
6
 
6
7
  [workspace]
@@ -15,6 +16,7 @@ path = "main.rs"
15
16
 
16
17
  [dependencies]
17
18
  ionyx = { path = "../../../../../../src-ionyx" }
19
+ include_dir = { version = "0.7", features = ["glob"] }
18
20
  anyhow = "1.0"
19
21
  wry = "0.54"
20
22
  tao = "0.34"
@@ -0,0 +1,11 @@
1
+ use std::fs;
2
+ use std::path::Path;
3
+
4
+ fn main() {
5
+ let dist_path = Path::new("../frontend/dist");
6
+ if !dist_path.exists() {
7
+ fs::create_dir_all(dist_path).unwrap();
8
+ fs::write(dist_path.join("index.html"), "<html><body><h1>Placeholder</h1></body></html>").unwrap();
9
+ }
10
+ println!("cargo:rerun-if-changed=../frontend/dist");
11
+ }
@@ -1,6 +1,6 @@
1
1
  use std::borrow::Cow;
2
2
  use wry::http::{Request, Response, StatusCode};
3
- use std::path::Path;
3
+
4
4
 
5
5
  #[cfg(not(debug_assertions))]
6
6
  use include_dir::{include_dir, Dir};
@@ -35,12 +35,11 @@ impl CustomProtocolHandler {
35
35
  }
36
36
 
37
37
  pub fn handle_request(&self, request: Request<Vec<u8>>) -> Response<Cow<'static, [u8]>> {
38
- // Debug modunda (npm run dev açıkken) bu handler'ın işi yok aslında,
39
- // WebView doğrudan localhost'a gitmeli. Ama bir şekilde buraya düşerse
40
- // 404 yerine temiz bir hata dönüyoruz.
41
38
  #[cfg(debug_assertions)]
42
39
  {
43
40
  let _uri_path = request.uri().path();
41
+ let _dist_path = get_frontend_dist_path();
42
+ let _unused_ct = Self::get_content_type("index.html");
44
43
  return Response::builder()
45
44
  .status(StatusCode::NOT_FOUND)
46
45
  .header("Content-Type", "text/plain")
@@ -48,7 +47,6 @@ impl CustomProtocolHandler {
48
47
  .unwrap();
49
48
  }
50
49
 
51
- // Release modunda gömülü dosyaları işle
52
50
  #[cfg(not(debug_assertions))]
53
51
  {
54
52
  let uri_path = request.uri().path();
@@ -61,7 +59,7 @@ impl CustomProtocolHandler {
61
59
  Response::builder()
62
60
  .status(StatusCode::OK)
63
61
  .header("Content-Type", content_type)
64
- .body(Cow::Borrowed(file.contents()))
62
+ .body(Cow::Borrowed::<'static, [u8]>(file.contents()))
65
63
  .unwrap()
66
64
  }
67
65
  None => {
@@ -70,7 +68,7 @@ impl CustomProtocolHandler {
70
68
  Response::builder()
71
69
  .status(StatusCode::OK)
72
70
  .header("Content-Type", "text/html")
73
- .body(Cow::Borrowed(index_file.contents()))
71
+ .body(Cow::Borrowed::<'static, [u8]>(index_file.contents()))
74
72
  .unwrap()
75
73
  } else {
76
74
  Response::builder()
@@ -81,10 +79,6 @@ impl CustomProtocolHandler {
81
79
  }
82
80
  }
83
81
  }
84
-
85
- // Burası teknik olarak unreachable ancak derleyiciyi tatmin etmek için
86
- #[cfg(debug_assertions)]
87
- Response::builder().status(StatusCode::NOT_FOUND).body(Cow::Borrowed(&b"Not Found"[..])).unwrap()
88
82
  }
89
83
 
90
84
  fn get_content_type(file_path: &str) -> &'static str {
@@ -104,3 +98,4 @@ impl CustomProtocolHandler {
104
98
  }
105
99
  }
106
100
  }
101
+
@@ -0,0 +1 @@
1
+ <html><body><h1>Placeholder</h1></body></html>
@@ -1,12 +1,13 @@
1
1
  [package]
2
2
  name = "my-ionyx-app"
3
- version = "0.3.1"
3
+ version = "0.3.3"
4
4
  edition = "2021"
5
5
 
6
6
  [lib]
7
7
  crate-type = ["cdylib"]
8
8
 
9
9
  [dependencies]
10
+ include_dir = { version = "0.7", features = ["glob"] }
10
11
  leptos = { version = "0.6", features = ["csr"] }
11
12
  wasm-bindgen = "0.2"
12
13
  console_log = "1.0"
@@ -0,0 +1 @@
1
+ <html><body><h1>Placeholder</h1></body></html>
@@ -1,6 +1,7 @@
1
1
  [package]
2
+ build = "build.rs"
2
3
  name = "my-ionyx-app"
3
- version = "0.3.1"
4
+ version = "0.3.3"
4
5
  edition = "2021"
5
6
 
6
7
  [workspace]
@@ -11,7 +12,10 @@ path = "main.rs"
11
12
 
12
13
  [dependencies]
13
14
  ionyx = { path = "../../../../../../src-ionyx" }
15
+ include_dir = { version = "0.7", features = ["glob"] }
14
16
  anyhow = "1.0"
17
+ wry = "0.54"
18
+ tao = "0.34"
15
19
 
16
20
  [profile.release]
17
21
  opt-level = 3
@@ -0,0 +1,11 @@
1
+ use std::fs;
2
+ use std::path::Path;
3
+
4
+ fn main() {
5
+ let dist_path = Path::new("../frontend/dist");
6
+ if !dist_path.exists() {
7
+ fs::create_dir_all(dist_path).unwrap();
8
+ fs::write(dist_path.join("index.html"), "<html><body><h1>Placeholder</h1></body></html>").unwrap();
9
+ }
10
+ println!("cargo:rerun-if-changed=../frontend/dist");
11
+ }
@@ -1,6 +1,6 @@
1
1
  use std::borrow::Cow;
2
2
  use wry::http::{Request, Response, StatusCode};
3
- use std::path::Path;
3
+
4
4
 
5
5
  #[cfg(not(debug_assertions))]
6
6
  use include_dir::{include_dir, Dir};
@@ -35,12 +35,10 @@ impl CustomProtocolHandler {
35
35
  }
36
36
 
37
37
  pub fn handle_request(&self, request: Request<Vec<u8>>) -> Response<Cow<'static, [u8]>> {
38
- // Debug modunda (npm run dev açıkken) bu handler'ın işi yok aslında,
39
- // WebView doğrudan localhost'a gitmeli. Ama bir şekilde buraya düşerse
40
- // 404 yerine temiz bir hata dönüyoruz.
41
38
  #[cfg(debug_assertions)]
42
39
  {
43
40
  let _uri_path = request.uri().path();
41
+ let _unused_ct = Self::get_content_type("index.html");
44
42
  return Response::builder()
45
43
  .status(StatusCode::NOT_FOUND)
46
44
  .header("Content-Type", "text/plain")
@@ -48,7 +46,6 @@ impl CustomProtocolHandler {
48
46
  .unwrap();
49
47
  }
50
48
 
51
- // Release modunda gömülü dosyaları işle
52
49
  #[cfg(not(debug_assertions))]
53
50
  {
54
51
  let uri_path = request.uri().path();
@@ -61,7 +58,7 @@ impl CustomProtocolHandler {
61
58
  Response::builder()
62
59
  .status(StatusCode::OK)
63
60
  .header("Content-Type", content_type)
64
- .body(Cow::Borrowed(file.contents()))
61
+ .body(Cow::Borrowed::<'static, [u8]>(file.contents()))
65
62
  .unwrap()
66
63
  }
67
64
  None => {
@@ -70,7 +67,7 @@ impl CustomProtocolHandler {
70
67
  Response::builder()
71
68
  .status(StatusCode::OK)
72
69
  .header("Content-Type", "text/html")
73
- .body(Cow::Borrowed(index_file.contents()))
70
+ .body(Cow::Borrowed::<'static, [u8]>(index_file.contents()))
74
71
  .unwrap()
75
72
  } else {
76
73
  Response::builder()
@@ -81,10 +78,6 @@ impl CustomProtocolHandler {
81
78
  }
82
79
  }
83
80
  }
84
-
85
- // Burası teknik olarak unreachable ancak derleyiciyi tatmin etmek için
86
- #[cfg(debug_assertions)]
87
- Response::builder().status(StatusCode::NOT_FOUND).body(Cow::Borrowed(&b"Not Found"[..])).unwrap()
88
81
  }
89
82
 
90
83
  fn get_content_type(file_path: &str) -> &'static str {
@@ -104,3 +97,4 @@ impl CustomProtocolHandler {
104
97
  }
105
98
  }
106
99
  }
100
+
@@ -0,0 +1 @@
1
+ <html><body><h1>Placeholder</h1></body></html>
@@ -1,6 +1,7 @@
1
1
  [package]
2
+ build = "build.rs"
2
3
  name = "my-ionyx-app"
3
- version = "0.3.1"
4
+ version = "0.3.3"
4
5
  edition = "2021"
5
6
 
6
7
  [workspace]
@@ -15,6 +16,7 @@ path = "main.rs"
15
16
 
16
17
  [dependencies]
17
18
  ionyx = { path = "../../../../../../src-ionyx" }
19
+ include_dir = { version = "0.7", features = ["glob"] }
18
20
  anyhow = "1.0"
19
21
  wry = "0.54"
20
22
  tao = "0.34"
@@ -0,0 +1,11 @@
1
+ use std::fs;
2
+ use std::path::Path;
3
+
4
+ fn main() {
5
+ let dist_path = Path::new("../frontend/dist");
6
+ if !dist_path.exists() {
7
+ fs::create_dir_all(dist_path).unwrap();
8
+ fs::write(dist_path.join("index.html"), "<html><body><h1>Placeholder</h1></body></html>").unwrap();
9
+ }
10
+ println!("cargo:rerun-if-changed=../frontend/dist");
11
+ }
@@ -1,6 +1,6 @@
1
1
  use std::borrow::Cow;
2
2
  use wry::http::{Request, Response, StatusCode};
3
- use std::path::Path;
3
+
4
4
 
5
5
  #[cfg(not(debug_assertions))]
6
6
  use include_dir::{include_dir, Dir};
@@ -35,12 +35,11 @@ impl CustomProtocolHandler {
35
35
  }
36
36
 
37
37
  pub fn handle_request(&self, request: Request<Vec<u8>>) -> Response<Cow<'static, [u8]>> {
38
- // Debug modunda (npm run dev açıkken) bu handler'ın işi yok aslında,
39
- // WebView doğrudan localhost'a gitmeli. Ama bir şekilde buraya düşerse
40
- // 404 yerine temiz bir hata dönüyoruz.
41
38
  #[cfg(debug_assertions)]
42
39
  {
43
40
  let _uri_path = request.uri().path();
41
+ let _dist_path = get_frontend_dist_path();
42
+ let _unused_ct = Self::get_content_type("index.html");
44
43
  return Response::builder()
45
44
  .status(StatusCode::NOT_FOUND)
46
45
  .header("Content-Type", "text/plain")
@@ -48,7 +47,6 @@ impl CustomProtocolHandler {
48
47
  .unwrap();
49
48
  }
50
49
 
51
- // Release modunda gömülü dosyaları işle
52
50
  #[cfg(not(debug_assertions))]
53
51
  {
54
52
  let uri_path = request.uri().path();
@@ -61,7 +59,7 @@ impl CustomProtocolHandler {
61
59
  Response::builder()
62
60
  .status(StatusCode::OK)
63
61
  .header("Content-Type", content_type)
64
- .body(Cow::Borrowed(file.contents()))
62
+ .body(Cow::Borrowed::<'static, [u8]>(file.contents()))
65
63
  .unwrap()
66
64
  }
67
65
  None => {
@@ -70,7 +68,7 @@ impl CustomProtocolHandler {
70
68
  Response::builder()
71
69
  .status(StatusCode::OK)
72
70
  .header("Content-Type", "text/html")
73
- .body(Cow::Borrowed(index_file.contents()))
71
+ .body(Cow::Borrowed::<'static, [u8]>(index_file.contents()))
74
72
  .unwrap()
75
73
  } else {
76
74
  Response::builder()
@@ -81,10 +79,6 @@ impl CustomProtocolHandler {
81
79
  }
82
80
  }
83
81
  }
84
-
85
- // Burası teknik olarak unreachable ancak derleyiciyi tatmin etmek için
86
- #[cfg(debug_assertions)]
87
- Response::builder().status(StatusCode::NOT_FOUND).body(Cow::Borrowed(&b"Not Found"[..])).unwrap()
88
82
  }
89
83
 
90
84
  fn get_content_type(file_path: &str) -> &'static str {
@@ -104,3 +98,4 @@ impl CustomProtocolHandler {
104
98
  }
105
99
  }
106
100
  }
101
+
@@ -1,6 +1,7 @@
1
1
  [package]
2
+ build = "build.rs"
2
3
  name = "my-ionyx-app"
3
- version = "0.3.1"
4
+ version = "0.3.3"
4
5
  edition = "2021"
5
6
 
6
7
  [[bin]]
@@ -8,6 +9,7 @@ name = "my-ionyx-app"
8
9
  path = "main.rs"
9
10
 
10
11
  [dependencies]
12
+ include_dir = { version = "0.7", features = ["glob"] }
11
13
  ionyx = "1.0.0"
12
14
  anyhow = "1.0"
13
15
 
@@ -0,0 +1,11 @@
1
+ use std::fs;
2
+ use std::path::Path;
3
+
4
+ fn main() {
5
+ let dist_path = Path::new("../frontend/dist");
6
+ if !dist_path.exists() {
7
+ fs::create_dir_all(dist_path).unwrap();
8
+ fs::write(dist_path.join("index.html"), "<html><body><h1>Placeholder</h1></body></html>").unwrap();
9
+ }
10
+ println!("cargo:rerun-if-changed=../frontend/dist");
11
+ }
@@ -0,0 +1 @@
1
+ <html><body><h1>Placeholder</h1></body></html>
@@ -1,6 +1,7 @@
1
1
  [package]
2
+ build = "build.rs"
2
3
  name = "my-ionyx-app"
3
- version = "0.3.1"
4
+ version = "0.3.3"
4
5
  edition = "2021"
5
6
 
6
7
  [workspace]
@@ -15,6 +16,7 @@ path = "main.rs"
15
16
 
16
17
  [dependencies]
17
18
  ionyx = { path = "../../../../../../src-ionyx" }
19
+ include_dir = { version = "0.7", features = ["glob"] }
18
20
  anyhow = "1.0"
19
21
  wry = "0.54"
20
22
  tao = "0.34"
@@ -0,0 +1,11 @@
1
+ use std::fs;
2
+ use std::path::Path;
3
+
4
+ fn main() {
5
+ let dist_path = Path::new("../frontend/dist");
6
+ if !dist_path.exists() {
7
+ fs::create_dir_all(dist_path).unwrap();
8
+ fs::write(dist_path.join("index.html"), "<html><body><h1>Placeholder</h1></body></html>").unwrap();
9
+ }
10
+ println!("cargo:rerun-if-changed=../frontend/dist");
11
+ }
@@ -1,6 +1,6 @@
1
1
  use std::borrow::Cow;
2
2
  use wry::http::{Request, Response, StatusCode};
3
- use std::path::Path;
3
+
4
4
 
5
5
  #[cfg(not(debug_assertions))]
6
6
  use include_dir::{include_dir, Dir};
@@ -35,12 +35,11 @@ impl CustomProtocolHandler {
35
35
  }
36
36
 
37
37
  pub fn handle_request(&self, request: Request<Vec<u8>>) -> Response<Cow<'static, [u8]>> {
38
- // Debug modunda (npm run dev açıkken) bu handler'ın işi yok aslında,
39
- // WebView doğrudan localhost'a gitmeli. Ama bir şekilde buraya düşerse
40
- // 404 yerine temiz bir hata dönüyoruz.
41
38
  #[cfg(debug_assertions)]
42
39
  {
43
40
  let _uri_path = request.uri().path();
41
+ let _dist_path = get_frontend_dist_path();
42
+ let _unused_ct = Self::get_content_type("index.html");
44
43
  return Response::builder()
45
44
  .status(StatusCode::NOT_FOUND)
46
45
  .header("Content-Type", "text/plain")
@@ -48,7 +47,6 @@ impl CustomProtocolHandler {
48
47
  .unwrap();
49
48
  }
50
49
 
51
- // Release modunda gömülü dosyaları işle
52
50
  #[cfg(not(debug_assertions))]
53
51
  {
54
52
  let uri_path = request.uri().path();
@@ -61,7 +59,7 @@ impl CustomProtocolHandler {
61
59
  Response::builder()
62
60
  .status(StatusCode::OK)
63
61
  .header("Content-Type", content_type)
64
- .body(Cow::Borrowed(file.contents()))
62
+ .body(Cow::Borrowed::<'static, [u8]>(file.contents()))
65
63
  .unwrap()
66
64
  }
67
65
  None => {
@@ -70,7 +68,7 @@ impl CustomProtocolHandler {
70
68
  Response::builder()
71
69
  .status(StatusCode::OK)
72
70
  .header("Content-Type", "text/html")
73
- .body(Cow::Borrowed(index_file.contents()))
71
+ .body(Cow::Borrowed::<'static, [u8]>(index_file.contents()))
74
72
  .unwrap()
75
73
  } else {
76
74
  Response::builder()
@@ -81,10 +79,6 @@ impl CustomProtocolHandler {
81
79
  }
82
80
  }
83
81
  }
84
-
85
- // Burası teknik olarak unreachable ancak derleyiciyi tatmin etmek için
86
- #[cfg(debug_assertions)]
87
- Response::builder().status(StatusCode::NOT_FOUND).body(Cow::Borrowed(&b"Not Found"[..])).unwrap()
88
82
  }
89
83
 
90
84
  fn get_content_type(file_path: &str) -> &'static str {
@@ -104,3 +98,4 @@ impl CustomProtocolHandler {
104
98
  }
105
99
  }
106
100
  }
101
+
@@ -0,0 +1 @@
1
+ <html><body><h1>Placeholder</h1></body></html>
@@ -1,6 +1,7 @@
1
1
  [package]
2
+ build = "build.rs"
2
3
  name = "my-ionyx-app"
3
- version = "0.3.1"
4
+ version = "0.3.3"
4
5
  edition = "2021"
5
6
 
6
7
  [workspace]
@@ -15,6 +16,7 @@ path = "main.rs"
15
16
 
16
17
  [dependencies]
17
18
  ionyx = { path = "../../../../../../src-ionyx" }
19
+ include_dir = { version = "0.7", features = ["glob"] }
18
20
  anyhow = "1.0"
19
21
  wry = "0.54"
20
22
  tao = "0.34"
@@ -0,0 +1,11 @@
1
+ use std::fs;
2
+ use std::path::Path;
3
+
4
+ fn main() {
5
+ let dist_path = Path::new("../frontend/dist");
6
+ if !dist_path.exists() {
7
+ fs::create_dir_all(dist_path).unwrap();
8
+ fs::write(dist_path.join("index.html"), "<html><body><h1>Placeholder</h1></body></html>").unwrap();
9
+ }
10
+ println!("cargo:rerun-if-changed=../frontend/dist");
11
+ }
@@ -1,6 +1,6 @@
1
1
  use std::borrow::Cow;
2
2
  use wry::http::{Request, Response, StatusCode};
3
- use std::path::Path;
3
+
4
4
 
5
5
  #[cfg(not(debug_assertions))]
6
6
  use include_dir::{include_dir, Dir};
@@ -35,12 +35,11 @@ impl CustomProtocolHandler {
35
35
  }
36
36
 
37
37
  pub fn handle_request(&self, request: Request<Vec<u8>>) -> Response<Cow<'static, [u8]>> {
38
- // Debug modunda (npm run dev açıkken) bu handler'ın işi yok aslında,
39
- // WebView doğrudan localhost'a gitmeli. Ama bir şekilde buraya düşerse
40
- // 404 yerine temiz bir hata dönüyoruz.
41
38
  #[cfg(debug_assertions)]
42
39
  {
43
40
  let _uri_path = request.uri().path();
41
+ let _dist_path = get_frontend_dist_path();
42
+ let _unused_ct = Self::get_content_type("index.html");
44
43
  return Response::builder()
45
44
  .status(StatusCode::NOT_FOUND)
46
45
  .header("Content-Type", "text/plain")
@@ -48,7 +47,6 @@ impl CustomProtocolHandler {
48
47
  .unwrap();
49
48
  }
50
49
 
51
- // Release modunda gömülü dosyaları işle
52
50
  #[cfg(not(debug_assertions))]
53
51
  {
54
52
  let uri_path = request.uri().path();
@@ -61,7 +59,7 @@ impl CustomProtocolHandler {
61
59
  Response::builder()
62
60
  .status(StatusCode::OK)
63
61
  .header("Content-Type", content_type)
64
- .body(Cow::Borrowed(file.contents()))
62
+ .body(Cow::Borrowed::<'static, [u8]>(file.contents()))
65
63
  .unwrap()
66
64
  }
67
65
  None => {
@@ -70,7 +68,7 @@ impl CustomProtocolHandler {
70
68
  Response::builder()
71
69
  .status(StatusCode::OK)
72
70
  .header("Content-Type", "text/html")
73
- .body(Cow::Borrowed(index_file.contents()))
71
+ .body(Cow::Borrowed::<'static, [u8]>(index_file.contents()))
74
72
  .unwrap()
75
73
  } else {
76
74
  Response::builder()
@@ -81,10 +79,6 @@ impl CustomProtocolHandler {
81
79
  }
82
80
  }
83
81
  }
84
-
85
- // Burası teknik olarak unreachable ancak derleyiciyi tatmin etmek için
86
- #[cfg(debug_assertions)]
87
- Response::builder().status(StatusCode::NOT_FOUND).body(Cow::Borrowed(&b"Not Found"[..])).unwrap()
88
82
  }
89
83
 
90
84
  fn get_content_type(file_path: &str) -> &'static str {
@@ -104,3 +98,4 @@ impl CustomProtocolHandler {
104
98
  }
105
99
  }
106
100
  }
101
+
@@ -0,0 +1 @@
1
+ <html><body><h1>Placeholder</h1></body></html>
@@ -1,6 +1,7 @@
1
1
  [package]
2
+ build = "build.rs"
2
3
  name = "my-ionyx-app"
3
- version = "0.3.1"
4
+ version = "0.3.3"
4
5
  edition = "2021"
5
6
 
6
7
  [workspace]
@@ -15,6 +16,7 @@ path = "main.rs"
15
16
 
16
17
  [dependencies]
17
18
  ionyx = { path = "../../../../../../src-ionyx" }
19
+ include_dir = { version = "0.7", features = ["glob"] }
18
20
  anyhow = "1.0"
19
21
  wry = "0.54"
20
22
  tao = "0.34"
@@ -0,0 +1,11 @@
1
+ use std::fs;
2
+ use std::path::Path;
3
+
4
+ fn main() {
5
+ let dist_path = Path::new("../frontend/dist");
6
+ if !dist_path.exists() {
7
+ fs::create_dir_all(dist_path).unwrap();
8
+ fs::write(dist_path.join("index.html"), "<html><body><h1>Placeholder</h1></body></html>").unwrap();
9
+ }
10
+ println!("cargo:rerun-if-changed=../frontend/dist");
11
+ }
@@ -17,12 +17,10 @@ impl CustomProtocolHandler {
17
17
  }
18
18
 
19
19
  pub fn handle_request(&self, request: Request<Vec<u8>>) -> Response<Cow<'static, [u8]>> {
20
- // Debug modunda (npm run dev açıkken) bu handler'ın işi yok aslında,
21
- // WebView doğrudan localhost'a gitmeli. Ama bir şekilde buraya düşerse
22
- // 404 yerine temiz bir hata dönüyoruz.
23
20
  #[cfg(debug_assertions)]
24
21
  {
25
22
  let _uri_path = request.uri().path();
23
+ let _unused_ct = Self::get_content_type("index.html");
26
24
  return Response::builder()
27
25
  .status(StatusCode::NOT_FOUND)
28
26
  .header("Content-Type", "text/plain")
@@ -30,7 +28,6 @@ impl CustomProtocolHandler {
30
28
  .unwrap();
31
29
  }
32
30
 
33
- // Release modunda gömülü dosyaları işle
34
31
  #[cfg(not(debug_assertions))]
35
32
  {
36
33
  let uri_path = request.uri().path();
@@ -43,7 +40,7 @@ impl CustomProtocolHandler {
43
40
  Response::builder()
44
41
  .status(StatusCode::OK)
45
42
  .header("Content-Type", content_type)
46
- .body(Cow::Borrowed(file.contents()))
43
+ .body(Cow::Borrowed::<'static, [u8]>(file.contents()))
47
44
  .unwrap()
48
45
  }
49
46
  None => {
@@ -52,7 +49,7 @@ impl CustomProtocolHandler {
52
49
  Response::builder()
53
50
  .status(StatusCode::OK)
54
51
  .header("Content-Type", "text/html")
55
- .body(Cow::Borrowed(index_file.contents()))
52
+ .body(Cow::Borrowed::<'static, [u8]>(index_file.contents()))
56
53
  .unwrap()
57
54
  } else {
58
55
  Response::builder()
@@ -63,10 +60,6 @@ impl CustomProtocolHandler {
63
60
  }
64
61
  }
65
62
  }
66
-
67
- // Burası teknik olarak unreachable ancak derleyiciyi tatmin etmek için
68
- #[cfg(debug_assertions)]
69
- Response::builder().status(StatusCode::NOT_FOUND).body(Cow::Borrowed(&b"Not Found"[..])).unwrap()
70
63
  }
71
64
 
72
65
  fn get_content_type(file_path: &str) -> &'static str {
@@ -86,3 +79,4 @@ impl CustomProtocolHandler {
86
79
  }
87
80
  }
88
81
  }
82
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ionyx-apps/cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Ionyx Framework CLI - High-performance desktop apps with Rust and WebGPU",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",