-
Notifications
You must be signed in to change notification settings - Fork 3
/
tasks.js
39 lines (36 loc) · 1.58 KB
/
tasks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { deleteFoldersRecursive, buildReact, npmInstall, copyFiles } = require('@iobroker/build-tools');
// http://127.0.0.1:18082/vis-2-beta/widgets/vis-2-widgets-material/static/js/node_modules_iobroker_vis-2-widgets-react-dev_index_jsx-_adb40.af309310.chunk.js
function copyAllFiles() {
copyFiles(
[
'src-widgets/build/**/*',
'!src-widgets/build/static/js/*node_modules*.*',
'!src-widgets/build/static/js/node_modules_*',
],
'widgets/vis-2-widgets-material/',
);
copyFiles(
[
`src-widgets/build/static/js/*echarts-for-react_lib_core*.*`,
`src-widgets/build/static/js/*spectrum_color_dist_import_mjs*.*`,
`src-widgets/build/static/js/*uiw_react-color-shade-slider*.*`,
`src-widgets/build/static/js/*lottie-react_build*.*`,
`src-widgets/build/static/js/*runtime_js-src_sketch_css*.*`,
`src-widgets/build/static/js/*node_modules_babel_runtime_helpers_createForOfItera*.*`,
],
'widgets/vis-2-widgets-material/static/js',
);
}
if (process.argv.includes('--copy-files')) {
copyAllFiles();
} else if (process.argv.includes('--build')) {
buildReact(`${__dirname}/src-widgets`, { rootDir: __dirname, craco: true }).catch(() =>
console.error('Error by build'),
);
} else {
deleteFoldersRecursive('src-widgets/build');
deleteFoldersRecursive('widgets');
npmInstall('src-widgets')
.then(() => buildReact(`${__dirname}/src-widgets`, { rootDir: __dirname, craco: true }))
.then(() => copyAllFiles());
}