serverless-newrelic-lambda-layers
Advanced tools
Comparing version 0.1.18 to 0.1.19
@@ -41,2 +41,7 @@ "use strict"; | ||
} | ||
get stage() { | ||
return ((this.options && this.options.stage) || | ||
(this.serverless.service.provider && | ||
this.serverless.service.provider.stage)); | ||
} | ||
get prependLayer() { | ||
@@ -56,2 +61,6 @@ return typeof this.config.prepend === "boolean" && this.config.prepend; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (this.shouldSkipPlugin()) { | ||
this.serverless.cli.log(`Skipping plugin serverless-newrelic-lambda-layers for stage ${this.stage}`); | ||
return; | ||
} | ||
const version = this.serverless.getVersion(); | ||
@@ -87,2 +96,5 @@ if (semver.lt(version, "1.34.0")) { | ||
cleanup() { | ||
if (this.shouldSkipPlugin()) { | ||
return; | ||
} | ||
this.removeNodeHelper(); | ||
@@ -92,2 +104,5 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (this.shouldSkipPlugin()) { | ||
return; | ||
} | ||
if (this.autoSubscriptionDisabled) { | ||
@@ -111,3 +126,3 @@ this.serverless.cli.log("Skipping adding log subscription. Explicitly disabled"); | ||
for (const funcName of Object.keys(funcs)) { | ||
if (this.shouldSkip(funcName)) { | ||
if (this.shouldSkipFunction(funcName)) { | ||
return; | ||
@@ -124,2 +139,5 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (this.shouldSkipPlugin()) { | ||
return; | ||
} | ||
if (this.autoSubscriptionDisabled) { | ||
@@ -165,3 +183,3 @@ this.serverless.cli.log("Skipping removing log subscription. Explicitly disabled"); | ||
} | ||
if (this.shouldSkip(funcName)) { | ||
if (this.shouldSkipFunction(funcName)) { | ||
return; | ||
@@ -212,3 +230,10 @@ } | ||
} | ||
shouldSkip(funcName) { | ||
shouldSkipPlugin() { | ||
if (!this.config.stages || | ||
(this.config.stages && this.config.stages.includes(this.stage))) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
shouldSkipFunction(funcName) { | ||
const { include = [], exclude = [] } = this.config; | ||
@@ -215,0 +240,0 @@ if (!_.isEmpty(include) && |
{ | ||
"name": "serverless-newrelic-lambda-layers", | ||
"version": "0.1.18", | ||
"version": "0.1.19", | ||
"description": "Serverless plugin for NewRelic APM AWS Lambda layers.", | ||
@@ -16,3 +16,3 @@ "main": "dist/index.js", | ||
"lint": "tslint -c tslint.json 'src/**/*.ts'", | ||
"generate:test:case": "yaml2json examples/nodejs/serverless.yml > tests/fixnpmtures/example.service.input.json" | ||
"generate:test:case": "yaml2json examples/nodejs/serverless.yml > tests/fixtures/example.service.input.json" | ||
}, | ||
@@ -19,0 +19,0 @@ "husky": { |
@@ -126,2 +126,13 @@ # serverless-newrelic-lambda-layers | ||
#### `stages` (optional) | ||
An array of stages that the plugin will be included for. If this key is not specified then all stages will be included. | ||
```yaml | ||
custom: | ||
newRelic: | ||
stages: | ||
- prod | ||
``` | ||
#### `include` (optional) | ||
@@ -153,3 +164,3 @@ | ||
Pin to a specific layer version. The latest layer ARN is automatically fetched from the [New Relic Layers API](https://nr-layers.iopipe.com) | ||
Pin to a specific layer version. The latest layer ARN is automatically fetched from the [New Relic Layers API](https://layers.newrelic-external.com) | ||
@@ -156,0 +167,0 @@ ```yaml |
Sorry, the diff of this file is not supported yet
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
38523
414
257