bertui 0.4.6 → 1.0.0
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 +4 -0
- package/package.json +1 -4
- package/src/build/image-optimizer.js +29 -30
- package/src/build.js +8 -13
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# BertUI ⚡
|
|
2
2
|
|
|
3
|
+
[](https://github.com/your-repo)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
**The fastest, zero-config React static site generator. Now stable and production-ready.**
|
|
3
7
|
Lightning-fast React development powered by Bun.
|
|
4
8
|
|
|
5
9
|
## ⚠️ Important Notice - CSS Animations Temporarily Unavailable
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bertui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Lightning-fast React dev server powered by Bun and Elysia",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -44,9 +44,6 @@
|
|
|
44
44
|
"url": "https://github.com/BunElysiaReact/BERTUI.git"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@jsquash/jpeg": "^1.6.0",
|
|
48
|
-
"@jsquash/png": "^3.1.1",
|
|
49
|
-
"@jsquash/webp": "^1.5.0",
|
|
50
47
|
"elysia": "^1.0.0",
|
|
51
48
|
"ernest-logger": "latest",
|
|
52
49
|
"lightningcss": "^1.30.2"
|
|
@@ -1,57 +1,55 @@
|
|
|
1
|
-
// bertui/src/build/image-optimizer.js - SIMPLE
|
|
1
|
+
// bertui/src/build/image-optimizer.js - SIMPLE & STABLE
|
|
2
2
|
import { join, extname } from 'path';
|
|
3
3
|
import { existsSync, mkdirSync, readdirSync, cpSync } from 'fs';
|
|
4
4
|
import logger from '../logger/logger.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Simple image copying
|
|
7
|
+
* Simple, reliable image copying
|
|
8
|
+
* No WASM, no optimization, just copy files
|
|
8
9
|
*/
|
|
10
|
+
|
|
9
11
|
export async function optimizeImages(srcDir, outDir) {
|
|
10
|
-
|
|
12
|
+
// Alias for copyImages to maintain API
|
|
13
|
+
logger.info(`📁 Copying from ${srcDir} to ${outDir}...`);
|
|
11
14
|
const copied = copyImages(srcDir, outDir);
|
|
12
15
|
return { optimized: 0, saved: 0, copied };
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
export async function checkOptimizationTools() {
|
|
16
|
-
|
|
19
|
+
// Always return empty array to disable optimization
|
|
17
20
|
return [];
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
export function copyImages(srcDir, outDir) {
|
|
21
|
-
|
|
24
|
+
// All common image formats
|
|
25
|
+
const imageExtensions = [
|
|
26
|
+
'.png', '.jpg', '.jpeg', '.webp', '.gif', '.svg',
|
|
27
|
+
'.avif', '.ico', '.bmp', '.tiff', '.tif'
|
|
28
|
+
];
|
|
29
|
+
|
|
22
30
|
let copied = 0;
|
|
31
|
+
let skipped = 0;
|
|
23
32
|
|
|
24
|
-
// Check if source directory exists
|
|
25
33
|
if (!existsSync(srcDir)) {
|
|
26
|
-
logger.warn(`⚠️ Source
|
|
34
|
+
logger.warn(`⚠️ Source not found: ${srcDir}`);
|
|
27
35
|
return 0;
|
|
28
36
|
}
|
|
29
37
|
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
mkdirSync(outDir, { recursive: true });
|
|
33
|
-
logger.info(`Created directory: ${outDir}`);
|
|
34
|
-
}
|
|
38
|
+
// Ensure output directory exists
|
|
39
|
+
mkdirSync(outDir, { recursive: true });
|
|
35
40
|
|
|
36
41
|
function processDirectory(dir, targetDir) {
|
|
37
42
|
try {
|
|
38
43
|
const entries = readdirSync(dir, { withFileTypes: true });
|
|
39
|
-
|
|
40
|
-
if (entries.length === 0) {
|
|
41
|
-
logger.warn(`Directory empty: ${dir}`);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
44
|
|
|
45
45
|
for (const entry of entries) {
|
|
46
46
|
const srcPath = join(dir, entry.name);
|
|
47
47
|
const destPath = join(targetDir, entry.name);
|
|
48
48
|
|
|
49
49
|
if (entry.isDirectory()) {
|
|
50
|
-
//
|
|
50
|
+
// Recursively process subdirectories
|
|
51
51
|
const subDestPath = join(targetDir, entry.name);
|
|
52
|
-
|
|
53
|
-
mkdirSync(subDestPath, { recursive: true });
|
|
54
|
-
}
|
|
52
|
+
mkdirSync(subDestPath, { recursive: true });
|
|
55
53
|
processDirectory(srcPath, subDestPath);
|
|
56
54
|
} else if (entry.isFile()) {
|
|
57
55
|
const ext = extname(entry.name).toLowerCase();
|
|
@@ -60,28 +58,29 @@ export function copyImages(srcDir, outDir) {
|
|
|
60
58
|
try {
|
|
61
59
|
cpSync(srcPath, destPath);
|
|
62
60
|
copied++;
|
|
63
|
-
logger.debug(` ✓ ${entry.name}`);
|
|
64
61
|
} catch (error) {
|
|
65
|
-
logger.warn(`
|
|
62
|
+
logger.warn(` Failed to copy ${entry.name}: ${error.message}`);
|
|
63
|
+
skipped++;
|
|
66
64
|
}
|
|
67
65
|
} else {
|
|
68
|
-
|
|
66
|
+
skipped++;
|
|
69
67
|
}
|
|
70
68
|
}
|
|
71
69
|
}
|
|
72
70
|
} catch (error) {
|
|
73
|
-
logger.error(`Error processing
|
|
71
|
+
logger.error(`Error processing ${dir}: ${error.message}`);
|
|
74
72
|
}
|
|
75
73
|
}
|
|
76
74
|
|
|
77
|
-
logger.info(`Processing ${srcDir}...`);
|
|
78
75
|
processDirectory(srcDir, outDir);
|
|
79
|
-
|
|
76
|
+
|
|
80
77
|
if (copied > 0) {
|
|
81
|
-
logger.success(`✅ Copied ${copied}
|
|
82
|
-
} else {
|
|
83
|
-
logger.warn(`⚠️ No images found in ${srcDir}`);
|
|
78
|
+
logger.success(`✅ Copied ${copied} image(s) to ${outDir}`);
|
|
84
79
|
}
|
|
85
80
|
|
|
81
|
+
if (skipped > 0) {
|
|
82
|
+
logger.info(`📝 Skipped ${skipped} non-image file(s)`);
|
|
83
|
+
}
|
|
84
|
+
|
|
86
85
|
return copied;
|
|
87
86
|
}
|
package/src/build.js
CHANGED
|
@@ -46,7 +46,7 @@ export async function buildProduction(options = {}) {
|
|
|
46
46
|
|
|
47
47
|
logger.info('Step 4: Copying and optimizing static assets...');
|
|
48
48
|
// SKIP OPTIMIZATION FOR NOW - JUST COPY
|
|
49
|
-
await copyAllStaticAssets(root, outDir
|
|
49
|
+
await copyAllStaticAssets(root, outDir);
|
|
50
50
|
|
|
51
51
|
logger.info('Step 5: Bundling JavaScript with Bun...');
|
|
52
52
|
const buildEntry = join(buildDir, 'main.js');
|
|
@@ -136,31 +136,26 @@ export async function buildProduction(options = {}) {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
async function copyAllStaticAssets(root, outDir, optimize = true) {
|
|
139
|
+
async function copyAllStaticAssets(root, outDir) {
|
|
141
140
|
const publicDir = join(root, 'public');
|
|
142
141
|
const srcImagesDir = join(root, 'src', 'images');
|
|
143
142
|
|
|
144
|
-
|
|
145
|
-
logger.info('Using simple asset copy (optimization disabled)...');
|
|
143
|
+
logger.info('📦 Copying static assets...');
|
|
146
144
|
|
|
147
|
-
// Copy from public/ to
|
|
145
|
+
// Copy from public/ to dist/
|
|
148
146
|
if (existsSync(publicDir)) {
|
|
149
|
-
logger.info('
|
|
147
|
+
logger.info(' Copying public/ directory...');
|
|
150
148
|
copyImages(publicDir, outDir);
|
|
151
|
-
} else {
|
|
152
|
-
logger.info('No public/ directory found');
|
|
153
149
|
}
|
|
154
150
|
|
|
155
151
|
// Copy from src/images/ to dist/images/
|
|
156
152
|
if (existsSync(srcImagesDir)) {
|
|
157
|
-
logger.info('🖼️ Copying src/images/ to dist/images/...');
|
|
158
153
|
const distImagesDir = join(outDir, 'images');
|
|
159
|
-
|
|
154
|
+
logger.info(` Copying src/images/ to ${relative(root, distImagesDir)}/...`);
|
|
160
155
|
copyImages(srcImagesDir, distImagesDir);
|
|
161
|
-
} else {
|
|
162
|
-
logger.info('No src/images/ directory found');
|
|
163
156
|
}
|
|
157
|
+
|
|
158
|
+
logger.success('✅ All assets copied');
|
|
164
159
|
}
|
|
165
160
|
|
|
166
161
|
async function buildAllCSS(root, outDir) {
|