Skip to content

Commit

Permalink
initial commit 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
atomicpages committed Aug 31, 2020
1 parent 72d11a2 commit 9d3104b
Show file tree
Hide file tree
Showing 7 changed files with 6,467 additions and 15 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on: [push, pull_request]
name: Build PR & Push
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, lint, and build
run: |
npm i
npm run lint
npm run build
19 changes: 19 additions & 0 deletions .github/workflows/on_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Release
on:
release:
types: [released]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: npm install
run: npm i
- name: publish
run: npm publish pkg/
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ dist

# TernJS port file
.tern-port

# pika
pkg/
58 changes: 51 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,54 @@
# My Typescript Template
# Docusaurus Plugin `react-docgen-typescript`

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

## Stack
## Installation

* `typescript`
* `@pika/pack`
* `eslint`
* `prettier`
Grab from NPM and install along with `react-docgen-typescript`:

```sh
npm i docusaurus-plugin-react-docgen-typescript react-docgen-typescript # or
yarn add docusaurus-plugin-react-docgen-typescript react-docgen-typescript
```

## Usage

Inside your `docusaurus.config.js` add to the `plugins` field and configure with the `src` option with full glob support :+1:.

```js
module.exports = {
// ...
plugins: [
[
'docusaurus-plugin-react-docgen-typescript',
{
// pass in a single string or an array of strings
src: ['path/to/**/*.tsx', '!path/to/**/*test.*'],
global: true,
parserOptions: {
propFilter: (prop, component) => {
if (prop.parent) {
return !prop.parent.fileName.includes('@types/react');
}

return true;
},
},
},
],
],
};
```

Any pattern supported by [`fast-glob`](https://github.com/mrmlnc/fast-glob) is allowed here (including negations).

## Options

| Name | Type | Required | Description |
| ----------------- | ---------------------------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `src` | `string` \| `string[]` | Yes | Tell `react-docgen` where to look for source files. |
| `global` | `boolean` | No | Store results so they're [globally accessible](https://v2.docusaurus.io/docs/docusaurus-core#useplugindatapluginname-string-pluginid-string) in docusaurus |
| `route` | [`RouteConfig`](https://v2.docusaurus.io/docs/lifecycle-apis#actions) | No | Makes docgen results accessible at the specified URL. Note `modules` cannot be overridden. |
| `tsConfig` | `string` | No | Specify the path to your custom tsconfig file (note that in most cases the default config is sufficient) |
| `compilerOptions` | `CompilerOptions` | No | Pass custom ts compiler options in lieu of of a custom `tsConfig` |
| `parserOptions` | [`ParserOptions`](https://github.com/styleguidist/react-docgen-typescript#options) | No | Options passed to `react-docgen-typescript` |
Loading

0 comments on commit 9d3104b

Please sign in to comment.