deepflow 0.1.56 → 0.1.57
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/install.js +20 -0
- package/package.json +1 -1
package/bin/install.js
CHANGED
|
@@ -35,6 +35,23 @@ const GLOBAL_DIR = path.join(os.homedir(), '.claude');
|
|
|
35
35
|
const PROJECT_DIR = path.join(process.cwd(), '.claude');
|
|
36
36
|
const PACKAGE_DIR = path.resolve(__dirname, '..');
|
|
37
37
|
|
|
38
|
+
function updateGlobalPackage() {
|
|
39
|
+
const currentVersion = require(path.join(PACKAGE_DIR, 'package.json')).version;
|
|
40
|
+
try {
|
|
41
|
+
const globalPkgPath = execFileSync('node', ['-e',
|
|
42
|
+
"try{console.log(require(require('path').join(require('child_process').execFileSync('npm',['root','-g'],{encoding:'utf8'}).trim(),'deepflow','package.json')).version)}catch(e){console.log('')}"
|
|
43
|
+
], { encoding: 'utf8' }).trim();
|
|
44
|
+
|
|
45
|
+
if (globalPkgPath && globalPkgPath !== currentVersion) {
|
|
46
|
+
console.log(`Updating global npm package (${globalPkgPath} → ${currentVersion})...`);
|
|
47
|
+
execFileSync('npm', ['install', '-g', `deepflow@${currentVersion}`], { stdio: 'inherit' });
|
|
48
|
+
console.log('');
|
|
49
|
+
}
|
|
50
|
+
} catch (e) {
|
|
51
|
+
// No global installation or npm not available - skip silently
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
38
55
|
async function main() {
|
|
39
56
|
// Handle --uninstall flag
|
|
40
57
|
if (process.argv.includes('--uninstall')) {
|
|
@@ -45,6 +62,9 @@ async function main() {
|
|
|
45
62
|
console.log(`${c.cyan}deepflow installer${c.reset}`);
|
|
46
63
|
console.log('');
|
|
47
64
|
|
|
65
|
+
// Update global npm package if stale
|
|
66
|
+
updateGlobalPackage();
|
|
67
|
+
|
|
48
68
|
// Detect existing installations
|
|
49
69
|
const globalInstalled = isInstalled(GLOBAL_DIR);
|
|
50
70
|
const projectInstalled = isInstalled(PROJECT_DIR);
|