diff --git a/index.js b/index.js index 745c33de..db88bbba 100644 --- a/index.js +++ b/index.js @@ -7,10 +7,6 @@ let direct = require('./src/direct') let sam = require('./src/sam') let _static = require('./src/static') -// eslint-disable-next-line -try { require('aws-sdk/lib/maintenance_mode_message').suppress = true } -catch { /* Noop */ } - function run (mod) { return function (options, callback) { let promise @@ -72,5 +68,5 @@ function run (mod) { module.exports = { direct: run(direct), sam: run(sam), - static: run(_static) + static: run(_static), } diff --git a/src/cli/flags.js b/src/cli/flags.js index e1476bae..07e5869a 100644 --- a/src/cli/flags.js +++ b/src/cli/flags.js @@ -53,6 +53,6 @@ function getSrcDirs (list) { } return acc } - catch (e) { return acc } + catch { return acc } }, []) } diff --git a/src/direct/deploy.js b/src/direct/deploy.js index 7d38e275..bbc1d754 100644 --- a/src/direct/deploy.js +++ b/src/direct/deploy.js @@ -119,6 +119,6 @@ module.exports = function deploySAM (params, callback) { if (err) console.log(err) callback() }) - } + }, ], callback) } diff --git a/src/direct/index.js b/src/direct/index.js index 49fdf89e..4842ec76 100644 --- a/src/direct/index.js +++ b/src/direct/index.js @@ -55,7 +55,7 @@ module.exports = function directDeploy (options, callback) { update.warn('Direct deployments should be considered temporary, and will be overwritten') update.status( 'Initializing direct deployment', - `Stack ... ${stackname}` + `Stack ... ${stackname}`, ) pretty.warn(update) @@ -76,7 +76,7 @@ module.exports = function directDeploy (options, callback) { specificLambdasToDeploy, stackname, ts, - update + update, }, callback) } } diff --git a/src/direct/pretty.js b/src/direct/pretty.js index 3e501e49..8e2aa2dd 100644 --- a/src/direct/pretty.js +++ b/src/direct/pretty.js @@ -14,5 +14,5 @@ module.exports = { let msg = chalk.grey('Success!') let time = chalk.green(`Deployed in ${(Date.now() - ts) / 1000} seconds`) console.log(check, msg, time) - } + }, } diff --git a/src/direct/update.js b/src/direct/update.js index 282ac83c..acc418aa 100644 --- a/src/direct/update.js +++ b/src/direct/update.js @@ -71,7 +71,7 @@ module.exports = function updateLambda (params, callback) { }) .then(() => callback()) .catch(callback) - } + }, ], function done (err) { update.done('Published code to Lambda') @@ -102,7 +102,7 @@ module.exports = function updateLambda (params, callback) { aws.lambda.GetFunctionConfiguration({ FunctionName }) .then(config => { args.Environment = { - Variables: { ...config.Environment.Variables, ...env } + Variables: { ...config.Environment.Variables, ...env }, } update.done('Updated Lambda env vars') callback() @@ -140,9 +140,9 @@ module.exports = function updateLambda (params, callback) { .catch(callback) }) } - } + }, ], callback) - } + }, ], function done (err) { if (err) callback(err) diff --git a/src/sam/02-after/00-get-app-apex/cloudfront-create.js b/src/sam/02-after/00-get-app-apex/cloudfront-create.js index 9604530a..4c078002 100644 --- a/src/sam/02-after/00-get-app-apex/cloudfront-create.js +++ b/src/sam/02-after/00-get-app-apex/cloudfront-create.js @@ -17,7 +17,7 @@ module.exports = function createCloudFrontDistribution (params, callback) { }, OriginReadTimeout: 30, OriginKeepaliveTimeout: 5, - } + }, } // Add origin path for REST APIs @@ -88,7 +88,7 @@ module.exports = function createCloudFrontDistribution (params, callback) { Items: [], }, }, - } + }, } aws.cloudfront.CreateDistribution(config) diff --git a/src/sam/02-after/00-get-app-apex/cloudfront-destroy.js b/src/sam/02-after/00-get-app-apex/cloudfront-destroy.js index 086692c8..8dd80497 100644 --- a/src/sam/02-after/00-get-app-apex/cloudfront-destroy.js +++ b/src/sam/02-after/00-get-app-apex/cloudfront-destroy.js @@ -24,7 +24,7 @@ module.exports = function destroyCloudFrontDistribution (aws, { id: Id }, callba aws.cloudfront.DeleteDistribution({ Id, IfMatch: ETag }) .then(() => callback()) .catch(callback) - } + }, ], function noop (err) { // If the CF distro isn't yet fully disabled, that's ok diff --git a/src/sam/02-after/00-get-app-apex/cloudfront-enable.js b/src/sam/02-after/00-get-app-apex/cloudfront-enable.js index fb97d465..327ea6dd 100644 --- a/src/sam/02-after/00-get-app-apex/cloudfront-enable.js +++ b/src/sam/02-after/00-get-app-apex/cloudfront-enable.js @@ -19,7 +19,7 @@ module.exports = function enableCloudFrontDistribution (aws, { id: Id }, callbac else { callback() } - } + }, ], function noop (err) { if (err) console.log(err) diff --git a/src/sam/02-after/00-get-app-apex/cloudfront-list.js b/src/sam/02-after/00-get-app-apex/cloudfront-list.js index 74031f49..4b6b64da 100644 --- a/src/sam/02-after/00-get-app-apex/cloudfront-list.js +++ b/src/sam/02-after/00-get-app-apex/cloudfront-list.js @@ -10,7 +10,7 @@ module.exports = function listCloudfrontDistributions (aws, callback) { domain: distro.DomainName, status: distro.Status, origin: distro.Origins.Items[0].DomainName, - enabled: distro.Enabled + enabled: distro.Enabled, }) callback(null, DistributionList.Items.map(fmt)) }) diff --git a/src/sam/02-after/00-get-app-apex/index.js b/src/sam/02-after/00-get-app-apex/index.js index 45d1d1ac..a041826e 100644 --- a/src/sam/02-after/00-get-app-apex/index.js +++ b/src/sam/02-after/00-get-app-apex/index.js @@ -11,7 +11,7 @@ module.exports = function getAppApex (params, callback) { reads({ aws, stackname, - stage + stage, }, function done (err, result) { if (err) callback(err) diff --git a/src/sam/02-after/00-get-app-apex/reads.js b/src/sam/02-after/00-get-app-apex/reads.js index 4a43cee1..b7dcb9da 100644 --- a/src/sam/02-after/00-get-app-apex/reads.js +++ b/src/sam/02-after/00-get-app-apex/reads.js @@ -8,7 +8,7 @@ let list = require('./cloudfront-list') * @param {String} params.stackname - the name of the currently deployed stack * @param {Function} callback - node errback (err, {url, s3, apigateway})=> */ -module.exports = function reads ({ aws, stackname, stage }, callback){ +module.exports = function reads ({ aws, stackname, stage }, callback) { let clean = str => str.replace(`/${stage}`, '').replace('http://', '').replace('https://', '') @@ -20,7 +20,7 @@ module.exports = function reads ({ aws, stackname, stage }, callback){ }, cf (callback) { list(aws, callback) - } + }, }, function done (err, { cfn, cf }) { if (err) callback(err) diff --git a/src/sam/02-after/01-deploy-ws.js b/src/sam/02-after/01-deploy-ws.js index e8f01b6e..fa5228a6 100644 --- a/src/sam/02-after/01-deploy-ws.js +++ b/src/sam/02-after/01-deploy-ws.js @@ -25,7 +25,7 @@ module.exports = function deployOldWebSocketAPI (params, callback) { ApiId = api.OutputValue.split('.')[0].replace('wss://', '') callback() } - catch (err) { + catch { callback(ReferenceError('Cannot find WebSocket API in CloudFormation stack')) } }) @@ -49,7 +49,7 @@ module.exports = function deployOldWebSocketAPI (params, callback) { function deploy (callback) { aws.apigatewayv2.CreateDeployment({ ApiId, - Description: 'arc_apig_cfn_patch' + Description: 'arc_apig_cfn_patch', }) .then(result => { if (!result?.DeploymentId) { @@ -67,11 +67,11 @@ module.exports = function deployOldWebSocketAPI (params, callback) { aws.apigatewayv2.UpdateStage({ ApiId, StageName, - DeploymentId + DeploymentId, }) .then(() => callback()) .catch(callback) - } + }, ], function done (err) { if (err && err === 'cancel') callback() else if (err) callback(err) diff --git a/src/sam/bucket/create-bucket.js b/src/sam/bucket/create-bucket.js index a247997d..7b18e59c 100644 --- a/src/sam/bucket/create-bucket.js +++ b/src/sam/bucket/create-bucket.js @@ -41,11 +41,11 @@ module.exports = function createDeployBucket ({ appname, aws, region, update }, Name: `/${appname}/deploy/bucket`, Value: bucket, Type: 'SecureString', - Overwrite: true + Overwrite: true, }) .then(() => callback()) .catch(callback) - } + }, ], function done (err) { if (err) { update.error('Deployment bucket creation error') diff --git a/src/sam/bucket/index.js b/src/sam/bucket/index.js index 3b723b2f..9c4be7f9 100644 --- a/src/sam/bucket/index.js +++ b/src/sam/bucket/index.js @@ -6,7 +6,7 @@ module.exports = function getBucket (params, callback) { // First: see if this app has a deploy bucket specified in SSM already aws.ssm.GetParametersByPath({ Path: `/${appname}/deploy`, - WithDecryption: true + WithDecryption: true, }) .then(result => { let vars = result.Parameters diff --git a/src/sam/compat/index.js b/src/sam/compat/index.js index 109140c6..64da8e1b 100644 --- a/src/sam/compat/index.js +++ b/src/sam/compat/index.js @@ -76,7 +76,7 @@ function getResources (aws, LogicalResourceId, StackName, callback, next) { // (as opposed to paginating & searching) aws.cloudformation.DescribeStackResources({ StackName, - LogicalResourceId + LogicalResourceId, }) .then(stack => next(stack.StackResources)) .catch(err => { diff --git a/src/sam/index.js b/src/sam/index.js index 7abedfdc..e87bb200 100644 --- a/src/sam/index.js +++ b/src/sam/index.js @@ -190,7 +190,7 @@ module.exports = function samDeploy (params, callback) { }, // Maybe pre-deploy static assets - function preDeployStatic (_template, callback){ + function preDeployStatic (_template, callback) { template = _template let params = { aws, compat, eject, inventory, isDryRun, production, prune, region, stackname, verbose, update } staticDeploy(params, true, callback) @@ -225,7 +225,7 @@ module.exports = function samDeploy (params, callback) { }, // Post-deploy static assets - function postDeployStatic (callback){ + function postDeployStatic (callback) { let params = { aws, compat, eject, inventory, isDryRun, production, prune, region, stackname, verbose, update } staticDeploy(params, false, callback) }, diff --git a/src/sam/patches/cfn.js b/src/sam/patches/cfn.js index 3c656f8c..1027834f 100644 --- a/src/sam/patches/cfn.js +++ b/src/sam/patches/cfn.js @@ -3,7 +3,6 @@ * - For clearer identification and to eliminate the possibility of name conflicts * - Various services' CFN impls had issues, so this corrects them for existing apps */ -// eslint-disable-next-line module.exports = async function oldResources (params, callback) { let { cloudformation: cfn, inventory, compat } = params let { inv } = inventory @@ -15,7 +14,7 @@ module.exports = async function oldResources (params, callback) { cfn.Resources.WebsocketDeployment.DependsOn = [ 'WebsocketConnectRoute', 'WebsocketDefaultRoute', - 'WebsocketDisconnectRoute' + 'WebsocketDisconnectRoute', ] Object.entries(cfn.Resources).forEach(([ resource, value ]) => { if (resource.endsWith('WSRoute')) { diff --git a/src/sam/plugins/services.js b/src/sam/plugins/services.js index 13153211..59e0b1a5 100644 --- a/src/sam/plugins/services.js +++ b/src/sam/plugins/services.js @@ -21,10 +21,10 @@ module.exports = function servicesPlugins (params, callback) { Type: 'String', Name: { 'Fn::Sub': [ '/${AWS::StackName}/${pluginName}/${key}', - { pluginName, key } + { pluginName, key }, ] }, - Value - } + Value, + }, } }) } diff --git a/src/sam/utils/print.js b/src/sam/utils/print.js index 560b3fb4..36203cd4 100644 --- a/src/sam/utils/print.js +++ b/src/sam/utils/print.js @@ -25,6 +25,6 @@ module.exports = function pretty ({ log, verbose }) { let msg = chalk.grey('Success!') let time = chalk.green(`Deployed app in ${(Date.now() - ts) / 1000} seconds\n`) console.log(check, msg, time) - } + }, } } diff --git a/src/static/index.js b/src/static/index.js index 534a00e7..24a791aa 100644 --- a/src/static/index.js +++ b/src/static/index.js @@ -115,7 +115,7 @@ module.exports = function deployStatic (params, callback) { update, verbose, }, callback) - } + }, ], function done (err) { if (err) callback(err) diff --git a/src/static/publish/filter-files.js b/src/static/publish/filter-files.js index 791e0e37..38a343d8 100644 --- a/src/static/publish/filter-files.js +++ b/src/static/publish/filter-files.js @@ -12,7 +12,7 @@ module.exports = function filterFiles (params, callback) { '.DS_Store', 'node_modules', 'readme.md', - 'static.json' + 'static.json', ]) // Find non-ignored files; diff --git a/src/static/publish/index.js b/src/static/publish/index.js index 7a7b958c..b1b8129b 100644 --- a/src/static/publish/index.js +++ b/src/static/publish/index.js @@ -86,7 +86,7 @@ module.exports = function publishStaticAssets (params, callback) { ignore: ignored, inventory, publishing, - publicDir + publicDir, }, callback) }, @@ -139,7 +139,7 @@ module.exports = function publishStaticAssets (params, callback) { }, callback) } else callback() - } + }, ], done) function done (err) { diff --git a/src/utils/bulk-delete.js b/src/utils/bulk-delete.js index b93c31eb..4438047f 100644 --- a/src/utils/bulk-delete.js +++ b/src/utils/bulk-delete.js @@ -9,7 +9,7 @@ module.exports = function bulkDelete (params, callback) { function deleteItems () { let deleteParams = { Bucket, - Delete: { Objects: objects.splice(0, 1000) } + Delete: { Objects: objects.splice(0, 1000) }, } aws.s3.DeleteObjects(deleteParams) .then(data => { diff --git a/src/utils/cleanup.js b/src/utils/cleanup.js index 78e9c0dd..bb68dc01 100644 --- a/src/utils/cleanup.js +++ b/src/utils/cleanup.js @@ -8,7 +8,7 @@ module.exports = function cleanup () { let tmp = join(process.cwd(), '__ARC_TMP__') rmSync(tmp, { recursive: true, force: true }) } - catch (err) { + catch { // Don't blow up on errors, we may have to bubble something else console.error(`Failed to clean up deployment temp directory: ${process.cwd(), '__ARC_TMP__'}`) } diff --git a/src/utils/pause-sandbox.js b/src/utils/pause-sandbox.js index 8ce8995f..5f809c69 100644 --- a/src/utils/pause-sandbox.js +++ b/src/utils/pause-sandbox.js @@ -11,7 +11,7 @@ module.exports = { writeFileSync(pauseFile, '\n') } } - catch (err) { /* noop */ } + catch { /* noop */ } }, unpause: () => { try { @@ -20,6 +20,6 @@ module.exports = { unlinkSync(pauseFile) } } - catch (err) { /* noop */ } - } + catch { /* noop */ } + }, } diff --git a/test/integration/static/index-test.js b/test/integration/static/index-test.js index db2c3962..00e5628b 100644 --- a/test/integration/static/index-test.js +++ b/test/integration/static/index-test.js @@ -13,7 +13,7 @@ function publish (params, callback) { let staticDeployPath = join(process.cwd(), 'src', 'static', 'index.js') let staticDeployMod = proxyquire(staticDeployPath, { - './publish': publish + './publish': publish, }) let defaultParams = () => ({ @@ -27,7 +27,7 @@ let defaultParams = () => ({ verbose: undefined, // `@static` settings prefix: undefined, - prune: false + prune: false, }) let params = defaultParams() diff --git a/test/integration/static/publish/index-test.js b/test/integration/static/publish/index-test.js index cc2bab8e..6a88a261 100644 --- a/test/integration/static/publish/index-test.js +++ b/test/integration/static/publish/index-test.js @@ -23,7 +23,7 @@ function deleteFiles (params, callback) { let filePath = join(process.cwd(), 'src', 'static', 'publish', 'index.js') let sut = proxyquire(filePath, { './s3/put-files': putFiles, - './s3/delete-files': deleteFiles + './s3/delete-files': deleteFiles, }) let aws @@ -34,7 +34,7 @@ let defaultParams = () => ({ inventory, prune: false, region: 'us-west-1', - update: updater('Deploy') + update: updater('Deploy'), }) let arc = '@app\nan-app\n@static' diff --git a/test/slow/cloudfront-test.js b/test/slow/cloudfront-test.js index 2396e4d4..0e513d75 100644 --- a/test/slow/cloudfront-test.js +++ b/test/slow/cloudfront-test.js @@ -5,7 +5,7 @@ let destroy = require('../../src/sam/02-after/00-get-app-apex/cloudfront-destroy let mock = { api: { domain: 'brian.io', path: '/staging' }, - s3: { domain: 'arc.codes' } + s3: { domain: 'arc.codes' }, } let distros diff --git a/test/unit/direct/deploy-test.js b/test/unit/direct/deploy-test.js index 661d73bd..40f92ff5 100644 --- a/test/unit/direct/deploy-test.js +++ b/test/unit/direct/deploy-test.js @@ -28,7 +28,7 @@ let defaultParams = () => ({ stackname: undefined, shouldHydrate: true, ts: new Date(), - update: updater('Deploy') + update: updater('Deploy'), }) let params = defaultParams() function reset () { diff --git a/test/unit/sam/plugins/index-test.js b/test/unit/sam/plugins/index-test.js index c1dd97ca..518f8359 100644 --- a/test/unit/sam/plugins/index-test.js +++ b/test/unit/sam/plugins/index-test.js @@ -4,14 +4,14 @@ let plugins = require('../../../../src/sam/plugins') function one (params) { let { cloudformation } = params cloudformation.Resources['OneSNS'] = { - Type: 'AWS::SNS' + Type: 'AWS::SNS', } return cloudformation } function two (params) { let { cloudformation } = params cloudformation.Resources['TwoSQS'] = { - Type: 'AWS::SQS' + Type: 'AWS::SQS', } return cloudformation } @@ -22,14 +22,14 @@ let inventory = { _project: { arc: [] }, plugins: { _methods: { deploy: { - start: [ one, two ] - } } - } - } + start: [ one, two ], + } }, + }, + }, } let fakeCfn = { - Resources: [] + Resources: [], } test('deploy.start should be able to modify CloudFormation', t => { diff --git a/test/unit/static/publish/filter-files-test.js b/test/unit/static/publish/filter-files-test.js index a6ab01db..2474cfff 100644 --- a/test/unit/static/publish/filter-files-test.js +++ b/test/unit/static/publish/filter-files-test.js @@ -15,7 +15,7 @@ test('File filtering', t => { let globbed = [ 'public/index.html', 'public/static.json', - 'public/something.json' + 'public/something.json', ] let ignore = [] diff --git a/test/unit/static/publish/s3/delete-files/index-test.js b/test/unit/static/publish/s3/delete-files/index-test.js index 82dbbfb6..5d492a01 100644 --- a/test/unit/static/publish/s3/delete-files/index-test.js +++ b/test/unit/static/publish/s3/delete-files/index-test.js @@ -143,14 +143,14 @@ test('Prune respects fingerprint setting', t => { params.fingerprint = true params.staticManifest = { 'index.html': 'index-df330f3f12.html', - 'folder/something.json': 'folder/something-df330f3f12.json' + 'folder/something.json': 'folder/something-df330f3f12.json', } params.files.pop() // Create a pruning opportunity let pruneThis = 'index-df330f3f12.js' awsLite.testing.mock('S3.ListObjectsV2', { Contents: [ { Key: 'index-df330f3f12.html' }, { Key: 'folder/something-df330f3f12.json' }, - { Key: pruneThis } + { Key: pruneThis }, ] }) awsLite.testing.mock('S3.DeleteObjects', s3DeleteObjects) sut(params, err => { @@ -173,14 +173,14 @@ test('Prune respects both prefix & fingerprint settings together', t => { params.fingerprint = true params.staticManifest = { 'index.html': 'index-df330f3f12.html', - 'folder/something.json': 'folder/something-df330f3f12.json' + 'folder/something.json': 'folder/something-df330f3f12.json', } params.files.pop() // Create a pruning opportunity let pruneThis = `${prefix}/index-df330f3f12.js` awsLite.testing.mock('S3.ListObjectsV2', { Contents: [ - { Key: `${prefix}/index-df330f3f12.html`, }, + { Key: `${prefix}/index-df330f3f12.html` }, { Key: `${prefix}/folder/something-df330f3f12.json` }, - { Key: pruneThis } + { Key: pruneThis }, ] }) awsLite.testing.mock('S3.DeleteObjects', s3DeleteObjects) sut(params, err => { @@ -207,13 +207,13 @@ test('Prune respects both prefix & fingerprint settings together in nested folde params.fingerprint = true params.staticManifest = { 'index.html': 'index-df330f3f12.html', - 'a-folder/something.json': 'a-folder/something-df330f3f12.json' + 'a-folder/something.json': 'a-folder/something-df330f3f12.json', } let pruneThis = `${prefix}/a-folder/index-df330f3f12.js` awsLite.testing.mock('S3.ListObjectsV2', { Contents: [ - { Key: `${prefix}/index-df330f3f12.html`, }, + { Key: `${prefix}/index-df330f3f12.html` }, { Key: `${prefix}/a-folder/something-df330f3f12.json` }, - { Key: pruneThis } + { Key: pruneThis }, ] }) awsLite.testing.mock('S3.DeleteObjects', s3DeleteObjects) sut(params, err => { diff --git a/test/unit/static/publish/s3/put-files/format-key-test.js b/test/unit/static/publish/s3/put-files/format-key-test.js index baf1b330..6c6790ae 100644 --- a/test/unit/static/publish/s3/put-files/format-key-test.js +++ b/test/unit/static/publish/s3/put-files/format-key-test.js @@ -12,7 +12,7 @@ let defaultParams = () => ({ fingerprint: false, publicDir: 'public', prefix: undefined, - staticManifest: {} + staticManifest: {}, }) test('Module is present', t => { @@ -59,7 +59,7 @@ test('Fingerprint key', t => { params.file = 'static.json' params.fingerprint = true params.staticManifest = { - 'index.html': 'index-a1b2c.html' + 'index.html': 'index-a1b2c.html', } let Key = formatKey(params) t.equal(Key, 'static.json', 'Did not fingerprint static.json') @@ -67,7 +67,7 @@ test('Fingerprint key', t => { params = defaultParams() params.fingerprint = true params.staticManifest = { - 'index.html': 'index-a1b2c.html' + 'index.html': 'index-a1b2c.html', } Key = formatKey(params) t.equal(Key, 'index-a1b2c.html', 'Fingerprinted filename') @@ -85,7 +85,7 @@ test('Prefix key', t => { params.prefix = 'some-folder' params.fingerprint = true params.staticManifest = { - 'index.html': 'index-a1b2c.html' + 'index.html': 'index-a1b2c.html', } Key = formatKey(params) t.equal(Key, 'some-folder/index-a1b2c.html', `Prepended prefix to fingerprinted filename: ${Key}`) diff --git a/test/unit/static/publish/s3/put-files/index-test.js b/test/unit/static/publish/s3/put-files/index-test.js index c5ddda04..f346732b 100644 --- a/test/unit/static/publish/s3/put-files/index-test.js +++ b/test/unit/static/publish/s3/put-files/index-test.js @@ -10,7 +10,7 @@ let filePath = join(process.cwd(), 'src', 'static', 'publish', 's3', 'put-files' let putParams = proxyquire(filePath, { './put-params': ({ Bucket, Key, Body }) => ({ Bucket, Key, Body, - }) + }), }) let aws, tmp