packlyze 1.0.1 → 1.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/README.md +51 -39
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,47 +28,59 @@ npm install -g packlyze
|
|
|
28
28
|
npx packlyze
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
## 📖 Usage
|
|
32
31
|
|
|
33
|
-
Packlyze works with stats files generated by webpack, rollup, or esbuild. For best results, generate a stats file in JSON format.
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
packlyze analyze stats.json
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
33
|
+
## 📖 How to Use
|
|
34
|
+
|
|
35
|
+
Packlyze can be used in two main ways: as a CLI tool and as a Node.js/TypeScript library.
|
|
36
|
+
|
|
37
|
+
### 1. CLI Usage
|
|
38
|
+
|
|
39
|
+
#### Step-by-step:
|
|
40
|
+
1. **Install Packlyze** (globally or use npx):
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g packlyze
|
|
43
|
+
# or
|
|
44
|
+
npx packlyze --help
|
|
45
|
+
```
|
|
46
|
+
2. **Generate a stats file** from your bundler (e.g., webpack, rollup, esbuild):
|
|
47
|
+
```bash
|
|
48
|
+
# For webpack:
|
|
49
|
+
webpack --profile --json > stats.json
|
|
50
|
+
```
|
|
51
|
+
3. **Run Packlyze analysis**:
|
|
52
|
+
```bash
|
|
53
|
+
packlyze analyze stats.json
|
|
54
|
+
# or (if using npx)
|
|
55
|
+
npx packlyze analyze stats.json
|
|
56
|
+
```
|
|
57
|
+
4. **Output an HTML report to a custom location**:
|
|
58
|
+
```bash
|
|
59
|
+
packlyze analyze stats.json -o ./reports/bundle-report.html
|
|
60
|
+
```
|
|
61
|
+
5. **Get results in JSON format (for CI/CD or automation):**
|
|
62
|
+
```bash
|
|
63
|
+
packlyze analyze stats.json --json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 2. Library Usage
|
|
67
|
+
|
|
68
|
+
#### Step-by-step:
|
|
69
|
+
1. **Install Packlyze** as a dependency:
|
|
70
|
+
```bash
|
|
71
|
+
npm install packlyze
|
|
72
|
+
```
|
|
73
|
+
2. **Import and use in your code:**
|
|
74
|
+
```typescript
|
|
75
|
+
import { Packlyze } from 'packlyze';
|
|
76
|
+
|
|
77
|
+
const analyzer = new Packlyze('./dist/stats.json');
|
|
78
|
+
const result = await analyzer.analyze();
|
|
79
|
+
|
|
80
|
+
console.log(result.recommendations);
|
|
81
|
+
console.log(result.metrics);
|
|
82
|
+
console.log(result.bundleStats.modules);
|
|
83
|
+
```
|
|
72
84
|
|
|
73
85
|
## 📁 Project Structure
|
|
74
86
|
|