@ionyx-apps/cli 0.2.0 → 0.3.0

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 (35) hide show
  1. package/bin/ionyx.exe +0 -0
  2. package/ionyx-cli/Cargo.toml +40 -0
  3. package/ionyx-cli/src/commands/build.rs +53 -0
  4. package/ionyx-cli/src/commands/bundle.rs +349 -0
  5. package/ionyx-cli/src/commands/config.rs +36 -0
  6. package/ionyx-cli/src/commands/dev.rs +142 -0
  7. package/ionyx-cli/src/commands/doctor.rs +158 -0
  8. package/ionyx-cli/src/commands/info.rs +79 -0
  9. package/ionyx-cli/src/commands/init.rs +64 -0
  10. package/ionyx-cli/src/commands/mod.rs +9 -0
  11. package/ionyx-cli/src/commands/plugin.rs +34 -0
  12. package/ionyx-cli/src/commands/run.rs +54 -0
  13. package/ionyx-cli/src/config/mod.rs +155 -0
  14. package/ionyx-cli/src/main.rs +161 -0
  15. package/ionyx-cli/src/templates/basic/src-ionyx/Cargo.toml +6 -0
  16. package/ionyx-cli/src/templates/basic/src-ionyx/src/lib.rs +6 -0
  17. package/ionyx-cli/src/templates/basic/src-ionyx/src/protocol.rs +20 -2
  18. package/ionyx-cli/src/templates/leptos/src-ionyx/src/protocol.rs +20 -2
  19. package/ionyx-cli/src/templates/mod.rs +2 -2
  20. package/ionyx-cli/src/templates/react/src-ionyx/Cargo.toml +6 -0
  21. package/ionyx-cli/src/templates/react/src-ionyx/src/lib.rs +6 -0
  22. package/ionyx-cli/src/templates/react/src-ionyx/src/protocol.rs +20 -2
  23. package/ionyx-cli/src/templates/svelte/src-ionyx/Cargo.toml +6 -0
  24. package/ionyx-cli/src/templates/svelte/src-ionyx/src/lib.rs +6 -0
  25. package/ionyx-cli/src/templates/svelte/src-ionyx/src/protocol.rs +20 -2
  26. package/ionyx-cli/src/templates/vanilla/src-ionyx/Cargo.toml +6 -0
  27. package/ionyx-cli/src/templates/vanilla/src-ionyx/src/lib.rs +6 -0
  28. package/ionyx-cli/src/templates/vanilla/src-ionyx/src/protocol.rs +20 -2
  29. package/ionyx-cli/src/templates/vue/src-ionyx/Cargo.toml +6 -0
  30. package/ionyx-cli/src/templates/vue/src-ionyx/src/lib.rs +6 -0
  31. package/ionyx-cli/src/templates/vue/src-ionyx/src/protocol.rs +2 -2
  32. package/package.json +11 -4
  33. package/bin/cargo-ionyx-win.exe +0 -0
  34. package/bin/cargo-ionyx.exe +0 -0
  35. package/ionyx-cli/src/templates/react/src-ionyx/Cargo.lock +0 -5536
