Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically generate props documentation from types #73

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
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
40 changes: 25 additions & 15 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
module.exports =
process.env.NODE_ENV === 'test'
? {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
}
: {}
var value = {}

if (process.env.NODE_ENV === 'test') {
value = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
}
} else if (process.env.NODE_ENV === 'docs') {
value = {
presets: [
'@babel/preset-env',
'@babel/preset-react',
'@babel/preset-typescript',
],
}
}
module.exports = value
29 changes: 29 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# carbonplan / maps / docs

**docs site for `@carbonplan/maps` — [live](https://maps.docs.carbonplan.org/maps)**

## development

Assuming you already have `Node.js` installed, you can install the build dependencies as:

```shell
npm install .
```

To start a development version of the site, simply run:

```shell
npm run dev
```

and then visit `http://localhost:3001/maps` in your browser.

### prop types

The docs site uses the automatically generated prop definitions in `components/component-props.json` to render `PropsTable`s typed components. To regenerate these prop definitions in the main `maps` project, you can run:

```shell
npm run build-docs
```

and check in the updates to `component-props.json`.
Loading