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.
Files changed (2) hide show
  1. package/bin/postinstall.js +32 -19
  2. package/package.json +1 -1
@@ -76,33 +76,46 @@ try {
76
76
  }
77
77
  console.log('');
78
78
 
79
- // Smart detection: If we found a binary that works, use it!
80
- if (!hasPlatformBinary && foundBinary && fs.existsSync(path.join(packageDir, foundBinary))) {
81
- console.log(`✅ Found compatible binary: ${foundBinary}`);
82
- console.log(`📋 Copying: ${foundBinary} ${binaryName}`);
83
-
84
- try {
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 (e) {
101
- // Continue to error handling
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
- } catch (copyError) {
104
- console.error(`⚠️ Copy failed: ${copyError.message}`);
105
- // Continue to error handling
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doc-fetch-cli",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Dynamic documentation fetching CLI that converts entire documentation sites to single markdown files for AI/LLM consumption",
5
5
  "bin": {
6
6
  "doc-fetch": "./bin/doc-fetch.js"