0.0.21 • Published 7 years ago

babel-plugin-doc-gen v0.0.21

Weekly downloads
11
License
MIT
Repository
github
Last release
7 years ago

babel plugin doc gen

A Docs generation

Build Status

Motivation

Aims to atuo generate json react docs or copy files from files which will parse by babel. All coded with ES6 syntax.

What's inside
  • Webpack for all development (server,hotload etc.) and build (package, optimize, etc.) needs.
  • Babel for writing codes with ES6 syntax and transpiling them browser compatible codes.
  • ESLint for protecting our nice formatted codes.
  • Flow for type checking.
  • Chai for asserting test errors.

Quick Start

Install and Usage

Go to your project folder

npm install babel-plugin-doc-gen --save

You can import this project in 2 ways.

  1. Partial import. For ex. import Transformer from "babel-plugin-doc-gen/lib/api/Transformer";
  2. All-in-one, minified, optimized single js. For ex. TODO: example coming soon.

Usage

Execute as Babel Plugin
  • Use plugin with babel. Add it to babel plugins.
{
  "presets": [
     "react",
     "es2015",
     "stage-0"
  ],
  "plugins": ["doc-gen"]
}
  • Execute it with environment.
{
  "presets": [
     "react",
     "es2015",
     "stage-0"
  ],
  "env": {
      "development": {
        "plugins":  ["doc-gen"]
      }
    }
}
Configuration File
  • create configuration file .doc.gen.json in root path.
  • Configuration file
{
  "hashFile": ".hash.json",
  "react" : {
    "sourceFolder":"src",
    "extensions": ["jsx", "js"],
    "destinationFolder":"site/docs",
    "exclude": ["index.js"]
  },
  "copy" : {
    "sourceFolder":"site/samples",
    "extensions": ["jsx", "js"],
    "destinationFolder":"site/samples",
    "destinationExtension":"txt",
    "exclude": ["index.js"]
  }
}
  • hashFile default name is .hash.json
  • if you want to change hash file name then use like following lines
{
  "hashFile": ".newhash.json",
  ...
}
  • react : Using generate json react docs.
{
  "hashFile": ".hash.json",
  "react" : {
    "sourceFolder":"src",
    "extensions": ["jsx", "js"],
    "destinationFolder":"site/docs",
    "exclude": ["index.js"]
  }
}
  • copy : Using copy file to another folder
{
  "hashFile": ".hash.json",
  "copy" : {
    "sourceFolder":"site/samples",
    "extensions": ["jsx", "js"],
    "destinationFolder":"site/samples",
    "destinationExtension":"txt",
    "exclude": ["index.js"]
  }
}

How to contribute

Clone and run npm install. This will install both run-time project dependencies and developer tools listed in package.json file.

How to Build for Production

If you need just to build the app (without running a dev server), simply run:

$ npm run build

How to run Unit Tests.

$ npm test
0.0.21

7 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago