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

Added support for asciidoc and custom handlebar templates #2

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f490dbf
Added support for asciidoc and custom handlebar templates
frode-carlsen Apr 9, 2017
2c3f86a
Rename to react-asciidoc-generator as react-doc-generator is not resp…
frode-carlsen Apr 27, 2017
cd05aa3
.gitignore
frode-carlsen Apr 27, 2017
a500266
Merge branch 'master' of https://github.com/frode-carlsen/react-doc-g…
frode-carlsen Apr 27, 2017
5874cc8
small change package.json
frode-carlsen Apr 27, 2017
b19b50e
fix babel ignore
frode-carlsen Apr 27, 2017
6bc0b33
Fix .npmignore
frode-carlsen Apr 27, 2017
5d78a4b
added npm prepubish
frode-carlsen Apr 27, 2017
1a285af
changed prepublish npm script
frode-carlsen Apr 27, 2017
839950b
updated version no, license and acknowledgemen info
frode-carlsen Apr 27, 2017
2fd55b4
added es2016 presets
frode-carlsen Apr 27, 2017
015b862
regexp exclude pattern
frode-carlsen Apr 27, 2017
1b976fc
regexp exclude pattern
frode-carlsen Apr 27, 2017
cecaeb2
changing filename pattern
frode-carlsen Apr 27, 2017
de974a9
working exclude pattern using regexp
frode-carlsen Apr 28, 2017
92e210a
excluding .spec.jsx and .spec.js by default
frode-carlsen Apr 28, 2017
99fb73d
updated version
frode-carlsen Apr 28, 2017
6a278eb
normalize paths (exclude rootDir from output names)
frode-carlsen May 3, 2017
4c7af79
updated version to 1.5.7
frode-carlsen May 3, 2017
2472194
updated README and version to 1.5.8
frode-carlsen May 3, 2017
1dc5a92
Update README.md
frode-carlsen Apr 19, 2018
2091aec
fix: package.json to reduce vulnerabilities
snyk-bot Aug 3, 2018
299d1b2
Merge pull request #2 from frode-carlsen/snyk-fix-5bhe9p
frode-carlsen Aug 3, 2018
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
7 changes: 7 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ignore": [
"__tests__",
"__mocks__"
],
"presets": [ "es2015", "es2016" ]
}
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# react-doc-generator
# react-asciidoc-generator
dist
node

# Logs
logs
Expand Down Expand Up @@ -38,3 +39,8 @@ jspm_packages

# Optional REPL history
.node_repl_history

#Other
/cmd
/node
pom.xml
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# react-doc-generator
# react-asciidoc-generator
# Logs
demo
logs
Expand Down Expand Up @@ -30,6 +30,7 @@ build/Release

# Dependency directories
node_modules
node
jspm_packages

# Optional npm cache directory
Expand Down
67 changes: 67 additions & 0 deletions DOCUMENTATION.ADOC
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
= Components

:numbered:


== File: *..\react-doc-generator-test\test\ExampleComponent.js*

=== General component description.

fdgdfgdf gfdgfdg fdgfdgdfg
gdfgfdgdfg dfgdfgfdg dfg df getDefaultPropsg fdgfd
gfdgfdgdfgfdg.


Example:
```html
<Component name="bebe" />
```



[options="header"]
|===
|Property | Type | Required | Default value | Description
|foo|number|no|42|Description of prop &quot;foo&quot;.
|bar|custom|no|21|Description of prop &quot;bar&quot; (a custom validation function).
|baz|union|no||

|===



== File: *..\react-doc-generator-test\test\inside\OtherExampleComponent.js*

=== General component description.



[options="header"]
|===
|Property | Type | Required | Default value | Description
|foo|number|no|10000099999|Description of prop &quot;foo&quot;.
|bar|custom|no||Description of prop &quot;bar&quot; (a custom validation function).
|baz|union|no||
|onExit|func|no|&lt;See the source code&gt;|

|===

=== DUPA

General another component description.
Blah blah blah...
fdfdfsdf
fdsfsd



[options="header"]
|===
|Property | Type | Required | Default value | Description
|foo|number|no||Description of prop &quot;foo&quot;.
|bar|custom|no||Description of prop &quot;bar&quot; (a custom validation function).
|baz|union|no||

|===


Expand Down
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,25 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

MIT License

