This repository has been archived by the owner on Jul 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[added] documentation generation as a separate script
- Loading branch information
Showing
4 changed files
with
31 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
build/** | ||
lib/** | ||
config/** | ||
coverage/** | ||
docs/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); |
This file was deleted.
Oops, something went wrong.