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.
- package/bin/postinstall.js +44 -5
- package/package.json +1 -1
package/bin/postinstall.js
CHANGED
|
@@ -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}
|
|
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(`ā ļø
|
|
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
|
-
|
|
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(
|
|
99
|
+
console.log(`\nā
Binary installed: ${binaryName}`);
|
|
71
100
|
} catch (error) {
|
|
72
|
-
console.error(
|
|
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