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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "mywebui",
4
- "version": "1.40.6",
4
+ "version": "1.40.7",
5
5
  "titleLang": {
6
6
  "en": "mywebui",
7
7
  "de": "mywebui",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.mywebui",
3
- "version": "1.40.6",
3
+ "version": "1.40.7",
4
4
  "description": "ioBroker mywebui - Custom edited mywebui by gokturk413 with 3D Editor",
5
5
  "type": "module",
6
6
  "main": "dist/backend/main.js",
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Copy Three.js to www/node_modules for demo.html
3
- * Runs automatically after npm install
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
- async function copyThree() {
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
- // Check if three.js exists in node_modules
18
- if (!fs.existsSync(sourceDir)) {
19
- console.log('⚠️ Three.js not found in node_modules, skipping copy');
20
- return;
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
- // Create www/node_modules if it doesn't exist
24
- const wwwNodeModules = path.join(rootDir, 'www', 'node_modules');
25
- if (!fs.existsSync(wwwNodeModules)) {
26
- fs.mkdirSync(wwwNodeModules, { recursive: true });
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
- // Remove existing three.js if it exists
30
- if (fs.existsSync(targetDir)) {
31
- fs.rmSync(targetDir, { recursive: true, force: true });
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
- // Copy three.js recursively
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('❌ Error copying Three.js:', error.message);
39
- // Don't fail the install if copy fails
40
- process.exit(0);
49
+ console.error(`✗ Copy failed: ${src}`);
50
+ console.error(` Error: ${error.message}`);
51
+ throw error;
41
52
  }
42
53
  }
43
54
 
44
- function copyDirSync(src, dest) {
45
- if (!fs.existsSync(dest)) {
46
- fs.mkdirSync(dest, { recursive: true });
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
- const files = fs.readdirSync(src);
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
- const stat = fs.statSync(srcFile);
55
- if (stat.isDirectory()) {
56
- copyDirSync(srcFile, destFile);
57
- } else {
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
- copyThree();
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
+ }