Created
February 17, 2018 05:22
-
-
Save sumn2u/78fe66fb1509c824a68df13cd01a08de to your computer and use it in GitHub Desktop.
deployment script for s3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const s3 = require('react-deploy') | |
const task = require('./task') | |
let config = require('./config') | |
const client = s3.createClient({ | |
s3Options: `${config().s3Options}` | |
}) | |
// | |
module.exports = task('upload', () => Promise.resolve() | |
.then(() => { | |
Uploader | |
}) | |
) | |
const Uploader = new Promise((resolve, reject) => { | |
const uploader = client.uploadDir({ | |
localDir: 'build/', | |
deleteRemoved: false, | |
s3Params: { | |
Bucket: `${config().s3Options.Bucket}`, | |
CacheControl: 'max-age=0,no-cache,no-store,must-revalidate', | |
ACL: 'public-read-write', | |
Metadata: { | |
'updated': (new Date()).toDateString() | |
} | |
} | |
}) | |
uploader.on('error', reject) | |
uploader.on('end', () => { | |
}, resolve) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment