Skip to content

Instantly share code, notes, and snippets.

@sumn2u
Created February 17, 2018 05:22
Show Gist options
  • Save sumn2u/78fe66fb1509c824a68df13cd01a08de to your computer and use it in GitHub Desktop.
Save sumn2u/78fe66fb1509c824a68df13cd01a08de to your computer and use it in GitHub Desktop.
deployment script for s3
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