@@ -0,0 +1,161 @@
1
+ use clap::{Parser, Subcommand};
2
+ use colored::*;
3
+ use anyhow::Result;
4
+
5
+ mod commands;
6
+ mod config;
7
+ mod templates;
8
+
9
+ #[derive(Parser)]
10
+ #[command(name = "ionyx")]
11
+ #[command(about = "Ionyx Framework CLI Tool")]
12
+ #[command(version)]
13
+ struct Cli {
14
+ #[command(subcommand)]
15
+ command: Commands,
16
+ }
17
+
18
+ #[derive(Subcommand)]
19
+ enum Commands {
20
+ /// Initialize a new Ionyx project
21
+ #[command(alias = "create")]
22
+ Init {
23
+ /// Project name
24
+ name: Option<String>,
25
+ /// Project template (basic, react, svelte, vue, vanilla, leptos, angular)
26
+ #[arg(short, long)]
27
+ template: Option<String>,
28
+ },
29
+ /// Start development server
30
+ Dev {
31
+ /// Port number
32
+ #[arg(short, long, default_value = "5173")]
33
+ port: u16,
34
+ /// Hot reload
35
+ #[arg(short = 'H', long)]
36
+ hot: bool,
37
+ },
38
+ /// Build the project
39
+ Build {
40
+ /// Build target
41
+ #[arg(short, long, default_value = "web")]
42
+ target: String,
43
+ /// Minify output
44
+ #[arg(short, long)]
45
+ minify: bool,
46
+ },
47
+ /// Run the application
48
+ Run {
49
+ /// Port number
50
+ #[arg(short, long, default_value = "5173")]
51
+ port: u16,
52
+ },
53
+ /// Manage configuration
54
+ Config {
55
+ #[command(subcommand)]
56
+ action: ConfigAction,
57
+ },
58
+ /// Plugin management
59
+ Plugin {
60
+ #[command(subcommand)]
61
+ action: PluginAction,
62
+ },
63
+ /// Shows Ionyx environment information
64
+ Info,
65
+ /// Bundle the project into a native installer (EXE, MSI, DEB, DMG)
66
+ Bundle {
67
+ /// Bundle target platform (windows, macos, linux)
68
+ #[arg(short, long)]
69
+ platform: Option<String>,
70
+ /// Bundle format (nsis, wix, deb, appimage, dmg)
71
+ #[arg(short, long)]
72
+ format: Option<String>,
73
+ },
74
+ /// Diagnose development environment (Inspired by Flutter Doctor)
75
+ Doctor,
76
+ }
77
+
78
+ #[derive(Subcommand)]
79
+ enum ConfigAction {
80
+ /// Get configuration value
81
+ Get { key: String },
82
+ /// Set configuration value
83
+ Set { key: String, value: String },
84
+ /// List all configuration
85
+ List,
86
+ /// Reset configuration
87
+ Reset,
88
+ }
89
+
90
+ #[derive(Subcommand)]
91
+ enum PluginAction {
92
+ /// Install a plugin
93
+ Install { name: String },
94
+ /// Uninstall a plugin
95
+ Uninstall { name: String },
96
+ /// List installed plugins
97
+ List,
98
+ /// Update a plugin
99
+ Update { name: String },
100
+ }
101
+
102
+ #[tokio::main]
103
+ async fn main() -> Result<()> {
104
+ let cli = Cli::parse();
105
+
106
+ match cli.command {
107
+ Commands::Init { name, template } => {
108
+ use dialoguer::{Input, Select};
109
+ use crate::templates::get_available_templates;
110
+
111
+ let final_name = match name {
112
+ Some(n) => n,
113
+ None => Input::<String>::new()
114
+ .with_prompt("Project name")
115
+ .default("my-ionyx-app".into())
116
+ .interact_text()?,
117
+ };
118
+
119
+ let final_template = match template {
120
+ Some(t) => t,
121
+ None => {
122
+ let templates = get_available_templates();
123
+ let selection = Select::new()
124
+ .with_prompt("Choose your frontend framework")
125
+ .items(&templates)
126
+ .default(0)
127
+ .interact()?;
128
+ templates[selection].to_string()
129
+ }
130
+ };
131
+
132
+ commands::init::execute(final_name, &final_template).await?;
133
+ }
134
+ Commands::Dev { port, hot } => {
135
+ commands::dev::execute(port, hot).await?;
136
+ }
137
+ Commands::Build { target, minify } => {
138
+ commands::build::execute(&target, minify).await?;
139
+ }
140
+ Commands::Run { port } => {
141
+ commands::run::execute(port).await?;
142
+ }
143
+ Commands::Config { action } => {
144
+ commands::config::execute(action).await?;
145
+ }
146
+ Commands::Plugin { action } => {
147
+ commands::plugin::execute(action).await?;
148
+ }
149
+ Commands::Info => {
150
+ commands::info::execute().await?;
151
+ }
152
+ Commands::Bundle { platform, format } => {
153
+ commands::bundle::execute(platform, format).await?;
154
+ }
155
+ Commands::Doctor => {
156
+ commands::doctor::execute().await?;
157
+ }
158
+ }
159
+
160
+ Ok(())
161
+ }
@@ -5,6 +5,10 @@ edition = "2021"
5
5
 
