Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanblock committed Apr 29, 2024
1 parent 6736efb commit 31ca0a4
Show file tree
Hide file tree
Showing 25 changed files with 161 additions and 161 deletions.
4 changes: 2 additions & 2 deletions scripts/deploy.js
Expand Up @@ -137,7 +137,7 @@ module.exports = function deploy (params = {}, callback) {
'--template-file', `${appname}-cfn.yaml`,
'--stack-name', name,
'--s3-bucket', bucket,
'--capabilities', 'CAPABILITY_AUTO_EXPAND', 'CAPABILITY_IAM'
'--capabilities', 'CAPABILITY_AUTO_EXPAND', 'CAPABILITY_IAM',
], { log, verbose }, callback)
},

Expand All @@ -152,7 +152,7 @@ module.exports = function deploy (params = {}, callback) {
else {
callback()
}
}
},

], callback)
return promise
Expand Down
2 changes: 1 addition & 1 deletion scripts/package.js
Expand Up @@ -8,6 +8,6 @@ module.exports = function samPackage ({ filename, bucket, log, verbose }, callba
'--output-template-file',
filename.replace('json', 'yaml'),
'--s3-bucket',
bucket
bucket,
], { log, verbose }, callback)
}
4 changes: 2 additions & 2 deletions scripts/print.js
Expand Up @@ -37,8 +37,8 @@ module.exports = function pretty ({ log, verbose }) {
if (!log) return
let check = chalk.green('✓')
let msg = chalk.grey('Deployed')
let time = chalk.green.bold((Date.now() - ts) / 1000 + ' seconds')
let time = chalk.green.bold(((Date.now() - ts) / 1000) + ' seconds')
console.log(check, msg, time)
}
},
}
}
8 changes: 4 additions & 4 deletions src/visitors/events/index.js
Expand Up @@ -25,17 +25,17 @@ module.exports = function visitEvents (inventory, template) {
template.Resources[eventLambda].Properties.Events[eventEvent] = {
Type: 'SNS',
Properties: {
Topic: { Ref: eventTopic }
}
Topic: { Ref: eventTopic },
},
}

// Create the SNS topic
template.Resources[eventTopic] = {
Type: 'AWS::SNS::Topic',
Properties: {
DisplayName: name,
Subscription: []
}
Subscription: [],
},
}

template.Outputs[eventTopic] = {
Expand Down
58 changes: 29 additions & 29 deletions src/visitors/globals/index.js
Expand Up @@ -19,13 +19,13 @@ module.exports = function visitGlobals (inventory, template) {
Statement: [ {
Effect: 'Allow',
Principal: {
Service: 'lambda.amazonaws.com'
Service: 'lambda.amazonaws.com',
},
Action: 'sts:AssumeRole'
} ]
Action: 'sts:AssumeRole',
} ],
},
Policies: []
}
Policies: [],
},
}

// Enables logs and capability reflection
Expand All @@ -38,11 +38,11 @@ module.exports = function visitGlobals (inventory, template) {
'logs:CreateLogGroup',
'logs:CreateLogStream',
'logs:PutLogEvents',
'logs:DescribeLogStreams'
'logs:DescribeLogStreams',
],
Resource: 'arn:aws:logs:*:*:*'
} ]
}
Resource: 'arn:aws:logs:*:*:*',
} ],
},
})

// allow lambdas read/write on the static bucket
Expand All @@ -66,17 +66,17 @@ module.exports = function visitGlobals (inventory, template) {
Resource: [ {
'Fn::Sub': [
'arn:aws:s3:::${bukkit}',
{ bukkit }
]
{ bukkit },
],
},
{
'Fn::Sub': [
'arn:aws:s3:::${bukkit}/*',
{ bukkit }
]
} ]
} ]
}
{ bukkit },
],
} ],
} ],
},
})
}

Expand All @@ -98,23 +98,23 @@ module.exports = function visitGlobals (inventory, template) {
'Fn::Sub': 'arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/*',
},
},
]
}
],
},
})
function getTableArns (tables) {
return tables.map(table => {
let name = `${toLogicalID(table.name)}Table`
return [ {
'Fn::Sub': [
'arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${tablename}',
{ tablename: { Ref: name } }
]
{ tablename: { Ref: name } },
],
},
{
'Fn::Sub': [
'arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${tablename}/*',
{ tablename: { Ref: name } }
]
{ tablename: { Ref: name } },
],
} ]
}).reduce((a, b) => a.concat(b), [])
}
Expand All @@ -131,15 +131,15 @@ module.exports = function visitGlobals (inventory, template) {
'sns:Publish',
],
Resource: getTopicArn(),
} ]
}
} ],
},
})
function getTopicArn () {
return {
'Fn::Sub': [
'arn:aws:sns:${AWS::Region}:${AWS::AccountId}:${AWS::StackName}*',
{}
]
{},
],
}
}
}
Expand All @@ -158,9 +158,9 @@ module.exports = function visitGlobals (inventory, template) {
'sqs:DeleteMessage',
'sqs:GetQueueAttributes',
],
Resource: '*'
} ]
}
Resource: '*',
} ],
},
})
}

