Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
[added] documentation generation as a separate script
Browse files Browse the repository at this point in the history
  • Loading branch information
thealjey committed Dec 22, 2015
1 parent 5f1f1f3 commit 7daa43f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build/**
lib/**
config/**
coverage/**
docs/**
Expand Down
34 changes: 15 additions & 19 deletions bin/build.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
/* @flow */

import {join} from 'path';
import {createReadStream, createWriteStream} from 'fs';
import JS from '../lib/JS';
import NativeProcess from '../lib/NativeProcess';
import JS from '../src/JS';
import NativeProcess from '../src/NativeProcess';

const rootDir = join(__dirname, '..'),
buildDir = join(rootDir, 'build'),
binDir = join(rootDir, 'bin'),
srcDir = join(rootDir, 'src'),
libDir = join(rootDir, 'lib'),
docsDir = join(rootDir, 'docs'),
specDir = join(rootDir, 'spec'),
readme = join(rootDir, 'README.md'),
jsdocConfig = join(rootDir, 'config', 'jsdoc.json'),
js = new JS(),
jsdoc = new NativeProcess(join(rootDir, 'node_modules', '.bin', 'jsdoc')),
npm = new NativeProcess('npm');
npm = new NativeProcess('npm'),

js.beDir(libDir, buildDir, function () {
jsdoc.run(function (jsdocErr) {
if (jsdocErr) {
return console.error(jsdocErr);
/* @flowignore */
emptyFn: () => void = Function.prototype;

js.be(srcDir, libDir, [specDir, binDir], () => {
npm.run(stderr => {
if (stderr) {
return console.error(stderr);
}
createReadStream(join(rootDir, 'LICENSE')).pipe(createWriteStream(join(docsDir, 'LICENSE')));
createReadStream(join(rootDir, 'doc_readme.md')).pipe(createWriteStream(join(docsDir, 'README.md')));
console.log('\x1b[32mGenerated API documentation!\x1b[0m');
npm.run(Function.prototype, ['test'], {stdio: 'inherit'});
}, [buildDir, '-d', docsDir, '-R', readme, '-c', jsdocConfig]);
}, specDir, __filename);
npm.run(emptyFn, ['test'], {stdio: 'inherit'});
}, ['run', 'docs-build'], {stdio: 'inherit'});
});
15 changes: 15 additions & 0 deletions bin/docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* @flow */

import Documentation from '../src/Documentation';
import {createReadStream, createWriteStream} from 'fs';
import {join} from 'path';

const rootDir = join(__dirname, '..'),
docsDir = join(rootDir, 'docs'),
docs = new Documentation();

docs.run(() => {
createReadStream(join(rootDir, 'LICENSE')).pipe(createWriteStream(join(docsDir, 'LICENSE')));
createReadStream(join(rootDir, 'README.md')).pipe(createWriteStream(join(docsDir, 'README.md')));
console.log('\x1b[32mGenerated API documentation!\x1b[0m');
});
6 changes: 0 additions & 6 deletions doc_readme.md

This file was deleted.

0 comments on commit 7daa43f

Please sign in to comment.