diff --git a/.changeset/config.json b/.changeset/config.json
index 0c82e29..91b6a95 100644
--- a/.changeset/config.json
+++ b/.changeset/config.json
@@ -7,5 +7,5 @@
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
- "ignore": ["homebridge-ui"]
+ "ignore": []
}
diff --git a/ui-src/index.html b/index.html
similarity index 100%
rename from ui-src/index.html
rename to index.html
diff --git a/modern.config.ts b/modern.config.ts
new file mode 100644
index 0000000..bcba02b
--- /dev/null
+++ b/modern.config.ts
@@ -0,0 +1,46 @@
+import { moduleTools, defineConfig } from '@modern-js/module-tools';
+import path from 'path';
+
+const baseOutDir = path.resolve(__dirname, './homebridge-ui');
+
+export default defineConfig({
+ plugins: [moduleTools()],
+ buildConfig: [
+ {
+ buildType: 'bundle',
+ input: ['ui-src/server.ts'],
+ outDir: baseOutDir,
+ tsconfig: 'tsconfig.ui.json',
+ externals: ['@homebridge/plugin-ui-utils', '@api/index'],
+ dts: false,
+ hooks: [
+ {
+ name: 'renderChunk',
+ apply(compiler) {
+ compiler.hooks.renderChunk.tapPromise('renderChunk', async (chunk) => {
+ if (chunk.type === 'chunk') {
+ chunk.contents = chunk.contents.replace(/@api\/index/g, '../dist/api');
+ }
+ return chunk;
+ });
+ },
+ },
+ ],
+ },
+ {
+ buildType: 'bundle',
+ input: ['ui-src/index.tsx'],
+ outDir: path.resolve(baseOutDir, 'public'),
+ autoExternal: false,
+ platform: 'browser',
+ tsconfig: 'tsconfig.ui.json',
+ copy: {
+ patterns: [{ from: './index.html', context: __dirname }],
+ },
+ define: {
+ 'process.env.NODE_ENV': process.env.NODE_ENV ?? 'development',
+ },
+ dts: false,
+ },
+ ],
+});
diff --git a/package-lock.json b/package-lock.json
index 3f70d7c..3598f8b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,25 +8,28 @@
"name": "homebridge-plugin-aqara",
"version": "0.0.0",
"license": "Apache-2.0",
- "workspaces": [
- "ui-src"
- ],
"dependencies": {
"@homebridge/plugin-ui-utils": "^1.0.1",
"axios": "^1.6.7"
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
+ "@modern-js/module-tools": "^2.46.1",
"@types/node": "^18.16.20",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
+ "ahooks": "^3.7.10",
"eslint": "^8.45.0",
"homebridge": "^1.6.0",
"homebridge-config-ui-x": "^4.55.1",
"nodemon": "^2.0.22",
+ "rc-field-form": "^1.41.0",
+ "react": "^18.2.0",
+ "react-bootstrap": "^2.10.1",
+ "react-dom": "^18.2.0",
"rimraf": "^3.0.2",
"ts-node": "^10.9.1",
- "typescript": "^4.9.5"
+ "typescript": "~5.0.2"
},
"engines": {
"homebridge": "^1.6.0",
@@ -453,6 +456,7 @@
"version": "7.23.9",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.9.tgz",
"integrity": "sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==",
+ "dev": true,
"dependencies": {
"regenerator-runtime": "^0.14.0"
},
@@ -3314,6 +3318,7 @@
"version": "2.11.8",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
"integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==",
+ "dev": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/popperjs"
@@ -3323,6 +3328,7 @@
"version": "3.9.1",
"resolved": "https://registry.npmjs.org/@react-aria/ssr/-/ssr-3.9.1.tgz",
"integrity": "sha512-NqzkLFP8ZVI4GSorS0AYljC13QW2sc8bDqJOkBvkAt3M8gbcAXJWVRGtZBCRscki9RZF+rNlnPdg0G0jYkhJcg==",
+ "dev": true,
"dependencies": {
"@swc/helpers": "^0.5.0"
},
@@ -3337,6 +3343,7 @@
"version": "0.4.16",
"resolved": "https://registry.npmjs.org/@restart/hooks/-/hooks-0.4.16.tgz",
"integrity": "sha512-f7aCv7c+nU/3mF7NWLtVVr0Ra80RqsO89hO72r+Y/nvQr5+q0UFGkocElTH6MJApvReVh6JHUFYn2cw1WdHF3w==",
+ "dev": true,
"dependencies": {
"dequal": "^2.0.3"
},
@@ -3348,6 +3355,7 @@
"version": "1.6.6",
"resolved": "https://registry.npmjs.org/@restart/ui/-/ui-1.6.6.tgz",
"integrity": "sha512-eC3puKuWE1SRYbojWHXnvCNHGgf3uzHCb6JOhnF4OXPibOIPEkR1sqDSkL643ydigxwh+ruCa1CmYHlzk7ikKA==",
+ "dev": true,
"dependencies": {
"@babel/runtime": "^7.21.0",
"@popperjs/core": "^2.11.6",
@@ -3368,6 +3376,7 @@
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/uncontrollable/-/uncontrollable-8.0.4.tgz",
"integrity": "sha512-ulRWYWHvscPFc0QQXvyJjY6LIXU56f0h8pQFvhxiKk5V1fcI8gp9Ht9leVAhrVjzqMw0BgjspBINx9r6oyJUvQ==",
+ "dev": true,
"peerDependencies": {
"react": ">=16.14.0"
}
@@ -3395,6 +3404,7 @@
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.3.tgz",
"integrity": "sha512-FaruWX6KdudYloq1AHD/4nU+UsMTdNE8CKyrseXWEcgjDAbvkwJg2QGPAnfIJLIWsjZOSPLOAykK6fuYp4vp4A==",
+ "dev": true,
"dependencies": {
"tslib": "^2.4.0"
}
@@ -3477,31 +3487,25 @@
"node_modules/@types/prop-types": {
"version": "15.7.11",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz",
- "integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng=="
+ "integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==",
+ "dev": true
},
"node_modules/@types/react": {
"version": "18.2.55",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.55.tgz",
"integrity": "sha512-Y2Tz5P4yz23brwm2d7jNon39qoAtMMmalOQv6+fEFt1mT+FcM3D841wDpoUvFXhaYenuROCy3FZYqdTjM7qVyA==",
+ "dev": true,
"dependencies": {
"@types/prop-types": "*",
"@types/scheduler": "*",
"csstype": "^3.0.2"
}
},
- "node_modules/@types/react-dom": {
- "version": "18.2.19",
- "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.19.tgz",
- "integrity": "sha512-aZvQL6uUbIJpjZk4U8JZGbau9KDeAwMfmhyWorxgBkqDIEf6ROjRozcmPIicqsUwPUjbkDfHKgGee1Lq65APcA==",
- "dev": true,
- "dependencies": {
- "@types/react": "*"
- }
- },
"node_modules/@types/react-transition-group": {
"version": "4.4.10",
"resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.10.tgz",
"integrity": "sha512-hT/+s0VQs2ojCX823m60m5f0sL5idt9SO6Tj6Dg+rdphGPIeJbJ6CxvBYkgkGKrYeDjvIpKTR38UzmtHJOGW3Q==",
+ "dev": true,
"dependencies": {
"@types/react": "*"
}
@@ -3509,7 +3513,8 @@
"node_modules/@types/scheduler": {
"version": "0.16.8",
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz",
- "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A=="
+ "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==",
+ "dev": true
},
"node_modules/@types/semver": {
"version": "7.5.7",
@@ -3526,7 +3531,8 @@
"node_modules/@types/warning": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/warning/-/warning-3.0.3.tgz",
- "integrity": "sha512-D1XC7WK8K+zZEveUPY+cf4+kgauk8N4eHr/XIHXGlGYkHLud6hK9lYfZk1ry1TNh798cZUCgb6MqGEG8DkJt6Q=="
+ "integrity": "sha512-D1XC7WK8K+zZEveUPY+cf4+kgauk8N4eHr/XIHXGlGYkHLud6hK9lYfZk1ry1TNh798cZUCgb6MqGEG8DkJt6Q==",
+ "dev": true
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "5.62.0",
@@ -3892,6 +3898,7 @@
"version": "3.7.10",
"resolved": "https://registry.npmjs.org/ahooks/-/ahooks-3.7.10.tgz",
"integrity": "sha512-/HLYif7sFA/5qSuWKrwvjDbf3bq+sdaMrUWS7XGCDRWdC2FrG/i+u5LZdakMYc6UIgJTMQ7tGiJCV7sdU4kSIw==",
+ "dev": true,
"dependencies": {
"@babel/runtime": "^7.21.0",
"dayjs": "^1.9.1",
@@ -4132,7 +4139,8 @@
"node_modules/async-validator": {
"version": "4.2.5",
"resolved": "https://registry.npmjs.org/async-validator/-/async-validator-4.2.5.tgz",
- "integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg=="
+ "integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==",
+ "dev": true
},
"node_modules/asynckit": {
"version": "0.4.0",
@@ -4627,7 +4635,8 @@
"node_modules/classnames": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz",
- "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow=="
+ "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==",
+ "dev": true
},
"node_modules/cli-cursor": {
"version": "3.1.0",
@@ -4909,7 +4918,8 @@
"node_modules/csstype": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
- "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="
+ "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
+ "dev": true
},
"node_modules/csv": {
"version": "5.5.3",
@@ -4947,7 +4957,8 @@
"node_modules/dayjs": {
"version": "1.11.10",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
- "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ=="
+ "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==",
+ "dev": true
},
"node_modules/debug": {
"version": "4.3.4",
@@ -5130,6 +5141,7 @@
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
"integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
+ "dev": true,
"engines": {
"node": ">=6"
}
@@ -5207,6 +5219,7 @@
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz",
"integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==",
+ "dev": true,
"dependencies": {
"@babel/runtime": "^7.8.7",
"csstype": "^3.0.2"
@@ -7012,10 +7025,6 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
},
- "node_modules/homebridge-ui": {
- "resolved": "ui-src",
- "link": true
- },
"node_modules/homebridge/node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
@@ -7449,12 +7458,14 @@
"node_modules/intersection-observer": {
"version": "0.12.2",
"resolved": "https://registry.npmjs.org/intersection-observer/-/intersection-observer-0.12.2.tgz",
- "integrity": "sha512-7m1vEcPCxXYI8HqnL8CKI6siDyD+eIWSwgB3DZA+ZTogxk9I4CDnj4wilt9x/+/QbHI4YG5YZNmC6458/e9Ktg=="
+ "integrity": "sha512-7m1vEcPCxXYI8HqnL8CKI6siDyD+eIWSwgB3DZA+ZTogxk9I4CDnj4wilt9x/+/QbHI4YG5YZNmC6458/e9Ktg==",
+ "dev": true
},
"node_modules/invariant": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
"integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==",
+ "dev": true,
"dependencies": {
"loose-envify": "^1.0.0"
}
@@ -7895,12 +7906,14 @@
"node_modules/js-cookie": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz",
- "integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ=="
+ "integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==",
+ "dev": true
},
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
- "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
+ "dev": true
},
"node_modules/js-yaml": {
"version": "3.14.1",
@@ -8188,7 +8201,8 @@
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
- "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
+ "dev": true
},
"node_modules/lodash.camelcase": {
"version": "4.3.0",
@@ -8346,6 +8360,7 @@
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
"integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
+ "dev": true,
"dependencies": {
"js-tokens": "^3.0.0 || ^4.0.0"
},
@@ -8961,6 +8976,7 @@
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+ "dev": true,
"engines": {
"node": ">=0.10.0"
}
@@ -9816,6 +9832,7 @@
"version": "15.8.1",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
"integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==",
+ "dev": true,
"dependencies": {
"loose-envify": "^1.4.0",
"object-assign": "^4.1.1",
@@ -9826,6 +9843,7 @@
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/prop-types-extra/-/prop-types-extra-1.1.1.tgz",
"integrity": "sha512-59+AHNnHYCdiC+vMwY52WmvP5dM3QLeoumYuEyceQDi9aEhtwN9zIQ2ZNo25sMyXnbh32h+P1ezDsUpUH3JAew==",
+ "dev": true,
"dependencies": {
"react-is": "^16.3.2",
"warning": "^4.0.0"
@@ -9837,12 +9855,14 @@
"node_modules/prop-types-extra/node_modules/react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
- "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
+ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
+ "dev": true
},
"node_modules/prop-types/node_modules/react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
- "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
+ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
+ "dev": true
},
"node_modules/proxy-addr": {
"version": "2.0.7",
@@ -9966,6 +9986,7 @@
"version": "1.41.0",
"resolved": "https://registry.npmjs.org/rc-field-form/-/rc-field-form-1.41.0.tgz",
"integrity": "sha512-k9AS0wmxfJfusWDP/YXWTpteDNaQ4isJx9UKxx4/e8Dub4spFeZ54/EuN2sYrMRID/+hUznPgVZeg+Gf7XSYCw==",
+ "dev": true,
"dependencies": {
"@babel/runtime": "^7.18.0",
"async-validator": "^4.1.0",
@@ -9983,6 +10004,7 @@
"version": "5.38.1",
"resolved": "https://registry.npmjs.org/rc-util/-/rc-util-5.38.1.tgz",
"integrity": "sha512-e4ZMs7q9XqwTuhIK7zBIVFltUtMSjphuPPQXHoHlzRzNdOwUxDejo0Zls5HYaJfRKNURcsS/ceKVULlhjBrxng==",
+ "dev": true,
"dependencies": {
"@babel/runtime": "^7.18.3",
"react-is": "^18.2.0"
@@ -10005,6 +10027,7 @@
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz",
"integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==",
+ "dev": true,
"dependencies": {
"loose-envify": "^1.1.0"
},
@@ -10016,6 +10039,7 @@
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-2.10.1.tgz",
"integrity": "sha512-J3OpRZIvCTQK+Tg/jOkRUvpYLHMdGeU9KqFUBQrV0d/Qr/3nsINpiOJyZMWnM5SJ3ctZdhPA6eCIKpEJR3Ellg==",
+ "dev": true,
"dependencies": {
"@babel/runtime": "^7.22.5",
"@restart/hooks": "^0.4.9",
@@ -10045,6 +10069,7 @@
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz",
"integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==",
+ "dev": true,
"dependencies": {
"loose-envify": "^1.1.0",
"scheduler": "^0.23.0"
@@ -10056,17 +10081,20 @@
"node_modules/react-is": {
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz",
- "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w=="
+ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==",
+ "dev": true
},
"node_modules/react-lifecycles-compat": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
- "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="
+ "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==",
+ "dev": true
},
"node_modules/react-transition-group": {
"version": "4.4.5",
"resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz",
"integrity": "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==",
+ "dev": true,
"dependencies": {
"@babel/runtime": "^7.5.5",
"dom-helpers": "^5.0.1",
@@ -10200,7 +10228,8 @@
"node_modules/regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
- "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
+ "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==",
+ "dev": true
},
"node_modules/regexp.prototype.flags": {
"version": "1.5.2",
@@ -10247,7 +10276,8 @@
"node_modules/resize-observer-polyfill": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz",
- "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg=="
+ "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==",
+ "dev": true
},
"node_modules/resolve": {
"version": "1.22.8",
@@ -10459,6 +10489,7 @@
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz",
"integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==",
+ "dev": true,
"dependencies": {
"loose-envify": "^1.1.0"
}
@@ -10467,6 +10498,7 @@
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/screenfull/-/screenfull-5.2.0.tgz",
"integrity": "sha512-9BakfsO2aUQN2K9Fdbj87RJIEZ82Q9IGim7FqM5OsebfoFC6ZHXgDq/KvniuLTPdeM8wY2o6Dj3WQ7KeQCj3cA==",
+ "dev": true,
"engines": {
"node": ">=0.10.0"
},
@@ -11694,7 +11726,8 @@
"node_modules/tslib": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
- "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
+ "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
+ "dev": true
},
"node_modules/tsutils": {
"version": "3.21.0",
@@ -11916,16 +11949,16 @@
}
},
"node_modules/typescript": {
- "version": "4.9.5",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
- "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
+ "version": "5.0.4",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
+ "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
- "node": ">=4.2.0"
+ "node": ">=12.20"
}
},
"node_modules/uid": {
@@ -11959,6 +11992,7 @@
"version": "7.2.1",
"resolved": "https://registry.npmjs.org/uncontrollable/-/uncontrollable-7.2.1.tgz",
"integrity": "sha512-svtcfoTADIB0nT9nltgjujTi7BzVmwjZClOmskKu/E8FW9BXzg9os8OLr4f8Dlnk0rYWJIWr4wv9eKUXiQvQwQ==",
+ "dev": true,
"dependencies": {
"@babel/runtime": "^7.6.3",
"@types/react": ">=16.9.11",
@@ -12139,6 +12173,7 @@
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz",
"integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==",
+ "dev": true,
"dependencies": {
"loose-envify": "^1.0.0"
}
@@ -12445,6 +12480,7 @@
"ui-src": {
"name": "homebridge-ui",
"version": "0.0.0",
+ "extraneous": true,
"dependencies": {
"@homebridge/plugin-ui-utils": "^1.0.1",
"ahooks": "^3.7.10",
@@ -12460,19 +12496,6 @@
"@types/react-dom": "^18.2.19",
"typescript": "~5.0.4"
}
- },
- "ui-src/node_modules/typescript": {
- "version": "5.0.4",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
- "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
- "dev": true,
- "bin": {
- "tsc": "bin/tsc",
- "tsserver": "bin/tsserver"
- },
- "engines": {
- "node": ">=12.20"
- }
}
}
}
diff --git a/package.json b/package.json
index 8ebd3ee..e98a45e 100644
--- a/package.json
+++ b/package.json
@@ -18,26 +18,30 @@
"main": "dist/index.js",
"scripts": {
"watch": "npm run build && npm link && nodemon",
- "build": "rimraf ./dist && tsc && cd ui-src && npm run build"
+ "build": "rimraf ./dist && tsc && npm run build:ui",
+ "build:ui": "modern build"
},
"keywords": [
"homebridge-plugin"
],
- "workspaces": [
- "ui-src"
- ],
"devDependencies": {
"@changesets/cli": "^2.27.1",
+ "@modern-js/module-tools": "^2.46.1",
"@types/node": "^18.16.20",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
+ "ahooks": "^3.7.10",
"eslint": "^8.45.0",
"homebridge": "^1.6.0",
"homebridge-config-ui-x": "^4.55.1",
"nodemon": "^2.0.22",
+ "rc-field-form": "^1.41.0",
+ "react": "^18.2.0",
+ "react-bootstrap": "^2.10.1",
+ "react-dom": "^18.2.0",
"rimraf": "^3.0.2",
"ts-node": "^10.9.1",
- "typescript": "^4.9.5"
+ "typescript": "~5.0.2"
},
"dependencies": {
"@homebridge/plugin-ui-utils": "^1.0.1",
diff --git a/ui-src/tsconfig.json b/tsconfig.ui.json
similarity index 80%
rename from ui-src/tsconfig.json
rename to tsconfig.ui.json
index 3463382..c44e8dc 100644
--- a/ui-src/tsconfig.json
+++ b/tsconfig.ui.json
@@ -11,14 +11,14 @@
"lib": ["DOM", "ESNext"],
"moduleResolution": "node",
"paths": {
- "@/*": ["./src/*"],
- "@api/*": ["../src/api/*"],
+ "@/*": ["./ui-src/*"],
+ "@api/*": ["./src/api/*"],
},
"resolveJsonModule": true,
- "rootDir": "src",
+ "rootDir": "ui-src",
"skipLibCheck": true,
"strict": true
},
"exclude": ["**/node_modules"],
- "include": ["src"]
+ "include": ["ui-src"]
}
diff --git a/ui-src/.eslintrc.js b/ui-src/.eslintrc.js
index a84ee27..fafc003 100644
--- a/ui-src/.eslintrc.js
+++ b/ui-src/.eslintrc.js
@@ -1,4 +1,9 @@
+// eslint-disable-next-line import/no-commonjs
module.exports = {
root: true,
- extends: ['@modern-js'],
+ extends: ['@modern-js-app'],
+ parserOptions: {
+ tsconfigRootDir: __dirname,
+ project: ['../tsconfig.json'],
+ },
};
diff --git a/ui-src/src/App.tsx b/ui-src/App.tsx
similarity index 100%
rename from ui-src/src/App.tsx
rename to ui-src/App.tsx
diff --git a/ui-src/src/app-config.tsx b/ui-src/app-config.tsx
similarity index 100%
rename from ui-src/src/app-config.tsx
rename to ui-src/app-config.tsx
diff --git a/ui-src/src/components/form-field.tsx b/ui-src/components/form-field.tsx
similarity index 100%
rename from ui-src/src/components/form-field.tsx
rename to ui-src/components/form-field.tsx
diff --git a/ui-src/src/context.ts b/ui-src/context.ts
similarity index 100%
rename from ui-src/src/context.ts
rename to ui-src/context.ts
diff --git a/ui-src/src/env.d.ts b/ui-src/env.d.ts
similarity index 73%
rename from ui-src/src/env.d.ts
rename to ui-src/env.d.ts
index 33eacbc..605a97b 100644
--- a/ui-src/src/env.d.ts
+++ b/ui-src/env.d.ts
@@ -1,3 +1,3 @@
///
///
-///
\ No newline at end of file
+///
\ No newline at end of file
diff --git a/ui-src/src/hooks/use-plugin-config.ts b/ui-src/hooks/use-plugin-config.ts
similarity index 100%
rename from ui-src/src/hooks/use-plugin-config.ts
rename to ui-src/hooks/use-plugin-config.ts
diff --git a/ui-src/src/index.tsx b/ui-src/index.tsx
similarity index 100%
rename from ui-src/src/index.tsx
rename to ui-src/index.tsx
diff --git a/ui-src/modern.config.ts b/ui-src/modern.config.ts
deleted file mode 100644
index 3018438..0000000
--- a/ui-src/modern.config.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { moduleTools, defineConfig } from '@modern-js/module-tools';
-import path from 'path';
-
-const baseOutDir = path.resolve(__dirname, '../homebridge-ui');
-
-export default defineConfig({
- plugins: [moduleTools()],
- buildConfig: [
- {
- buildType: 'bundleless',
- input: ['src/server.ts'],
- outDir: baseOutDir,
- dts: false,
- alias: {
- '@api': './dist/api',
- },
- },
- {
- buildType: 'bundle',
- input: ['src/index.tsx'],
- outDir: path.resolve(baseOutDir, 'public'),
- autoExternal: false,
- copy: {
- patterns: [{ from: './index.html', context: __dirname }],
- },
- define: {
- 'process.env.NODE_ENV': process.env.NODE_ENV ?? 'development',
- },
- dts: false,
- },
- ],
-});
diff --git a/ui-src/package.json b/ui-src/package.json
deleted file mode 100644
index 293f802..0000000
--- a/ui-src/package.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "name": "homebridge-ui",
- "private": true,
- "version": "0.0.0",
- "scripts": {
- "build": "modern build",
- "build:watch": "modern build -w"
- },
- "dependencies": {
- "@homebridge/plugin-ui-utils": "^1.0.1",
- "ahooks": "^3.7.10",
- "rc-field-form": "^1.41.0",
- "react": "^18.2.0",
- "react-bootstrap": "^2.10.1",
- "react-dom": "^18.2.0"
- },
- "devDependencies": {
- "@modern-js/module-tools": "2.46.1",
- "@types/node": "^18.16.20",
- "@types/react": "^18.2.55",
- "@types/react-dom": "^18.2.19",
- "typescript": "~5.0.4"
- }
-}
diff --git a/ui-src/src/server.ts b/ui-src/server.ts
similarity index 100%
rename from ui-src/src/server.ts
rename to ui-src/server.ts
diff --git a/ui-src/src/.eslintrc.js b/ui-src/src/.eslintrc.js
deleted file mode 100644
index fafc003..0000000
--- a/ui-src/src/.eslintrc.js
+++ /dev/null
@@ -1,9 +0,0 @@
-// eslint-disable-next-line import/no-commonjs
-module.exports = {
- root: true,
- extends: ['@modern-js-app'],
- parserOptions: {
- tsconfigRootDir: __dirname,
- project: ['../tsconfig.json'],
- },
-};
diff --git a/ui-src/src/user-config.tsx b/ui-src/user-config.tsx
similarity index 100%
rename from ui-src/src/user-config.tsx
rename to ui-src/user-config.tsx
diff --git a/ui-src/src/utils.ts b/ui-src/utils.ts
similarity index 100%
rename from ui-src/src/utils.ts
rename to ui-src/utils.ts