Expand Down
62 changes: 31 additions & 31 deletions src/visitors/globals/ssm.js
Expand Up @@ -17,11 +17,11 @@ module.exports = function ssm ({ inv }, template) {
Name: {
'Fn::Sub': [
'/${AWS::StackName}/tables/${tablename}',
{ tablename: name }
]
{ tablename: name },
],
},
Value: { Ref: TableName }
}
Value: { Ref: TableName },
},
}
})
}
Expand All @@ -38,11 +38,11 @@ module.exports = function ssm ({ inv }, template) {
Name: {
'Fn::Sub': [
'/${AWS::StackName}/events/${event}',
{ event: name }
]
{ event: name },
],
},
Value: { Ref: Event }
}
Value: { Ref: Event },
},
}
})
}
Expand All @@ -59,11 +59,11 @@ module.exports = function ssm ({ inv }, template) {
Name: {
'Fn::Sub': [
'/${AWS::StackName}/queues/${queue}',
{ queue: name }
]
{ queue: name },
],
},
Value: { Ref: Queue }
}
Value: { Ref: Queue },
},
}
})
}
Expand All @@ -82,11 +82,11 @@ module.exports = function ssm ({ inv }, template) {
Name: {
'Fn::Sub': [
'/${AWS::StackName}/static/${key}',
{ key: 'bucket' }
]
{ key: 'bucket' },
],
},
Value
}
Value,
},
}

let fingerprint = inv.static.fingerprint ? true : false
Expand All @@ -97,11 +97,11 @@ module.exports = function ssm ({ inv }, template) {
Name: {
'Fn::Sub': [
'/${AWS::StackName}/static/${key}',
{ key: 'fingerprint' }
]
{ key: 'fingerprint' },
],
},
Value: `${fingerprint}`
}
Value: `${fingerprint}`,
},
}
}

Expand All @@ -122,9 +122,9 @@ module.exports = function ssm ({ inv }, template) {
Resource: {
'Fn::Sub': [
'arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${AWS::StackName}',
{}
]
}
{},
],
},
},
{
Effect: 'Allow',
Expand All @@ -135,9 +135,9 @@ module.exports = function ssm ({ inv }, template) {
Resource: {
'Fn::Sub': [
'arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${AWS::StackName}/*',
{}
]
}
{},
],
},
},
{
Effect: 'Allow',
Expand All @@ -148,14 +148,14 @@ module.exports = function ssm ({ inv }, template) {
Resource: {
'Fn::Sub': [
'arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${AWS::StackName}/*/*',
{}
]
}
{},
],
},
},
]
],
},
Roles: [ { Ref: 'Role' } ],
}
},
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/visitors/http/get-api-properties.js
Expand Up @@ -13,7 +13,7 @@ module.exports = function getHttpApiProperties (inventory) {
openapi: '3.0.1',
info: { title: { Ref: 'AWS::StackName' } },
paths,
}
},
}
return Properties
}
Expand All @@ -40,7 +40,7 @@ function getPaths (routes, payloadFormatVersion) {
// cacheKeyParameters: [
// 'method.request.path.proxy'
// ]
}
},
}
}
})
Expand Down
12 changes: 6 additions & 6 deletions src/visitors/http/index.js
Expand Up @@ -45,8 +45,8 @@ module.exports = function visitHttp (inventory, template) {
Properties: {
Path: path,
Method: method.toUpperCase(),
ApiId: { Ref: 'HTTP' }
}
ApiId: { Ref: 'HTTP' },
},
}
})

Expand All @@ -57,14 +57,14 @@ module.exports = function visitHttp (inventory, template) {
'Fn::Sub': [
// Always default to staging; mutate to production via macro where necessary
'https://${ApiId}.execute-api.${AWS::Region}.amazonaws.com',
{ ApiId: { Ref: 'HTTP' } }
]
}
{ ApiId: { Ref: 'HTTP' } },
],
},
}

template.Outputs.ApiId = {
Description: 'API ID (ApiId)',
Value: { Ref: 'HTTP' }
Value: { Ref: 'HTTP' },
}

// Backfill @static
Expand Down
6 changes: 3 additions & 3 deletions src/visitors/http/proxy.js
Expand Up @@ -11,9 +11,9 @@ module.exports = function proxy ({ inv }, template) {
httpMethod: 'ANY',
uri: inv.proxy[deployStage],
connectionType: 'INTERNET',
timeoutInMillis: 30000
}
}
timeoutInMillis: 30000,
},
},
}

return template
Expand Down
8 changes: 4 additions & 4 deletions src/visitors/queues/index.js
Expand Up @@ -28,16 +28,16 @@ module.exports = function visitQueues (inventory, template) {
template.Resources[queueLambda].Properties.Events[queueEvent] = {
Type: 'SQS',
Properties: {
Queue: { 'Fn::GetAtt': [ queueQueue, 'Arn' ] }
}
Queue: { 'Fn::GetAtt': [ queueQueue, 'Arn' ] },
},
}

// Create the sqs queue
template.Resources[queueQueue] = {
Type: 'AWS::SQS::Queue',
Properties: {
VisibilityTimeout: timeout
}
VisibilityTimeout: timeout,
},
}

// Only add fifo when true; false will cause cfn to fail =/
Expand Down

0 comments on commit 31ca0a4

Please sign in to comment.