6
6
  [workspace]
7
7
 
8
+ [lib]
9
+ name = "my_ionyx_app"
10
+ path = "src/lib.rs"
11
+
8
12
  [[bin]]
9
13
  name = "my-ionyx-app"
10
14
  path = "main.rs"
@@ -12,6 +16,8 @@ path = "main.rs"
12
16
  [dependencies]
13
17
  ionyx = { path = "../../../../../../src-ionyx" }
14
18
  anyhow = "1.0"
19
+ wry = "0.54"
20
+ tao = "0.34"
15
21
 
16
22
  [profile.release]
17
23
  opt-level = 3
@@ -0,0 +1,6 @@
1
+ //! Basic template library for Ionyx Framework
2
+
3
+ pub mod protocol;
4
+
5
+ // Re-export main protocol handler
6
+ pub use protocol::CustomProtocolHandler;
@@ -1,13 +1,31 @@
1
1
  use std::borrow::Cow;
2
2
  use wry::http::{Request, Response, StatusCode};
3
+ use std::path::Path;
3
4
 
4
5
  #[cfg(not(debug_assertions))]
5
6
  use include_dir::{include_dir, Dir};
6
7
 
8
+ // Configuration'dan frontendDist path'ini oku
9
+ fn get_frontend_dist_path() -> String {
10
+ // Önce Ionyx config dosyasını okumaya çalış
11
+ if let Ok(config_content) = std::fs::read_to_string("ionyx.config.toml") {
12
+ for line in config_content.lines() {
13
+ if line.trim().starts_with("frontendDist") {
14
+ if let Some(path) = line.split('=').nth(1) {
15
+ return path.trim().trim_matches('"').to_string();
16
+ }
17
+ }
18
+ }
19
+ }
20
+
21
+ // Varsayılan path
22
+ "../frontend/dist".to_string()
23
+ }
24
+
7
25
  // Release modunda frontend/dist içindeki dosyaları binary'ye gömer.
8
- // Path hatasını engellemek için senin yapılandırdığın "../dist" yolunu kullanıyoruz.
26
+ // Configuration'dan dinamik path okur.
9
27
  #[cfg(not(debug_assertions))]
10
- static EMBEDDED_ASSETS: Dir<'static> = include_dir!("$CARGO_MANIFEST_DIR/../dist");
28
+ static EMBEDDED_ASSETS: Dir<'static> = include_dir!("../frontend/dist");
11
29
 
12
30
  pub struct CustomProtocolHandler;
13
31
 
@@ -1,13 +1,31 @@
1
1
  use std::borrow::Cow;
2
2
  use wry::http::{Request, Response, StatusCode};
3
+ use std::path::Path;
3
4
 
4
5
  #[cfg(not(debug_assertions))]
5
6
  use include_dir::{include_dir, Dir};
6
7
 
8
+ // Configuration'dan frontendDist path'ini oku
9
+ fn get_frontend_dist_path() -> String {
10
+ // Önce Ionyx config dosyasını okumaya çalış
11
+ if let Ok(config_content) = std::fs::read_to_string("ionyx.config.toml") {
12
+ for line in config_content.lines() {
13
+ if line.trim().starts_with("frontendDist") {
14
+ if let Some(path) = line.split('=').nth(1) {
15
+ return path.trim().trim_matches('"').to_string();
16
+ }
17
+ }
18
+ }
19
+ }
20
+
21
+ // Varsayılan path
22
+ "../frontend/dist".to_string()
23
+ }
24
+
7
25
  // Release modunda frontend/dist içindeki dosyaları binary'ye gömer.
8
- // Path hatasını engellemek için senin yapılandırdığın "../dist" yolunu kullanıyoruz.
26
+ // Configuration'dan dinamik path okur.
9
27
  #[cfg(not(debug_assertions))]
10
- static EMBEDDED_ASSETS: Dir<'static> = include_dir!("$CARGO_MANIFEST_DIR/../dist");
28
+ static EMBEDDED_ASSETS: Dir<'static> = include_dir!("../frontend/dist");
11
29
 
12
30
  pub struct CustomProtocolHandler;
13
31
 
@@ -51,10 +51,10 @@ pub async fn copy_template(project_name: &str, dest_path: &str, template: &str)
51
51
  if Path::new(&backend_cargo_path).exists() {
52
52
  let mut content = fs::read_to_string(&backend_cargo_path)?;
53
53
  content = content.replace("my-ionyx-app", project_name);
54
- // Use local path dependency to avoid Git repository path issues
54
+ // Use Git dependency for generated projects
55
55
  content = content.replace(
56
56
  "ionyx = { path = \"../../../../../../src-ionyx\" }",
57
- "ionyx = { path = \"../../../src-ionyx\" }"
57
+ "ionyx = { git = \"https://github.com/ionyx-apps/ionyx\", branch = \"quantum\" }"
58
58
  );
59
59
  fs::write(&backend_cargo_path, content)?;
60
60
  }
@@ -5,6 +5,10 @@ edition = "2021"
5
5
 
6
6
  [workspace]
7
7
 
8
+ [lib]
9
+ name = "my_ionyx_app"
10
+ path = "src/lib.rs"
11
+
8
12
  [[bin]]
9
13
  name = "my-ionyx-app"
10
14
  path = "main.rs"
@@ -12,6 +16,8 @@ path = "main.rs"
12
16
  [dependencies]
13
17
  ionyx = { path = "../../../../../../src-ionyx" }
14
18
  anyhow = "1.0"
19
+ wry = "0.54"
20
+ tao = "0.34"
15
21
 
16
22
  [profile.release]
17
23
  opt-level = 3
@@ -0,0 +1,6 @@
1
+ //! React template library for Ionyx Framework
2
+
3
+ pub mod protocol;
4
+
5
+ // Re-export main protocol handler
6
+ pub use protocol::CustomProtocolHandler;
@@ -1,13 +1,31 @@
1
1
  use std::borrow::Cow;
2
2
  use wry::http::{Request, Response, StatusCode};
3
+ use std::path::Path;
3
4
 
4
5
  #[cfg(not(debug_assertions))]
5
6
  use include_dir::{include_dir, Dir};
6
7
 
8
+ // Configuration'dan frontendDist path'ini oku
9
+ fn get_frontend_dist_path() -> String {
10
+ // Önce Ionyx config dosyasını okumaya çalış
11
+ if let Ok(config_content) = std::fs::read_to_string("ionyx.config.toml") {
12
+ for line in config_content.lines() {
13
+ if line.trim().starts_with("frontendDist") {
14
+ if let Some(path) = line.split('=').nth(1) {
15
+ return path.trim().trim_matches('"').to_string();
16
+ }
17
+ }
18
+ }
19
+ }
20
+
21
+ // Varsayılan path
22
+ "../frontend/dist".to_string()
23
+ }
24
+
7
25
  // Release modunda frontend/dist içindeki dosyaları binary'ye gömer.
8
- // Path hatasını engellemek için senin yapılandırdığın "../dist" yolunu kullanıyoruz.
26
+ // Configuration'dan dinamik path okur.
9
27
  #[cfg(not(debug_assertions))]
10
- static EMBEDDED_ASSETS: Dir<'static> = include_dir!("$CARGO_MANIFEST_DIR/../dist");
28
+ static EMBEDDED_ASSETS: Dir<'static> = include_dir!("../frontend/dist");
11
29
 
12
30
  pub struct CustomProtocolHandler;
13
31
 
@@ -5,6 +5,10 @@ edition = "2021"
5
5
 
6
6
  [workspace]
7
7
 
8
+ [lib]
9
+ name = "my_ionyx_app"
10
+ path = "src/lib.rs"
11
+
8
12
  [[bin]]
9
13
  name = "my-ionyx-app"
10
14
  path = "main.rs"
