@iobroker/adapter-react-v5 7.4.21 → 7.5.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/LICENSE +22 -22
- package/build/AdminConnection.js.map +1 -1
- package/build/Components/404.js +13 -13
- package/build/Components/404.js.map +1 -1
- package/build/Components/ColorPicker.js.map +1 -1
- package/build/Components/ComplexCron.js.map +1 -1
- package/build/Components/CopyToClipboard.js.map +1 -1
- package/build/Components/CustomModal.js.map +1 -1
- package/build/Components/FileBrowser.js +1 -1
- package/build/Components/FileBrowser.js.map +1 -1
- package/build/Components/FileViewer.js.map +1 -1
- package/build/Components/Icon.js.map +1 -1
- package/build/Components/IconPicker.js.map +1 -1
- package/build/Components/IconSelector.js.map +1 -1
- package/build/Components/IobUri.js.map +1 -1
- package/build/Components/Loader.js +223 -223
- package/build/Components/Loader.js.map +1 -1
- package/build/Components/Loaders/MV.js.map +1 -1
- package/build/Components/Loaders/PT.js +103 -103
- package/build/Components/Loaders/PT.js.map +1 -1
- package/build/Components/Loaders/Vendor.js +7 -7
- package/build/Components/Loaders/Vendor.js.map +1 -1
- package/build/Components/MDUtils.js.map +1 -1
- package/build/Components/ObjectBrowser.d.ts +11 -0
- package/build/Components/ObjectBrowser.js +172 -11
- package/build/Components/ObjectBrowser.js.map +1 -1
- package/build/Components/Router.js.map +1 -1
- package/build/Components/SaveCloseButtons.js.map +1 -1
- package/build/Components/Schedule.js.map +1 -1
- package/build/Components/SelectWithIcon.js.map +1 -1
- package/build/Components/SimpleCron/cronText.js.map +1 -1
- package/build/Components/SimpleCron/index.js.map +1 -1
- package/build/Components/TabContainer.js.map +1 -1
- package/build/Components/TabContent.js.map +1 -1
- package/build/Components/TabHeader.js.map +1 -1
- package/build/Components/TableResize.js.map +1 -1
- package/build/Components/TextWithIcon.js.map +1 -1
- package/build/Components/ToggleThemeMenu.js.map +1 -1
- package/build/Components/TreeTable.js.map +1 -1
- package/build/Components/UploadImage.js +305 -305
- package/build/Components/UploadImage.js.map +1 -1
- package/build/Components/withWidth.js.map +1 -1
- package/build/Connection.js.map +1 -1
- package/build/Dialogs/ComplexCron.js.map +1 -1
- package/build/Dialogs/Confirm.js.map +1 -1
- package/build/Dialogs/Cron.js.map +1 -1
- package/build/Dialogs/Error.js.map +1 -1
- package/build/Dialogs/Message.js.map +1 -1
- package/build/Dialogs/SelectFile.js.map +1 -1
- package/build/Dialogs/SimpleCron.js.map +1 -1
- package/build/Dialogs/TextInput.d.ts +1 -1
- package/build/Dialogs/TextInput.js.map +1 -1
- package/build/GenericApp.js.map +1 -1
- package/build/LegacyConnection.d.ts +4 -46
- package/build/LegacyConnection.js.map +1 -1
- package/build/Prompt.js +7 -7
- package/build/Prompt.js.map +1 -1
- package/build/Theme.js +6 -6
- package/build/Theme.js.map +1 -1
- package/build/assets/devices/parseNames.js.map +1 -1
- package/build/assets/devices.json +1 -1
- package/build/assets/lamp_ceiling.svg +8 -8
- package/build/assets/lamp_table.svg +7 -7
- package/build/assets/no_icon.svg +9 -9
- package/build/assets/rooms/parseNames.js.map +1 -1
- package/build/assets/rooms.json +1 -1
- package/build/dictionary.js.map +1 -1
- package/build/i18n/de.json +11 -0
- package/build/i18n/en.json +11 -0
- package/build/i18n/es.json +11 -0
- package/build/i18n/fr.json +11 -0
- package/build/i18n/it.json +11 -0
- package/build/i18n/nl.json +11 -0
- package/build/i18n/pl.json +11 -0
- package/build/i18n/pt.json +11 -0
- package/build/i18n/ru.json +11 -0
- package/build/i18n/uk.json +11 -0
- package/build/i18n/zh-cn.json +11 -0
- package/build/i18n.js.map +1 -1
- package/build/icons/IconAdapter.js.map +1 -1
- package/build/icons/IconAlias.js.map +1 -1
- package/build/icons/IconButtonImage.js.map +1 -1
- package/build/icons/IconChannel.js.map +1 -1
- package/build/icons/IconClearFilter.js.map +1 -1
- package/build/icons/IconClosed.js.map +1 -1
- package/build/icons/IconCopy.js.map +1 -1
- package/build/icons/IconDevice.js.map +1 -1
- package/build/icons/IconDocument.js.map +1 -1
- package/build/icons/IconDocumentReadOnly.js.map +1 -1
- package/build/icons/IconExpert.js.map +1 -1
- package/build/icons/IconFx.js +1 -1
- package/build/icons/IconFx.js.map +1 -1
- package/build/icons/IconInstance.js.map +1 -1
- package/build/icons/IconLogout.js +1 -1
- package/build/icons/IconLogout.js.map +1 -1
- package/build/icons/IconNoIcon.js.map +1 -1
- package/build/icons/IconOpen.js.map +1 -1
- package/build/icons/IconProps.js.map +1 -1
- package/build/icons/IconState.js.map +1 -1
- package/build/icons/IconVacuum.js.map +1 -1
- package/build/index.css +56 -56
- package/build/index.js.map +1 -1
- package/craco-module-federation.js +62 -62
- package/i18n/de.json +11 -0
- package/i18n/en.json +11 -0
- package/i18n/es.json +11 -0
- package/i18n/fr.json +11 -0
- package/i18n/it.json +11 -0
- package/i18n/nl.json +11 -0
- package/i18n/pl.json +11 -0
- package/i18n/pt.json +11 -0
- package/i18n/ru.json +11 -0
- package/i18n/uk.json +11 -0
- package/i18n/zh-cn.json +11 -0
- package/index.css +56 -56
- package/modulefederation.admin.config.js +33 -33
- package/package.json +14 -15
- package/tasksExample.js +91 -91
package/index.css
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
3
|
-
*
|
|
4
|
-
* MIT License
|
|
5
|
-
*
|
|
6
|
-
**/
|
|
7
|
-
|
|
8
|
-
html {
|
|
9
|
-
height: 100%;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
body {
|
|
13
|
-
margin: 0;
|
|
14
|
-
padding: 0;
|
|
15
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
|
|
16
|
-
'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
17
|
-
-webkit-font-smoothing: antialiased;
|
|
18
|
-
-moz-osx-font-smoothing: grayscale;
|
|
19
|
-
width: 100%;
|
|
20
|
-
height: 100%;
|
|
21
|
-
overflow: hidden;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/* scrollbar */
|
|
25
|
-
::-webkit-scrollbar-track {
|
|
26
|
-
background-color: #ccc;
|
|
27
|
-
border-radius: 5px;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
::-webkit-scrollbar {
|
|
31
|
-
width: 5px;
|
|
32
|
-
height: 5px;
|
|
33
|
-
background-color: #ccc;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
::-webkit-scrollbar-thumb {
|
|
37
|
-
background-color: #575757;
|
|
38
|
-
border-radius: 5px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
#root {
|
|
42
|
-
height: 100%;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.App {
|
|
46
|
-
height: 100%;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@keyframes glow {
|
|
50
|
-
from {
|
|
51
|
-
background-color: initial;
|
|
52
|
-
}
|
|
53
|
-
to {
|
|
54
|
-
background-color: #58c458;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
**/
|
|
7
|
+
|
|
8
|
+
html {
|
|
9
|
+
height: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
body {
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
|
|
16
|
+
'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
17
|
+
-webkit-font-smoothing: antialiased;
|
|
18
|
+
-moz-osx-font-smoothing: grayscale;
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* scrollbar */
|
|
25
|
+
::-webkit-scrollbar-track {
|
|
26
|
+
background-color: #ccc;
|
|
27
|
+
border-radius: 5px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
::-webkit-scrollbar {
|
|
31
|
+
width: 5px;
|
|
32
|
+
height: 5px;
|
|
33
|
+
background-color: #ccc;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
::-webkit-scrollbar-thumb {
|
|
37
|
+
background-color: #575757;
|
|
38
|
+
border-radius: 5px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#root {
|
|
42
|
+
height: 100%;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.App {
|
|
46
|
+
height: 100%;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@keyframes glow {
|
|
50
|
+
from {
|
|
51
|
+
background-color: initial;
|
|
52
|
+
}
|
|
53
|
+
to {
|
|
54
|
+
background-color: #58c458;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
function makeShared(pkgs) {
|
|
2
|
-
const result = {};
|
|
3
|
-
pkgs.forEach(packageName => {
|
|
4
|
-
result[packageName] = {
|
|
5
|
-
requiredVersion: '*',
|
|
6
|
-
singleton: true,
|
|
7
|
-
};
|
|
8
|
-
});
|
|
9
|
-
return result;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Admin shares these modules for all components
|
|
13
|
-
module.exports = {
|
|
14
|
-
shared: makeShared([
|
|
15
|
-
'@emotion/react',
|
|
16
|
-
'@emotion/styled',
|
|
17
|
-
'@iobroker/adapter-react-v5',
|
|
18
|
-
'@iobroker/json-config',
|
|
19
|
-
'@iobroker/dm-gui-components',
|
|
20
|
-
'@mui/icons-material',
|
|
21
|
-
'@mui/material',
|
|
22
|
-
'@mui/x-date-pickers',
|
|
23
|
-
'date-fns/locale',
|
|
24
|
-
'leaflet',
|
|
25
|
-
'leaflet-geosearch',
|
|
26
|
-
'prop-types',
|
|
27
|
-
'react',
|
|
28
|
-
'react-ace',
|
|
29
|
-
'react-dom',
|
|
30
|
-
'react-dropzone',
|
|
31
|
-
'semver',
|
|
32
|
-
]),
|
|
33
|
-
};
|
|
1
|
+
function makeShared(pkgs) {
|
|
2
|
+
const result = {};
|
|
3
|
+
pkgs.forEach(packageName => {
|
|
4
|
+
result[packageName] = {
|
|
5
|
+
requiredVersion: '*',
|
|
6
|
+
singleton: true,
|
|
7
|
+
};
|
|
8
|
+
});
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Admin shares these modules for all components
|
|
13
|
+
module.exports = {
|
|
14
|
+
shared: makeShared([
|
|
15
|
+
'@emotion/react',
|
|
16
|
+
'@emotion/styled',
|
|
17
|
+
'@iobroker/adapter-react-v5',
|
|
18
|
+
'@iobroker/json-config',
|
|
19
|
+
'@iobroker/dm-gui-components',
|
|
20
|
+
'@mui/icons-material',
|
|
21
|
+
'@mui/material',
|
|
22
|
+
'@mui/x-date-pickers',
|
|
23
|
+
'date-fns/locale',
|
|
24
|
+
'leaflet',
|
|
25
|
+
'leaflet-geosearch',
|
|
26
|
+
'prop-types',
|
|
27
|
+
'react',
|
|
28
|
+
'react-ace',
|
|
29
|
+
'react-dom',
|
|
30
|
+
'react-dropzone',
|
|
31
|
+
'semver',
|
|
32
|
+
]),
|
|
33
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iobroker/adapter-react-v5",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.0",
|
|
4
4
|
"description": "React components to develop ioBroker interfaces with react.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "bluefox",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"release-patch": "release-script patch --yes --lf",
|
|
15
15
|
"release-minor": "release-script minor --yes --lf",
|
|
16
16
|
"release-major": "release-script major --yes --lf",
|
|
17
|
-
"update-packages": "
|
|
17
|
+
"update-packages": "npx -y npm-check-updates --upgrade",
|
|
18
18
|
"0-clean": "node tasks --0-clean",
|
|
19
19
|
"1-build": "tsc -p tsconfig.build.json",
|
|
20
20
|
"2-copy": "node tasks --2-copy",
|
|
@@ -59,33 +59,32 @@
|
|
|
59
59
|
"@emotion/styled": "^11.14.0",
|
|
60
60
|
"@iobroker/js-controller-common": "^7.0.6",
|
|
61
61
|
"@iobroker/js-controller-common-db": "^7.0.6",
|
|
62
|
-
"@iobroker/socket-client": "
|
|
62
|
+
"@iobroker/socket-client": "4.0.21",
|
|
63
63
|
"@iobroker/types": "^7.0.6",
|
|
64
|
-
"@mui/icons-material": "^6.4.
|
|
65
|
-
"@mui/material": "^6.4.
|
|
66
|
-
"@sentry/browser": "^
|
|
67
|
-
"cronstrue": "^2.
|
|
64
|
+
"@mui/icons-material": "^6.4.5",
|
|
65
|
+
"@mui/material": "^6.4.5",
|
|
66
|
+
"@sentry/browser": "^9.1.0",
|
|
67
|
+
"cronstrue": "^2.55.0",
|
|
68
68
|
"file-selector": "^2.1.2",
|
|
69
69
|
"react-color": "^2.19.3",
|
|
70
70
|
"react-colorful": "^5.6.1",
|
|
71
71
|
"react-cropper": "^2.3.3",
|
|
72
|
-
"react-dropzone": "^14.3.
|
|
73
|
-
"react-inlinesvg": "^4.
|
|
72
|
+
"react-dropzone": "^14.3.6",
|
|
73
|
+
"react-inlinesvg": "^4.2.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@babel/core": "^7.26.
|
|
76
|
+
"@babel/core": "^7.26.9",
|
|
77
77
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
78
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
79
|
-
"@babel/preset-env": "^7.26.
|
|
78
|
+
"@babel/plugin-transform-runtime": "^7.26.9",
|
|
79
|
+
"@babel/preset-env": "^7.26.9",
|
|
80
80
|
"@babel/preset-flow": "^7.25.9",
|
|
81
81
|
"@babel/preset-react": "^7.26.3",
|
|
82
82
|
"@iobroker/eslint-config": "^1.0.0",
|
|
83
|
-
"@types/node": "^22.13.
|
|
83
|
+
"@types/node": "^22.13.5",
|
|
84
84
|
"@types/react": "^18.3.18",
|
|
85
85
|
"@types/react-color": "^3.0.13",
|
|
86
86
|
"ajv": "^8.17.1",
|
|
87
87
|
"ts-node": "^10.9.2",
|
|
88
88
|
"typescript": "^5.7.3"
|
|
89
|
-
}
|
|
90
|
-
"gitHead": "348fe64af871f96077bf9074cc2bc14b738f8b6c"
|
|
89
|
+
}
|
|
91
90
|
}
|
package/tasksExample.js
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2024 bluefox <dogafox@gmail.com>
|
|
3
|
-
*
|
|
4
|
-
* MIT License
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
'use strict';
|
|
8
|
-
|
|
9
|
-
const fs = require('node:fs');
|
|
10
|
-
const { deleteFoldersRecursive, npmInstall, buildReact, copyFiles } = require('@iobroker/build-tools');
|
|
11
|
-
|
|
12
|
-
const SRC = 'src';
|
|
13
|
-
|
|
14
|
-
function copyAllFiles() {
|
|
15
|
-
deleteFoldersRecursive('admin', ['.png', '.json', 'i18n']);
|
|
16
|
-
|
|
17
|
-
copyFiles(
|
|
18
|
-
[
|
|
19
|
-
`${SRC}/build/*`,
|
|
20
|
-
`!${SRC}/build/index.html`,
|
|
21
|
-
`!${SRC}/build/static/js/main.*.chunk.js`,
|
|
22
|
-
`!${SRC}/build/static/media/*.svg`,
|
|
23
|
-
`!${SRC}/build/static/media/*.txt`,
|
|
24
|
-
`!${SRC}/build/i18n/*`,
|
|
25
|
-
`!${SRC}/build/i18n`,
|
|
26
|
-
],
|
|
27
|
-
'admin',
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
copyFiles(`${SRC}/build/index.html`, 'admin');
|
|
31
|
-
|
|
32
|
-
copyFiles(`${SRC}/build/static/js/main.*.chunk.js`, 'admin/static/js');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function clean() {
|
|
36
|
-
deleteFoldersRecursive('admin', ['.png', '.json', 'i18n']);
|
|
37
|
-
deleteFoldersRecursive(`${SRC}/build`);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function installNpmLocal() {
|
|
41
|
-
if (fs.existsSync(`${SRC}/node_modules`)) {
|
|
42
|
-
return Promise.resolve();
|
|
43
|
-
}
|
|
44
|
-
return npmInstall(`${__dirname.replace(/\\/g, '/')}/${SRC}/`);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function patchFiles() {
|
|
48
|
-
if (fs.existsSync(`${__dirname}/admin/index.html`)) {
|
|
49
|
-
let code = fs.readFileSync(`${__dirname}/admin/index.html`).toString('utf8');
|
|
50
|
-
code = code.replace(
|
|
51
|
-
/<script>var script=document\.createElement\("script"\).+?<\/script>/,
|
|
52
|
-
`<script type="text/javascript" src="./../../lib/js/socket.io.js"></script>`,
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
fs.writeFileSync(`${__dirname}/admin/index.html`, code);
|
|
56
|
-
}
|
|
57
|
-
if (fs.existsSync(`${__dirname}/${SRC}/build/index.html`)) {
|
|
58
|
-
let code = fs.readFileSync(`${__dirname}/${SRC}/build/index.html`).toString('utf8');
|
|
59
|
-
code = code.replace(
|
|
60
|
-
/<script>var script=document\.createElement\("script"\).+?<\/script>/,
|
|
61
|
-
`<script type="text/javascript" src="./../../lib/js/socket.io.js"></script>`,
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
fs.writeFileSync(`${SRC}/build/index.html`, code);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (process.argv.find(arg => arg === '--0-clean')) {
|
|
69
|
-
clean();
|
|
70
|
-
} else if (process.argv.find(arg => arg === '--1-npm')) {
|
|
71
|
-
npmInstall(`${__dirname.replace(/\\/g, '/')}/${SRC}/`).catch(e => {
|
|
72
|
-
console.error(`Cannot install: ${e}`);
|
|
73
|
-
process.exit(1);
|
|
74
|
-
});
|
|
75
|
-
} else if (process.argv.find(arg => arg === '--2-build')) {
|
|
76
|
-
buildReact(SRC, { rootDir: __dirname }).catch(e => {
|
|
77
|
-
console.error(`Cannot build: ${e}`);
|
|
78
|
-
process.exit(1);
|
|
79
|
-
});
|
|
80
|
-
} else if (process.argv.find(arg => arg === '--3-copy')) {
|
|
81
|
-
copyAllFiles();
|
|
82
|
-
} else if (process.argv.find(arg => arg === '--4-patch')) {
|
|
83
|
-
patchFiles();
|
|
84
|
-
} else {
|
|
85
|
-
clean();
|
|
86
|
-
|
|
87
|
-
installNpmLocal()
|
|
88
|
-
.then(() => buildReact(SRC, { rootDir: __dirname }))
|
|
89
|
-
.then(() => copyAllFiles())
|
|
90
|
-
.then(() => patchFiles());
|
|
91
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2024 bluefox <dogafox@gmail.com>
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const fs = require('node:fs');
|
|
10
|
+
const { deleteFoldersRecursive, npmInstall, buildReact, copyFiles } = require('@iobroker/build-tools');
|
|
11
|
+
|
|
12
|
+
const SRC = 'src';
|
|
13
|
+
|
|
14
|
+
function copyAllFiles() {
|
|
15
|
+
deleteFoldersRecursive('admin', ['.png', '.json', 'i18n']);
|
|
16
|
+
|
|
17
|
+
copyFiles(
|
|
18
|
+
[
|
|
19
|
+
`${SRC}/build/*`,
|
|
20
|
+
`!${SRC}/build/index.html`,
|
|
21
|
+
`!${SRC}/build/static/js/main.*.chunk.js`,
|
|
22
|
+
`!${SRC}/build/static/media/*.svg`,
|
|
23
|
+
`!${SRC}/build/static/media/*.txt`,
|
|
24
|
+
`!${SRC}/build/i18n/*`,
|
|
25
|
+
`!${SRC}/build/i18n`,
|
|
26
|
+
],
|
|
27
|
+
'admin',
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
copyFiles(`${SRC}/build/index.html`, 'admin');
|
|
31
|
+
|
|
32
|
+
copyFiles(`${SRC}/build/static/js/main.*.chunk.js`, 'admin/static/js');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function clean() {
|
|
36
|
+
deleteFoldersRecursive('admin', ['.png', '.json', 'i18n']);
|
|
37
|
+
deleteFoldersRecursive(`${SRC}/build`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function installNpmLocal() {
|
|
41
|
+
if (fs.existsSync(`${SRC}/node_modules`)) {
|
|
42
|
+
return Promise.resolve();
|
|
43
|
+
}
|
|
44
|
+
return npmInstall(`${__dirname.replace(/\\/g, '/')}/${SRC}/`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function patchFiles() {
|
|
48
|
+
if (fs.existsSync(`${__dirname}/admin/index.html`)) {
|
|
49
|
+
let code = fs.readFileSync(`${__dirname}/admin/index.html`).toString('utf8');
|
|
50
|
+
code = code.replace(
|
|
51
|
+
/<script>var script=document\.createElement\("script"\).+?<\/script>/,
|
|
52
|
+
`<script type="text/javascript" src="./../../lib/js/socket.io.js"></script>`,
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
fs.writeFileSync(`${__dirname}/admin/index.html`, code);
|
|
56
|
+
}
|
|
57
|
+
if (fs.existsSync(`${__dirname}/${SRC}/build/index.html`)) {
|
|
58
|
+
let code = fs.readFileSync(`${__dirname}/${SRC}/build/index.html`).toString('utf8');
|
|
59
|
+
code = code.replace(
|
|
60
|
+
/<script>var script=document\.createElement\("script"\).+?<\/script>/,
|
|
61
|
+
`<script type="text/javascript" src="./../../lib/js/socket.io.js"></script>`,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
fs.writeFileSync(`${SRC}/build/index.html`, code);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (process.argv.find(arg => arg === '--0-clean')) {
|
|
69
|
+
clean();
|
|
70
|
+
} else if (process.argv.find(arg => arg === '--1-npm')) {
|
|
71
|
+
npmInstall(`${__dirname.replace(/\\/g, '/')}/${SRC}/`).catch(e => {
|
|
72
|
+
console.error(`Cannot install: ${e}`);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
});
|
|
75
|
+
} else if (process.argv.find(arg => arg === '--2-build')) {
|
|
76
|
+
buildReact(SRC, { rootDir: __dirname }).catch(e => {
|
|
77
|
+
console.error(`Cannot build: ${e}`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
});
|
|
80
|
+
} else if (process.argv.find(arg => arg === '--3-copy')) {
|
|
81
|
+
copyAllFiles();
|
|
82
|
+
} else if (process.argv.find(arg => arg === '--4-patch')) {
|
|
83
|
+
patchFiles();
|
|
84
|
+
} else {
|
|
85
|
+
clean();
|
|
86
|
+
|
|
87
|
+
installNpmLocal()
|
|
88
|
+
.then(() => buildReact(SRC, { rootDir: __dirname }))
|
|
89
|
+
.then(() => copyAllFiles())
|
|
90
|
+
.then(() => patchFiles());
|
|
91
|
+
}
|