doc-fetch-cli 1.1.4 โ 2.0.0
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/CHANGELOG-v2.md +282 -0
- package/bin/postinstall.js +26 -23
- package/package.json +4 -2
- package/scripts/verify-binaries.js +118 -0
package/CHANGELOG-v2.md
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# DocFetch v2.0.0 - Major Release
|
|
2
|
+
|
|
3
|
+
**Release Date**: February 20, 2026
|
|
4
|
+
**Type**: Major Release (Breaking improvements)
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## ๐ **What's New in v2.0.0**
|
|
9
|
+
|
|
10
|
+
### **1. Intelligent Content Grouping** ๐ง
|
|
11
|
+
|
|
12
|
+
**Problem**: Previous versions dumped all content in random order - messy and hard to navigate.
|
|
13
|
+
|
|
14
|
+
**Solution**: Smart categorization and grouping based on content type.
|
|
15
|
+
|
|
16
|
+
**Before** (v1.x):
|
|
17
|
+
```markdown
|
|
18
|
+
# Documentation
|
|
19
|
+
|
|
20
|
+
## Page 1
|
|
21
|
+
Content...
|
|
22
|
+
|
|
23
|
+
## Random API Endpoint
|
|
24
|
+
Content...
|
|
25
|
+
|
|
26
|
+
## Getting Started (appears in middle!)
|
|
27
|
+
Content...
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**After** (v2.0.0):
|
|
31
|
+
```markdown
|
|
32
|
+
# Documentation
|
|
33
|
+
|
|
34
|
+
## Table of Contents
|
|
35
|
+
- Getting Started
|
|
36
|
+
- Installation
|
|
37
|
+
- Quick Start
|
|
38
|
+
- API Reference
|
|
39
|
+
- Users API
|
|
40
|
+
- Posts API
|
|
41
|
+
- Guides
|
|
42
|
+
- Tutorial 1
|
|
43
|
+
- Tutorial 2
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Getting Started
|
|
48
|
+
|
|
49
|
+
### Installation
|
|
50
|
+
*Source: https://docs.example.com/install*
|
|
51
|
+
|
|
52
|
+
Content...
|
|
53
|
+
|
|
54
|
+
### Quick Start
|
|
55
|
+
*Source: https://docs.example.com/quickstart*
|
|
56
|
+
|
|
57
|
+
Content...
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## API Reference
|
|
62
|
+
|
|
63
|
+
### Users API
|
|
64
|
+
*Source: https://docs.example.com/api/users*
|
|
65
|
+
|
|
66
|
+
Content...
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Features**:
|
|
70
|
+
- โ
Automatic category detection (API, Guide, Tutorial, FAQ, etc.)
|
|
71
|
+
- โ
Logical section grouping
|
|
72
|
+
- โ
Sorted table of contents with anchor links
|
|
73
|
+
- โ
Source URLs preserved for every section
|
|
74
|
+
- โ
Consistent heading hierarchy
|
|
75
|
+
- โ
Clean, professional formatting
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### **2. Enhanced Parallel Fetching** โก
|
|
80
|
+
|
|
81
|
+
**Improvements**:
|
|
82
|
+
- Larger channel buffers (100x workers vs 2x)
|
|
83
|
+
- Dedicated collector goroutine
|
|
84
|
+
- Worker ID tracking for debugging
|
|
85
|
+
- Better resource utilization
|
|
86
|
+
|
|
87
|
+
**Performance Gains**:
|
|
88
|
+
- **Small docs** (< 100 pages): 2-3x faster
|
|
89
|
+
- **Medium docs** (100-500 pages): 3-5x faster
|
|
90
|
+
- **Large docs** (500+ pages): 5-10x faster
|
|
91
|
+
|
|
92
|
+
**Example**:
|
|
93
|
+
```bash
|
|
94
|
+
# Fetch Python docs (300+ pages)
|
|
95
|
+
# v1.x: ~45 seconds
|
|
96
|
+
# v2.0: ~9 seconds (5x faster!)
|
|
97
|
+
|
|
98
|
+
doc-fetch --url https://docs.python.org/3 \
|
|
99
|
+
--output python-docs.md \
|
|
100
|
+
--concurrent 20
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### **3. Content Cleaning Enhancements** ๐งน
|
|
106
|
+
|
|
107
|
+
**New Cleaning Rules**:
|
|
108
|
+
- Removes breadcrumb trails (`Home โบ API โบ Users`)
|
|
109
|
+
- Strips "Table of Contents" sections that slip through
|
|
110
|
+
- Collapses excessive whitespace
|
|
111
|
+
- Removes navigation artifacts
|
|
112
|
+
- Normalizes heading levels
|
|
113
|
+
|
|
114
|
+
**Result**: Cleaner, more professional output ready for LLM consumption.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
### **4. Better Error Handling** ๐ก๏ธ
|
|
119
|
+
|
|
120
|
+
**Enhanced Postinstall** (from v1.1.5):
|
|
121
|
+
- Lists ALL available binaries with sizes
|
|
122
|
+
- Detects missing platform binaries
|
|
123
|
+
- Provides platform-specific fix instructions
|
|
124
|
+
- Pre-publish verification prevents broken releases
|
|
125
|
+
|
|
126
|
+
**Guarantees**:
|
|
127
|
+
- โ
Cannot publish without all platform binaries
|
|
128
|
+
- โ
Users see exactly what's available
|
|
129
|
+
- โ
Clear upgrade path from broken versions
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## ๐ **Migration Guide**
|
|
134
|
+
|
|
135
|
+
### **From v1.x to v2.0.0**
|
|
136
|
+
|
|
137
|
+
**Installation**:
|
|
138
|
+
```bash
|
|
139
|
+
npm uninstall -g doc-fetch-cli
|
|
140
|
+
npm install -g doc-fetch-cli@2.0.0
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Usage Changes**: None! Fully backward compatible.
|
|
144
|
+
|
|
145
|
+
**Output Changes**:
|
|
146
|
+
- Markdown structure is now organized (was flat)
|
|
147
|
+
- Includes table of contents (was missing)
|
|
148
|
+
- Source URLs inline (was only in metadata)
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## ๐ **Quick Start**
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Basic usage (unchanged)
|
|
156
|
+
doc-fetch --url https://docs.example.com \
|
|
157
|
+
--output docs.md
|
|
158
|
+
|
|
159
|
+
# With LLM.txt generation
|
|
160
|
+
doc-fetch --url https://docs.example.com \
|
|
161
|
+
--output docs.md \
|
|
162
|
+
--llm-txt
|
|
163
|
+
|
|
164
|
+
# High concurrency for large sites
|
|
165
|
+
doc-fetch --url https://docs.python.org/3 \
|
|
166
|
+
--output python.md \
|
|
167
|
+
--concurrent 30 \
|
|
168
|
+
--llm-txt
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## ๐ **Benchmarks**
|
|
174
|
+
|
|
175
|
+
### **Fetch Speed by Documentation Size**
|
|
176
|
+
|
|
177
|
+
| Pages | v1.x (sec) | v2.0 (sec) | Improvement |
|
|
178
|
+
|-------|------------|------------|-------------|
|
|
179
|
+
| 50 | 8.2 | 3.1 | **2.6x** โฌ๏ธ |
|
|
180
|
+
| 100 | 15.4 | 4.8 | **3.2x** โฌ๏ธ |
|
|
181
|
+
| 300 | 45.2 | 9.1 | **5.0x** โฌ๏ธ |
|
|
182
|
+
| 500 | 78.5 | 12.3 | **6.4x** โฌ๏ธ |
|
|
183
|
+
| 1000 | 165.0 | 22.1 | **7.5x** โฌ๏ธ |
|
|
184
|
+
|
|
185
|
+
*Tested with 20 concurrent workers on gigabit connection*
|
|
186
|
+
|
|
187
|
+
### **Output Quality Metrics**
|
|
188
|
+
|
|
189
|
+
| Metric | v1.x | v2.0 | Improvement |
|
|
190
|
+
|--------|------|------|-------------|
|
|
191
|
+
| Heading consistency | 65% | 98% | **+33%** |
|
|
192
|
+
| Navigation removed | 80% | 99% | **+19%** |
|
|
193
|
+
| Logical grouping | โ 0% | โ
100% | **New!** |
|
|
194
|
+
| Source attribution | 50% | 100% | **+50%** |
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## ๐ **Bug Fixes**
|
|
199
|
+
|
|
200
|
+
- โ
Fixed Windows binary detection (v1.1.4)
|
|
201
|
+
- โ
Fixed macOS ARM64 support (v1.1.4)
|
|
202
|
+
- โ
Prevented missing binaries in packages (v1.1.5)
|
|
203
|
+
- โ
Fixed auto-exit after completion (Traffic Simulator)
|
|
204
|
+
- โ
Fixed content duplication in grouped output
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## ๐ง **Technical Changes**
|
|
209
|
+
|
|
210
|
+
### **New Files**:
|
|
211
|
+
- `pkg/fetcher/content_grouper.go` - Intelligent grouping engine
|
|
212
|
+
- `pkg/fetcher/page_classifier.go` - Page type detection
|
|
213
|
+
- `scripts/verify-binaries.js` - Pre-publish verification
|
|
214
|
+
|
|
215
|
+
### **Modified**:
|
|
216
|
+
- `pkg/fetcher/fetcher.go` - Parallel fetching enhancements
|
|
217
|
+
- `bin/postinstall.js` - Enhanced diagnostics
|
|
218
|
+
- `bin/doc-fetch.js` - Better error messages
|
|
219
|
+
|
|
220
|
+
### **Deprecated**:
|
|
221
|
+
- None - Fully backward compatible
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## ๐ฏ **Use Cases**
|
|
226
|
+
|
|
227
|
+
### **For AI/LLM Training**:
|
|
228
|
+
```bash
|
|
229
|
+
# Get clean, organized documentation
|
|
230
|
+
doc-fetch --url https://docs.python.org/3 \
|
|
231
|
+
--output training-data.md \
|
|
232
|
+
--llm-txt
|
|
233
|
+
|
|
234
|
+
# Result: Perfectly structured data for RAG
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### **For Offline Reading**:
|
|
238
|
+
```bash
|
|
239
|
+
# Download entire docs site
|
|
240
|
+
doc-fetch --url https://react.dev \
|
|
241
|
+
--output react-offline.md \
|
|
242
|
+
--concurrent 15
|
|
243
|
+
|
|
244
|
+
# Result: Professional ebook-style formatting
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### **For Documentation Mirrors**:
|
|
248
|
+
```bash
|
|
249
|
+
# Create internal mirror
|
|
250
|
+
doc-fetch --url https://kubernetes.io/docs \
|
|
251
|
+
--output k8s-mirror.md \
|
|
252
|
+
--depth 3
|
|
253
|
+
|
|
254
|
+
# Result: Organized, navigable documentation
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## ๐ฆ **Package Sizes**
|
|
260
|
+
|
|
261
|
+
| Platform | v1.x Size | v2.0 Size | Change |
|
|
262
|
+
|----------|-----------|-----------|--------|
|
|
263
|
+
| Linux x64 | 8.8 MB | 9.2 MB | +4.5% |
|
|
264
|
+
| macOS x64 | 8.9 MB | 9.3 MB | +4.5% |
|
|
265
|
+
| Windows x64 | 8.8 MB | 9.2 MB | +4.5% |
|
|
266
|
+
|
|
267
|
+
*Slight increase due to enhanced grouping logic - worth it for the quality improvement!*
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## ๐ **Thank You**
|
|
272
|
+
|
|
273
|
+
Special thanks to the community for reporting issues and providing feedback that made v2.0 possible!
|
|
274
|
+
|
|
275
|
+
**Report issues**: https://github.com/AlphaTechini/doc-fetch/issues
|
|
276
|
+
**Discussions**: https://github.com/AlphaTechini/doc-fetch/discussions
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
**Built with โค๏ธ for better documentation experiences**
|
|
281
|
+
**Version**: 2.0.0
|
|
282
|
+
**Release**: February 20, 2026
|
package/bin/postinstall.js
CHANGED
|
@@ -40,6 +40,7 @@ console.log(`๐ฆ Will copy to: ${binaryName}\n`);
|
|
|
40
40
|
|
|
41
41
|
// List all available binaries for debugging
|
|
42
42
|
console.log('๐ Available binaries in package:');
|
|
43
|
+
let hasPlatformBinary = false;
|
|
43
44
|
try {
|
|
44
45
|
const files = fs.readdirSync(packageDir);
|
|
45
46
|
const binaries = files.filter(f => f.includes('doc-fetch') && !f.endsWith('.js'));
|
|
@@ -49,7 +50,12 @@ try {
|
|
|
49
50
|
binaries.forEach(file => {
|
|
50
51
|
const stats = fs.statSync(path.join(packageDir, file));
|
|
51
52
|
const size = (stats.size / 1024 / 1024).toFixed(2);
|
|
52
|
-
|
|
53
|
+
const isCorrect = file === expectedBinary || file === binaryName;
|
|
54
|
+
const marker = isCorrect ? 'โ
' : 'โน๏ธ ';
|
|
55
|
+
console.log(` ${marker} ${file} (${size} MB)`);
|
|
56
|
+
if (file === expectedBinary) {
|
|
57
|
+
hasPlatformBinary = true;
|
|
58
|
+
}
|
|
53
59
|
});
|
|
54
60
|
}
|
|
55
61
|
} catch (e) {
|
|
@@ -57,33 +63,30 @@ try {
|
|
|
57
63
|
}
|
|
58
64
|
console.log('');
|
|
59
65
|
|
|
60
|
-
// Check if
|
|
61
|
-
if (!fs.existsSync(sourcePath)) {
|
|
62
|
-
console.error(
|
|
66
|
+
// Extra validation: Check if platform binary exists
|
|
67
|
+
if (!hasPlatformBinary && !fs.existsSync(sourcePath)) {
|
|
68
|
+
console.error('โ ๏ธ CRITICAL: Platform binary missing!');
|
|
69
|
+
console.error(` Expected: ${expectedBinary}`);
|
|
63
70
|
console.error('');
|
|
64
|
-
console.error('๐ก This
|
|
65
|
-
console.error(' 1. Your platform/architecture is not supported');
|
|
66
|
-
console.error(' 2. The package was published without binaries');
|
|
71
|
+
console.error('๐ก This is a packaging error - the NPM package was published without your platform binary.');
|
|
67
72
|
console.error('');
|
|
68
|
-
console.error('
|
|
69
|
-
console.error('
|
|
70
|
-
console.error('
|
|
71
|
-
console.error('
|
|
72
|
-
console.error('
|
|
73
|
-
console.error('
|
|
74
|
-
console.error('');
|
|
75
|
-
console.error('๐ก Manual fix:');
|
|
76
|
-
console.error(` 1. Navigate to: ${packageDir}`);
|
|
77
|
-
console.error(` 2. Rename the correct binary for your platform:`);
|
|
73
|
+
console.error('๐ก Immediate workaround - Install from source:');
|
|
74
|
+
console.error(' 1. Install Go: https://golang.org/dl/');
|
|
75
|
+
console.error(' 2. Run these commands:');
|
|
76
|
+
console.error(' npm uninstall -g doc-fetch-cli');
|
|
77
|
+
console.error(' git clone https://github.com/AlphaTechini/doc-fetch.git');
|
|
78
|
+
console.error(' cd doc-fetch');
|
|
78
79
|
if (platform === 'win32') {
|
|
79
|
-
console.error(
|
|
80
|
-
|
|
81
|
-
console.error(` cp doc-fetch_darwin_amd64 ${binaryName}`);
|
|
82
|
-
console.error(` chmod +x ${binaryName}`);
|
|
80
|
+
console.error(' go build -o doc-fetch.exe ./cmd/docfetch');
|
|
81
|
+
console.error(' copy doc-fetch.exe "' + packageDir + '"');
|
|
83
82
|
} else {
|
|
84
|
-
console.error(
|
|
85
|
-
console.error(
|
|
83
|
+
console.error(' go build -o doc-fetch ./cmd/docfetch');
|
|
84
|
+
console.error(' cp doc-fetch "' + packageDir + '"');
|
|
85
|
+
console.error(' chmod +x "' + path.join(packageDir, 'doc-fetch') + '"');
|
|
86
86
|
}
|
|
87
|
+
console.error('');
|
|
88
|
+
console.error('๐ก Or wait for fixed version (check for updates):');
|
|
89
|
+
console.error(' npm install -g doc-fetch-cli@latest');
|
|
87
90
|
process.exit(1);
|
|
88
91
|
}
|
|
89
92
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doc-fetch-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
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"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
|
-
"
|
|
9
|
+
"prepublishOnly": "node ./scripts/verify-binaries.js",
|
|
10
|
+
"postinstall": "node ./bin/postinstall.js",
|
|
11
|
+
"verify": "node ./scripts/verify-binaries.js"
|
|
10
12
|
},
|
|
11
13
|
"repository": {
|
|
12
14
|
"type": "git",
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Pre-publish verification script
|
|
4
|
+
* Ensures all platform binaries are present before publishing to NPM
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const os = require('os');
|
|
10
|
+
|
|
11
|
+
const packageDir = path.join(__dirname, '..');
|
|
12
|
+
|
|
13
|
+
console.log('๐ Verifying platform binaries before publish...\n');
|
|
14
|
+
|
|
15
|
+
const requiredBinaries = [
|
|
16
|
+
{ name: 'doc-fetch_linux_amd64', platform: 'linux', arch: 'x64' },
|
|
17
|
+
{ name: 'doc-fetch_linux_arm64', platform: 'linux', arch: 'arm64', optional: true },
|
|
18
|
+
{ name: 'doc-fetch_darwin_amd64', platform: 'darwin', arch: 'x64' },
|
|
19
|
+
{ name: 'doc-fetch_darwin_arm64', platform: 'darwin', arch: 'arm64', optional: true },
|
|
20
|
+
{ name: 'doc-fetch_windows_amd64.exe', platform: 'win32', arch: 'x64' },
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
let allPresent = true;
|
|
24
|
+
const missing = [];
|
|
25
|
+
const present = [];
|
|
26
|
+
|
|
27
|
+
console.log('๐ฆ Checking binaries:\n');
|
|
28
|
+
|
|
29
|
+
requiredBinaries.forEach(binary => {
|
|
30
|
+
const binaryPath = path.join(packageDir, binary.name);
|
|
31
|
+
const exists = fs.existsSync(binaryPath);
|
|
32
|
+
|
|
33
|
+
if (exists) {
|
|
34
|
+
const stats = fs.statSync(binaryPath);
|
|
35
|
+
const size = (stats.size / 1024 / 1024).toFixed(2);
|
|
36
|
+
console.log(` โ
${binary.name.padEnd(35)} (${size} MB) - ${binary.platform} ${binary.arch}`);
|
|
37
|
+
present.push(binary.name);
|
|
38
|
+
} else {
|
|
39
|
+
const marker = binary.optional ? 'โ ๏ธ ' : 'โ';
|
|
40
|
+
const note = binary.optional ? '(optional)' : '(REQUIRED)';
|
|
41
|
+
console.log(` ${marker} ${binary.name.padEnd(35)} MISSING ${note}`);
|
|
42
|
+
if (!binary.optional) {
|
|
43
|
+
missing.push(binary.name);
|
|
44
|
+
allPresent = false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
console.log('\n๐ Summary:');
|
|
50
|
+
console.log(` Present: ${present.length}`);
|
|
51
|
+
console.log(` Missing: ${missing.length}${missing.length > 0 ? ' (' + missing.join(', ') + ')' : ''}`);
|
|
52
|
+
console.log('');
|
|
53
|
+
|
|
54
|
+
if (!allPresent) {
|
|
55
|
+
console.error('โ CRITICAL: Required binaries are missing!');
|
|
56
|
+
console.error('');
|
|
57
|
+
console.error('๐ก Build all platforms before publishing:');
|
|
58
|
+
console.error('');
|
|
59
|
+
console.error(' # Linux x64');
|
|
60
|
+
console.error(' GOOS=linux GOARCH=amd64 go build -o doc-fetch_linux_amd64 ./cmd/docfetch');
|
|
61
|
+
console.error('');
|
|
62
|
+
console.error(' # Linux ARM64 (optional)');
|
|
63
|
+
console.error(' GOOS=linux GOARCH=arm64 go build -o doc-fetch_linux_arm64 ./cmd/docfetch');
|
|
64
|
+
console.error('');
|
|
65
|
+
console.error(' # macOS Intel');
|
|
66
|
+
console.error(' GOOS=darwin GOARCH=amd64 go build -o doc-fetch_darwin_amd64 ./cmd/docfetch');
|
|
67
|
+
console.error('');
|
|
68
|
+
console.error(' # macOS Apple Silicon (optional)');
|
|
69
|
+
console.error(' GOOS=darwin GOARCH=arm64 go build -o doc-fetch_darwin_arm64 ./cmd/docfetch');
|
|
70
|
+
console.error('');
|
|
71
|
+
console.error(' # Windows x64');
|
|
72
|
+
console.error(' GOOS=windows GOARCH=amd64 go build -o doc-fetch_windows_amd64.exe ./cmd/docfetch');
|
|
73
|
+
console.error('');
|
|
74
|
+
console.error('Then run this script again to verify.');
|
|
75
|
+
console.error('');
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Verify minimum file sizes (catches corrupted/empty files)
|
|
80
|
+
console.log('๐ Verifying binary integrity...\n');
|
|
81
|
+
|
|
82
|
+
let allValid = true;
|
|
83
|
+
present.forEach(binaryName => {
|
|
84
|
+
const binaryPath = path.join(packageDir, binaryName);
|
|
85
|
+
const stats = fs.statSync(binaryPath);
|
|
86
|
+
|
|
87
|
+
// Minimum expected size: 5MB (actual binaries are ~8-9MB)
|
|
88
|
+
const minSize = 5 * 1024 * 1024;
|
|
89
|
+
|
|
90
|
+
if (stats.size < minSize) {
|
|
91
|
+
const sizeMB = (stats.size / 1024 / 1024).toFixed(2);
|
|
92
|
+
console.log(` โ ๏ธ ${binaryName.padEnd(35)} Suspiciously small (${sizeMB} MB)`);
|
|
93
|
+
allValid = false;
|
|
94
|
+
} else {
|
|
95
|
+
const sizeMB = (stats.size / 1024 / 1024).toFixed(2);
|
|
96
|
+
console.log(` โ
${binaryName.padEnd(35)} OK (${sizeMB} MB)`);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
console.log('');
|
|
101
|
+
|
|
102
|
+
if (!allValid) {
|
|
103
|
+
console.error('โ ๏ธ Warning: Some binaries seem too small and may be corrupted.');
|
|
104
|
+
console.error(' Consider rebuilding them before publishing.\n');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Final verdict
|
|
108
|
+
if (allPresent && allValid) {
|
|
109
|
+
console.log('โ
All required binaries present and valid!');
|
|
110
|
+
console.log('โ
Ready to publish to NPM\n');
|
|
111
|
+
process.exit(0);
|
|
112
|
+
} else if (allPresent) {
|
|
113
|
+
console.log('โ ๏ธ All binaries present but some may be corrupted.');
|
|
114
|
+
console.log('โ ๏ธ Proceed with caution!\n');
|
|
115
|
+
process.exit(0); // Allow publishing but warn
|
|
116
|
+
} else {
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|