bertui 1.0.2 → 1.0.3

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 (3) hide show
  1. package/index.js +1 -1
  2. package/package.json +1 -1
  3. package/src/build.js +21 -5
package/index.js CHANGED
@@ -32,5 +32,5 @@ export default {
32
32
  buildCSS,
33
33
  copyCSS,
34
34
  program,
35
- version: "0.3.9"
35
+ version: "1.0.3"
36
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bertui",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Lightning-fast React dev server powered by Bun and Elysia",
5
5
  "type": "module",
6
6
  "main": "./index.js",
package/src/build.js CHANGED
@@ -157,6 +157,7 @@ async function copyAllStaticAssets(root, outDir, optimize = true) {
157
157
  }
158
158
 
159
159
  // COMBINE ALL CSS INTO ONE FILE
160
+ // COMBINE ALL CSS INTO ONE FILE - FIXED BUN API
160
161
  async function buildAllCSS(root, outDir) {
161
162
  const srcStylesDir = join(root, 'src', 'styles');
162
163
  const stylesOutDir = join(outDir, 'styles');
@@ -167,12 +168,20 @@ async function buildAllCSS(root, outDir) {
167
168
  const cssFiles = readdirSync(srcStylesDir).filter(f => f.endsWith('.css'));
168
169
  logger.info(`📦 Found ${cssFiles.length} CSS files to combine`);
169
170
 
171
+ if (cssFiles.length === 0) {
172
+ logger.warn('⚠️ No CSS files found in src/styles/');
173
+ return;
174
+ }
175
+
170
176
  // COMBINE ALL CSS INTO ONE FILE
171
177
  let combinedCSS = '';
178
+ let totalOriginalSize = 0;
172
179
 
173
180
  for (const cssFile of cssFiles) {
174
181
  const srcPath = join(srcStylesDir, cssFile);
175
- const cssContent = await Bun.file(srcPath).text();
182
+ const file = Bun.file(srcPath);
183
+ const cssContent = await file.text();
184
+ totalOriginalSize += file.size;
176
185
  combinedCSS += `/* === ${cssFile} === */\n${cssContent}\n\n`;
177
186
  }
178
187
 
@@ -181,16 +190,23 @@ async function buildAllCSS(root, outDir) {
181
190
  await Bun.write(combinedPath, combinedCSS);
182
191
 
183
192
  // Minify it
184
- await buildCSS(combinedPath, combinedPath);
193
+ const minified = await buildCSS(combinedPath, combinedPath);
185
194
 
186
- const size = (await Bun.file(combinedPath).size()) / 1024;
187
- logger.success(`✅ Combined ${cssFiles.length} CSS files → bertui.min.css (${size.toFixed(1)}KB)`);
195
+ // Get final size
196
+ const finalFile = Bun.file(combinedPath);
197
+ const finalSize = finalFile.size / 1024;
198
+ const originalSize = totalOriginalSize / 1024;
199
+ const savings = ((originalSize - finalSize) / originalSize * 100).toFixed(1);
200
+
201
+ logger.success(`✅ Combined ${cssFiles.length} CSS files (${originalSize.toFixed(1)}KB) → bertui.min.css (${finalSize.toFixed(1)}KB, -${savings}%)`);
188
202
 
189
203
  } else {
190
204
  logger.warn('⚠️ No src/styles/ directory found');
205
+ // Create empty CSS file so build doesn't fail
206
+ const emptyPath = join(stylesOutDir, 'bertui.min.css');
207
+ await Bun.write(emptyPath, '/* No CSS files found */');
191
208
  }
192
209
  }
193
-
194
210
  async function compileForBuild(root, buildDir, envVars) {
195
211
  const srcDir = join(root, 'src');
196
212
  const pagesDir = join(srcDir, 'pages');