@@ -12,6 +16,8 @@ path = "main.rs"
12
16
  [dependencies]
13
17
  ionyx = { path = "../../../../../../src-ionyx" }
14
18
  anyhow = "1.0"
19
+ wry = "0.54"
20
+ tao = "0.34"
15
21
 
16
22
  [profile.release]
17
23
  opt-level = 3
@@ -0,0 +1,6 @@
1
+ //! Svelte template library for Ionyx Framework
2
+
3
+ pub mod protocol;
4
+
5
+ // Re-export main protocol handler
6
+ pub use protocol::CustomProtocolHandler;
@@ -1,13 +1,31 @@
1
1
  use std::borrow::Cow;
2
2
  use wry::http::{Request, Response, StatusCode};
3
+ use std::path::Path;
3
4
 
4
5
  #[cfg(not(debug_assertions))]
5
6
  use include_dir::{include_dir, Dir};
6
7
 
8
+ // Configuration'dan frontendDist path'ini oku
9
+ fn get_frontend_dist_path() -> String {
10
+ // Önce Ionyx config dosyasını okumaya çalış
11
+ if let Ok(config_content) = std::fs::read_to_string("ionyx.config.toml") {
12
+ for line in config_content.lines() {
13
+ if line.trim().starts_with("frontendDist") {
14
+ if let Some(path) = line.split('=').nth(1) {
15
+ return path.trim().trim_matches('"').to_string();
16
+ }
17
+ }
18
+ }
19
+ }
20
+
21
+ // Varsayılan path
22
+ "../frontend/dist".to_string()
23
+ }
24
+
7
25
  // Release modunda frontend/dist içindeki dosyaları binary'ye gömer.
8
- // Path hatasını engellemek için senin yapılandırdığın "../dist" yolunu kullanıyoruz.
26
+ // Configuration'dan dinamik path okur.
9
27
  #[cfg(not(debug_assertions))]
10
- static EMBEDDED_ASSETS: Dir<'static> = include_dir!("$CARGO_MANIFEST_DIR/../dist");
28
+ static EMBEDDED_ASSETS: Dir<'static> = include_dir!("../frontend/dist");
11
29
 
12
30
  pub struct CustomProtocolHandler;
13
31
 
@@ -5,6 +5,10 @@ edition = "2021"
5
5
 
6
6
  [workspace]
7
7
 
8
+ [lib]
9
+ name = "my_ionyx_app"
10
+ path = "src/lib.rs"
11
+
8
12
  [[bin]]
9
13
  name = "my-ionyx-app"
10
14
  path = "main.rs"
@@ -12,6 +16,8 @@ path = "main.rs"
12
16
  [dependencies]
13
17
  ionyx = { path = "../../../../../../src-ionyx" }
14
18
  anyhow = "1.0"
19
+ wry = "0.54"
20
+ tao = "0.34"
15
21
 
16
22
  [profile.release]
17
23
  opt-level = 3
@@ -0,0 +1,6 @@
1
+ //! Vanilla template library for Ionyx Framework
2
+
3
+ pub mod protocol;
4
+
5
+ // Re-export main protocol handler
6
+ pub use protocol::CustomProtocolHandler;
@@ -1,13 +1,31 @@
1
1
  use std::borrow::Cow;
2
2
  use wry::http::{Request, Response, StatusCode};
3
+ use std::path::Path;
3
4
 
4
5
  #[cfg(not(debug_assertions))]
5
6
  use include_dir::{include_dir, Dir};
6
7
 
8
+ // Configuration'dan frontendDist path'ini oku
9
+ fn get_frontend_dist_path() -> String {
10
+ // Önce Ionyx config dosyasını okumaya çalış
11
+ if let Ok(config_content) = std::fs::read_to_string("ionyx.config.toml") {
12
+ for line in config_content.lines() {
13
+ if line.trim().starts_with("frontendDist") {
14
+ if let Some(path) = line.split('=').nth(1) {
15
+ return path.trim().trim_matches('"').to_string();
16
+ }
17
+ }
18
+ }
19
+ }
20
+
21
+ // Varsayılan path
22
+ "../frontend/dist".to_string()
23
+ }
24
+
7
25
  // Release modunda frontend/dist içindeki dosyaları binary'ye gömer.
