@kubit-ui-web/react-components 2.0.0-beta.27 ā 2.0.0-beta.28
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/package.json +1 -1
- package/dist/cjs/.storybook/bundle-sizes.json +0 -13
- package/dist/cjs/assets/banner_kubit_readme.png +0 -0
- package/dist/cjs/assets/react-components.css +0 -1
- package/dist/cjs/scripts/generate-bundle-sizes.mjs +0 -236
- package/dist/cjs/scripts/new-component-web-ui.js +0 -2092
- package/dist/esm/.storybook/bundle-sizes.json +0 -13
- package/dist/esm/assets/banner_kubit_readme.png +0 -0
- package/dist/esm/assets/react-components.css +0 -1
- package/dist/esm/scripts/generate-bundle-sizes.mjs +0 -236
- package/dist/esm/scripts/new-component-web-ui.js +0 -2092
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubit-ui-web/react-components",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.28",
|
|
4
4
|
"description": "Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Kubit",
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.kbt-text{-webkit-text-size-adjust:100%;text-size-adjust:100%}.kbt-text--disabled{pointer-events:none}.kbt-text--truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:root{--border-radius: 0;--fallback-ratio: 1;--object-fit: cover;--ratio: 1;--width: 100%}.kbt-picture{position:relative;display:inline-block;overflow:hidden;max-width:100%;max-height:100%;width:var(--width);aspect-ratio:var(--ratio)}@supports not (aspect-ratio: 16 / 9){.kbt-picture{padding-top:var(--fallback-ratio)}.kbt-picture img{position:absolute;top:0;left:0;width:100%;height:auto}}.kbt-picture img{max-width:100%;border-radius:var(--border-radius);object-fit:var(--object-fit);aspect-ratio:var(--ratio)}@keyframes popover-enter-center{0%{opacity:0;transform:translate(-50%,-50%) scale(.8)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@keyframes popover-exit-center{0%{opacity:1;transform:translate(-50%,-50%) scale(1)}to{opacity:0;transform:translate(-50%,-50%) scale(.8)}}@keyframes popover-enter-top{0%{opacity:0;transform:translate(-50%) translateY(-20px)}to{opacity:1;transform:translate(-50%) translateY(0)}}@keyframes popover-exit-top{0%{opacity:1;transform:translate(-50%) translateY(0)}to{opacity:0;transform:translate(-50%) translateY(-20px)}}@keyframes popover-enter-top-start{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}@keyframes popover-exit-top-start{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-20px)}}@keyframes popover-enter-top-end{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}@keyframes popover-exit-top-end{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-20px)}}@keyframes popover-enter-bottom{0%{opacity:0;transform:translate(-50%) translateY(20px)}to{opacity:1;transform:translate(-50%) translateY(0)}}@keyframes popover-exit-bottom{0%{opacity:1;transform:translate(-50%) translateY(0)}to{opacity:0;transform:translate(-50%) translateY(20px)}}@keyframes popover-enter-bottom-start{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes popover-exit-bottom-start{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(20px)}}@keyframes popover-enter-bottom-end{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes popover-exit-bottom-end{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(20px)}}@keyframes popover-enter-left{0%{opacity:0;transform:translateY(-50%) translate(-20px)}to{opacity:1;transform:translateY(-50%) translate(0)}}@keyframes popover-exit-left{0%{opacity:1;transform:translateY(-50%) translate(0)}to{opacity:0;transform:translateY(-50%) translate(-20px)}}@keyframes popover-enter-left-start{0%{opacity:0;transform:translate(-20px)}to{opacity:1;transform:translate(0)}}@keyframes popover-exit-left-start{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(-20px)}}@keyframes popover-enter-left-end{0%{opacity:0;transform:translate(-20px)}to{opacity:1;transform:translate(0)}}@keyframes popover-exit-left-end{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(-20px)}}@keyframes popover-enter-right{0%{opacity:0;transform:translateY(-50%) translate(20px)}to{opacity:1;transform:translateY(-50%) translate(0)}}@keyframes popover-exit-right{0%{opacity:1;transform:translateY(-50%) translate(0)}to{opacity:0;transform:translateY(-50%) translate(20px)}}@keyframes popover-enter-right-start{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes popover-exit-right-start{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(20px)}}@keyframes popover-enter-right-end{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes popover-exit-right-end{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(20px)}}.popover-animate{animation-duration:.2s;animation-timing-function:cubic-bezier(.16,1,.3,1);animation-fill-mode:forwards}.popover-enter-center{animation-name:popover-enter-center}.popover-enter-top{animation-name:popover-enter-top}.popover-enter-top-start{animation-name:popover-enter-top-start}.popover-enter-top-end{animation-name:popover-enter-top-end}.popover-enter-bottom{animation-name:popover-enter-bottom}.popover-enter-bottom-start{animation-name:popover-enter-bottom-start}.popover-enter-bottom-end{animation-name:popover-enter-bottom-end}.popover-enter-left{animation-name:popover-enter-left}.popover-enter-left-start{animation-name:popover-enter-left-start}.popover-enter-left-end{animation-name:popover-enter-left-end}.popover-enter-right{animation-name:popover-enter-right}.popover-enter-right-start{animation-name:popover-enter-right-start}.popover-enter-right-end{animation-name:popover-enter-right-end}.popover-exit-center{animation-name:popover-exit-center}.popover-exit-top{animation-name:popover-exit-top}.popover-exit-top-start{animation-name:popover-exit-top-start}.popover-exit-top-end{animation-name:popover-exit-top-end}.popover-exit-bottom{animation-name:popover-exit-bottom}.popover-exit-bottom-start{animation-name:popover-exit-bottom-start}.popover-exit-bottom-end{animation-name:popover-exit-bottom-end}.popover-exit-left{animation-name:popover-exit-left}.popover-exit-left-start{animation-name:popover-exit-left-start}.popover-exit-left-end{animation-name:popover-exit-left-end}.popover-exit-right{animation-name:popover-exit-right}.popover-exit-right-start{animation-name:popover-exit-right-start}.popover-exit-right-end{animation-name:popover-exit-right-end}[data-kbt-id=popover][data-kbt-placement]{animation-duration:.5s;animation-timing-function:cubic-bezier(.16,1,.3,1);animation-fill-mode:forwards;animation-iteration-count:1}[data-kbt-id=popover][data-kbt-closing=false]:not([data-kbt-disable-animations=true]){--animation-prefix: "popover-enter-"}[data-kbt-id=popover][data-kbt-placement=center][data-kbt-closing=false]:not([data-kbt-disable-animations=true]){animation-name:popover-enter-center}[data-kbt-id=popover][data-kbt-placement^=top][data-kbt-closing=false]:not([data-kbt-disable-animations=true]){animation-name:var(--animation-name, popover-enter-top)}[data-kbt-id=popover][data-kbt-placement=top-start][data-kbt-closing=false]:not([data-kbt-disable-animations=true]){animation-name:popover-enter-top-start}[data-kbt-id=popover][data-kbt-placement=top-end][data-kbt-closing=false]:not([data-kbt-disable-animations=true]){animation-name:popover-enter-top-end}[data-kbt-id=popover][data-kbt-placement^=bottom][data-kbt-closing=false]:not([data-kbt-disable-animations=true]){animation-name:var(--animation-name, popover-enter-bottom)}[data-kbt-id=popover][data-kbt-placement=bottom-start][data-kbt-closing=false]:not([data-kbt-disable-animations=true]){animation-name:popover-enter-bottom-start}[data-kbt-id=popover][data-kbt-placement=bottom-end][data-kbt-closing=false]:not([data-kbt-disable-animations=true]){animation-name:popover-enter-bottom-end}[data-kbt-id=popover][data-kbt-placement^=left][data-kbt-closing=false]:not([data-kbt-disable-animations=true]){animation-name:var(--animation-name, popover-enter-left)}[data-kbt-id=popover][data-kbt-placement=left-start][data-kbt-closing=false]:not([data-kbt-disable-animations=true]){animation-name:popover-enter-left-start}[data-kbt-id=popover][data-kbt-placement=left-end][data-kbt-closing=false]:not([data-kbt-disable-animations=true]){animation-name:popover-enter-left-end}[data-kbt-id=popover][data-kbt-placement^=right][data-kbt-closing=false]:not([data-kbt-disable-animations=true]){animation-name:var(--animation-name, popover-enter-right)}[data-kbt-id=popover][data-kbt-placement=right-start][data-kbt-closing=false]:not([data-kbt-disable-animations=true]){animation-name:popover-enter-right-start}[data-kbt-id=popover][data-kbt-placement=right-end][data-kbt-closing=false]:not([data-kbt-disable-animations=true]){animation-name:popover-enter-right-end}[data-kbt-id=popover][data-kbt-closing=true]:not([data-kbt-disable-animations=true]){--animation-prefix: "popover-exit-"}[data-kbt-id=popover][data-kbt-placement=center][data-kbt-closing=true]:not([data-kbt-disable-animations=true]){animation-name:popover-exit-center}[data-kbt-id=popover][data-kbt-placement^=top][data-kbt-closing=true]:not([data-kbt-disable-animations=true]){animation-name:var(--exit-animation-name, popover-exit-top)}[data-kbt-id=popover][data-kbt-placement=top-start][data-kbt-closing=true]:not([data-kbt-disable-animations=true]){animation-name:popover-exit-top-start}[data-kbt-id=popover][data-kbt-placement=top-end][data-kbt-closing=true]:not([data-kbt-disable-animations=true]){animation-name:popover-exit-top-end}[data-kbt-id=popover][data-kbt-placement^=bottom][data-kbt-closing=true]:not([data-kbt-disable-animations=true]){animation-name:var(--exit-animation-name, popover-exit-bottom)}[data-kbt-id=popover][data-kbt-placement=bottom-start][data-kbt-closing=true]:not([data-kbt-disable-animations=true]){animation-name:popover-exit-bottom-start}[data-kbt-id=popover][data-kbt-placement=bottom-end][data-kbt-closing=true]:not([data-kbt-disable-animations=true]){animation-name:popover-exit-bottom-end}[data-kbt-id=popover][data-kbt-placement^=left][data-kbt-closing=true]:not([data-kbt-disable-animations=true]){animation-name:var(--exit-animation-name, popover-exit-left)}[data-kbt-id=popover][data-kbt-placement=left-start][data-kbt-closing=true]:not([data-kbt-disable-animations=true]){animation-name:popover-exit-left-start}[data-kbt-id=popover][data-kbt-placement=left-end][data-kbt-closing=true]:not([data-kbt-disable-animations=true]){animation-name:popover-exit-left-end}[data-kbt-id=popover][data-kbt-placement^=right][data-kbt-closing=true]:not([data-kbt-disable-animations=true]){animation-name:var(--exit-animation-name, popover-exit-right)}[data-kbt-id=popover][data-kbt-placement=right-start][data-kbt-closing=true]:not([data-kbt-disable-animations=true]){animation-name:popover-exit-right-start}[data-kbt-id=popover][data-kbt-placement=right-end][data-kbt-closing=true]:not([data-kbt-disable-animations=true]){animation-name:popover-exit-right-end}[data-kbt-id=popover-arrow]{position:absolute;transform:rotate(45deg);z-index:-1}[data-kbt-id=popover-arrow][data-kbt-placement^=top]{bottom:calc(-1 * var(--arrow-size, 8px) / 2);left:50%;transform:translate(-50%) rotate(45deg)}[data-kbt-id=popover-arrow][data-kbt-placement^=bottom]{top:calc(-1 * var(--arrow-size, 8px) / 2);left:50%;transform:translate(-50%) rotate(45deg)}[data-kbt-id=popover-arrow][data-kbt-placement^=left]{right:calc(-1 * var(--arrow-size, 8px) / 2);top:50%;transform:translateY(-50%) rotate(45deg)}[data-kbt-id=popover-arrow][data-kbt-placement^=right]{left:calc(-1 * var(--arrow-size, 8px) / 2);top:50%;transform:translateY(-50%) rotate(45deg)}[data-kbt-id=popover-arrow][data-kbt-placement=center]{top:calc(-1 * var(--arrow-size, 8px) / 2);left:50%;transform:translate(-50%) rotate(45deg)}@keyframes breatheAnimation{0%{background-position-x:0%}to{background-position-x:-200%}}.kbt-skeleton{width:var(--skeleton-width, 100%);height:var(--skeleton-height, 20px);animation-name:breatheAnimation;animation-timing-function:linear;animation-iteration-count:infinite;animation-duration:var(--skeleton-duration, 2s);animation-delay:1ms;background-size:200% 100%}.kbt-tooltip{display:inline-block}.kbt-tooltip__trigger-wrapper{display:flex;align-items:center;justify-content:center;padding:0;border:none;background:none;min-height:1.5rem;min-width:1.5rem}.kbt-tooltip__external-container{display:flex}.kbt-tooltip__paragraph{word-break:break-word}.kbt-tooltip__inner-content{overflow-y:auto}.kbt-tooltip__arrow{position:absolute}.kbt-tooltip__arrow--top{bottom:100%;left:50%;transform:translate(-50%)}.kbt-tooltip__arrow--right{top:50%;left:100%;transform:translateY(-50%)}.kbt-tooltip__arrow--bottom{top:100%;left:50%;transform:translate(-50%)}.kbt-tooltip__arrow--left{top:50%;right:100%;transform:translateY(-50%)}
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Generate bundle size information for each component
|
|
5
|
-
* This script analyzes the dist folder and generates a JSON file with size information
|
|
6
|
-
*/
|
|
7
|
-
import fs from 'fs';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import { fileURLToPath } from 'url';
|
|
10
|
-
import { gzipSync } from 'zlib';
|
|
11
|
-
|
|
12
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
-
const __dirname = path.dirname(__filename);
|
|
14
|
-
const rootDir = path.resolve(__dirname, '../..');
|
|
15
|
-
|
|
16
|
-
// Paths
|
|
17
|
-
const distEsmDir = path.join(rootDir, 'dist/esm/components');
|
|
18
|
-
const outputFile = path.join(rootDir, '.storybook/bundle-sizes.json');
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Get file size in bytes
|
|
22
|
-
*/
|
|
23
|
-
function getFileSize(filePath) {
|
|
24
|
-
try {
|
|
25
|
-
const stats = fs.statSync(filePath);
|
|
26
|
-
return stats.size;
|
|
27
|
-
} catch (error) {
|
|
28
|
-
return 0;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Get gzipped size of file
|
|
34
|
-
*/
|
|
35
|
-
function getGzipSize(filePath) {
|
|
36
|
-
try {
|
|
37
|
-
const content = fs.readFileSync(filePath);
|
|
38
|
-
const gzipped = gzipSync(content);
|
|
39
|
-
return gzipped.length;
|
|
40
|
-
} catch (error) {
|
|
41
|
-
return 0;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Format bytes to human readable
|
|
47
|
-
*/
|
|
48
|
-
function formatBytes(bytes) {
|
|
49
|
-
if (bytes === 0) return '0 B';
|
|
50
|
-
const k = 1024;
|
|
51
|
-
const sizes = ['B', 'KB', 'MB'];
|
|
52
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
53
|
-
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Get component files
|
|
58
|
-
*/
|
|
59
|
-
function getComponentFiles(componentPath) {
|
|
60
|
-
const files = {
|
|
61
|
-
css: [],
|
|
62
|
-
js: [],
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
try {
|
|
66
|
-
const entries = fs.readdirSync(componentPath, { withFileTypes: true });
|
|
67
|
-
|
|
68
|
-
for (const entry of entries) {
|
|
69
|
-
const fullPath = path.join(componentPath, entry.name);
|
|
70
|
-
|
|
71
|
-
if (entry.isDirectory()) {
|
|
72
|
-
// Recursively search subdirectories
|
|
73
|
-
const subFiles = getComponentFiles(fullPath);
|
|
74
|
-
files.css.push(...subFiles.css);
|
|
75
|
-
files.js.push(...subFiles.js);
|
|
76
|
-
} else if (entry.isFile()) {
|
|
77
|
-
if (entry.name.endsWith('.css')) {
|
|
78
|
-
files.css.push(fullPath);
|
|
79
|
-
} else if (entry.name.endsWith('.js')) {
|
|
80
|
-
files.js.push(fullPath);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
} catch (error) {
|
|
85
|
-
// Directory doesn't exist
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return files;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Calculate sizes for a component
|
|
93
|
-
*/
|
|
94
|
-
function calculateComponentSizes(componentName, componentPath) {
|
|
95
|
-
const files = getComponentFiles(componentPath);
|
|
96
|
-
|
|
97
|
-
let jsSize = 0;
|
|
98
|
-
let jsGzipSize = 0;
|
|
99
|
-
let cssSize = 0;
|
|
100
|
-
let cssGzipSize = 0;
|
|
101
|
-
|
|
102
|
-
// Sum JS files
|
|
103
|
-
for (const file of files.js) {
|
|
104
|
-
jsSize += getFileSize(file);
|
|
105
|
-
jsGzipSize += getGzipSize(file);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Sum CSS files
|
|
109
|
-
for (const file of files.css) {
|
|
110
|
-
cssSize += getFileSize(file);
|
|
111
|
-
cssGzipSize += getGzipSize(file);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const totalSize = jsSize + cssSize;
|
|
115
|
-
const totalGzipSize = jsGzipSize + cssGzipSize;
|
|
116
|
-
|
|
117
|
-
return {
|
|
118
|
-
component: componentName,
|
|
119
|
-
sizes: {
|
|
120
|
-
js: {
|
|
121
|
-
raw: jsSize,
|
|
122
|
-
gzip: jsGzipSize,
|
|
123
|
-
formatted: formatBytes(jsSize),
|
|
124
|
-
gzipFormatted: formatBytes(jsGzipSize),
|
|
125
|
-
},
|
|
126
|
-
css: {
|
|
127
|
-
raw: cssSize,
|
|
128
|
-
gzip: cssGzipSize,
|
|
129
|
-
formatted: formatBytes(cssSize),
|
|
130
|
-
gzipFormatted: formatBytes(cssGzipSize),
|
|
131
|
-
},
|
|
132
|
-
total: {
|
|
133
|
-
raw: totalSize,
|
|
134
|
-
gzip: totalGzipSize,
|
|
135
|
-
formatted: formatBytes(totalSize),
|
|
136
|
-
gzipFormatted: formatBytes(totalGzipSize),
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
treeshakeable: true, // All ESM exports are treeshakeable
|
|
140
|
-
timestamp: new Date().toISOString(),
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Main function
|
|
146
|
-
*/
|
|
147
|
-
function main() {
|
|
148
|
-
console.log('š¦ Generating bundle size information...\n');
|
|
149
|
-
|
|
150
|
-
if (!fs.existsSync(distEsmDir)) {
|
|
151
|
-
console.warn('ā ļø Warning: dist/esm/components directory not found.');
|
|
152
|
-
console.warn(
|
|
153
|
-
' Creating empty bundle-sizes.json. Run `pnpm dist` to populate.\n',
|
|
154
|
-
);
|
|
155
|
-
|
|
156
|
-
// Create empty bundle sizes file
|
|
157
|
-
const emptyOutput = {
|
|
158
|
-
metadata: {
|
|
159
|
-
generated: new Date().toISOString(),
|
|
160
|
-
totalComponents: 0,
|
|
161
|
-
totalSize: {
|
|
162
|
-
raw: 0,
|
|
163
|
-
gzip: 0,
|
|
164
|
-
formatted: '0 B',
|
|
165
|
-
gzipFormatted: '0 B',
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
components: {},
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
const storybookDir = path.dirname(outputFile);
|
|
172
|
-
if (!fs.existsSync(storybookDir)) {
|
|
173
|
-
fs.mkdirSync(storybookDir, { recursive: true });
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
fs.writeFileSync(outputFile, JSON.stringify(emptyOutput, null, 2));
|
|
177
|
-
console.log('š Created empty bundle-sizes.json\n');
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const components = fs
|
|
182
|
-
.readdirSync(distEsmDir, { withFileTypes: true })
|
|
183
|
-
.filter((dirent) => dirent.isDirectory())
|
|
184
|
-
.map((dirent) => dirent.name);
|
|
185
|
-
|
|
186
|
-
const bundleSizes = {};
|
|
187
|
-
let totalComponents = 0;
|
|
188
|
-
let totalSize = 0;
|
|
189
|
-
let totalGzipSize = 0;
|
|
190
|
-
|
|
191
|
-
for (const component of components) {
|
|
192
|
-
const componentPath = path.join(distEsmDir, component);
|
|
193
|
-
const sizeInfo = calculateComponentSizes(component, componentPath);
|
|
194
|
-
|
|
195
|
-
bundleSizes[component] = sizeInfo;
|
|
196
|
-
totalComponents++;
|
|
197
|
-
totalSize += sizeInfo.sizes.total.raw;
|
|
198
|
-
totalGzipSize += sizeInfo.sizes.total.gzip;
|
|
199
|
-
|
|
200
|
-
console.log(
|
|
201
|
-
`ā ${component.padEnd(20)} ${sizeInfo.sizes.total.gzipFormatted} (gzip)`,
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Add metadata
|
|
206
|
-
const output = {
|
|
207
|
-
metadata: {
|
|
208
|
-
generated: new Date().toISOString(),
|
|
209
|
-
totalComponents,
|
|
210
|
-
totalSize: {
|
|
211
|
-
raw: totalSize,
|
|
212
|
-
gzip: totalGzipSize,
|
|
213
|
-
formatted: formatBytes(totalSize),
|
|
214
|
-
gzipFormatted: formatBytes(totalGzipSize),
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
components: bundleSizes,
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
// Write to file
|
|
221
|
-
const storybookDir = path.dirname(outputFile);
|
|
222
|
-
if (!fs.existsSync(storybookDir)) {
|
|
223
|
-
fs.mkdirSync(storybookDir, { recursive: true });
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
fs.writeFileSync(outputFile, JSON.stringify(output, null, 2));
|
|
227
|
-
|
|
228
|
-
console.log(`\n⨠Bundle sizes generated successfully!`);
|
|
229
|
-
console.log(`š Total components: ${totalComponents}`);
|
|
230
|
-
console.log(
|
|
231
|
-
`š¦ Total size: ${formatBytes(totalSize)} (raw) / ${formatBytes(totalGzipSize)} (gzip)`,
|
|
232
|
-
);
|
|
233
|
-
console.log(`š Output: ${path.relative(rootDir, outputFile)}\n`);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
main();
|