iobroker.mywebui 1.40.5 → 1.40.6

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.5",
4
+ "version": "1.40.6",
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.5",
3
+ "version": "1.40.6",
4
4
  "description": "ioBroker mywebui - Custom edited mywebui by gokturk413 with 3D Editor",
5
5
  "type": "module",
6
6
  "main": "dist/backend/main.js",
@@ -11,8 +11,9 @@
11
11
  "start": "web-dev-server --open",
12
12
  "startwww": "cd www && web-dev-server --node-resolve --open",
13
13
  "prepublishOnly": "npm run build",
14
- "build": "npm i && npm run reflection && gulp delAll && tsc && gulp",
15
- "postinstall": "node scripts/copy-three.mjs && node setup-scada-utils.js || echo 'SCADA setup will run on adapter start'",
14
+ "copy-three": "node scripts/copy-three.mjs",
15
+ "build": "npm i && npm run copy-three && npm run reflection && gulp delAll && tsc && gulp",
16
+ "postinstall": "node setup-scada-utils.js || echo 'SCADA setup will run on adapter start'",
16
17
  "test:ts": "mocha --config test/mocharc.custom.json test/tests/*.js",
17
18
  "test:package": "mocha test/package --exit",
18
19
  "test:unit": "mocha test/unit --exit",
@@ -54,6 +55,7 @@
54
55
  "dist/",
55
56
  "www/",
56
57
  "widgets/",
58
+ "scripts/",
57
59
  "io-package.json",
58
60
  "LICENSE",
59
61
  "README.md",
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Copy Three.js to www/node_modules for demo.html
3
+ * Runs automatically after npm install
4
+ */
5
+
6
+ import fs from 'fs';
7
+ import path from 'path';
8
+ import { fileURLToPath } from 'url';
9
+
10
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
+ const rootDir = path.join(__dirname, '..');
12
+ const sourceDir = path.join(rootDir, 'node_modules', 'three');
13
+ const targetDir = path.join(rootDir, 'www', 'node_modules', 'three');
14
+
15
+ async function copyThree() {
16
+ 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;
21
+ }
22
+
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
+ }
28
+
29
+ // Remove existing three.js if it exists
30
+ if (fs.existsSync(targetDir)) {
31
+ fs.rmSync(targetDir, { recursive: true, force: true });
32
+ }
33
+
34
+ // Copy three.js recursively
35
+ copyDirSync(sourceDir, targetDir);
36
+ console.log('✅ Three.js copied to www/node_modules');
37
+ } catch (error) {
38
+ console.error('❌ Error copying Three.js:', error.message);
39
+ // Don't fail the install if copy fails
40
+ process.exit(0);
41
+ }
42
+ }
43
+
44
+ function copyDirSync(src, dest) {
45
+ if (!fs.existsSync(dest)) {
46
+ fs.mkdirSync(dest, { recursive: true });
47
+ }
48
+
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);
53
+
54
+ const stat = fs.statSync(srcFile);
55
+ if (stat.isDirectory()) {
56
+ copyDirSync(srcFile, destFile);
57
+ } else {
58
+ fs.copyFileSync(srcFile, destFile);
59
+ }
60
+ }
61
+ }
62
+
63
+ copyThree();