Skip to content

Commit

Permalink
Merge branch 'multi-version'
Browse files Browse the repository at this point in the history
  • Loading branch information
glicht committed May 26, 2018
2 parents e28d381 + 0153d79 commit ae6227a
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 318 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ node_js:
- "6"
- "8"
- "10"
env:
- SERVERLESS_VERSION=latest
- SERVERLESS_VERSION=latest~1
- SERVERLESS_VERSION=latest~2
- SERVERLESS_VERSION=latest~3
- SERVERLESS_VERSION=latest~4

before_install:
- npm i -g npm@6

install:
- travis_retry npm install
- npm install --no-save `npx npm-get-version serverless@$SERVERLESS_VERSION`

sudo: false

Expand Down
52 changes: 33 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@
},
"devDependencies": {
"@types/chai": "^4.1.3",
"@types/lodash": "^4.14.108",
"@types/lodash": "^4.14.109",
"@types/mocha": "^5.2.0",
"@types/node": "^6.0.110",
"chai": "^4.1.2",
"coveralls": "^3.0.1",
"mocha": "^5.1.1",
"mocha": "^5.2.0",
"npm-get-version": "^0.1.0",
"nyc": "^11.8.0",
"rimraf": "^2.6.2",
"serverless": "^1.27.2",
Expand Down
7 changes: 3 additions & 4 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ServerlessIamPerFunctionPlugin {
this.provider = 'aws';
this.serverless = serverless;
this.hooks = {
'after:package:compileFunctions': this.createRolesPerFunction.bind(this),
'before:package:finalize': this.createRolesPerFunction.bind(this),
};
this.defaultInherit = _.get(this.serverless.service, "custom.serverless-iam-roles-per-function.defaultInherit", false);
}
Expand All @@ -42,8 +42,7 @@ class ServerlessIamPerFunctionPlugin {
}
}
if(!this.awsPackagePlugin) {
this.serverless.cli.log(`WARNING: could not find ${awsPackagePluginName} plugin to verify statements.`);
return;
throw new this.serverless.classes.Error(`ERROR: could not find ${awsPackagePluginName} plugin to verify statements.`);
}
this.awsPackagePlugin.validateStatements(statements);
}
Expand Down Expand Up @@ -93,7 +92,7 @@ class ServerlessIamPerFunctionPlugin {
*/
getStreamStatements(functionObject: any) {
const res: any[] = [];
if(!functionObject.events) { //no events
if(_.isEmpty(functionObject.events)) { //no events
return res;
}
const dynamodbStreamStatement: Statement = {
Expand Down
Loading

0 comments on commit ae6227a

Please sign in to comment.