Skip to content

Commit a0d2a52

Browse files
committed
Rename the run command to invoke
1 parent 1483a00 commit a0d2a52

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,51 @@ Note that, if the `output` configuration is not set, it will automatically be
2929
generated to write bundles in the `.webpack` directory.
3030

3131
## Usage
32+
### Automatic bundling
3233

3334
The normal Serverless deploy procedure will automatically bundle with Webpack:
3435

3536
- Create the Serverless project with `serverless create -t aws-node`
3637
- Install Serverless Webpack as above
3738
- Deploy with `serverless deploy`
3839

40+
### Run a function locally
41+
3942
To run your bundled functions locally you can:
4043

4144
```
42-
serverless webpack run --function <function-name>
45+
serverless webpack invoke --function <function-name>
4346
```
4447

48+
Options are:
49+
50+
- `--function` or `-f` (required) is the name of the function to run
51+
- `--path` or `-p` (optional) is a JSON file path used as the function input event
52+
53+
### Run a function locally on source changes
54+
4555
Or to run a function every time the source files change use `watch`:
4656

4757
```
4858
serverless webpack watch --function <function-name> --path event.json
4959
```
5060

51-
For both commands the options are:
61+
Options are:
5262

5363
- `--function` or `-f` (required) is the name of the function to run
5464
- `--path` or `-p` (optional) is a JSON file path used as the function input event
5565

56-
Lastly use `serverless webpack --out dist` to compile files in the `dist` directory.
66+
### Bundle with webpack
67+
68+
To just bundle and see the output result use:
69+
70+
```
71+
serverless webpack --out dist
72+
```
73+
74+
Options are:
75+
76+
- `--out` or `-o` (optional) The output directory. Defaults to `.webpack`.
5777

5878
## Example with Babel
5979

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ class ServerlessWebpack {
3434
},
3535
},
3636
commands: {
37-
run: {
37+
invoke: {
3838
usage: 'Run a function locally from the webpack output bundle',
3939
lifecycleEvents: [
40-
'run',
40+
'invoke',
4141
],
4242
options: {
4343
function: {
@@ -86,7 +86,7 @@ class ServerlessWebpack {
8686
'webpack:compile': () => BbPromise.bind(this)
8787
.then(this.compile),
8888

89-
'webpack:run:run': () => BbPromise.bind(this)
89+
'webpack:invoke:invoke': () => BbPromise.bind(this)
9090
.then(this.validate)
9191
.then(this.compile)
9292
.then(this.run)

0 commit comments

Comments
 (0)