8
- // Path hatasını engellemek için senin yapılandırdığın "../dist" yolunu kullanıyoruz.
26
+ // Configuration'dan dinamik path okur.
9
27
  #[cfg(not(debug_assertions))]
10
- static EMBEDDED_ASSETS: Dir<'static> = include_dir!("$CARGO_MANIFEST_DIR/../dist");
28
+ static EMBEDDED_ASSETS: Dir<'static> = include_dir!("../frontend/dist");
11
29
 
12
30
  pub struct CustomProtocolHandler;
13
31
 
@@ -5,6 +5,10 @@ edition = "2021"
5
5
 
6
6
  [workspace]
7
7
 
8
+ [lib]
9
+ name = "my_ionyx_app"
10
+ path = "src/lib.rs"
11
+
8
12
  [[bin]]
9
13
  name = "my-ionyx-app"
10
14
  path = "main.rs"
@@ -12,6 +16,8 @@ path = "main.rs"
12
16
  [dependencies]
13
17
  ionyx = { path = "../../../../../../src-ionyx" }
14
18
  anyhow = "1.0"
19
+ wry = "0.54"
20
+ tao = "0.34"
15
21
 
16
22
  [profile.release]
17
23
  opt-level = 3
@@ -0,0 +1,6 @@
1
+ //! Vue template library for Ionyx Framework
2
+
3
+ pub mod protocol;
4
+
5
+ // Re-export main protocol handler
6
+ pub use protocol::CustomProtocolHandler;
@@ -5,9 +5,9 @@ use wry::http::{Request, Response, StatusCode};
5
5
  use include_dir::{include_dir, Dir};
6
6
 
7
7
  // Release modunda frontend/dist içindeki dosyaları binary'ye gömer.
8
- // Path hatasını engellemek için senin yapılandırdığın "../dist" yolunu kullanıyoruz.
8
+ // Path hatasını engellemek için doğru path kullanıyoruz.
9
9
  #[cfg(not(debug_assertions))]
10
- static EMBEDDED_ASSETS: Dir<'static> = include_dir!("$CARGO_MANIFEST_DIR/../dist");
10
+ static EMBEDDED_ASSETS: Dir<'static> = include_dir!("../frontend/dist");
11
11
 
12
12
  pub struct CustomProtocolHandler;
13
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ionyx-apps/cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Ionyx Framework CLI - High-performance desktop apps with Rust and WebGPU",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
@@ -11,12 +11,19 @@
11
11
  "ionyx": "node bin/ionyx.js",
12
12
  "dev": "cd ionyx-cli && cargo run --bin ionyx",
13
13
  "build": "cd ionyx-cli && cargo build --release",
14
- "prepack": "npm run build && (copy ionyx-cli\\target\\release\\ionyx.exe bin\\ionyx.exe || cp ionyx-cli/target/release/ionyx bin/ionyx)",
14
+ "prepack": "npm run build && (copy ionyx-cli\\target\\release\\ionyx.exe bin\\ionyx.exe || cp ionyx-cli/target/release/ionyx bin/ionyx) && (upx --best --lzma bin\\ionyx.exe || echo 'UPX not available, skipping compression')",
15
15
  "test": "node test-framework.js"
16
16
  },
17
17
  "files": [
18
- "bin/",
19
- "ionyx-cli/src/templates/",
18
+ "bin/index.js",
19
+ "bin/ionyx.js",
20
+ "bin/ionyx.exe",
21
+ "!bin/cargo-ionyx*",
22
+ "ionyx-cli/Cargo.toml",
23
+ "ionyx-cli/src/",
24
+ "!ionyx-cli/src/templates/**/target/**",
25
+ "!ionyx-cli/src/templates/**/node_modules/**",
26
+ "!ionyx-cli/src/templates/**/*.lock",
20
27
  "README.md",
21
28
  "LICENSE"
22
29
  ],
Binary file
Binary file