-
Notifications
You must be signed in to change notification settings - Fork 2
/
deploy.js
47 lines (39 loc) · 1.66 KB
/
deploy.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
const path = require('path')
const fs = require('fs')
const { exec } = require('child_process');
const dirCss = path.join(__dirname, 'build/static/css')
const dirJs = path.join(__dirname, 'build/static/js')
const build = path.join(__dirname, 'build/')
fs.readdir(dirCss, function (err, files) {
//handling error
if (err) {
return console.log(`Unable to scan css directory: ${err}`)
}
//listing all files using forEach
files.forEach(function (file) {
// Do whatever you want to do with the file
if (file.match(/^main.(.*).chunk.css$/)) {
console.log(`aws s3 cp ${dirCss}/${file} s3://streamsnipers/static/static/css/ --acl public-read`)
exec(`aws s3 cp ${dirCss}/${file} s3://streamsnipers/static/static/css/ --acl public-read`)
}
})
})
fs.readdir(dirJs, function (err, files) {
//handling error
if (err) {
return console.log(`Unable to scan js directory: ${err}`)
}
//listing all files using forEach
files.forEach(function (file) {
// Do whatever you want to do with the file
if (file.match(/^(.*).chunk.js$/)) {
console.log(`aws s3 cp ${dirJs}/${file} s3://streamsnipers/static/static/js/ --acl public-read`)
exec(`aws s3 cp ${dirJs}/${file} s3://streamsnipers/static/static/js/ --acl public-read`)
}
})
})
function callback(err) {
if (err) throw err;
console.log(`${build}index.html was copied to ${path.join(__dirname, `../develop/streamsnipers-web/common_site/templates/index.html`)}`);
}
fs.copyFile(`${build}index.html`, path.join(__dirname, `../develop/streamsnipers-web/common_site/templates/index.html`), callback)