demio-ui 4.0.2 → 4.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.
- package/README.md +122 -44
- package/dist/bundle-analysis.html +4949 -0
- package/dist/cjs/index.css +1 -1
- package/dist/cjs/index.js +1 -7
- package/dist/cjs/types/src/icons/index.d.ts +10 -1
- package/dist/esm/index.css +1 -1
- package/dist/esm/index.js +1 -7
- package/dist/esm/types/src/icons/index.d.ts +10 -1
- package/dist/types.d.ts +1088 -857
- package/package.json +19 -38
package/README.md
CHANGED
|
@@ -13,8 +13,7 @@ As a small team, we need to build and maintain our UI library quickly and with a
|
|
|
13
13
|
7. [Styling](#styling)
|
|
14
14
|
8. [Storybook](#storybook)
|
|
15
15
|
9. [Testing](#testing)
|
|
16
|
-
10. [
|
|
17
|
-
11. [Publishing](#publishing)
|
|
16
|
+
10. [Publishing](#publishing)
|
|
18
17
|
|
|
19
18
|
## Project Roadmap
|
|
20
19
|
|
|
@@ -151,75 +150,154 @@ Testing commands:
|
|
|
151
150
|
- `npm run test` - run all tests
|
|
152
151
|
- `npm run test:watch` - run all tests in watch mode
|
|
153
152
|
|
|
154
|
-
## Bundle
|
|
153
|
+
## Bundle Size Analysis
|
|
155
154
|
|
|
156
|
-
|
|
155
|
+
We monitor bundle sizes to ensure our library remains lightweight and performant. Our bundle size analysis provides two different perspectives:
|
|
157
156
|
|
|
158
|
-
###
|
|
157
|
+
### 📊 **Current Bundle Sizes**
|
|
159
158
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
159
|
+
| Component | Size | Purpose |
|
|
160
|
+
| -------------------------- | -------------- | ---------------------------- |
|
|
161
|
+
| **JavaScript Bundle** | 886KB (0.85MB) | Core library code (minified) |
|
|
162
|
+
| **CSS Bundle** | 76KB | Styles and theming |
|
|
163
|
+
| **TypeScript Definitions** | 164KB | Type definitions |
|
|
164
|
+
| **SVG Icons** | 105 files | Icon assets |
|
|
165
|
+
| **Total Package Size** | **2.5MB** | Complete library on disk |
|
|
165
166
|
|
|
166
|
-
###
|
|
167
|
+
### 🔍 **Bundle Analysis Tools**
|
|
167
168
|
|
|
168
|
-
|
|
169
|
+
We provide multiple tools to analyze bundle sizes from different perspectives:
|
|
169
170
|
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
#### 1. **JavaScript Bundle Analysis (Visualizer)**
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
npm run build:analyze
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
- **Measures**: Only the JavaScript bundle (886KB)
|
|
178
|
+
- **Shows**: Module breakdown, dependencies, tree-shaking analysis
|
|
179
|
+
- **Output**: Interactive HTML visualization with Gzip and Brotli sizes
|
|
180
|
+
- **Purpose**: Optimize JavaScript code and identify large dependencies
|
|
181
|
+
|
|
182
|
+
#### 2. **Complete Package Size Check**
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
npm run bundle-size
|
|
172
186
|
```
|
|
173
187
|
|
|
174
|
-
|
|
188
|
+
- **Measures**: All output files (2.5MB total)
|
|
189
|
+
- **Shows**: JavaScript, CSS, TypeScript definitions, and other assets
|
|
190
|
+
- **Purpose**: Monitor total package size for distribution
|
|
191
|
+
|
|
192
|
+
#### 3. **Assets Analysis**
|
|
175
193
|
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
import Button from 'demio-ui/dist/esm/Button';
|
|
179
|
-
import Modal from 'demio-ui/dist/esm/Modal';
|
|
194
|
+
```bash
|
|
195
|
+
npm run analyze-assets
|
|
180
196
|
```
|
|
181
197
|
|
|
182
|
-
|
|
198
|
+
- **Measures**: SVG icons and other assets
|
|
199
|
+
- **Shows**: File count, largest files, optimization opportunities
|
|
200
|
+
- **Purpose**: Monitor asset sizes and identify optimization needs
|
|
201
|
+
|
|
202
|
+
#### 4. **Comprehensive Analysis**
|
|
183
203
|
|
|
184
204
|
```bash
|
|
185
|
-
|
|
186
|
-
npm install demio-ui react-select
|
|
205
|
+
npm run analyze-all
|
|
187
206
|
```
|
|
188
207
|
|
|
189
|
-
|
|
208
|
+
- **Measures**: Everything combined
|
|
209
|
+
- **Shows**: Complete picture of bundle and assets
|
|
210
|
+
- **Purpose**: Full analysis for optimization planning
|
|
211
|
+
|
|
212
|
+
### 📈 **Bundle Size Guidelines**
|
|
213
|
+
|
|
214
|
+
- **JavaScript Bundle**: Target under 1MB (current: 886KB ✅)
|
|
215
|
+
- **CSS Bundle**: Target under 100KB (current: 76KB ✅)
|
|
216
|
+
- **Total Package**: Target under 3MB (current: 2.5MB ✅)
|
|
217
|
+
- **SVG Icons**: Keep individual files under 10KB
|
|
218
|
+
- **TypeScript Definitions**: Monitor for excessive type complexity
|
|
219
|
+
|
|
220
|
+
### 🎯 **Why Two Different Measurements?**
|
|
221
|
+
|
|
222
|
+
1. **Visualizer (886KB)**:
|
|
223
|
+
|
|
224
|
+
- Shows only JavaScript code size
|
|
225
|
+
- Helps optimize code and dependencies
|
|
226
|
+
- Focuses on runtime performance
|
|
227
|
+
|
|
228
|
+
2. **File Size Commands (2.5MB)**:
|
|
229
|
+
- Shows complete package size
|
|
230
|
+
- Includes all assets and metadata
|
|
231
|
+
- Focuses on distribution size
|
|
190
232
|
|
|
191
|
-
|
|
233
|
+
Both measurements are correct and serve different optimization purposes!
|
|
234
|
+
|
|
235
|
+
### 🚀 **Optimization Recommendations**
|
|
236
|
+
|
|
237
|
+
1. **JavaScript Bundle (886KB)**:
|
|
238
|
+
|
|
239
|
+
- ✅ Already well-optimized
|
|
240
|
+
- Consider tree-shaking for unused components
|
|
241
|
+
- Monitor for large dependency additions
|
|
242
|
+
|
|
243
|
+
2. **CSS Bundle (76KB)**:
|
|
244
|
+
|
|
245
|
+
- ✅ Good size for comprehensive styling
|
|
246
|
+
- Consider CSS-in-JS for component-specific styles
|
|
247
|
+
- Monitor for duplicate styles
|
|
248
|
+
|
|
249
|
+
3. **Assets (105 SVG files)**:
|
|
250
|
+
|
|
251
|
+
- Optimize SVG files using SVGO
|
|
252
|
+
- Consider icon font for frequently used icons
|
|
253
|
+
- Monitor total assets size
|
|
254
|
+
|
|
255
|
+
4. **TypeScript Definitions (164KB)**:
|
|
256
|
+
- ✅ Reasonable size for comprehensive types
|
|
257
|
+
- Consider selective type exports
|
|
258
|
+
- Monitor for complex type definitions
|
|
259
|
+
|
|
260
|
+
### 🔧 **CI/CD Integration**
|
|
261
|
+
|
|
262
|
+
The bundle size analysis tools can be integrated into your CI/CD pipeline. The `prepublishOnly` script runs:
|
|
263
|
+
|
|
264
|
+
- Tests
|
|
265
|
+
- Linting
|
|
266
|
+
|
|
267
|
+
You can also add bundle size monitoring to your CI/CD pipeline by running:
|
|
192
268
|
|
|
193
269
|
```bash
|
|
194
|
-
npm run analyze
|
|
195
|
-
npm run analyze:size # Quick size check
|
|
196
|
-
npm run analyze:detailed # Console breakdown
|
|
197
|
-
npm run size-check # Friendly bundle overview
|
|
270
|
+
npm run analyze-all
|
|
198
271
|
```
|
|
199
272
|
|
|
200
|
-
|
|
273
|
+
This will provide comprehensive bundle size information for monitoring and alerting purposes.
|
|
201
274
|
|
|
202
|
-
|
|
275
|
+
### 📋 **Manual Analysis**
|
|
276
|
+
|
|
277
|
+
For detailed investigation:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
npm run build
|
|
281
|
+
```
|
|
203
282
|
|
|
204
|
-
|
|
205
|
-
- **📦 External**: `react-select` (~170KB) - only when you use MultiSelect
|
|
283
|
+
Then check the generated files in the `dist/` directory:
|
|
206
284
|
|
|
207
|
-
|
|
285
|
+
- `dist/cjs/index.js` - CommonJS bundle (2.5MB)
|
|
286
|
+
- `dist/esm/index.js` - ES Module bundle (2.5MB)
|
|
287
|
+
- `dist/cjs/index.css` - CSS bundle (76KB)
|
|
288
|
+
- `dist/types.d.ts` - TypeScript definitions (164KB)
|
|
289
|
+
- `dist/bundle-analysis.html` - Interactive JavaScript bundle analysis (886KB)
|
|
208
290
|
|
|
209
|
-
|
|
210
|
-
2. **Avoid wildcard imports** (`import * as UI from 'demio-ui'`)
|
|
211
|
-
3. **Import CSS separately** if using selective imports
|
|
212
|
-
4. **Check bundle analysis** regularly with `npm run analyze`
|
|
291
|
+
### 🎉 **Current Status**
|
|
213
292
|
|
|
214
|
-
|
|
293
|
+
✅ **All bundle sizes are within acceptable limits**
|
|
215
294
|
|
|
216
|
-
|
|
295
|
+
- JavaScript: 886KB (excellent optimization)
|
|
296
|
+
- CSS: 76KB (good size)
|
|
297
|
+
- Total package: 2.5MB (reasonable for comprehensive UI library)
|
|
298
|
+
- TypeScript: 164KB (comprehensive types)
|
|
217
299
|
|
|
218
|
-
|
|
219
|
-
- **🧩 Component-level Code Splitting**: Lazy load heavy components with dynamic imports
|
|
220
|
-
- **🔄 Radix UI Audit**: Remove unused Radix UI components and optimize imports
|
|
221
|
-
- **⚡ Floating UI Optimization**: Investigate lighter positioning alternatives
|
|
222
|
-
- **📊 RelativeCI Integration**: Setup RelativeCI for advanced bundle size tracking, historical analysis, and automated regression detection in CI/CD pipeline
|
|
300
|
+
The library is well-optimized and ready for production use!
|
|
223
301
|
|
|
224
302
|
## Publishing
|
|
225
303
|
|