flying-lobster 0.1.2 → 1.6.1
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/bin/cli.js +27 -63
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -53,9 +53,23 @@ function findBuiltApp(projectRoot) {
|
|
|
53
53
|
return null;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
function findBuiltDmg(projectRoot) {
|
|
57
|
+
const distDir = path.join(projectRoot, 'dist');
|
|
58
|
+
|
|
59
|
+
// Look for any .dmg file in dist
|
|
60
|
+
if (fs.existsSync(distDir)) {
|
|
61
|
+
const files = fs.readdirSync(distDir);
|
|
62
|
+
const dmg = files.find(f => f.endsWith('.dmg'));
|
|
63
|
+
if (dmg) {
|
|
64
|
+
return path.join(distDir, dmg);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
|
|
56
71
|
async function install() {
|
|
57
72
|
const projectRoot = path.resolve(__dirname, '..');
|
|
58
|
-
const destPath = path.join(INSTALL_PATH, APP_NAME);
|
|
59
73
|
|
|
60
74
|
log('Building Flying Lobster...');
|
|
61
75
|
|
|
@@ -67,81 +81,31 @@ async function install() {
|
|
|
67
81
|
await runCommand('npm', ['install', '--include=dev'], { cwd: projectRoot });
|
|
68
82
|
}
|
|
69
83
|
|
|
70
|
-
// Build the
|
|
84
|
+
// Build the DMG (standard Mac installer experience)
|
|
71
85
|
try {
|
|
72
|
-
await runCommand('npm', ['run', 'build
|
|
86
|
+
await runCommand('npm', ['run', 'build'], { cwd: projectRoot });
|
|
73
87
|
} catch (e) {
|
|
74
88
|
error('Build failed. Make sure you have the right permissions and dependencies.');
|
|
75
89
|
}
|
|
76
90
|
|
|
77
|
-
// Find the built
|
|
78
|
-
const
|
|
79
|
-
if (!
|
|
80
|
-
error('
|
|
91
|
+
// Find the built DMG
|
|
92
|
+
const dmgPath = findBuiltDmg(projectRoot);
|
|
93
|
+
if (!dmgPath) {
|
|
94
|
+
error('DMG not found. Build may have failed.');
|
|
81
95
|
}
|
|
82
96
|
|
|
83
|
-
log(`
|
|
84
|
-
|
|
85
|
-
// Remove existing installation
|
|
86
|
-
if (fs.existsSync(destPath)) {
|
|
87
|
-
log('Removing existing installation...');
|
|
88
|
-
try {
|
|
89
|
-
execSync(`rm -rf "${destPath}"`);
|
|
90
|
-
} catch (e) {
|
|
91
|
-
error(`Failed to remove existing app.\n\n Option 1: Open Finder → Applications → drag "Flying Lobster" to Trash\n Option 2: sudo rm -rf "${destPath}"\n\n Then run this command again.`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Copy to Applications (try /Applications first, then ~/Applications)
|
|
96
|
-
log('Installing to /Applications...');
|
|
97
|
-
let finalDestPath = destPath;
|
|
98
|
-
try {
|
|
99
|
-
execSync(`cp -R "${appPath}" "${INSTALL_PATH}/"`);
|
|
100
|
-
} catch (e) {
|
|
101
|
-
// Try user's Applications folder
|
|
102
|
-
const userApps = path.join(os.homedir(), 'Applications');
|
|
103
|
-
const userDestPath = path.join(userApps, APP_NAME);
|
|
104
|
-
|
|
105
|
-
log('/Applications failed, trying ~/Applications...');
|
|
106
|
-
try {
|
|
107
|
-
if (!fs.existsSync(userApps)) {
|
|
108
|
-
fs.mkdirSync(userApps, { recursive: true });
|
|
109
|
-
}
|
|
110
|
-
if (fs.existsSync(userDestPath)) {
|
|
111
|
-
execSync(`rm -rf "${userDestPath}"`);
|
|
112
|
-
}
|
|
113
|
-
execSync(`cp -R "${appPath}" "${userApps}/"`);
|
|
114
|
-
finalDestPath = userDestPath;
|
|
115
|
-
log('Installed to ~/Applications instead.');
|
|
116
|
-
} catch (e2) {
|
|
117
|
-
// Last resort: open Finder and let user drag
|
|
118
|
-
log('Could not copy automatically. Opening Finder...');
|
|
119
|
-
spawn('open', ['-R', appPath], { detached: true, stdio: 'ignore' }).unref();
|
|
120
|
-
console.log('');
|
|
121
|
-
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
122
|
-
console.log('');
|
|
123
|
-
console.log(' 📂 Drag "Flying Lobster.app" to your Applications folder');
|
|
124
|
-
console.log('');
|
|
125
|
-
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
126
|
-
console.log('');
|
|
127
|
-
process.exit(0);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Open the app
|
|
132
|
-
log('Installation complete! ✨');
|
|
133
|
-
log(`Installed to: ${destPath}`);
|
|
134
|
-
log('');
|
|
135
|
-
log('Starting Flying Lobster...');
|
|
97
|
+
log(`Built: ${path.basename(dmgPath)}`);
|
|
98
|
+
log('Opening installer...');
|
|
136
99
|
|
|
137
|
-
|
|
100
|
+
// Open the DMG - this mounts it and shows the drag-to-install window
|
|
101
|
+
spawn('open', [dmgPath], { detached: true, stdio: 'ignore' }).unref();
|
|
138
102
|
|
|
139
103
|
console.log('');
|
|
140
104
|
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
141
105
|
console.log('');
|
|
142
|
-
console.log(' 🦞 Flying Lobster
|
|
106
|
+
console.log(' 🦞 Drag Flying Lobster to Applications to install!');
|
|
143
107
|
console.log('');
|
|
144
|
-
console.log('
|
|
108
|
+
console.log(' After installing:');
|
|
145
109
|
console.log(' • Press Cmd+Shift+L to toggle the chat window');
|
|
146
110
|
console.log(' • Click the 🦞 tray icon to show/hide');
|
|
147
111
|
console.log(' • Add your OpenClaw gateway in Settings');
|