Skip to content

Commit 351af08

Browse files
committed
feat(vuepress): switch to vuepress 2
BREAKING CHANGE: no vuepress 1 support anymore, drop older node versions Switch from chalk to kleur Fix some bugs
1 parent 4822a0a commit 351af08

File tree

17 files changed

+8893
-26962
lines changed

17 files changed

+8893
-26962
lines changed

.github/workflows/vercel-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
strategy:
1313
matrix:
14-
node-version: [16.x, 17.x]
14+
node-version: [19.x, 20.x]
1515

1616
steps:
1717
- uses: actions/checkout@v1

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ coverage
55
.vercel
66
dist
77
public
8-
documentation/code
8+
documentation/code
9+
.cache
10+
.temp

README.md

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
[![npm](https://img.shields.io/npm/v/vuepress-jsdoc.svg)](https://www.npmjs.com/package/vuepress-jsdoc)
55
[![vercel](https://img.shields.io/badge/vercel-demo-black)](https://vuepress-jsdoc-example.vercel.app)
66

7-
This npm package is a command line script, which scans your JavaScript, Vue or Typescript source code and generates markdown files for vuepress with the help of [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown) and [vue-docgen-cli](https://github.com/vue-styleguidist/vue-styleguidist/tree/dev/packages/vue-docgen-cli).
7+
This npm package serves as a command line script designed to analyze your JavaScript, Vue, or TypeScript source code. Leveraging [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown) and [vue-docgen-cli](https://github.com/vue-styleguidist/vue-styleguidist/tree/dev/packages/vue-docgen-cli), it dynamically generates markdown files tailored for VuePress.
88

99
![CLI ./example](https://user-images.githubusercontent.com/15351728/131877824-0124e47f-9080-4976-88d0-84ad04b64f24.gif)
1010

11+
## Vuepress support
12+
13+
This npm package is compatible with VuePress 2; however, it requires a version lower than `5.0.0` for proper functionality with VuePress 1.
14+
1115
## How to
1216

1317
```bash
@@ -24,29 +28,6 @@ vuepress-jsdoc --source ./src --dist ./documentation --folder code --title API -
2428

2529
You can also use `npx vuepress-jsdoc`, if you want.
2630

27-
#### Plugin (Dev-Mode) `alpha`
28-
29-
You can use `vuepress-jsdoc` also as plugin.
30-
This plugin watches you generated files.
31-
32-
```javascript
33-
// ./documentation/.vuepress/config.js
34-
plugins: [
35-
[
36-
require('vuepress-jsdoc').default,
37-
{
38-
folder: 'code',
39-
source: './dist',
40-
dist: './documentation',
41-
title: 'API',
42-
partials: ['./example/partials/*.hbs'],
43-
readme: './README.md',
44-
exclude: '**/*.d.ts,**/interfaces.*,**/constants.*,**/cmds.*'
45-
}
46-
]
47-
];
48-
```
49-
5031
#### Watch-Mode `alpha`
5132

5233
If you do not want to run`vuepress-jsdoc` again and again and again.
@@ -137,12 +118,13 @@ module.exports = {
137118

138119
## Custom readme
139120

140-
You can easily add a custom path to your readme by using the `--readme ./path/to/file.md` parameter. If you move a `README.md` inside your source folder, it should resolve it automatically.
141-
You can set the title by passing it to the `sidebarTree('Mainpage title')` function inside your `./.vuepress/config.js`.
121+
To include a custom path for your readme, simply utilize the `--readme ./path/to/file.md` parameter. If you relocate a `README.md` file into your source folder, the system will automatically resolve it.
122+
123+
For setting the title, provide it as an argument to the `sidebarTree('Mainpage title')` function within your `./.vuepress/config.js` file.
142124

143125
## @vuepress comment block
144126

145-
You can add custom meta data to your pages by using the `@vuepress` block:
127+
Enhance your page customization by incorporating custom metadata through the `@vuepress` block:
146128

147129
```javascript
148130
/*
@@ -160,15 +142,13 @@ Use `headline` to add a custom `h1` title.
160142

161143
## Typescript
162144

163-
To use typescript, you have to install these dev-dependencies:
145+
To integrate TypeScript support, install the following dev-dependencies with the following command:
164146

165147
```bash
166148
npm install -D typescript jsdoc-babel @babel/cli @babel/core @babel/preset-env @babel/preset-typescript jsdoc-to-markdown
167149
```
168150

169-
Next, you have to add a `jsdoc.json` to your project with some settings and add it with the `-c` parameter.
170-
You can find a full working example with all settings inside the `./example` folder.
171-
The example shows also how to use babel-`plugins`.
151+
After installation, include a `jsdoc.json` file in your project with specific settings, and reference it using the `-c` parameter. For a comprehensive example with all the necessary configurations, refer to the `./example` folder. The example also demonstrates the usage of Babel plugins.
172152

173153
## Example
174154

documentation/.vuepress/config.js

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,30 @@
1-
const { sidebarTree } = require('../code/config');
1+
import { defaultTheme } from '@vuepress/theme-default';
2+
import { sidebarTree } from '../code/config';
23

3-
module.exports = {
4+
export default {
45
contentLoading: true,
56
dest: 'public',
67
title: 'vuepress-jsdoc',
78
description: 'vuepress-jsdoc documented with itself',
8-
plugins: [
9-
[
10-
// require('vuepress-jsdoc')
11-
require('../../dist/index.js').default,
12-
{
13-
folder: 'code',
14-
source: './dist',
15-
dist: './documentation',
16-
title: 'API',
17-
partials: ['./example/partials/*.hbs'],
18-
readme: './README.md',
19-
exclude: '**/*.d.ts,**/interfaces.*,**/constants.*,**/cmds.*'
20-
}
21-
]
22-
],
239
locales: {
2410
'/': {
2511
title: 'vuepress-jsdoc',
26-
description: 'A CLI to create jsdoc md files for vuepress'
12+
description: 'A CLI to create jsdoc md files for vuepress',
13+
home: '/code/'
2714
}
2815
},
29-
themeConfig: {
30-
sidebarDepth: 4,
16+
theme: defaultTheme({
3117
locales: {
3218
'/': {
33-
nav: [
19+
navbar: [
3420
{
3521
text: 'Home',
3622
link: '/'
3723
},
24+
{
25+
text: 'Code',
26+
link: '/code/'
27+
},
3828
{
3929
text: 'Github',
4030
link: 'https://github.com/ph1p/vuepress-jsdoc'
@@ -46,5 +36,5 @@ module.exports = {
4636
}
4737
}
4838
}
49-
}
39+
})
5040
};
Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,33 @@
1-
const { sidebarTree } = require('../code/config');
1+
import { defaultTheme } from '@vuepress/theme-default';
2+
import { sidebarTree } from '../code/config';
23

3-
module.exports = {
4+
export default {
45
contentLoading: true,
56
dest: 'public',
6-
title: 'Hello vuepress-jsdoc',
7+
title: 'vuepress-jsdoc',
78
description: 'Just playing around with vuepress-jsdoc',
8-
/*plugins: [
9-
[
10-
// require('vuepress-jsdoc')
11-
require('../../../dist/index.js').default,
12-
{
13-
folder: 'code',
14-
jsDocConfigPath: './jsdoc.json',
15-
source: './src',
16-
dist: './documentation',
17-
title: 'API'
18-
}
19-
]
20-
],*/
219
locales: {
2210
'/': {
2311
title: 'vuepress-jsdoc',
24-
description: 'A CLI to create jsdoc md files for vuepress'
12+
description: 'A CLI to create jsdoc md files for vuepress',
13+
home: '/code/'
2514
}
2615
},
27-
themeConfig: {
28-
sidebarDepth: 4,
16+
theme: defaultTheme({
2917
locales: {
3018
'/': {
31-
nav: [
19+
navbar: [
3220
{
3321
text: 'Home',
3422
link: '/'
23+
},
24+
{
25+
text: 'Code',
26+
link: '/code/'
27+
},
28+
{
29+
text: 'Github',
30+
link: 'https://github.com/ph1p/vuepress-jsdoc'
3531
}
3632
],
3733
// Add the generated sidebar
@@ -40,5 +36,5 @@ module.exports = {
4036
}
4137
}
4238
}
43-
}
39+
})
4440
};

0 commit comments

Comments
 (0)