linkgravity 1.5.9 → 1.5.10
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 +8 -5
- package/npm-scripts/ensure-env.js +30 -21
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -376,11 +376,8 @@ if (cmd === 'version' || cmd === '-v' || cmd === '--version') {
|
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
if (!isEnvironmentReady()) {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
`run ${color.cyan}lgy setup${color.reset} first (it installs everything on its first run).\n`,
|
|
382
|
-
);
|
|
383
|
-
process.exit(1);
|
|
379
|
+
info('Some dependencies are missing - installing them first...');
|
|
380
|
+
require('../npm-scripts/ensure-env').ensureEnvironment();
|
|
384
381
|
}
|
|
385
382
|
|
|
386
383
|
info('Starting LinkGravity daemon...');
|
|
@@ -602,6 +599,12 @@ if (cmd === 'version' || cmd === '-v' || cmd === '--version') {
|
|
|
602
599
|
}
|
|
603
600
|
success(`Installed v${latestVersion}.`);
|
|
604
601
|
|
|
602
|
+
// The new install ships without voice-service/node_modules, so restore anything the
|
|
603
|
+
// directory swap dropped. Loaded here rather than at the top of the file: by now npm has
|
|
604
|
+
// replaced this package on disk, and the copy required at startup is the pre-update one.
|
|
605
|
+
delete require.cache[require.resolve('../npm-scripts/ensure-env')];
|
|
606
|
+
require('../npm-scripts/ensure-env').ensureEnvironment();
|
|
607
|
+
|
|
605
608
|
if (!procBeforeUpdate) {
|
|
606
609
|
info("Daemon wasn't running - starting it fresh...");
|
|
607
610
|
runPm2(['start', LGY_SCRIPT_PATH, '--interpreter', pythonExe, '--name', LGY_PM2_NAME]);
|
|
@@ -8,31 +8,40 @@ const { pip: venvPip, python: venvPython, workspaceDir, repoRoot } = require('./
|
|
|
8
8
|
const isWin = os.platform() === 'win32';
|
|
9
9
|
const pyCmd = isWin ? 'python' : 'python3';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const voiceServiceDir = path.join(repoRoot, 'voice-service');
|
|
12
|
+
|
|
13
|
+
function isVenvReady() {
|
|
12
14
|
return fs.existsSync(venvPython);
|
|
13
15
|
}
|
|
14
16
|
|
|
17
|
+
function isVoiceServiceReady() {
|
|
18
|
+
return fs.existsSync(path.join(voiceServiceDir, 'node_modules'));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function isEnvironmentReady() {
|
|
22
|
+
return isVenvReady() && isVoiceServiceReady();
|
|
23
|
+
}
|
|
24
|
+
|
|
15
25
|
function ensureEnvironment() {
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
stdio: 'inherit',
|
|
34
|
-
|
|
35
|
-
});
|
|
26
|
+
if (!isVenvReady()) {
|
|
27
|
+
console.log('⚙️ Setting up Python Virtual Environment...');
|
|
28
|
+
console.log(
|
|
29
|
+
` (in ${path.join(workspaceDir, 'venv')} - not inside this install, so it survives`,
|
|
30
|
+
);
|
|
31
|
+
console.log(' package updates/reinstalls and works the same whether this is a global');
|
|
32
|
+
console.log(' `npm install -g linkgravity` or a local dev clone.)');
|
|
33
|
+
|
|
34
|
+
fs.mkdirSync(workspaceDir, { recursive: true });
|
|
35
|
+
execSync(`${pyCmd} -m venv "${path.join(workspaceDir, 'venv')}"`, { stdio: 'inherit' });
|
|
36
|
+
|
|
37
|
+
console.log('📦 Installing Python dependencies...');
|
|
38
|
+
execSync(`"${venvPip}" install -r requirements.txt`, { stdio: 'inherit', cwd: repoRoot });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!isVoiceServiceReady()) {
|
|
42
|
+
console.log('🎙️ Installing Voice Service dependencies...');
|
|
43
|
+
execSync('npm install', { stdio: 'inherit', cwd: voiceServiceDir });
|
|
44
|
+
}
|
|
36
45
|
|
|
37
46
|
console.log('✅ Environment ready.');
|
|
38
47
|
}
|