Welcome, and thanks in advance for your help!
To install all the locked versions for serverless-offline
npm ci
You can test your local changes to serverless-offline if different ways
- Point your serverless.yml directly to the local changes
- agnostic to your tech stack, as long as you have serverless.yml
- Point your npm package.json to the local changes
- depends on an npm project
we are using Babel to transform ES6 modules (static imports and dynamic imports).
you have several options:
-
point your
serverless.yml
plugin entry point tosrc/main.js
(https://github.com/dherault/serverless-offline/blob/master/src/main.js) and uncomment the block betweenuse strict
andmodule.exports
. that way, babel/register will compile es6 module syntax on the fly.(as an alternative you can point the entry point to the package.json of the plugin and change
main
tosrc/main.js
)service: foo plugins: - ../../../src/main.js # - ../../../ alternative: point to package.json provider: memorySize: 128 name: aws # ....
-
run the build step ahead of running the plugin. in that case don't uncomment anything in
main.js
!npm run build
point your
serverless.yml
plugin entry to the build folder:./dist/main.js
(see 1. on how to)
- Make sure you install/build your local serverless-offline
# serverless-offline npm ci npm run build
- Install the local serverless-offline in your other npm project as a dev dependency
After this, you should see a devDependencies like the following in your package.json
# in your-npm-project npm i -D serverless-offline@file:../serverless-offline
{ "devDependencies": { "serverless-offline": "file:serverless-offline" } }
- When you make changes to serverless-offline, re-run the build so Babel will
re-compile the plugin source
The local file include in your-npm-project should have the linked changes in it's respective node_modules
# serverless-offline npm run build
We're using Prettier, ESlint and the Airbnb preset. To fix errors which are automatically fixable, run:
npm run format
To run the linter, run:
npm run lint
There are a few test scripts, depending on what type of testing you want to run.
Unit tests
To run unit tests only:
npm run test:unit
Watch mode
To run all tests in watch mode (this skips npm install
):
npm run test:watch
Test coverage
npm run test:cov