@bobfrankston/msger 0.1.12 → 0.1.14
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.
- package/msger-native/build-wsl.ts +56 -0
- package/package.json +2 -2
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execSync } from 'child_process';
|
|
4
|
+
import { resolve } from 'path';
|
|
5
|
+
|
|
6
|
+
// Get the absolute path to msger-native directory
|
|
7
|
+
const msgerNativePath = resolve(import.meta.dirname);
|
|
8
|
+
|
|
9
|
+
// Convert Windows path to WSL path
|
|
10
|
+
// Example: Y:\dev\utils\msger\msger-native -> /mnt/y/dev/utils/msger/msger-native
|
|
11
|
+
function toWSLPath(winPath: string): string {
|
|
12
|
+
// Replace backslashes with forward slashes
|
|
13
|
+
let path = winPath.replace(/\\/g, '/');
|
|
14
|
+
|
|
15
|
+
// Convert drive letter (e.g., Y: -> /mnt/y)
|
|
16
|
+
path = path.replace(/^([A-Za-z]):/, (_, drive) => `/mnt/${drive.toLowerCase()}`);
|
|
17
|
+
|
|
18
|
+
return path;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const wslPath = toWSLPath(msgerNativePath);
|
|
22
|
+
|
|
23
|
+
console.log('🐧 Building Linux binary via WSL...');
|
|
24
|
+
console.log(`📍 WSL path: ${wslPath}`);
|
|
25
|
+
|
|
26
|
+
// Check if Rust/Cargo is installed in WSL, and install if not
|
|
27
|
+
console.log('🔍 Checking for Rust/Cargo in WSL...');
|
|
28
|
+
try {
|
|
29
|
+
execSync('wsl -e bash -c "command -v cargo"', { stdio: 'pipe' });
|
|
30
|
+
console.log('✅ Rust/Cargo found');
|
|
31
|
+
} catch {
|
|
32
|
+
console.log('⚠️ Rust/Cargo not found in WSL, installing...');
|
|
33
|
+
try {
|
|
34
|
+
execSync(
|
|
35
|
+
'wsl -e bash -c "curl --proto \'=https\' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && source ~/.cargo/env"',
|
|
36
|
+
{ stdio: 'inherit' }
|
|
37
|
+
);
|
|
38
|
+
console.log('✅ Rust installed successfully');
|
|
39
|
+
} catch (error: any) {
|
|
40
|
+
console.error('❌ Failed to install Rust:', error.message);
|
|
41
|
+
console.error('Please install Rust manually in WSL:');
|
|
42
|
+
console.error(' wsl');
|
|
43
|
+
console.error(' curl --proto \'=https\' --tlsv1.2 -sSf https://sh.rustup.rs | sh');
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
execSync(`wsl -e bash -c "source ~/.cargo/env 2>/dev/null || true && cd '${wslPath}' && npm run build"`, {
|
|
50
|
+
stdio: 'inherit'
|
|
51
|
+
});
|
|
52
|
+
console.log('✅ WSL build completed');
|
|
53
|
+
} catch (error: any) {
|
|
54
|
+
console.error('❌ WSL build failed:', error.message);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/msger",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Fast, lightweight, cross-platform message box - Rust-powered alternative to msgview",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "npm run build:ts && npm run build:native",
|
|
18
18
|
"build:native": "cd msger-native && npm run build",
|
|
19
|
-
"build:native:wsl": "
|
|
19
|
+
"build:native:wsl": "cd msger-native && npm run build:wsl",
|
|
20
20
|
"build:native:all": "npm run build:native && npm run build:native:wsl",
|
|
21
21
|
"build:ts": "tsc",
|
|
22
22
|
"watch": "tsc -w",
|