@@ -3,24 +3,19 @@ JSDoc for VueJS
3
3
4
4
[ ![ npm version] ( https://badge.fury.io/js/jsdoc-vuejs.svg )] ( https://badge.fury.io/js/jsdoc-vuejs )
5
5
[ ![ 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 )
7
7
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.
13
9
14
10
## Installation
15
11
16
12
``` bash
17
- $ yarn add jsdoc-vuejs -D
18
- # $ npm i jsdoc-vuejs -D
13
+ $ npm install --save-dev jsdoc-vuejs
19
14
```
20
15
21
16
## Usage
22
17
23
- Update your JSDoc configuration
18
+ Your should update your JSDoc configuration to enable JSDoc-VueJS:
24
19
25
20
``` json
26
21
{
@@ -29,47 +24,112 @@ Update your JSDoc configuration
29
24
],
30
25
"source" : {
31
26
"includePattern" : " \\ .(vue|js)$"
32
- },
33
- "jsdoc-vuejs" : {}
27
+ }
34
28
}
35
29
```
36
30
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 ) .
38
38
39
39
``` vue
40
40
<template>
41
- <div>Foo </div>
41
+ <div>Hello world! </div>
42
42
</template>
43
43
44
44
<script>
45
45
/**
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
48
50
*/
49
51
export default {
52
+ props: {
53
+ initialCounter: {
54
+ type: Number,
55
+ required: true,
56
+ },
57
+ step: {
58
+ type: Number,
59
+ default: 1,
60
+ },
61
+ },
50
62
data () {
51
- return {}
63
+ return {
64
+ counter: 0,
65
+ }
66
+ },
67
+ computed: {
68
+ message() {
69
+ return `Current value is ${this.counter}`;
70
+ }
52
71
}
53
72
}
54
73
</script>
55
74
```
56
75
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 )
58
97
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:
60
118
61
119
``` bash
62
120
$ 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 ..
66
127
```
67
128
68
- Then run:
129
+ And then run Cypress :
69
130
70
131
``` bash
71
- $ yarn test
72
- # $ npm test
132
+ $ yarn cypress run
73
133
```
74
134
75
135
## License
0 commit comments