* [codeshift] add proper ignore comments * [codeshift] apply require-to-import transform * [codeshift/fixup] remove duplicate imports * [eslint] upgrade config for react "unused" support * [codeshift] apply remove-unused-imports transform * [codeshift] apply remove-unused-basic-requires transform * [codeshift] apply remove-unused-function-arguments transform * [lintroller] fix argument list spacing * [codeshift] apply remove-unused-basic-bars transform * [codeshift/fixup] fixup unused basic var removals * manually apply remove-unused-assignments transform * [codeshift] reapply remove-unused-imports transform * [codeshift] reapply remove-unused-function-arguments transform * [eslint] autofix param spacing * manually fix remaining no-undef errors * use more descriptive file ignore pattern * add eslint-plugin-react peerDependency * replace values that looked unused in tests * remove // kibana-jscodeshift-no-babel comment * remove import statements from code required by api tests * Remove '// kibana-jscodeshift-ignore' comments * address review feedback * remove remnant of removed if condition
60 lines
1.7 KiB
JavaScript
60 lines
1.7 KiB
JavaScript
import readline from 'readline';
|
|
import url from 'url';
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
module.exports = function (grunt) {
|
|
// build, then zip and upload to s3
|
|
grunt.registerTask('release', [
|
|
'_release:confirmUpload',
|
|
'build',
|
|
'_release:loadS3Config',
|
|
'aws_s3:staging',
|
|
'_release:complete'
|
|
]);
|
|
|
|
grunt.registerTask('_release:confirmUpload', function () {
|
|
const rl = readline.createInterface({
|
|
input: process.stdin,
|
|
output: process.stdout
|
|
});
|
|
|
|
rl.on('close', this.async());
|
|
rl.question('Do you want to actually upload the files to s3 after building?, [N/y] ', function (resp) {
|
|
const debug = resp.toLowerCase().trim()[0] !== 'y';
|
|
|
|
grunt.config.set('aws_s3.staging.options.debug', debug);
|
|
|
|
rl.close();
|
|
});
|
|
});
|
|
|
|
// collect the key and secret from the .aws-config.json file, finish configuring the s3 task
|
|
grunt.registerTask('_release:loadS3Config', function () {
|
|
const config = grunt.file.readJSON('.aws-config.json');
|
|
|
|
grunt.config('aws_s3.options', {
|
|
accessKeyId: config.key,
|
|
secretAccessKey: config.secret,
|
|
bucket: config.bucket || grunt.config.get('aws_s3.options.bucket'),
|
|
region: config.region
|
|
});
|
|
});
|
|
|
|
grunt.registerTask('_release:complete', function () {
|
|
const config = grunt.config.get('aws_s3.staging.files');
|
|
|
|
grunt.log.ok('Builds uploaded');
|
|
|
|
fs.readdirSync('./target').forEach((file) => {
|
|
if (path.extname(file) !== '.txt') {
|
|
const link = url.format({
|
|
protocol: 'https',
|
|
hostname: 'download.elastic.co',
|
|
pathname: config[0].dest + file
|
|
});
|
|
|
|
grunt.log.writeln(link);
|
|
}
|
|
});
|
|
});
|
|
};
|