cicy-code 0.2.6 → 0.2.7
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/cicy-code.js +10 -3
- package/package.json +1 -1
package/bin/cicy-code.js
CHANGED
|
@@ -50,7 +50,7 @@ async function main() {
|
|
|
50
50
|
new Promise(r => setTimeout(() => r(null), 3000))
|
|
51
51
|
]);
|
|
52
52
|
|
|
53
|
-
if (latest) {
|
|
53
|
+
if (latest && !process.env.CICY_SKIP_UPDATE) {
|
|
54
54
|
console.log(`\n Update available: ${pkg.version} → ${latest}`);
|
|
55
55
|
console.log(` Updating...\n`);
|
|
56
56
|
try {
|
|
@@ -125,15 +125,22 @@ function waitForServer(port, timeout) {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
async function launchDesktop() {
|
|
128
|
-
const port = process.env.PORT ||
|
|
128
|
+
const port = process.env.PORT || 8008;
|
|
129
129
|
const desktopPort = 18101;
|
|
130
130
|
|
|
131
|
+
// 0. Kill existing electron/cicy-code and free ports
|
|
132
|
+
try { execSync(`pkill -f 'electron' 2>/dev/null || true`, { shell: true }); } catch {}
|
|
133
|
+
try { execSync(`pkill -f 'cicy-code' 2>/dev/null || true`, { shell: true }); } catch {}
|
|
134
|
+
try { execSync(`lsof -ti:${desktopPort} | xargs kill -9 2>/dev/null || true`, { shell: true }); } catch {}
|
|
135
|
+
try { execSync(`lsof -ti:${port} | xargs kill -9 2>/dev/null || true`, { shell: true }); } catch {}
|
|
136
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
137
|
+
|
|
131
138
|
// 1. Start API server in background
|
|
132
139
|
const serverArgs = process.argv.slice(2).filter(a => a !== '--desktop');
|
|
133
140
|
const server = spawn(binPath, serverArgs, {
|
|
134
141
|
stdio: 'ignore',
|
|
135
142
|
detached: true,
|
|
136
|
-
env: process.env
|
|
143
|
+
env: { ...process.env, CICY_NO_BROWSER: '1' }
|
|
137
144
|
});
|
|
138
145
|
server.unref();
|
|
139
146
|
console.log(` 🚀 Starting cicy-code server (PID: ${server.pid})...`);
|