Skip to content

Commit

Permalink
feat: add SLS_BROWSERIFIER_DEBUG flag
Browse files Browse the repository at this point in the history
  • Loading branch information
nolde committed Feb 11, 2020
1 parent 24f58c6 commit 1dac77e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,14 @@ Usage

When this plugin is enabled, and `package.individually` is `true`, running `serverless deploy` and `serverless deploy -f <funcName>` will automatically browserify your Node.js lambda code.

If you want to see more information about the process, simply set `SLS_DEBUG=*`. Example:
If you want to see more information about the process, simply set envvar `SLS_DEBUG=*` for full serverless debug output, or `SLS_BROWSERIFIER_DEBUG=*` for plugin only debug messages. Example:

```
$ export SLS_DEBUG=*
$ sls deploy function -v -f usersGet
```

You can also verify your bundles by simply using `sls package`, which bundles everything up but does not deploy.
You may also verify your bundles by simply using `sls package`, which bundles everything up but does not deploy.


Using browserify plugins/transforms
Expand Down
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class BrowserifierPlugin {
this.S = serverless
this._b = {
options,
debugOn: Boolean(process.env.SLS_DEBUG) || Boolean(process.env.SLS_BROWSERIFIER_DEBUG),
isDisabled: get(this.S, 'service.custom.browserify.disable', false),
servicePath: path.join(this.S.config.servicePath || os.tmpdir(), '.serverless'),
runtimeIsNode: get(this.S, 'service.provider.runtime', '').indexOf('nodejs') !== -1,
Expand All @@ -39,13 +40,13 @@ class BrowserifierPlugin {
.then(() => {
const fns = this._getAllFunctions()
this.S.cli.log(`Browserifier: Preparing ${fns.length} function(s)...`)
return Promise.all(fns.map(name => this._bootstrap(name).reflect()))
return Promise.map(fns, name => this._bootstrap(name).reflect())
})
.then(results =>
results
.then(results => {
return results
.filter(inspection => inspection.isRejected())
.forEach(inspection => this._handleSkip(inspection.reason()))
)
})
.catch(this._handleSkip)
.tapCatch(this._warnFailure)
}
Expand Down

0 comments on commit 1dac77e

Please sign in to comment.