Skip to content

Commit

Permalink
feat(docs): setup GitBook (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed May 6, 2016
1 parent b5fbd3e commit 60a7553
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,3 +1,5 @@
# GitBook
/_book
### https://raw.github.com/github/gitignore/608690d6b9a78c2a003affc792e49a84905b3118/Node.gitignore

# Logs
Expand Down
8 changes: 7 additions & 1 deletion README.md
Expand Up @@ -67,10 +67,16 @@ Almin is a implementation of Read/Write Stack Architecture that is well-known as
- How to test.
- How to implement domain layer.

## Tests
## Running Tests

npm test

## Building Docs

npm run build:docs
# preview
npm run start:docs

## Contributing

1. Fork it!
Expand Down
7 changes: 4 additions & 3 deletions docs/SUMMARY.md → SUMMARY.md
@@ -1,6 +1,6 @@
# SUMMARY
## Table of Contents

- What is this?
- [What is Almin?](./docs/README.md)
- [ ] Work flow
- [ ] Data flow
- [ ] Example: Counter
Expand All @@ -10,7 +10,8 @@
- Repository
- Store
- State
- [ ] Example
- Example
- [Counter App](./docs/counter/README.md)
- Immutability
- Nesting UseCase
- [ ] Testing
Expand Down
15 changes: 15 additions & 0 deletions book.json
@@ -0,0 +1,15 @@
{
"gitbook": "2.x.x",
"title": "Almin.js",
"description": "Flux/CQRS patterns for JavaScript app.",
"githubId": "almin/almin",
"author": "azu",
"plugins": [
"include-codeblock"
],
"pluginsConfig": {
},
"structure": {
"summary": "./SUMMARY.md"
}
}
10 changes: 9 additions & 1 deletion docs/README.md
Expand Up @@ -44,7 +44,15 @@ Almin has not perfect solution for an application, but we can write code thinkin

We are going to learn two architecture(Flux/CQRS) using Almin :)

## Tutorial
## Table of Contents

Truly [Table of Contents](../SUMMARY.md) is here :arrow_left:

## Rough Table of Contents

Rough version of Table of Contents.

### Tutorial

- [Creating Counter App](./counter/)
- Apply Flux pattern to Almin
Expand Down
6 changes: 3 additions & 3 deletions docs/counter/README.md
Expand Up @@ -91,7 +91,7 @@ In flux:

Return `IncrementalCounterUseCase` and add "dispatch increment event"

[include, IncrementalCounterUseCase.js](../../example/counter/usecase/IncrementalCounterUseCase.js)
[include, IncrementalCounterUseCase.js](../../example/counter/src/usecase/IncrementalCounterUseCase.js)

A class inherited `UseCase` has `this.dispatch(payload);` method.

Expand Down Expand Up @@ -167,7 +167,7 @@ We have created `CounterState.js`.

- receive "payload" and return state.

[include, CounterState.js](../../example/counter/store/CounterState.js)
[include, CounterState.js](../../example/counter/src/store/CounterState.js)

You may have seen the pattern...
Yes It is **reducer**!
Expand All @@ -185,7 +185,7 @@ Finally, we have added some code to `CounterStore`
A class inherited `Store` has `this.emitChange();` method.
It method is called and emit change to the subscribers(often View).

[include, CounterStore.js](../../example/counter/store/CounterStore.js)
[include, CounterStore.js](../../example/counter/src/store/CounterStore.js)

### Side note: Testing

Expand Down
4 changes: 4 additions & 0 deletions package.json
Expand Up @@ -22,6 +22,8 @@
"test": "test"
},
"scripts": {
"start:docs": "gitbook serve",
"build:docs": "gitbook build",
"build": "NODE_ENV=production babel src --out-dir lib --source-maps",
"watch": "babel src --out-dir lib --watch --source-maps",
"prepublish": "npm run --if-present build",
Expand All @@ -43,6 +45,8 @@
"babel-preset-jsdoc-to-assert": "^1.0.1",
"babel-preset-power-assert": "^1.0.0",
"babel-register": "^6.7.2",
"gitbook-cli": "^2.1.3",
"gitbook-plugin-include-codeblock": "^1.8.2",
"mocha": "^2.4.5",
"power-assert": "^1.3.1",
"textlint": "^6.3.0",
Expand Down

0 comments on commit 60a7553

Please sign in to comment.