Skip to content

Commit

Permalink
Merge branch 'master' of github.com:dherault/serverless-offline
Browse files Browse the repository at this point in the history
  • Loading branch information
dherault committed Mar 17, 2020
2 parents 0f6f88c + 95ec5c4 commit 8e82571
Show file tree
Hide file tree
Showing 33 changed files with 1,421 additions and 813 deletions.
95 changes: 71 additions & 24 deletions CONTRIBUTING.md
Expand Up @@ -4,36 +4,83 @@ Welcome, and thanks in advance for your help!

# How to contribute to Serverless-Offline

# Development setup

we are using Babel to transform ES6 modules (static imports and dynamic imports).

you have several options:

1. point your `serverless.yml` plugin entry point to `src/main.js` (https://github.com/dherault/serverless-offline/blob/master/src/main.js and uncomment the block between `use strict` and `module.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` to `src/main.js`)
To install all the locked versions for serverless-offline
```bash
npm ci
```

```yaml
service: foo
# Development setup

plugins:
- ../../../src/main.js
# - ../../../ alternative: point to package.json
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

provider:
memorySize: 128
name: aws
# ....
```
we are using Babel to transform ES6 modules (static imports and dynamic imports).

2. run the build step ahead of running the plugin. in that case don't uncomment anything in `main.js`!
## serverless.yml

```
npm run build
```
you have several options:

point your `serverless.yml` plugin entry to the build folder: `./dist/main.js` (see 1. on how to)
1. point your `serverless.yml` plugin entry point to `src/main.js`
(https://github.com/dherault/serverless-offline/blob/master/src/main.js) and
uncomment the block between `use strict` and `module.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` to `src/main.js`)

```yaml
service: foo

plugins:
- ../../../src/main.js
# - ../../../ alternative: point to package.json

provider:
memorySize: 128
name: aws
# ....
```

2. 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)

## package.json

1. Make sure you install/build your local serverless-offline
```bash
# serverless-offline
npm ci
npm run build
```
2. Install the local serverless-offline in your other npm project as a dev dependency
```bash
# in your-npm-project
npm i -D serverless-offline@file:../serverless-offline
```
After this, you should see a devDependencies like the following in your package.json
```JSON
{
"devDependencies": {
"serverless-offline": "file:serverless-offline"
}
}
```
3. When you make changes to serverless-offline, re-run the build so Babel will
re-compile the plugin source
```bash
# serverless-offline
npm run build
```
The local file include in your-npm-project should have the linked changes in
it's respective node_modules

---

Expand Down
6 changes: 4 additions & 2 deletions README.md
Expand Up @@ -35,7 +35,8 @@ To do so, it starts an HTTP server that handles the request's lifecycle like API

This plugin is updated by its users, I just do maintenance and ensure that PRs are relevant to the community. In other words, if you [find a bug or want a new feature](https://github.com/dherault/serverless-offline/issues), please help us by becoming one of the [contributors](https://github.com/dherault/serverless-offline/graphs/contributors) :v: ! See the [contributing section](#contributing).

## Important
***
# Important

You are viewing the documentation for the latest **v6.0.0-alpha** release.

Expand All @@ -44,6 +45,7 @@ In order to see the **documentation** for the latest stable **v5.x** release, go
**v6.x** includes major refactorings (still ongoing effort) and should not contain any new bugs. If you find any behaviour to be different from previous releases (other than the _breaking changes_), please file an issue!

v6.x changelog, breaking changes and migration path from previous releases, see: [#728](https://github.com/dherault/serverless-offline/issues/768)
***

## Documentation

Expand Down Expand Up @@ -227,7 +229,7 @@ By doing this you are now able to change those values using a custom header. Thi

## Environment variables

You are able to use environmnet variables to customize identity params in event context.
You are able to use environment variables to customize identity params in event context.

| Environment Variable | Event key |
| ----------------------------------- | ----------------------------------------------------------- |
Expand Down

0 comments on commit 8e82571

Please sign in to comment.