Skip to content

Commit 4ab0e06

Browse files
authored
revert to original forked readme
1 parent bfb8d94 commit 4ab0e06

File tree

1 file changed

+200
-4
lines changed

1 file changed

+200
-4
lines changed

README.md

Lines changed: 200 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,202 @@
1-
### JSDoc for VueJS Script Setup
1+
JSDoc for VueJS
2+
===============
23

3-
This is a fork from JSDoc for VueJS [Kocal/jsdoc-vuejs](https://github.com/Kocal/jsdoc-vuejs)
4-
It adds ability to parse the `<script setup>` tag in vue component files.
5-
See documentaion in original project.
4+
[![npm version](https://badge.fury.io/js/jsdoc-vuejs.svg)](https://badge.fury.io/js/jsdoc-vuejs)
5+
[![Build Status (Travis)](https://travis-ci.org/Kocal/jsdoc-vuejs.svg?branch=master)](https://travis-ci.org/Kocal/jsdoc-vuejs)
6+
[![Build Status (AppVeyor)](https://ci.appveyor.com/api/projects/status/a36pui6w1qhqq582?svg=true)](https://ci.appveyor.com/project/Kocal/jsdoc-vuejs)
7+
[![codecov](https://codecov.io/gh/Kocal/jsdoc-vuejs/branch/master/graph/badge.svg)](https://codecov.io/gh/Kocal/jsdoc-vuejs)
8+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/850b7601f2bf4e8787a6aadbafa8afef)](https://www.codacy.com/app/kocal/jsdoc-vuejs?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Kocal/jsdoc-vuejs&amp;utm_campaign=Badge_Grade)
69

10+
A JSDoc plugin for listing props, data, computed data, and methods from `.vue` files.
11+
12+
:warning: This branch is for Vue 3. If you still use Vue 2, please see [`3.x` branch](https://github.com/Kocal/jsdoc-vuejs/tree/3.x).
13+
14+
---
15+
16+
## Requirements
17+
18+
- Node 10+
19+
- Vue 3
20+
21+
## Installation
22+
23+
```bash
24+
$ npm install --save-dev jsdoc jsdoc-vuejs
25+
```
26+
27+
You also need to install `@vue/compiler-sfc` that match your Vue version:
28+
29+
```bash
30+
$ npm install --save-dev @vue/compiler-sfc
31+
```
32+
33+
## Usage
34+
35+
Your should update your JSDoc configuration to enable JSDoc-VueJS:
36+
37+
```json
38+
{
39+
"plugins": [
40+
"node_modules/jsdoc-vuejs"
41+
],
42+
"source": {
43+
"includePattern": "\\.(vue|js)$"
44+
}
45+
}
46+
```
47+
48+
Update your .vue files with one of the following tags:
49+
50+
- `@vue-prop`
51+
- `@vue-data`
52+
- `@vue-computed`
53+
- `@vue-event`
54+
55+
All of those tags work the same way than [`@param` tag](http://usejsdoc.org/tags-param.html).
56+
57+
```vue
58+
<template>
59+
<div>Hello world!</div>
60+
</template>
61+
62+
<script>
63+
/**
64+
* @vue-prop {Number} initialCounter - Initial counter's value
65+
* @vue-prop {Number} [step=1] - Step
66+
* @vue-data {Number} counter - Current counter's value
67+
* @vue-computed {String} message
68+
* @vue-event {Number} increment - Emit counter's value after increment
69+
* @vue-event {Number} decrement - Emit counter's value after decrement
70+
*/
71+
export default {
72+
props: {
73+
initialCounter: {
74+
type: Number,
75+
required: true,
76+
},
77+
step: {
78+
type: Number,
79+
default: 1,
80+
},
81+
},
82+
data () {
83+
return {
84+
counter: 0,
85+
}
86+
},
87+
computed: {
88+
message() {
89+
return `Current value is ${this.counter}`;
90+
}
91+
},
92+
methods: {
93+
increment() {
94+
this.counter += 1;
95+
this.$emit('increment', this.counter);
96+
},
97+
decrement() {
98+
this.counter -= 1;
99+
this.$emit('decrement', this.counter);
100+
}
101+
}
102+
}
103+
</script>
104+
```
105+
106+
## Supported templates
107+
108+
The rendering engine has been rewritten in v2, it can supports every JSDoc templates that exists.
109+
110+
Actually, it supports 4 templates:
111+
- Default
112+
- [Docstrap](https://github.com/docstrap/docstrap)
113+
- [Minami](https://github.com/nijikokun/minami)
114+
- [Tui](https://github.com/nhnent/tui.jsdoc-template)
115+
116+
If you use a template that is not supported, it will use the default one as a fallback.
117+
118+
Feel free to open an issue/pull request if your template is not supported!
119+
120+
<details>
121+
<summary>Default</summary>
122+
123+
![](./screenshots/templates/default.png)
124+
125+
</details>
126+
127+
<details>
128+
<summary>Docstrap</summary>
129+
130+
![](./screenshots/templates/docstrap.png)
131+
132+
</details>
133+
134+
<details>
135+
<summary>Minami</summary>
136+
137+
![](./screenshots/templates/minami.png)
138+
139+
</details>
140+
141+
<details>
142+
<summary>Tui</summary>
143+
144+
![](./screenshots/templates/tui.png)
145+
146+
</details>
147+
148+
## Testing
149+
150+
### Install Dependencies
151+
152+
```bash
153+
$ git clone https://github.com/Kocal/jsdoc-vuejs
154+
$ cd jsdoc-vuejs
155+
$ yarn install
156+
157+
# For testing the example docs
158+
$ cd example
159+
$ yarn install
160+
```
161+
162+
#### Generate documentations
163+
164+
```bash
165+
$ cd example
166+
167+
# Generate docs for every renderer
168+
$ yarn docs:all
169+
170+
# or one by one
171+
$ yarn docs # default jsdoc template
172+
$ yarn docs:docstrap
173+
$ yarn docs:minami
174+
$ yarn docs:tui
175+
```
176+
177+
### Unit
178+
179+
```bash
180+
$ yarn test
181+
```
182+
183+
### E2E
184+
185+
Before running integration tests with [Cypress](https://cypress.io),
186+
you should generate documentation with all renderers:
187+
188+
```bash
189+
$ cd example
190+
$ yarn docs:all
191+
```
192+
193+
And then run Cypress:
194+
195+
```bash
196+
$ cd ..
197+
$ yarn cypress run
198+
```
199+
200+
## License
201+
202+
MIT.

0 commit comments

Comments
 (0)