Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@ jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 17.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 20
- run: npm ci
- run: npm run build
- run: npm test
25 changes: 11 additions & 14 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,24 @@ jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 17.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 20
- run: npm ci
- run: npm run build
- run: npm test

release:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v1
- name: Make stable release to npm
uses: epeli/npm-release@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
type: stable
token: ${{ secrets.NPM_TOKEN }}
node-version: 20
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
15 changes: 7 additions & 8 deletions .github/workflows/vercel-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@ jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 17.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 20
- run: npm ci
- run: npm run build
- run: npm test
Expand All @@ -27,7 +23,10 @@ jobs:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: build
run: |
npm ci
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ coverage
.vercel
dist
public
documentation/code
documentation/code
.cache
.temp
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
## 5.0.0 (2023-11-23)

* feat(vuepress): switch to vuepress 2 ([351af08](https://github.com/ph1p/vuepress-jsdoc/commit/351af08))
* build(deps): update dependencies ([2e85188](https://github.com/ph1p/vuepress-jsdoc/commit/2e85188))
* build(deps): update example ([c9529fe](https://github.com/ph1p/vuepress-jsdoc/commit/c9529fe))
* build(workflow): set node 16 in github action ([4822a0a](https://github.com/ph1p/vuepress-jsdoc/commit/4822a0a))
* Make sidebar config compatible with Vuepress 2 ([592a7b5](https://github.com/ph1p/vuepress-jsdoc/commit/592a7b5))
* Wait for async `extractConfig()` call to complete ([6ddb19f](https://github.com/ph1p/vuepress-jsdoc/commit/6ddb19f))


### BREAKING CHANGE

* no vuepress 1 support anymore, drop older node versions

Switch from chalk to kleur
Fix some bugs


## <small>4.3.1 (2022-10-06)</small>

* build(deps): update dependencies and fix an npm script ([78a6e83](https://github.com/ph1p/vuepress-jsdoc/commit/78a6e83))
* 4.3.1 ([8b596fb](https://github.com/ph1p/vuepress-jsdoc/commit/8b596fb))
* build(deps): update dependencies and fix an npm script ([82a5b93](https://github.com/ph1p/vuepress-jsdoc/commit/82a5b93))
* build(deps): update dependencies and rename success to include ([dd5b6c4](https://github.com/ph1p/vuepress-jsdoc/commit/dd5b6c4))
* chore: audit example dependencies ([21823a1](https://github.com/ph1p/vuepress-jsdoc/commit/21823a1))
* chore: drop node 14 ([ae30caf](https://github.com/ph1p/vuepress-jsdoc/commit/ae30caf))
Expand Down
44 changes: 12 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
[![npm](https://img.shields.io/npm/v/vuepress-jsdoc.svg)](https://www.npmjs.com/package/vuepress-jsdoc)
[![vercel](https://img.shields.io/badge/vercel-demo-black)](https://vuepress-jsdoc-example.vercel.app)

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).
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.

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

## Vuepress support

This npm package is compatible with VuePress 2; however, it requires a version lower than `5.0.0` for proper functionality with VuePress 1.

## How to

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

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

#### Plugin (Dev-Mode) `alpha`

You can use `vuepress-jsdoc` also as plugin.
This plugin watches you generated files.

```javascript
// ./documentation/.vuepress/config.js
plugins: [
[
require('vuepress-jsdoc').default,
{
folder: 'code',
source: './dist',
dist: './documentation',
title: 'API',
partials: ['./example/partials/*.hbs'],
readme: './README.md',
exclude: '**/*.d.ts,**/interfaces.*,**/constants.*,**/cmds.*'
}
]
];
```

#### Watch-Mode `alpha`

If you do not want to run`vuepress-jsdoc` again and again and again.
Expand All @@ -66,7 +47,7 @@ Use these options after `vuepress-jsdoc`.
| --version | -v | | Show current version |
| --readme | -r | | Path to custom readme file |
| --exclude | -e | | Pattern to exclude files/folders (Comma seperated) - \*.test.js,exclude.js [more information](https://github.com/micromatch/micromatch#ismatch) |
| --include | -e | | Pattern to include files/folders (Comma seperated) - \*.test.js,exclude.js [more information](https://github.com/micromatch/micromatch#ismatch) |
| --include | -e | | Pattern to include files/folders (Comma seperated) - \*.test.js,include.js [more information](https://github.com/micromatch/micromatch#ismatch) |
| --rmPattern | -rm | | Pattern when removing files. You can ex- and include files. (glob pattern) |
| --partials | -p | | jsdoc2markdown partial templates (overwrites default ones) |
| --jsDocConfigPath | -c | | Path to [JsDoc Config](http://usejsdoc.org/about-configuring-jsdoc.html) (experimental) |
Expand Down Expand Up @@ -137,12 +118,13 @@ module.exports = {

## Custom readme

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.
You can set the title by passing it to the `sidebarTree('Mainpage title')` function inside your `./.vuepress/config.js`.
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.

For setting the title, provide it as an argument to the `sidebarTree('Mainpage title')` function within your `./.vuepress/config.js` file.

## @vuepress comment block

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

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

## Typescript

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

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

Next, you have to add a `jsdoc.json` to your project with some settings and add it with the `-c` parameter.
You can find a full working example with all settings inside the `./example` folder.
The example shows also how to use babel-`plugins`.
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.

## Example

Expand Down
34 changes: 12 additions & 22 deletions documentation/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,30 @@
const { sidebarTree } = require('../code/config');
import { defaultTheme } from '@vuepress/theme-default';
import { sidebarTree } from '../code/config';

module.exports = {
export default {
contentLoading: true,
dest: 'public',
title: 'vuepress-jsdoc',
description: 'vuepress-jsdoc documented with itself',
plugins: [
[
// require('vuepress-jsdoc')
require('../../dist/index.js').default,
{
folder: 'code',
source: './dist',
dist: './documentation',
title: 'API',
partials: ['./example/partials/*.hbs'],
readme: './README.md',
exclude: '**/*.d.ts,**/interfaces.*,**/constants.*,**/cmds.*'
}
]
],
locales: {
'/': {
title: 'vuepress-jsdoc',
description: 'A CLI to create jsdoc md files for vuepress'
description: 'A CLI to create jsdoc md files for vuepress',
home: '/code/'
}
},
themeConfig: {
sidebarDepth: 4,
theme: defaultTheme({
locales: {
'/': {
nav: [
navbar: [
{
text: 'Home',
link: '/'
},
{
text: 'Code',
link: '/code/'
},
{
text: 'Github',
link: 'https://github.com/ph1p/vuepress-jsdoc'
Expand All @@ -46,5 +36,5 @@ module.exports = {
}
}
}
}
})
};
38 changes: 17 additions & 21 deletions example/documentation/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
const { sidebarTree } = require('../code/config');
import { defaultTheme } from '@vuepress/theme-default';
import { sidebarTree } from '../code/config';

module.exports = {
export default {
contentLoading: true,
dest: 'public',
title: 'Hello vuepress-jsdoc',
title: 'vuepress-jsdoc',
description: 'Just playing around with vuepress-jsdoc',
/*plugins: [
[
// require('vuepress-jsdoc')
require('../../../dist/index.js').default,
{
folder: 'code',
jsDocConfigPath: './jsdoc.json',
source: './src',
dist: './documentation',
title: 'API'
}
]
],*/
locales: {
'/': {
title: 'vuepress-jsdoc',
description: 'A CLI to create jsdoc md files for vuepress'
description: 'A CLI to create jsdoc md files for vuepress',
home: '/code/'
}
},
themeConfig: {
sidebarDepth: 4,
theme: defaultTheme({
locales: {
'/': {
nav: [
navbar: [
{
text: 'Home',
link: '/'
},
{
text: 'Code',
link: '/code/'
},
{
text: 'Github',
link: 'https://github.com/ph1p/vuepress-jsdoc'
}
],
// Add the generated sidebar
Expand All @@ -40,5 +36,5 @@ module.exports = {
}
}
}
}
})
};
39 changes: 0 additions & 39 deletions example/documentation/code/Icon.md

This file was deleted.

3 changes: 2 additions & 1 deletion example/documentation/code/components/sub/sub-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ title: sub-test
| Prop name | Description | Type | Values | Default |
| ------------- | ----------- | --------- | ----------- | ----------- |
| msg | object/array defaults should be returned from a factory function<br/>`@version` 1.0.5<br/>`@since` Version 1.0.1<br/>`@see` See [Wikipedia](https://en.wikipedia.org/wiki/Web_colors#HTML_color_names) for a list of color names<br/>`@link` See [Wikipedia](https://en.wikipedia.org/wiki/Web_colors#HTML_color_names) for a list of color names | string\|number | - | text |
| myF | Function | func | - | (param, param2) => {} |
| myF | Function | func | - | (param, param2) =&gt; {} |
| v-model | Model example<br/>`@model` true | string | - | |
| data | describe data<br/>`@version` 1.0.5 | array | - | |
| columns | get columns list | array | - | |
Expand Down Expand Up @@ -69,6 +69,7 @@ title: sub-test
| header | Use this slot header | |
| footer | Use this slot footer | |


---


Expand Down
Loading