-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathtasks.js
52 lines (47 loc) · 2.04 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
40
41
42
43
44
45
46
47
48
49
50
51
52
const { deleteFoldersRecursive, copyFiles, npmInstall, buildReact } = require('@iobroker/build-tools');
const srcAdmin = `${__dirname}/src-admin/`;
function admin0Clean() {
deleteFoldersRecursive(`${__dirname}/admin/custom`);
deleteFoldersRecursive(`${__dirname}/src-admin/build`);
}
function copyAllFiles() {
copyFiles(
[
'src-admin/build/static/js/*.js',
//'!src-admin/build/static/js/vendors*.js',
//'!src-admin/build/static/js/src_bootstrap_*.js',
],
'admin/custom/static/js',
);
// copyFiles(['src-admin/build/static/js/*_emotion_react_dist_*.js'], 'admin/custom/static/js');
// copyFiles(['src-admin/build/static/js/*_material_styles_createTheme_*.js'], 'admin/custom/static/js');
// copyFiles(['src-admin/build/static/js/*_material_styles_ThemeProvider_*.js'], 'admin/custom/static/js');
copyFiles(
[
'src-admin/build/static/js/*.map',
'!src-admin/build/static/js/vendors*.map',
'!src-admin/build/static/js/src_bootstrap_*.map',
],
'admin/custom/static/js',
);
copyFiles(['src-admin/build/customComponents.js'], 'admin/custom');
copyFiles(['src-admin/build/customComponents.js.map'], 'admin/custom');
copyFiles(['src-admin/src/i18n/*.json'], 'admin/custom/i18n');
}
if (process.argv.find(arg => arg.replace(/^--/, '') === '0-clean')) {
admin0Clean();
} else if (process.argv.find(arg => arg.replace(/^--/, '') === '1-npm')) {
npmInstall(srcAdmin).catch(e => console.error(`Cannot install: ${e}`));
} else if (process.argv.find(arg => arg.replace(/^--/, '') === '2-compile')) {
buildReact(srcAdmin, { rootDir: __dirname, craco: true, exec: true }).catch(e =>
console.error(`Cannot compile: ${e}`),
);
} else if (process.argv.find(arg => arg.replace(/^--/, '') === '3-copy')) {
copyAllFiles();
} else {
admin0Clean();
npmInstall(srcAdmin).then(async () => {
await buildReact(srcAdmin, { rootDir: __dirname, craco: true, exec: true });
copyAllFiles();
});
}