Package Exports
- export-serverless
- export-serverless/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (export-serverless) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
export-serverless
A serverless plugin that interpolates serverless config so that you can use it more flexibly.
Home page - https://github.com/anonflux/export-serverless
⚡ Pros
- TBD
Before you begin
- Install the serverless framework
npm install -g serverlessGetting started
First, Install and configure
Installation
npm install --save-dev export-serverlessConfiguration
In real world scenarios, there is more to ensuring quality than simply deploying the application. In applications using the serverless framework, this often presents a problem, as configuration is only available within the context of serverless commands.
Not anymore. This plugin will export serverless.yml configuration, interpolations, variables, etc to a file of your choosing.
# add to your serverless.yml
plugins:
- export-serverless
custom:
export:
toFile: './.service.config.json' # relative to process.cwd() file name/path config will be written to
config: # the output of the config file will be json objects that match this object
service:
name: 'service' # value corresponds to the 'service' property in serverless.yml
stackName: 'provider.stackName' # value corresponds to the 'provider.stackName' property in serverless.yml
envKey: 'custom.env-key' # value corresponds to the 'custom.env-key' property in serverless.ymlFor example, if serverless.yml looked like this:
# add to your serverless.yml
service: exporty-sport-port
provider:
stage: ${opt:stage, 'local'}
stackName: ${self:provider.stage}-${self:service}
custom:
env-key: ${self:provider.stage}
export:
toFile: './.service.config.json'
config:
service:
name: 'service'
stackName: 'provider.stackName'
envKey: 'custom.env-key'
plugins:
- export-serverlessWhen running npx sls export, the ./service.config.json file would look like this:
{
"service": {
"name": "exporty-sport-port"
},
"stackName": "local-exporty-sport-port",
"envKey": "local"
}To run
npx sls exportnpx sls export --stage={stagehere}