<commit_before>'use strict';

const fs = require('fs');
const util = require('util');
const gulp = require('gulp');
const del = require('del');
const install = require('gulp-install');
const zip = require('gulp-zip');
const runSequence = require('run-sequence');
const AWS = require('aws-sdk');
const s3 = new AWS.S3();
const cloudFormation = new AWS.CloudFormation();
const lambda = new AWS.Lambda();

let config;
try {
	config = require('./config.json');
} catch (ex) {
	config = {};
}

const stackName = 'cognito-identity-pool';

gulp.task('clean', () => del([
	'./build/*',
	'./dist/*',
	'./dist.zip'
]));

gulp.task('js', () => gulp
	.src([
		'index.js'
	])
	.pipe(gulp.dest('./dist'))
);

gulp.task('npm', () => gulp
	.src('./package.json')
	.pipe(gulp.dest('./dist'))
	.pipe(install({production: true}))
);

gulp.task('zip', () => gulp
	.src([
		'dist/**/*',
		'!dist/package.json',
		'dist/.*'
	])
	.pipe(zip('dist.zip'))
	.pipe(gulp.dest('./'))
);

gulp.task('upload', s3
	.putObject({
		Bucket: config.LambdaS3Bucket,
		Key: config.LambdaS3Key,
		Body: fs.createReadStream('./dist.zip')
	})
	.promise()
);

gulp.task('listStacks', () => cloudFormation
	.listStacks({
		StackStatusFilter: [<commit_msg>Add double arrow inline function back in for gulp upload task, include error message if the configuration fails to load<commit_after>'use strict';

const fs = require('fs');
const util = require('util');
const gulp = require('gulp');
const del = require('del');
const install = require('gulp-install');
const zip = require('gulp-zip');
const runSequence = require('run-sequence');
const AWS = require('aws-sdk');
const s3 = new AWS.S3();
const cloudFormation = new AWS.CloudFormation();
const lambda = new AWS.Lambda();

let config;
try {
	config = require('./config.json');
} catch (ex) {
	console.error('Cannot load configuration');
	config = {};
}

const stackName = 'cognito-identity-pool';

gulp.task('clean', () => del([
	'./build/*',
	'./dist/*',
	'./dist.zip'
]));

gulp.task('js', () => gulp
	.src([
		'index.js'
	])
	.pipe(gulp.dest('./dist'))
);

gulp.task('npm', () => gulp
	.src('./package.json')
	.pipe(gulp.dest('./dist'))
	.pipe(install({production: true}))
);

gulp.task('zip', () => gulp
	.src([
		'dist/**/*',
		'!dist/package.json',
		'dist/.*'
	])
	.pipe(zip('dist.zip'))
	.pipe(gulp.dest('./'))
);

gulp.task('upload', () => s3
	.putObject({
		Bucket: config.LambdaS3Bucket,
		Key: config.LambdaS3Key,
		Body: fs.createReadStream('./dist.zip')
	})
	.promise()
);

gulp.task('listStacks', () => cloudFormation
	.listStacks({
		StackStatusFilter: [
{'fraction_non_alphanumeric': 0.23381155486622723, 'fraction_numerical': 0.0038774718883288098, 'mean_word_length': 4.254582484725051, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5577134', 'n_tokens_mistral': 968, 'n_tokens_neox': 948, 'n_words': 196}