Copyright (c) 2017 Frode Carlsen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
46 changes: 29 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,47 @@
# React DOC Generator
[![npm version](https://img.shields.io/npm/v/react-doc-generator.svg?style=flat-square)](https://www.npmjs.com/package/react-doc-generator)
[![dependency status](https://img.shields.io/david/marborkowski/react-doc-generator.svg?style=flat-square)](https://david-dm.org/marborkowski/react-doc-generator)
[![build status](https://img.shields.io/travis/marborkowski/react-doc-generator.svg?style=flat-square)](https://travis-ci.org/marborkowski/react-doc-generator)
[![npm version](https://img.shields.io/npm/v/react-asciidoc-generator.svg?style=flat-square)](https://www.npmjs.com/package/react-asciidoc-generator)
[![dependency status](https://img.shields.io/david/frode-carlsen/react-asciidoc-generator.svg?style=flat-square)](https://david-dm.org/frode-carlsen/react-asciidoc-generator)
[![build status](https://img.shields.io/travis/frode-carlsen/react-asciidoc-generator.svg?style=flat-square)](https://travis-ci.org/frode-carlsen/react-asciidoc-generator)
[![Known Vulnerabilities](https://snyk.io/test/github/frode-carlsen/react-asciidoc-generator/badge.svg?targetFile=package.json)](https://snyk.io/test/github/frode-carlsen/react-asciidoc-generator?targetFile=package.json)

Generate simple React components documentation in [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet).
This is a fork of [react-doc-generator](https://github.com/frode-carlsen/react-doc-generator) to provide additional features for asciidoc or custom templates.

Generate simple React components documentation in either
* [Asciidoc](http://asciidoctor.org/docs/).
* [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet).
* Any custom handlebar template

## Installation

`$ npm install -save-dev react-doc-generator`
`$ npm install -save-dev react-asciidoc-generator`

## Usage

Check every option runnig `react-doc-generator` with `--help` or `-h`:
Check every option running `react-asciidoc-generator` with `--help` or `-h`:

```
$ react-doc-generator --help
$ react-asciidoc-generator --help

Usage: react-doc-generator <dir> [options]
Usage: react-asciidoc-generator <dir> [options]

Options:

-h, --help output usage information
-V, --version output the version number
-x, --extensions <items> Include only these file extensions. Default: js,jsx
-f, --format <format> Output format (asciiddoc|asciidoc) [asciidoc]
-i, --ignore <items> Folders to ignore. Default: node_modules,__tests__,__mocks__
-e, --exclude-patterns <items> Filename patterns to exclude. Default: []
-e, --exclude-patterns <items> Filename patterns to exclude (may be comma-separated list of regexp). Default: '.*\.spec.(jsx|js)'
-t, --title [value]> Document title. Default: 'Components'
-o, --output <file> Markdown file to write. Default: 'README.MD'
-o, --output <file> Output file to write. Default (asciidoc): 'DOCUMENTATION.ADOC'. Default (markdown): 'DOCUMENTATION.MD'
--handlebar-template [path] Custom handlebar output template. Alternative to --format.
```

### By the command line

Example:

`$ react-doc-generator src -o DOCUMENTATION.md`
`$ react-asciidoc-generator src -o DOCUMENTATION.adoc

### NPM script

Expand All @@ -44,7 +52,7 @@ In your `package.json` put:
{
// ...
"scripts": {
"doc": "react-doc-generator ./app/components/custom -o DOCUMENTATION.md"
"doc": "react-asciidoc-generator ./app/components/custom -o DOCUMENTATION.ADOC"
}
// ...
}
Expand Down Expand Up @@ -94,22 +102,26 @@ export class MyComponent extends React.Component {
}
```

Because [**react-doc-generator**](https://github.com/marborkowski/react-doc-generator) uses [**react-docgen**](https://github.com/reactjs/react-docgen) library, you can [follow other examples here](https://github.com/reactjs/react-docgen).
Because [**react-asciidoc-generator**](https://github.com/frode-carlsen/react-asciidoc-generator) uses [**react-docgen**](https://github.com/reactjs/react-docgen) library, you can [follow other examples here](https://github.com/reactjs/react-docgen).

## Demo

* [Example output](https://github.com/marborkowski/react-doc-generator/blob/master/demo/DOCUMENTATION.md)
* [Example output](https://github.com/frode-carlsen/react-asciidoc-generator/blob/master/demo/DOCUMENTATION.adoc)

## Terminal

This is an example of what you'll see in your terminal.

![Terminal](https://raw.githubusercontent.com/marborkowski/react-doc-generator/master/demo/terminal.png)
![Terminal](https://raw.githubusercontent.com/frode-carlsen/react-asciidoc-generator/master/demo/terminal.png)

### Acknowledgemens

Forked from original module 'react-doc-generator' by Marcin Borowski (https://github.com/marborkowski/react-doc-generator)

### License
### Licenses

<sub>MIT License</sub>
<sub>Copyright (c) 2017 Marcin Borkowski (<marborkowski@gmail.com>)</sub>
<sub>Copyright (c) 2017 Marcin Borkowski (<marborowski@gmail.com>)</sub>
<sub>Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
Expand Down
67 changes: 67 additions & 0 deletions doc.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
= Components

:numbered:


== File: **

=== General component description.

fdgdfgdf gfdgfdg fdgfdgdfg
gdfgfdgdfg dfgdfgfdg dfg df getDefaultPropsg fdgfd
gfdgfdgdfgfdg.


Example:
```html
<Component name="bebe" />
```



[options="header"]
|===
|Property | Type | Required | Default value | Description
|foo|number|no|42|Description of prop &quot;foo&quot;.
|bar|custom|no|21|Description of prop &quot;bar&quot; (a custom validation function).
|baz|union|no||

|===



== File: **

=== General component description.



[options="header"]
|===
|Property | Type | Required | Default value | Description
|foo|number|no|10000099999|Description of prop &quot;foo&quot;.
|bar|custom|no||Description of prop &quot;bar&quot; (a custom validation function).
|baz|union|no||
|onExit|func|no|&lt;See the source code&gt;|

|===

=== DUPA

General another component description.
Blah blah blah...
fdfdfsdf
fdsfsd



[options="header"]
|===
|Property | Type | Required | Default value | Description
|foo|number|no||Description of prop &quot;foo&quot;.
|bar|custom|no||Description of prop &quot;bar&quot; (a custom validation function).
|baz|union|no||

|===


Expand Down
29 changes: 18 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
{
"name": "react-doc-generator",
"version": "1.2.5",
"description": "Generate a simple React Component documentation in Markdown.",
"name": "react-asciidoc-generator",
"version": "1.5.8",
"description": "Generate a simple React Component documentation in Asciidoc, Markdown, or custom template",
"main": "dist/index.js",
"bin": {
"react-doc-generator": "dist/react-doc-generator.js"
"react-asciidoc-generator": "dist/react-asciidoc-generator.js"
},
"scripts": {
"lint": "eslint src",
"transpile": "babel src -D -d dist --ignore '__tests__, __mocks__'",
"watch": "babel src -D -d dist --ignore '__tests__,__mocks__' --watch",
"transpile": "babel src -D -d dist",
"build": "babel src -D -d dist",
"watch": "babel src -D -d dist --watch",
"pretest": "npm run transpile",
"preversion": "npm run lint",
"prepublish": "babel src -D -d dist",
"test": "jest"
},
"repository": {
"type": "git",
"url": "git+https://github.com/marborkowski/react-doc-generator.git"
"url": "git+https://github.com/frode-carlsen/react-asciidoc-generator.git"
},
"author": "Marcin Borkowski",
"author": "Frode Carlsen",
"contributors": [
"Marcin Borkowski <marborowski@gmail.com> (https://github.com/marborkowski/react-doc-generator)"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/marborkowski/react-doc-generator/issues"
"url": "https://github.com/frode-carlsen/react-asciidoc-generator/issues"
},
"homepage": "https://github.com/marborkowski/react-doc-generator#readme",
"homepage": "https://github.com/frode-carlsen/react-asciidoc-generator#readme",
"keywords": [
"react",
"react-docgen",
Expand Down Expand Up @@ -51,13 +56,15 @@
"node-dir": "^0.1.16",
"react": "^15.4.2",
"react-docgen": "^2.13.0",
"react-dom": "^15.4.2"
"react-dom": "^16.0.1"
},
"devDependencies": {
"babel-cli": "^6.23.0",
"babel-eslint": "^7.1.1",
"babel-jest": "^19.0.0",
"babel-preset-env": "^1.2.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-es2016": "^6.24.1",
"eslint": "^3.17.0",
"eslint-config-react-app": "^0.5.2",
"eslint-plugin-flowtype": "^2.30.0",
Expand Down
6 changes: 4 additions & 2 deletions src/lib/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ export default (function Command () {
.usage(`<dir> [options]`)
.option('-x, --extensions <items>', 'Include only these file extensions. Default: js,jsx', list, ['js', 'jsx'])
.option('-i, --ignore <items>', 'Folders to ignore. Default: node_modules,__tests__,__mocks__', list, ['node_modules', '__tests__', '__mocks__'])
.option('-e, --exclude-patterns <items>', 'Filename patterns to exclude. Default: []', list, [])
.option('-e, --exclude-patterns <items>', 'Filename patterns to exclude. Default: []', list, ['.*\.spec.(jsx|js)' ])
.option('-f, --format <format>', 'Output format (markdown|asciiddoc) [asciidoc]')
.option('-t, --title [value]', 'Document title. Default: \'Components\'', 'Components')
.option('-o, --output <file>', 'Markdown file to write. Default: \'DOCUMENTATION.MD\'', 'DOCUMENTATION.MD')
.option('-o, --output <file>', 'Output file to write. Default (asciidoc): \'DOCUMENTATION.ADOC\'')
.option('--handlebar-template [path]', 'Custom handlebar output template. Alternative to --format.')
.parse(process.argv);


Expand Down
Loading