Skip to content

Commit 9d3104b

Browse files
committed
initial commit 🎉
1 parent 72d11a2 commit 9d3104b

File tree

7 files changed

+6467
-15
lines changed

7 files changed

+6467
-15
lines changed

.github/workflows/on_push.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
on: [push, pull_request]
2+
name: Build PR & Push
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
strategy:
7+
matrix:
8+
node-version: [12.x, 14.x]
9+
steps:
10+
- uses: actions/checkout@v1
11+
- name: Use Node.js ${{ matrix.node-version }}
12+
uses: actions/setup-node@v1
13+
with:
14+
node-version: ${{ matrix.node-version }}
15+
- name: npm install, lint, and build
16+
run: |
17+
npm i
18+
npm run lint
19+
npm run build

.github/workflows/on_release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Release
2+
on:
3+
release:
4+
types: [released]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v1
10+
- uses: actions/setup-node@v1
11+
with:
12+
node-version: 12
13+
registry-url: https://registry.npmjs.org/
14+
- name: npm install
15+
run: npm i
16+
- name: publish
17+
run: npm publish pkg/
18+
env:
19+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@ dist
102102

103103
# TernJS port file
104104
.tern-port
105+
106+
# pika
107+
pkg/

README.md

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,54 @@
1-
# My Typescript Template
1+
# Docusaurus Plugin `react-docgen-typescript`
22

3-
A small template that I use to build node typescript-based projects.
3+
A Docusaurus 2.x plugin that help generate and consume auto-generated docs from `react-docgen-typescript`.
44

5-
## Stack
5+
## Installation
66

7-
* `typescript`
8-
* `@pika/pack`
9-
* `eslint`
10-
* `prettier`
7+
Grab from NPM and install along with `react-docgen-typescript`:
8+
9+
```sh
10+
npm i docusaurus-plugin-react-docgen-typescript react-docgen-typescript # or
11+
yarn add docusaurus-plugin-react-docgen-typescript react-docgen-typescript
12+
```
13+
14+
## Usage
15+
16+
Inside your `docusaurus.config.js` add to the `plugins` field and configure with the `src` option with full glob support :+1:.
17+
18+
```js
19+
module.exports = {
20+
// ...
21+
plugins: [
22+
[
23+
'docusaurus-plugin-react-docgen-typescript',
24+
{
25+
// pass in a single string or an array of strings
26+
src: ['path/to/**/*.tsx', '!path/to/**/*test.*'],
27+
global: true,
28+
parserOptions: {
29+
propFilter: (prop, component) => {
30+
if (prop.parent) {
31+
return !prop.parent.fileName.includes('@types/react');
32+
}
33+
34+
return true;
35+
},
36+
},
37+
},
38+
],
39+
],
40+
};
41+
```
42+
43+
Any pattern supported by [`fast-glob`](https://github.com/mrmlnc/fast-glob) is allowed here (including negations).
44+
45+
## Options
46+
47+
| Name | Type | Required | Description |
48+
| ----------------- | ---------------------------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
49+
| `src` | `string` \| `string[]` | Yes | Tell `react-docgen` where to look for source files. |
50+
| `global` | `boolean` | No | Store results so they're [globally accessible](https://v2.docusaurus.io/docs/docusaurus-core#useplugindatapluginname-string-pluginid-string) in docusaurus |
51+
| `route` | [`RouteConfig`](https://v2.docusaurus.io/docs/lifecycle-apis#actions) | No | Makes docgen results accessible at the specified URL. Note `modules` cannot be overridden. |
52+
| `tsConfig` | `string` | No | Specify the path to your custom tsconfig file (note that in most cases the default config is sufficient) |
53+
| `compilerOptions` | `CompilerOptions` | No | Pass custom ts compiler options in lieu of of a custom `tsConfig` |
54+
| `parserOptions` | [`ParserOptions`](https://github.com/styleguidist/react-docgen-typescript#options) | No | Options passed to `react-docgen-typescript` |

0 commit comments

Comments
 (0)