packlyze 1.0.3 → 1.0.5

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/README.md +44 -49
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -18,76 +18,71 @@ Advanced bundle analyzer with insights, recommendations, and historical tracking
18
18
  - **CLI Tool**: Easy-to-use command-line interface
19
19
  - **TypeScript Ready**: Full TypeScript support with type definitions
20
20
 
21
- ## 🚀 Installation
21
+ ## 🚀 Quick Start
22
+
23
+ Packlyze can be used in two main ways: as a CLI tool and as a Node.js/TypeScript library.
24
+
25
+ **1. Install Packlyze (globally or with npx):**
22
26
 
23
27
  You can install Packlyze globally or use it via npx:
24
28
 
25
29
  ```bash
26
- npm install -g packlyze
30
+ npm install -g packlyze
27
31
  # or
28
- npx packlyze
32
+ npx packlyze --help
29
33
  ```
30
34
 
35
+ **2. Generate a stats file from your bundler (e.g., webpack):**
31
36
 
37
+ > ⚠️ **Important:**
38
+ > You must generate a valid JSON stats file before running Packlyze.
39
+ > For webpack, use the following command in your project folder:
32
40
 
33
- ## 📖 How to Use
41
+ ```bash
42
+ npx webpack --profile --json stats.json
43
+ ```
44
+ - This will create a readable `stats.json` file in your project directory.
34
45
 
35
- Packlyze can be used in two main ways: as a CLI tool and as a Node.js/TypeScript library.
46
+ **3. Run Packlyze analysis:**
47
+ ```bash
48
+ packlyze analyze stats.json
49
+ # or (if using npx)
50
+ npx packlyze analyze stats.json
51
+ ```
36
52
 
37
- ### 1. CLI Usage
53
+ **4. (Optional) Output an HTML report:**
54
+ ```bash
55
+ packlyze analyze stats.json -o ./reports/bundle-report.html
56
+ ```
38
57
 
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
- ```
58
+ ---
65
59
 
66
- ### 2. Library Usage
60
+ ## 🐛 Common Issues & Solutions
67
61
 
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';
62
+ - **"Stats file not found":**
63
+ Make sure `stats.json` exists in your folder.
64
+ Generate it using your bundler (see above).
76
65
 
77
- const analyzer = new Packlyze('./dist/stats.json');
78
- const result = await analyzer.analyze();
66
+ - **"Invalid JSON in stats file":**
67
+ Your stats file may be corrupted or not plain JSON.
68
+ - Delete the file and re-run the correct webpack command.
69
+ - Open `stats.json` in a text editor; it should start with `{` and be readable.
79
70
 
80
- console.log(result.recommendations);
81
- console.log(result.metrics);
82
- console.log(result.bundleStats.modules);
71
+ - **"webpack not recognized":**
72
+ Install webpack locally in your project:
73
+ ```bash
74
+ npm install --save-dev webpack webpack-cli
83
75
  ```
76
+ Then use `npx webpack ...` to generate stats.
77
+
78
+ ---
84
79
 
85
- ## 📁 Project Structure
80
+ ## 📁 File Structure
86
81
 
87
- Typical structure for a Packlyze-based project:
82
+ Typical structure for a Packlyze:
88
83
 
89
84
  ```
90
- Packlyze-plus/
85
+ Packlyze/
91
86
  ├── src/
92
87
  │ ├── types.ts # TypeScript interfaces
93
88
  │ ├── index.ts # Main entry point
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "packlyze",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Advanced bundle analyzer with insights, recommendations, and historical tracking",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",