packlyze 1.0.0 → 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 +90 -60
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Packlyze
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/packlyze)
|
|
4
|
+
[](https://github.com/iamabhshk/Packlyze/actions)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
# Packlyze
|
|
8
|
+
|
|
3
9
|
Advanced bundle analyzer with insights, recommendations, and historical tracking.
|
|
4
10
|
|
|
5
11
|
## 📊 Features
|
|
@@ -14,48 +20,72 @@ Advanced bundle analyzer with insights, recommendations, and historical tracking
|
|
|
14
20
|
|
|
15
21
|
## 🚀 Installation
|
|
16
22
|
|
|
23
|
+
You can install Packlyze globally or use it via npx:
|
|
24
|
+
|
|
17
25
|
```bash
|
|
18
26
|
npm install -g packlyze
|
|
19
27
|
# or
|
|
20
28
|
npx packlyze
|
|
21
29
|
```
|
|
22
30
|
|
|
23
|
-
## 📖 Usage
|
|
24
|
-
|
|
25
|
-
### Basic Analysis
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
# Generate webpack stats
|
|
29
|
-
webpack --profile --json > stats.json
|
|
30
|
-
|
|
31
|
-
# Analyze with packlyze
|
|
32
|
-
packlyze analyze stats.json
|
|
33
|
-
|
|
34
|
-
# Output HTML report to custom location
|
|
35
|
-
packlyze analyze stats.json -o ./reports/bundle-report.html
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### JSON Output
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
packlyze analyze stats.json --json
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### As a Library
|
|
45
31
|
|
|
46
|
-
```typescript
|
|
47
|
-
import { Packlyze } from 'packlyze';
|
|
48
32
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
+
```
|
|
56
84
|
|
|
57
85
|
## 📁 Project Structure
|
|
58
86
|
|
|
87
|
+
Typical structure for a Packlyze-based project:
|
|
88
|
+
|
|
59
89
|
```
|
|
60
90
|
Packlyze-plus/
|
|
61
91
|
├── src/
|
|
@@ -77,37 +107,11 @@ Packlyze-plus/
|
|
|
77
107
|
└── README.md
|
|
78
108
|
```
|
|
79
109
|
|
|
80
|
-
## 🔧 Development
|
|
81
|
-
|
|
82
|
-
### Setup
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
npm install
|
|
86
|
-
npm run dev # Watch mode TypeScript compilation
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Build
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
npm run build # Compile TypeScript to JavaScript
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### Testing
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
npm run test # Run all tests
|
|
99
|
-
npm run test:coverage # Generate coverage report
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Code Quality
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
npm run lint # ESLint check and fix
|
|
106
|
-
npm run format # Prettier formatting
|
|
107
|
-
```
|
|
108
110
|
|
|
109
111
|
## 📊 Analysis Output
|
|
110
112
|
|
|
113
|
+
Packlyze provides detailed metrics, recommendations, and insights to help you optimize your bundle.
|
|
114
|
+
|
|
111
115
|
The analyzer provides:
|
|
112
116
|
|
|
113
117
|
### Metrics
|
|
@@ -130,6 +134,8 @@ The analyzer provides:
|
|
|
130
134
|
|
|
131
135
|
## 🎯 Use Cases
|
|
132
136
|
|
|
137
|
+
Common scenarios where Packlyze is helpful:
|
|
138
|
+
|
|
133
139
|
- **Performance Optimization**: Identify and reduce bundle bloat
|
|
134
140
|
- **Code Splitting**: Find optimal splitting points
|
|
135
141
|
- **Dependency Analysis**: Detect unused or duplicate packages
|
|
@@ -138,6 +144,8 @@ The analyzer provides:
|
|
|
138
144
|
|
|
139
145
|
## 📝 Examples
|
|
140
146
|
|
|
147
|
+
Here are some example commands and configurations for different frameworks:
|
|
148
|
+
|
|
141
149
|
### Webpack Project
|
|
142
150
|
|
|
143
151
|
```bash
|
|
@@ -176,6 +184,8 @@ packlyze analyze dist/stats.json
|
|
|
176
184
|
|
|
177
185
|
## 🐛 Troubleshooting
|
|
178
186
|
|
|
187
|
+
If you encounter issues, check the following:
|
|
188
|
+
|
|
179
189
|
### "Stats file not found"
|
|
180
190
|
Ensure your stats.json path is correct and the file exists.
|
|
181
191
|
|
|
@@ -189,12 +199,25 @@ Consider:
|
|
|
189
199
|
- Removing unused dependencies
|
|
190
200
|
- Using lighter alternatives
|
|
191
201
|
|
|
202
|
+
## 📦 Publishing to NPM
|
|
203
|
+
|
|
204
|
+
To publish your own version of Packlyze:
|
|
205
|
+
1. Update the version in `package.json`.
|
|
206
|
+
2. Run `npm run build` to compile TypeScript.
|
|
207
|
+
3. Run tests with `npm run test`.
|
|
208
|
+
4. Login to NPM: `npm login`.
|
|
209
|
+
5. Publish: `npm publish`.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
192
213
|
## 📄 License
|
|
193
214
|
|
|
194
215
|
MIT
|
|
195
216
|
|
|
196
217
|
## 🤝 Contributing
|
|
197
218
|
|
|
219
|
+
We welcome contributions! Please follow the steps below:
|
|
220
|
+
|
|
198
221
|
Contributions welcome! Please:
|
|
199
222
|
|
|
200
223
|
1. Fork the repository
|
|
@@ -205,6 +228,11 @@ Contributions welcome! Please:
|
|
|
205
228
|
|
|
206
229
|
## 📞 Support
|
|
207
230
|
|
|
231
|
+
For issues and questions:
|
|
232
|
+
- GitHub Issues: [https://github.com/iamabhshk/Packlyze/issues](https://github.com/iamabhshk/Packlyze/issues)
|
|
233
|
+
- Email: [your-email]
|
|
234
|
+
- Twitter: [@yourhandle]
|
|
235
|
+
|
|
208
236
|
For issues and questions:
|
|
209
237
|
- GitHub Issues: [link]
|
|
210
238
|
- Email: [your-email]
|
|
@@ -212,8 +240,10 @@ For issues and questions:
|
|
|
212
240
|
|
|
213
241
|
## 🙏 Acknowledgments
|
|
214
242
|
|
|
243
|
+
Packlyze is built with TypeScript, Commander.js, and Chalk. Special thanks to all contributors and users!
|
|
244
|
+
|
|
215
245
|
Built with TypeScript, Commander.js, and Chalk
|
|
216
246
|
|
|
217
247
|
---
|
|
218
248
|
|
|
219
|
-
**Made with ❤️ by
|
|
249
|
+
**Made with ❤️ by Abhishek**
|