@bobfrankston/msger 0.1.126 → 0.1.128
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.
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/msger-native/build.rs
CHANGED
|
@@ -1,34 +1,7 @@
|
|
|
1
|
-
use std::fs;
|
|
2
|
-
use std::path::Path;
|
|
3
|
-
|
|
4
1
|
fn main() {
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if
|
|
9
|
-
|
|
10
|
-
.expect("Failed to read package.json");
|
|
11
|
-
|
|
12
|
-
// Parse JSON to extract version
|
|
13
|
-
if let Some(version_line) = content.lines().find(|line| line.contains("\"version\"")) {
|
|
14
|
-
// Extract version value (simple string parsing)
|
|
15
|
-
if let Some(start) = version_line.find('"') {
|
|
16
|
-
if let Some(colon) = version_line[start+1..].find(':') {
|
|
17
|
-
let after_colon = &version_line[start+colon+2..];
|
|
18
|
-
if let Some(quote_start) = after_colon.find('"') {
|
|
19
|
-
if let Some(quote_end) = after_colon[quote_start+1..].find('"') {
|
|
20
|
-
let version = &after_colon[quote_start+1..quote_start+1+quote_end];
|
|
21
|
-
println!("cargo:rustc-env=NPM_VERSION={}", version);
|
|
22
|
-
println!("cargo:rerun-if-changed=../package.json");
|
|
23
|
-
println!("cargo:rerun-if-changed=src/template.html");
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Fallback to Cargo version if package.json not found
|
|
33
|
-
println!("cargo:rustc-env=NPM_VERSION={}", env!("CARGO_PKG_VERSION"));
|
|
2
|
+
// Version is now read at runtime from package.json, not embedded at build time
|
|
3
|
+
// Just set up rebuild triggers for template changes
|
|
4
|
+
println!("cargo:rerun-if-changed=src/template.html");
|
|
5
|
+
println!("cargo:rerun-if-changed=src/msger-api.js");
|
|
6
|
+
println!("cargo:rerun-if-changed=src/main.rs");
|
|
34
7
|
}
|
package/msger-native/src/main.rs
CHANGED
|
@@ -164,7 +164,40 @@ struct MessageBoxResult {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
fn default_title() -> String {
|
|
167
|
-
|
|
167
|
+
// Read version from package.json at runtime (not embedded at build time)
|
|
168
|
+
let version = get_package_version().unwrap_or_else(|| "unknown".to_string());
|
|
169
|
+
format!("msger {}", version)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
fn get_package_version() -> Option<String> {
|
|
173
|
+
// Read ../package.json relative to executable
|
|
174
|
+
let exe_path = std::env::current_exe().ok()?;
|
|
175
|
+
let exe_dir = exe_path.parent()?;
|
|
176
|
+
|
|
177
|
+
// Try multiple possible locations for package.json
|
|
178
|
+
let possible_paths = vec![
|
|
179
|
+
exe_dir.join("../package.json"), // Development: bin/../package.json
|
|
180
|
+
exe_dir.join("../../package.json"), // Installed globally: lib/node_modules/@bobfrankston/msger/package.json
|
|
181
|
+
exe_dir.join("../../../package.json"), // node_modules structure
|
|
182
|
+
];
|
|
183
|
+
|
|
184
|
+
for path in possible_paths {
|
|
185
|
+
if let Ok(content) = std::fs::read_to_string(&path) {
|
|
186
|
+
// Simple JSON parsing - just extract version field
|
|
187
|
+
if let Some(version_line) = content.lines().find(|line| line.contains("\"version\"")) {
|
|
188
|
+
if let Some(start) = version_line.find("\":") {
|
|
189
|
+
let after_colon = &version_line[start+2..].trim_start();
|
|
190
|
+
if let Some(quote_start) = after_colon.find('"') {
|
|
191
|
+
if let Some(quote_end) = after_colon[quote_start+1..].find('"') {
|
|
192
|
+
return Some(after_colon[quote_start+1..quote_start+1+quote_end].to_string());
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
None
|
|
168
201
|
}
|
|
169
202
|
|
|
170
203
|
fn default_width() -> i32 {
|
|
@@ -716,7 +749,7 @@ fn main() {
|
|
|
716
749
|
is_maximized,
|
|
717
750
|
is_fullscreen,
|
|
718
751
|
is_always_on_top,
|
|
719
|
-
|
|
752
|
+
get_package_version().unwrap_or_else(|| "unknown".to_string())
|
|
720
753
|
);
|
|
721
754
|
|
|
722
755
|
// Show the info in an alert
|
package/msgernative-linux-x64
CHANGED
|
Binary file
|