Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,17 @@ Where:

# Run Plugin
```bash
sls step-functions-offline --stateMachine={{name}} --event={{path to event file}}
sls step-functions-offline --stateMachine={{name}} --event={{path to event file}} --buildDir={{build-path}}
```

- `name`: name of state machine in section state functions. In example above it's `foo`.
- `stateMachine`: name of state machine in section state functions. In example above it's `foo`.
- `event`: input values for execution in JSON format (optional)
- `buildDir`: path to the build directory, eg: .webpack/.build (optional)

In case you have a custom build directory use:
```bash
sls step-functions-offline --stateMachine={{name}} --event={{path to event file}} --buildDir={{build-path}}
```

If you want to know where you are (in offline mode or not) you can use env variable `STEP_IS_OFFLINE`.

Expand Down
3 changes: 2 additions & 1 deletion build.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ module.exports = {
// },
//
_findFunctionPathAndHandler(functionHandler) {
const dir = path.dirname(functionHandler);
const buildDir = this.options.buildDir ? `${this.options.buildDir}/` : '';
const dir = `${buildDir}${path.dirname(functionHandler)}`;
Copy link

@ryanolee ryanolee Aug 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth making this configurable from the custom: config object also? (Or possibly under something like )

stepFunctions:
    build:
         path: './webpack/some/path'

So it does not have to be entered from the CLI / scripts all the time 🤔

const handler = path.basename(functionHandler);
const splitHandler = handler.split('.');
const filePath = `${dir}/${splitHandler[0]}.js`;
Expand Down