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.
Files changed (2) hide show
  1. package/README.md +51 -39
  2. 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
- ### Basic Analysis
36
-
37
- Generate a stats file with your bundler, then analyze it:
38
-
39
- ```bash
40
- # Generate webpack stats
41
- webpack --profile --json > stats.json
42
-
43
- # Analyze with packlyze
44
- packlyze analyze stats.json
45
-
46
- # Output HTML report to custom location
47
- packlyze analyze stats.json -o ./reports/bundle-report.html
48
- ```
49
-
50
- ### JSON Output
51
-
52
- Get results in JSON format for CI/CD or further processing:
53
-
54
- ```bash
55
- packlyze analyze stats.json --json
56
- ```
57
-
58
- ### As a Library
59
-
60
- You can use Packlyze programmatically in your Node.js/TypeScript projects:
61
-
62
- ```typescript
63
- import { Packlyze } from 'packlyze';
64
-
65
- const analyzer = new Packlyze('./dist/stats.json');
66
- const result = await analyzer.analyze();
67
-
68
- console.log(result.recommendations);
69
- console.log(result.metrics);
70
- console.log(result.bundleStats.modules);
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "packlyze",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
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",