doc-fetch-cli 2.0.1 → 2.0.2
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/postinstall.js +32 -19
- package/package.json +1 -1
package/bin/postinstall.js
CHANGED
|
@@ -76,33 +76,46 @@ try {
|
|
|
76
76
|
}
|
|
77
77
|
console.log('');
|
|
78
78
|
|
|
79
|
-
// Smart detection:
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
fs.copyFileSync(path.join(packageDir, foundBinary), path.join(packageDir, binaryName));
|
|
86
|
-
|
|
87
|
-
if (platform !== 'win32') {
|
|
88
|
-
fs.chmodSync(path.join(packageDir, binaryName), 0o755);
|
|
89
|
-
}
|
|
79
|
+
// Smart detection: Copy platform binary to generic name if needed
|
|
80
|
+
if (foundBinary && fs.existsSync(path.join(packageDir, foundBinary))) {
|
|
81
|
+
// Check if we need to copy (found binary != expected generic name)
|
|
82
|
+
if (foundBinary !== binaryName) {
|
|
83
|
+
console.log(`✅ Found platform binary: ${foundBinary}`);
|
|
84
|
+
console.log(`📋 Copying to: ${binaryName}`);
|
|
90
85
|
|
|
91
|
-
console.log(`✅ Binary installed successfully!\n`);
|
|
92
|
-
|
|
93
|
-
// Verify it works
|
|
94
86
|
try {
|
|
87
|
+
fs.copyFileSync(path.join(packageDir, foundBinary), path.join(packageDir, binaryName));
|
|
88
|
+
|
|
89
|
+
if (platform !== 'win32') {
|
|
90
|
+
fs.chmodSync(path.join(packageDir, binaryName), 0o755);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
console.log(`✅ Binary installed successfully!\n`);
|
|
94
|
+
|
|
95
|
+
// Verify it works
|
|
95
96
|
const testPath = path.join(packageDir, binaryName);
|
|
96
97
|
if (fs.existsSync(testPath)) {
|
|
97
98
|
console.log('✨ Installation complete! You can now use: doc-fetch\n');
|
|
98
99
|
return; // Success!
|
|
99
100
|
}
|
|
100
|
-
} catch (
|
|
101
|
-
|
|
101
|
+
} catch (copyError) {
|
|
102
|
+
console.error(`⚠️ Copy failed: ${copyError.message}`);
|
|
103
|
+
console.error('');
|
|
104
|
+
console.error('💡 Manual fix:');
|
|
105
|
+
console.error(` cd "${packageDir}"`);
|
|
106
|
+
if (platform === 'win32') {
|
|
107
|
+
console.error(` copy "${foundBinary}" "${binaryName}"`);
|
|
108
|
+
} else {
|
|
109
|
+
console.error(` cp "${foundBinary}" "${binaryName}"`);
|
|
110
|
+
console.error(` chmod +x "${binaryName}"`);
|
|
111
|
+
}
|
|
112
|
+
process.exit(1);
|
|
102
113
|
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
114
|
+
} else {
|
|
115
|
+
// Binary already has correct name
|
|
116
|
+
console.log(`✅ Binary already correctly named: ${binaryName}\n`);
|
|
117
|
+
console.log('✨ Installation complete! You can now use: doc-fetch\n');
|
|
118
|
+
return;
|
|
106
119
|
}
|
|
107
120
|
}
|
|
108
121
|
|
package/package.json
CHANGED