iobroker.mywebui 1.40.6 → 1.40.7
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/io-package.json +1 -1
- package/package.json +1 -1
- package/scripts/copy-three.mjs +66 -35
package/io-package.json
CHANGED
package/package.json
CHANGED
package/scripts/copy-three.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copy Three.js to www/node_modules for demo.html
|
|
3
|
-
*
|
|
3
|
+
* Simple, robust version with detailed logging
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import fs from 'fs';
|
|
@@ -11,53 +11,84 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
11
11
|
const rootDir = path.join(__dirname, '..');
|
|
12
12
|
const sourceDir = path.join(rootDir, 'node_modules', 'three');
|
|
13
13
|
const targetDir = path.join(rootDir, 'www', 'node_modules', 'three');
|
|
14
|
+
const wwwNodeModules = path.dirname(targetDir);
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
console.log('📦 Three.js Copy Script');
|
|
17
|
+
console.log(`Root: ${rootDir}`);
|
|
18
|
+
console.log(`Source: ${sourceDir}`);
|
|
19
|
+
console.log(`Target: ${targetDir}`);
|
|
20
|
+
|
|
21
|
+
function copyDirSync(src, dest) {
|
|
16
22
|
try {
|
|
17
|
-
//
|
|
18
|
-
if (!fs.existsSync(
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
// Create destination if needed
|
|
24
|
+
if (!fs.existsSync(dest)) {
|
|
25
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
26
|
+
console.log(`✓ Created: ${dest}`);
|
|
21
27
|
}
|
|
22
28
|
|
|
23
|
-
//
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
// Copy all files
|
|
30
|
+
const items = fs.readdirSync(src, { withFileTypes: true });
|
|
31
|
+
let fileCount = 0;
|
|
32
|
+
let dirCount = 0;
|
|
33
|
+
|
|
34
|
+
for (const item of items) {
|
|
35
|
+
const srcPath = path.join(src, item.name);
|
|
36
|
+
const destPath = path.join(dest, item.name);
|
|
28
37
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
if (item.isDirectory()) {
|
|
39
|
+
dirCount++;
|
|
40
|
+
copyDirSync(srcPath, destPath);
|
|
41
|
+
} else {
|
|
42
|
+
fileCount++;
|
|
43
|
+
fs.copyFileSync(srcPath, destPath);
|
|
44
|
+
}
|
|
32
45
|
}
|
|
33
46
|
|
|
34
|
-
|
|
35
|
-
copyDirSync(sourceDir, targetDir);
|
|
36
|
-
console.log('✅ Three.js copied to www/node_modules');
|
|
47
|
+
console.log(`✓ Copied ${dirCount} dirs, ${fileCount} files from ${src}`);
|
|
37
48
|
} catch (error) {
|
|
38
|
-
console.error(
|
|
39
|
-
|
|
40
|
-
|
|
49
|
+
console.error(`✗ Copy failed: ${src}`);
|
|
50
|
+
console.error(` Error: ${error.message}`);
|
|
51
|
+
throw error;
|
|
41
52
|
}
|
|
42
53
|
}
|
|
43
54
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
try {
|
|
56
|
+
// Check source exists
|
|
57
|
+
if (!fs.existsSync(sourceDir)) {
|
|
58
|
+
console.error(`✗ Source not found: ${sourceDir}`);
|
|
59
|
+
console.log(' Run: npm install');
|
|
60
|
+
process.exit(1);
|
|
47
61
|
}
|
|
48
62
|
|
|
49
|
-
|
|
50
|
-
for (const file of files) {
|
|
51
|
-
const srcFile = path.join(src, file);
|
|
52
|
-
const destFile = path.join(dest, file);
|
|
63
|
+
console.log(`✓ Source found: ${sourceDir}`);
|
|
53
64
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
fs.copyFileSync(srcFile, destFile);
|
|
59
|
-
}
|
|
65
|
+
// Create www/node_modules parent
|
|
66
|
+
if (!fs.existsSync(wwwNodeModules)) {
|
|
67
|
+
fs.mkdirSync(wwwNodeModules, { recursive: true });
|
|
68
|
+
console.log(`✓ Created: ${wwwNodeModules}`);
|
|
60
69
|
}
|
|
61
|
-
}
|
|
62
70
|
|
|
63
|
-
|
|
71
|
+
// Remove old copy
|
|
72
|
+
if (fs.existsSync(targetDir)) {
|
|
73
|
+
fs.rmSync(targetDir, { recursive: true, force: true });
|
|
74
|
+
console.log(`✓ Removed old: ${targetDir}`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Copy three.js
|
|
78
|
+
console.log('📋 Copying Three.js...');
|
|
79
|
+
copyDirSync(sourceDir, targetDir);
|
|
80
|
+
|
|
81
|
+
// Verify
|
|
82
|
+
const testFile = path.join(targetDir, 'build', 'three.module.js');
|
|
83
|
+
if (fs.existsSync(testFile)) {
|
|
84
|
+
console.log(`✅ SUCCESS! Three.js copied to www/node_modules`);
|
|
85
|
+
console.log(` ${testFile}`);
|
|
86
|
+
process.exit(0);
|
|
87
|
+
} else {
|
|
88
|
+
console.error(`✗ Verification failed: ${testFile}`);
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.error(`✗ FAILED: ${error.message}`);
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|