Remove --s3 option

This commit is contained in:
Cory LaViska
2017-08-07 17:07:08 -04:00
parent aaafdbadf7
commit 82a8dab31b
2 changed files with 1 additions and 51 deletions

View File

@@ -1,6 +0,0 @@
S3_BUCKET=
S3_URL=
S3_ACL=
S3_REGION=
S3_ACCESS_KEY=
S3_SECRET_KEY=

View File

@@ -3,7 +3,6 @@
global.__version = require('./package.json').version;
require('dotenv').config();
const AtImport = require('postcss-import');
const Autoprefixer = require('autoprefixer');
const Chalk = require('chalk');
@@ -13,15 +12,13 @@ const FS = require('fs');
const Path = require('path');
const PostCSS = require('postcss');
const Program = require('commander');
const S3 = require('s3');
const UglifyJS = require('uglify-js');
// Initialize CLI
Program
.version(__version)
.option('--clean', 'Removes the local dist directory')
.option('--build', 'Builds a release')
.option('--s3', 'Publish latest release to an S3 bucket (requires .env file)')
.option('--clean', 'Removes existing release files')
.on('--help', () => {
console.log(Chalk.cyan('\n Version %s\n'), __version);
process.exit(1);
@@ -157,41 +154,6 @@ if(Program.build) {
});
}))
// Publish to S3
.then(() => new Promise((resolve, reject) => {
// Skip if the --s3 flag is missing
if(!Program.s3) {
resolve();
return;
}
const client = S3.createClient({
s3Options: {
accessKeyId: process.env.S3_ACCESS_KEY,
secretAccessKey: process.env.S3_SECRET_KEY
}
});
// Sync the local /dist directory to /{version} in the S3 bucket
let uploader = client.uploadDir({
localDir: Path.join(__dirname, 'dist'),
deleteRemoved: true,
s3Params: {
ACL: process.env.S3_ACL,
Prefix: __version,
Bucket: process.env.S3_BUCKET
}
});
uploader.on('error', (err) => {
reject('Unable to publish to S3: ' + err);
return;
});
uploader.on('end', () => {
console.log(Chalk.green('%s has been published to S3! ☁️'), __version);
resolve();
});
}))
// Exit with success
.then(() => process.exit(1))
@@ -200,12 +162,6 @@ if(Program.build) {
console.error(Chalk.red(err));
process.exit(-1);
});
} else {
// Can't use the --s3 options without --build
if(Program.s3) {
console.error(Chalk.yellow('The --s3 flag can only be used with --build'));
process.exit(-1);
}
}
// Clean task