doc-fetch-cli 1.1.2 → 1.1.3

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 +44 -5
  2. package/package.json +1 -1
@@ -35,11 +35,24 @@ const sourcePath = path.join(packageDir, expectedBinary);
35
35
  const destPath = path.join(packageDir, binaryName);
36
36
 
37
37
  console.log(`šŸ“¦ Platform: ${platform} ${arch}`);
38
- console.log(`šŸ“¦ Expected binary: ${expectedBinary}\n`);
38
+ console.log(`šŸ“¦ Expected binary: ${expectedBinary}`);
39
+ console.log(`šŸ“¦ Will copy to: ${binaryName}\n`);
39
40
 
40
41
  // Check if the expected binary exists
41
42
  if (!fs.existsSync(sourcePath)) {
42
- console.error(`āš ļø Warning: Expected binary not found: ${expectedBinary}`);
43
+ console.error(`āš ļø CRITICAL: Expected binary not found at: ${sourcePath}`);
44
+ console.error('');
45
+ console.error('šŸ’” Listing package contents:');
46
+ try {
47
+ const files = fs.readdirSync(packageDir);
48
+ files.forEach(file => {
49
+ if (file.includes('doc-fetch')) {
50
+ console.error(` šŸ“„ ${file}`);
51
+ }
52
+ });
53
+ } catch (e) {
54
+ console.error(` Could not list directory: ${e.message}`);
55
+ }
43
56
  console.error('');
44
57
  console.error('šŸ’” This might be because:');
45
58
  console.error(' 1. The package was published without binaries');
@@ -54,22 +67,48 @@ if (!fs.existsSync(sourcePath)) {
54
67
  console.error(' npm uninstall -g doc-fetch-cli');
55
68
  console.error(' git clone https://github.com/AlphaTechini/doc-fetch.git');
56
69
  console.error(' cd doc-fetch && go build -o doc-fetch ./cmd/docfetch');
57
- console.error(' sudo cp doc-fetch /usr/local/bin/');
70
+ if (platform === 'win32') {
71
+ console.error(' copy doc-fetch.exe %APPDATA%\\npm\\node_modules\\doc-fetch-cli\\');
72
+ } else {
73
+ console.error(' sudo cp doc-fetch /usr/local/bin/');
74
+ }
58
75
  process.exit(1);
59
76
  }
60
77
 
78
+ console.log(`āœ… Found source binary: ${expectedBinary}`);
79
+
61
80
  // Copy the binary to the expected location
62
81
  try {
82
+ console.log(`šŸ“‹ Copying: ${expectedBinary} → ${binaryName}`);
63
83
  fs.copyFileSync(sourcePath, destPath);
84
+ console.log(`āœ… Copy successful`);
85
+
86
+ // Verify the destination exists
87
+ if (!fs.existsSync(destPath)) {
88
+ throw new Error('Destination file does not exist after copy');
89
+ }
64
90
 
65
91
  // Make executable on Unix-like systems
66
92
  if (platform !== 'win32') {
67
93
  fs.chmodSync(destPath, 0o755);
94
+ console.log(`āœ… Set executable permissions`);
95
+ } else {
96
+ console.log(`ā„¹ļø Windows: No chmod needed`);
68
97
  }
69
98
 
70
- console.log(`āœ… Binary installed: ${binaryName}`);
99
+ console.log(`\nāœ… Binary installed: ${binaryName}`);
71
100
  } catch (error) {
72
- console.error(`āŒ Failed to install binary: ${error.message}`);
101
+ console.error(`\nāŒ CRITICAL: Failed to install binary!`);
102
+ console.error(` Source: ${sourcePath}`);
103
+ console.error(` Destination: ${destPath}`);
104
+ console.error(` Error: ${error.message}`);
105
+ console.error('');
106
+ console.error('šŸ’” Manual fix:');
107
+ console.error(` 1. Navigate to: ${packageDir}`);
108
+ console.error(` 2. Rename: ${expectedBinary} → ${binaryName}`);
109
+ if (platform !== 'win32') {
110
+ console.error(` 3. Run: chmod +x ${binaryName}`);
111
+ }
73
112
  process.exit(1);
74
113
  }
75
114
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doc-fetch-cli",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
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"