-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
39 lines (35 loc) · 1004 Bytes
/
build.js
File metadata and controls
39 lines (35 loc) · 1004 Bytes
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 fs = require('fs')
const fse = require('fs-extra');
const exec = require('child_process').exec
const execSync = require('child_process').execSync
console.log("# Building front")
let res = exec('cd front && npm run build && cd ..', (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
console.log(`stdout: ${stdout}`);
console.error(`stderr: ${stderr}`);
moveFiles()
})
function moveFiles(){
console.log("# Moving files")
if(fs.existsSync('build'))
execSync('rm -Rf build && mkdir build')
const toMove = [
'front/build',
'DTOs',
'Controllers',
'Services',
'env.json',
'index.js',
'package.json',
]
toMove.forEach(folder => {
fse.copySync(folder, 'build/' + folder, {overwrite: true}, (err) => {
if (err) {
console.error(err);
}
});
})
}