Skip to content

Commit 3e7812c

Browse files
committed
feat(core): Switch to Promises everywhere. Adopt Node v4 ES6
Big changes: * Uses template strings where appropriate * Config and argument parsing is unified and there is no such thing as formatterOptions anymore. All user-passed options go through mergeConfig.
1 parent ec03e0b commit 3e7812c

File tree

90 files changed

+656
-2081
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+656
-2081
lines changed

.eslintrc

+1-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
"extends": "eslint:recommended",
3939
"env": {
4040
"node": true,
41-
"es6": true,
42-
"browser": true
41+
"es6": true
4342
}
4443
}

README.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,21 @@ lets you run `documentation` as a [Gulp](http://gulpjs.com/) build task.
4646

4747
## Examples
4848

49-
* [HTML output with default template](http://documentation.js.org/html-example/)
50-
* [Markdown](https://github.com/documentationjs/documentation/blob/master/docs/NODE_API.md)
51-
* [JSON](http://documentation.js.org/html-example/index.json)
49+
- [HTML output with default template](http://documentation.js.org/html-example/)
50+
- [Markdown](https://github.com/documentationjs/documentation/blob/master/docs/NODE_API.md)
51+
- [JSON](http://documentation.js.org/html-example/index.json)
5252

5353
## Documentation
5454

55-
* [Getting Started](docs/GETTING_STARTED.md): start here
56-
* [Usage](docs/USAGE.md): how to use documentation.js
57-
* [Recipes](docs/RECIPES.md): tricks for writing effective JSDoc docs
58-
* [Node API](docs/NODE_API.md): documentation.js's self-generated documentation
59-
* [Configuring documentation.js](docs/CONFIG.md)
60-
* [FAQ](docs/FAQ.md)
61-
* [Troubleshooting](docs/TROUBLESHOOTING.md)
62-
* [Theming](docs/THEMING.md): tips for theming documentation output in HTML
63-
* [See also](https://github.com/documentationjs/documentation/wiki/See-also): a list of projects similar to documentation.js
55+
- [Getting Started](docs/GETTING_STARTED.md): start here
56+
- [Usage](docs/USAGE.md): how to use documentation.js
57+
- [Recipes](docs/RECIPES.md): tricks for writing effective JSDoc docs
58+
- [Node API](docs/NODE_API.md): documentation.js's self-generated documentation
59+
- [Configuring documentation.js](docs/CONFIG.md)
60+
- [FAQ](docs/FAQ.md)
61+
- [Troubleshooting](docs/TROUBLESHOOTING.md)
62+
- [Theming](docs/THEMING.md): tips for theming documentation output in HTML
63+
- [See also](https://github.com/documentationjs/documentation/wiki/See-also): a list of projects similar to documentation.js
6464

6565
## User Guide
6666

@@ -116,9 +116,9 @@ _We have plenty of
116116
[issues](https://github.com/documentationjs/documentation/issues) that we'd
117117
love help with._
118118

119-
* Robust and complete `JSDoc` support, including typedefs.
120-
* Strong support for HTML and Markdown output
121-
* Documentation coverage, statistics, and validation
119+
- Robust and complete `JSDoc` support, including typedefs.
120+
- Strong support for HTML and Markdown output
121+
- Documentation coverage, statistics, and validation
122122

123123
documentation is an OPEN Open Source Project. This means that:
124124

bin/documentation.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,28 @@ var argv = yargs
2424
.version(function () {
2525
return require('../package').version;
2626
})
27-
.usage('Usage:\n\n' +
28-
'# generate markdown docs for index.js and files it references\n' +
29-
'$0 build index.js -f md\n\n' +
27+
.usage(`Usage:
28+
# generate markdown docs for index.js and files it references
29+
$0 build index.js -f md
3030
31-
'# generate html docs for all files in src\n' +
32-
'$0 build src/** -f html -o docs\n\n' +
31+
# generate html docs for all files in src
32+
$0 build src/** -f html -o docs
3333
34-
'# document index.js, ignoring any files it requires or imports\n' +
35-
'$0 build index.js -f md --shallow\n\n' +
34+
# document index.js, ignoring any files it requires or imports
35+
$0 build index.js -f md --shallow
3636
37-
'# build, serve, and live-update html docs for app.js\n' +
38-
'$0 serve app.js\n\n' +
37+
# build, serve, and live-update html docs for app.js
38+
$0 serve app.js
3939
40-
'# validate JSDoc syntax in util.js\n' +
41-
'$0 lint util.js\n\n' +
40+
# validate JSDoc syntax in util.js
41+
$0 lint util.js
4242
43-
'# update the API section of README.md with docs from index.js\n' +
44-
'$0 readme index.js --section=API\n\n' +
43+
# update the API section of README.md with docs from index.js
44+
$0 readme index.js --section=API
4545
46-
'# build docs for all values exported by index.js\n' +
47-
'$0 build --document-exported index.js'
48-
)
46+
# build docs for all values exported by index.js
47+
$0 build --document-exported index.js
48+
`)
4949
.recommendCommands()
5050
.help()
5151
.argv;

default_theme/index.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var fs = require('fs'),
1111
createLinkerStack = require('../').util.createLinkerStack,
1212
hljs = require('highlight.js');
1313

14-
module.exports = function (comments, options, callback) {
14+
module.exports = function (comments, options) {
1515

1616
var linkerStack = createLinkerStack(options)
1717
.namespaceResolver(comments, function (namespace) {
@@ -79,14 +79,16 @@ module.exports = function (comments, options, callback) {
7979
var pageTemplate = _.template(fs.readFileSync(path.join(__dirname, 'index._'), 'utf8'), sharedImports);
8080

8181
// push assets into the pipeline as well.
82-
vfs.src([__dirname + '/assets/**'], { base: __dirname })
83-
.pipe(concat(function (files) {
84-
callback(null, files.concat(new File({
85-
path: 'index.html',
86-
contents: new Buffer(pageTemplate({
87-
docs: comments,
88-
options: options
89-
}), 'utf8')
90-
})));
91-
}));
82+
return new Promise(resolve => {
83+
vfs.src([__dirname + '/assets/**'], { base: __dirname })
84+
.pipe(concat(function (files) {
85+
resolve(files.concat(new File({
86+
path: 'index.html',
87+
contents: new Buffer(pageTemplate({
88+
docs: comments,
89+
options: options
90+
}), 'utf8')
91+
})));
92+
}));
93+
});
9294
};

0 commit comments

Comments
 (0)