Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Commit

Permalink
⭐ new: setup documentation with gitbook
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Jun 8, 2016
1 parent 0a7260f commit 78a57a8
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 1 deletion.
12 changes: 11 additions & 1 deletion meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@ module.exports = {
e2e: {
type: 'confirm',
message: 'Setup e2e tests?'
},
gitbook: {
type: 'confirm',
message: 'Setup gitbook documentaion?'
}
},
filters: {
"examples/**/*": 'e2e',
"test/e2e/**/*": 'e2e'
"test/e2e/**/*": 'e2e',
"docs/**/**": 'gitbook'
},
helpers: {
nowYear: function () {
Expand All @@ -42,6 +47,11 @@ module.exports = {
const startPosition = author.indexOf('<')
const endPosition = author.indexOf('>')
return author.slice(startPosition + 1, endPosition)
},
classify: function (str) {
return str.replace(/(?:^|[-_\/])(\w)/g, function (_, c) {
return c ? c.toUpperCase() : ''
})
}
}
}
4 changes: 4 additions & 0 deletions template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

{{ description }}

{{#gitbook}}{{#unless_eq githubAccount ""}}
## Documentation
See [here](http://{{ githubAccount }}.github.io/{{ name }}/)
{{/unless_eq}}{{/gitbook}}

## Build Setup

Expand Down
1 change: 1 addition & 0 deletions template/docs/LANGS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [English](en/)
21 changes: 21 additions & 0 deletions template/docs/book.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"gitbook": "2.x.x",
"plugins": ["edit-link", "github", "advanced-emoji"],
"pluginsConfig": {
{{#unless_eq githubAccount ""}}
"edit-link": {
"base": "https://github.com/{{ githubAccount }}/{{ name }}/tree/master/docs",
"label": "Edit This Page"
},
"github": {
"url": "https://github.com/{{ githubAccount }}/{{ name }}/"
}
{{/unless_eq}}
},
"links": {
"sharing": {
"facebook": false,
"twitter": false
}
}
}
1 change: 1 addition & 0 deletions template/docs/en/README.md
9 changes: 9 additions & 0 deletions template/docs/en/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# {{ name }} documentation

> {{ description }}
{{#unless_eq githubAccount ""}}
**[CHANGELOG](https://github.com/{{ githubAccount }}/{{ name }}/blob/master/CHANGELOG.md)**
{{/unless_eq}}

- [Installation](installation.md)
34 changes: 34 additions & 0 deletions template/docs/en/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Installation

{{#unless_eq githubAccount ""}}
## Direct Download

See [dist folder](https://github.com/{{ githubAccount }}/{{ name }}/tree/master/dist). Note the dist files are always the latest stable - it's not update-to-date with the master branch source.
{{/unless_eq}}

## NPM

### stable version

$ npm install {{ name }}

{{#unless_eq githubAccount ""}}
### development version

$ git clone https://github.com/{{ githubAccount }}/{{ name }}.git node_modules/{{ name }}
$ cd node_modules/{{ name }}
$ npm install
$ npm run build

When used in CommonJS, you must explicitly install the validator via `Vue.use()`:
{{/unless_eq}}


```javascript
const Vue = require('vue')
const {{ classify name }} = require('{{ name }}')

Vue.use({{ classify name }})
```

You don't need to do this when using the standalone build, as it installs itself automatically.
12 changes: 12 additions & 0 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
"eslint": "^2.8.0",
"eslint-config-vue": "^1.0.0",
"eslint-loader": "^1.3.0",
{{#gitbook}}
"gitbook-cli": "^2.2.0",
{{/gitbook}}
"jasmine": "^2.4.1",
"jasmine-core": "^2.4.1",
"json-loader": "^0.5.4",
Expand Down Expand Up @@ -78,7 +81,16 @@
"scripts": {
"build": "NODE_ENV=production node config/build.js",
"dev": "webpack-dev-server --quiet --config config/webpack.dev.conf.js --host 0.0.0.0",
{{#gitbook}}
"docs": "cd docs && gitbook serve",
{{#unless_eq githubAccount ""}}
"docs:deploy": "cd docs && rm -rf _book && gitbook build && cd _book && git init && git add -A && git commit -m 'update book' && git push -f git@github.com:{{ githubAccount }}/{{ name }}.git master:gh-pages && cd .. && cd ..",
{{/unless_eq}}
{{/gitbook}}
"lint": "eslint src test config",
{{#gitbook}}
"postinstall": "cd docs && gitbook install && cd ..",
{{/gitbook}}
"test": "npm run lint && npm run test:unit{{#e2e}} && npm run test:e2e{{/e2e}}",
"test:cover": "NODE_ENV=development karma start config/karma.cover.conf.js",
{{#e2e}}
Expand Down

0 comments on commit 78a57a8

Please sign in to comment.