serverless-newrelic-lambda-layers
Advanced tools
Comparing version 0.1.14 to 0.1.15
@@ -69,2 +69,7 @@ "use strict"; | ||
} | ||
const { exclude = [], include = [] } = this.config; | ||
if (!_.isEmpty(exclude) && !_.isEmpty(include)) { | ||
this.serverless.cli.log("exclude and include options are mutually exclusive; skipping."); | ||
return; | ||
} | ||
const funcs = this.functions; | ||
@@ -99,4 +104,3 @@ for (const funcName of Object.keys(funcs)) { | ||
for (const funcName of Object.keys(funcs)) { | ||
const { exclude = [] } = this.config; | ||
if (_.isArray(exclude) && exclude.indexOf(funcName) !== -1) { | ||
if (this.shouldSkip(funcName)) { | ||
return; | ||
@@ -150,5 +154,3 @@ } | ||
} | ||
const { exclude = [] } = this.config; | ||
if (_.isArray(exclude) && exclude.indexOf(funcName) !== -1) { | ||
this.serverless.cli.log(`Excluded function ${funcName}; skipping`); | ||
if (this.shouldSkip(funcName)) { | ||
return; | ||
@@ -198,2 +200,16 @@ } | ||
} | ||
shouldSkip(funcName) { | ||
const { include = [], exclude = [] } = this.config; | ||
if (!_.isEmpty(include) && | ||
_.isArray(include) && | ||
include.indexOf(funcName) === -1) { | ||
this.serverless.cli.log(`Excluded function ${funcName}; is not part of include skipping`); | ||
return true; | ||
} | ||
if (_.isArray(exclude) && exclude.indexOf(funcName) !== -1) { | ||
this.serverless.cli.log(`Excluded function ${funcName}; skipping`); | ||
return true; | ||
} | ||
return false; | ||
} | ||
logLevel(environment) { | ||
@@ -200,0 +216,0 @@ environment.NEW_RELIC_LOG_ENABLED = "true"; |
{ | ||
"name": "serverless-newrelic-lambda-layers", | ||
"version": "0.1.14", | ||
"version": "0.1.15", | ||
"description": "Serverless plugin for NewRelic APM AWS Lambda layers.", | ||
@@ -16,4 +16,9 @@ "main": "dist/index.js", | ||
"lint": "tslint -c tslint.json 'src/**/*.ts'", | ||
"generate:test:case": "yaml2json examples/nodejs/serverless.yml > tests/fixtures/example.service.input.json" | ||
"generate:test:case": "yaml2json examples/nodejs/serverless.yml > tests/fixnpmtures/example.service.input.json" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "npm run lint" | ||
} | ||
}, | ||
"repository": { | ||
@@ -23,3 +28,3 @@ "type": "git", | ||
}, | ||
"author": "IOpipe", | ||
"author": "New Relic", | ||
"license": "Apache-2.0", | ||
@@ -38,2 +43,3 @@ "bugs": { | ||
"get-installed-path": "^4.0.8", | ||
"husky": "^4.2.3", | ||
"jest": "^25.1.0", | ||
@@ -47,4 +53,4 @@ "prettier": "^1.16.4", | ||
"tslint-plugin-prettier": "^2.0.1", | ||
"yamljs": "^0.3.0", | ||
"typescript": "^3.3.3333" | ||
"typescript": "^3.3.3333", | ||
"yamljs": "^0.3.0" | ||
}, | ||
@@ -51,0 +57,0 @@ "dependencies": { |
@@ -73,3 +73,3 @@ # serverless-newrelic-lambda-layers | ||
Your [New Relic ACcount ID](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/account-id). | ||
Your [New Relic Account ID](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/account-id). | ||
@@ -127,5 +127,17 @@ ```yaml | ||
#### `include` (optional) | ||
An array of functions to include for automatic wrapping. (You can set `include` or `exclude` options, but not both.) | ||
```yaml | ||
custom: | ||
newRelic: | ||
include: | ||
- include-only-func | ||
- another-included-func | ||
``` | ||
#### `exclude` (optional) | ||
An array of functions to exclude from automatic wrapping. | ||
An array of functions to exclude from automatic wrapping. (You can set `include` or `exclude` options, but not both.) | ||
@@ -132,0 +144,0 @@ ```yaml |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37125
381
246
18