Skip to content

Commit

Permalink
chore(release): configure semantic-release action
Browse files Browse the repository at this point in the history
  • Loading branch information
HipsterBrown committed May 11, 2020
1 parent 9b7c467 commit 0225afe
Show file tree
Hide file tree
Showing 4 changed files with 6,140 additions and 291 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release
on:
push:
branches:
- master

jobs:
release:
name: Release
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install dependencies
run: npm ci
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm run semantic-release
74 changes: 63 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,72 @@

A library for building multi-step forms backed by a state machine using [robot](https://thisrobot.life).

*TODO:*
- [X] support conditional step progression with `when` guard function
- [X] add GitHub Actions CI for tests + linting
- [X] update `onChange` to pass object of values and functions to handler
- [X] update `onChange` handler arguments with `goToNextStep` and `goToPreviousStep` helper functions
- [X] augement result of createWizard to be object / class to be passed into OnChangeHandler
- [X] add example of usage of HTML + JS
- [X] add example of JS framework integration
- [ ] generate typedoc site, deploy to gh-pages
- [ ] use semantic-release to auto-publish 1.0
**Installation**

This package is written in TypeScript so type definitions are included by default:
```
npm install robo-wizard
```

```
yarn add robo-wizard
```

**Basic usage:**

```typescript
import { createWizard } from 'robo-wizard';

const wizard = createWizard(['first', 'second', 'third']);
wizard.start(updatedWizard => { console.log('Updated!', updatedWizard.currentStep) });

console.log(wizard.currentStep); // first

wizard.goToNextStep();

console.log(wizard.currentStep); // second

wizard.goToNextStep();

console.log(wizard.currentStep); // third

wizard.goToPreviousStep();

console.log(wizard.currentStep); // second
```

**Gathering values:**

```typescript
import { createWizard } from 'robo-wizard';

const wizard = createWizard(['first', 'second', 'third'], { firstName: '', lastName: '' });
wizard.start(updatedWizard => { console.log('Updated!', updatedWizard.currentStep), updatedWizard.currentValues });

console.log(wizard.currentValues); // { firstName: '', lastName: '' }

wizard.goToNextStep({ values: { firstName: 'Jane' } });

console.log(wizard.currentValues); // { firstName: 'Jane', lastName: '' }

wizard.goToNextStep({ values: { lastName: 'Doe' } });

console.log(wizard.currentValues); // { firstName: 'Jane', lastName: 'Doe' }

wizard.goToPreviousStep({ values: { firstName: '', lastName: '' } });

console.log(wizard.currentValues); // { firstName: '', lastName: '' }
```

## Examples

Check out the [examples](./examples/) directory to see a sample of usage.
Check out the [examples](./examples/) directory to see a sample of usage with HTML and a few framework integrations.

## Work In Progress Roadmap

- [ ] `createForm` state machine generator to control form state for a step in the wizard
- [ ] example integration of routed wizard steps, i.e. using `react-router` or `history` packages
- [ ] add history stack to internal state machine to lookup the previous step when using custom progression

## Local Development

Expand Down
Loading

0 comments on commit 0225afe

Please sign in to comment.