Skip to content

Commit 1cfe3c4

Browse files
authored
doc: rewrite README for v2 (#70)
* chore: add generated docs & cypress screens/videos to .gitignore * doc: add screenshots for renderers * doc: rewrite README * refactor: use yarn scripts as a shortcut instead of long command * chore(ci): put example/node_modules in cache
1 parent 277a326 commit 1cfe3c4

File tree

8 files changed

+99
-28
lines changed

8 files changed

+99
-28
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,7 @@ typings/
5656

5757
# dotenv environment variables file
5858
.env
59+
60+
example/docs*
61+
cypress/screenshots/
62+
cypress/videos/

.travis.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ cache:
1212
yarn: true
1313
directories:
1414
- node_modules
15+
- example/node_modules
1516
- ~/.cache
1617

1718
before_install:
@@ -26,10 +27,10 @@ before_script:
2627
- export DISPLAY=:99.0
2728
- sh -e /etc/init.d/xvfb start
2829
- cd example
29-
- yarn jsdoc -d docs -c jsdoc.json
30-
- yarn jsdoc -d docs-docstrap -c jsdoc.json -t ./node_modules/ink-docstrap/template
31-
- yarn jsdoc -d docs-minami -c jsdoc.json -t ./node_modules/minami
32-
- yarn jsdoc -d docs-tui -c jsdoc.json -t ./node_modules/tui-jsdoc-template
30+
- yarn docs
31+
- yarn docs:docstrap
32+
- yarn docs:minami
33+
- yarn docs:tui
3334
- cd ..
3435

3536
script:

README.md

+84-24
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,19 @@ JSDoc for VueJS
33

44
[![npm version](https://badge.fury.io/js/jsdoc-vuejs.svg)](https://badge.fury.io/js/jsdoc-vuejs)
55
[![Build Status](https://travis-ci.org/Kocal/jsdoc-vuejs.svg?branch=master)](https://travis-ci.org/Kocal/jsdoc-vuejs)
6-
[![Coverage Status](https://coveralls.io/repos/github/Kocal/jsdoc-vuejs/badge.svg?branch=master)](https://coveralls.io/github/Kocal/jsdoc-vuejs?branch=master)
6+
[![codecov](https://codecov.io/gh/Kocal/jsdoc-vuejs/branch/master/graph/badge.svg)](https://codecov.io/gh/Kocal/jsdoc-vuejs)
77

8-
> A wobbly JSDoc plugin for listing props, data, computed data, and methods from *.vue files.
9-
10-
> WARNING: Actually, it's only working with the default JSDoc template.
11-
12-
## [Demo](https://kocal.github.io/jsdoc-vuejs-demo-docs/)
8+
> A JSDoc plugin for listing props, data, computed data, and methods from *.vue files.
139
1410
## Installation
1511

1612
```bash
17-
$ yarn add jsdoc-vuejs -D
18-
# $ npm i jsdoc-vuejs -D
13+
$ npm install --save-dev jsdoc-vuejs
1914
```
2015

2116
## Usage
2217

23-
Update your JSDoc configuration
18+
Your should update your JSDoc configuration to enable JSDoc-VueJS:
2419

2520
```json
2621
{
@@ -29,47 +24,112 @@ Update your JSDoc configuration
2924
],
3025
"source": {
3126
"includePattern": "\\.(vue|js)$"
32-
},
33-
"jsdoc-vuejs": {}
27+
}
3428
}
3529
```
3630

37-
Update your .vue files:
31+
Update your .vue files with one of the following tags:
32+
33+
- `@vue-prop`
34+
- `@vue-data`
35+
- `@vue-computed`
36+
37+
All of those tags work the same way than [`@param` tag](http://usejsdoc.org/tags-param.html).
3838

3939
```vue
4040
<template>
41-
<div>Foo</div>
41+
<div>Hello world!</div>
4242
</template>
4343
4444
<script>
4545
/**
46-
* Add the @vue tag here
47-
* @vue
46+
* @vue-prop {Number} initialCounter - Initial counter's value
47+
* @vue-prop {Number} [step=1] - Step
48+
* @vue-data {Number} counter - Current counter's value
49+
* @vue-computed {String} message
4850
*/
4951
export default {
52+
props: {
53+
initialCounter: {
54+
type: Number,
55+
required: true,
56+
},
57+
step: {
58+
type: Number,
59+
default: 1,
60+
},
61+
},
5062
data () {
51-
return {}
63+
return {
64+
counter: 0,
65+
}
66+
},
67+
computed: {
68+
message() {
69+
return `Current value is ${this.counter}`;
70+
}
5271
}
5372
}
5473
</script>
5574
```
5675

57-
## Tests
76+
## Supported templates
77+
78+
The rendering engine has been rewritten in v2, it can supports every JSDoc templates that exists.
79+
80+
Actually, it supports 4 templates:
81+
- Default
82+
- [Docstrap](https://github.com/docstrap/docstrap)
83+
- [Minami](https://github.com/nijikokun/minami)
84+
- [Tui](https://github.com/nhnent/tui.jsdoc-template)
85+
86+
If you use a template that is not supported, it will use the default one as a fallback.
87+
88+
Feel free to open an issue/pull request if your template is not supported!
89+
90+
### Default
91+
92+
![](./screenshots/renderers/default.png)
93+
94+
### [Docstrap](https://github.com/docstrap/docstrap)
95+
96+
![](./screenshots/renderers/docstrap.png)
5897

59-
Before running tests, you should generate a JSDoc documentation inside `example` folder:
98+
### [Minami](https://github.com/nijikokun/minami)
99+
100+
![](./screenshots/renderers/minami.png)
101+
102+
### [Tui](https://github.com/nhnent/tui.jsdoc-template)
103+
104+
![](./screenshots/renderers/tui.png)
105+
106+
## Testing
107+
108+
### Unit
109+
110+
```bash
111+
$ yarn test
112+
```
113+
114+
### E2E
115+
116+
Before running integration tests with [Cypress](https://cypress.io),
117+
you should generate documentation with all renderers:
60118

61119
```bash
62120
$ cd example
63-
$ yarn && yarn docs
64-
# $ npm install && npm run docs
65-
$ $ cd ..
121+
$ yarn
122+
$ yarn docs
123+
$ yarn docs:docstrap
124+
$ yarn docs:minami
125+
$ yarn docs:tui
126+
$ cd ..
66127
```
67128

68-
Then run:
129+
And then run Cypress:
69130

70131
```bash
71-
$ yarn test
72-
# $ npm test
132+
$ yarn cypress run
73133
```
74134

75135
## License

example/package.json

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
{
2+
"scripts": {
3+
"docs": "jsdoc -d docs -c jsdoc.json",
4+
"docs:docstrap": "jsdoc -d docs-docstrap -c jsdoc.json -t ./node_modules/ink-docstrap/template",
5+
"docs:minami": "jsdoc -d docs-minami -c jsdoc.json -t ./node_modules/minami",
6+
"docs:tui": "jsdoc -d docs-tui -c jsdoc.json -t ./node_modules/tui-jsdoc-template"
7+
},
28
"dependencies": {
39
"ink-docstrap": "^1.3.2",
410
"jsdoc": "^3.5.5",

screenshots/renderers/default.png

77.6 KB
Loading

screenshots/renderers/docstrap.png

55.4 KB
Loading

screenshots/renderers/minami.png

62.5 KB
Loading

screenshots/renderers/tui.png

51.1 KB
Loading

0 commit comments

Comments
 (0)