Skip to content

Commit f0d0897

Browse files
committed
Consolidate types into /types
1 parent a553c21 commit f0d0897

File tree

6 files changed

+80
-83
lines changed

6 files changed

+80
-83
lines changed

build/builder.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

build/make_helpers.md

Lines changed: 0 additions & 38 deletions
This file was deleted.

build/renderer.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,27 @@ var buildHash = require("./build_hash");
88

99
/**
1010
* @parent bit-docs-generate-html/modules
11-
* @module {function} bit-docs-generate-html/build/renderer renderer
11+
* @module {function} bit-docs-generate-html/build/renderer
1212
*
13-
* Creates a renderer function used to generate
14-
* the documentation.
13+
* Creates a renderer function used to generate the documentation.
1514
*
16-
* @signature `.build.renderer(buildTemplatesPromise, options)`
15+
* @signature `build.renderer(buildTemplatesPromise, options)`
1716
*
18-
* Registers all `.mustache` files in the _documentjs/site/templates_ folder as
19-
* partials and creates a [documentjs.generators.html.types.renderer renderer] function that
20-
* renders the `content.mustache` template within the `layout.mustache` template.
17+
* Registers all `.mustache` files in the
18+
* [bit-docs-generate-html/site/templates/buildHash] folder as partials and
19+
* creates a [bit-docs-generate-html/types/renderer] function that renders the
20+
* `content.mustache` template within the `layout.mustache` template.
2121
*
2222
* @param {Promise<Handlebars>} buildTemplatesPromise The result of calling
23-
* [documentjs.generators.html.build.templates]. Building the renderer
24-
* must happen after the templates have been copied over. Passing this
25-
* argument enforces that.
23+
* [bit-docs-generate-html/build/templates]. Building the renderer must happen
24+
* after the templates have been copied over. Passing this argument enforces
25+
* that.
2626
*
2727
* @param {{}} options
2828
*
2929
* Options used to configure the behavior of the renderer.
3030
*
31-
*
32-
* @return {Promise<documentjs.generators.html.types.renderer>} A promise that
31+
* @return {Promise<bit-docs-generate-html/types/renderer>} A promise that
3332
* resolves with the renderer function.
3433
*/
3534
module.exports = function(buildTemplatesPromise, options){

types/builder.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
@parent bit-docs-generate-html/types
2+
@typedef {function(Object,{})} bit-docs-generate-html/types/builder(options,folders) Builder
3+
4+
A function that builds the static resources and copies the ones needed for
5+
the html site to a distributable location.
6+
7+
@param {Object} options The options passed to [bit-docs/lib/generate/generate].
8+
9+
@param {{dist: String, build: String}} folders Paths to where the build
10+
should take place and the final static content should be copied to.
11+
12+
@option {String} build The path where the default static and
13+
`options.static` content have been copied.
14+
15+
@option {String} dist The path where the final static content should be
16+
copied after it has been minified and prepared.
17+
18+
@return {Promise} A promise that resolves when the build and copying have
19+
been successful.
20+
21+
@body
22+
23+
## Use
24+
25+
A builder that simply copies all static content over:
26+
27+
var Q = require('q'),
28+
fs = require('fs-extra'),
29+
copy = Q.denodify(fs.copy);
30+
module.exports = function(options, folders){
31+
return copy(folders.build, folders.dist);
32+
};

types/make_helpers.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@parent bit-docs-generate-html/types
2+
@typedef {function(bit-docs/types/docMap,Object,function)} bit-docs-generate-html/types/makeHelpers(docMap,options,getCurrent) MakeHelpers
3+
4+
@param {bit-docs/types/docMap} docMap Contains every
5+
[bit-docs/types/docObject] keyed by its name.
6+
7+
@param {Object} options The options passed to [bit-docs/lib/generate/generate].
8+
9+
@param {function():bit-docs/types/docObject} getCurrent Returns the current
10+
[bit-docs/types/docObject] being rendered.
11+
12+
@param {bit-docs-generate-html} helpers The default helpers object that the
13+
return value will be added to.
14+
15+
@return {Object<String,function>} A map of Handlebars function helpers that
16+
will be registered.
17+
18+
@body
19+
20+
## Use
21+
22+
To create a helper that loops through every function's name excluding the
23+
current page's name:
24+
25+
module.exports = function(docMap,options,getCurrent, defaultHelpers, Handlebars){
26+
return {
27+
eachFunction: function(options){
28+
for(var name in docMap) {
29+
var docObject = docMap[name];
30+
if(docObject.type === "function" && name !== getCurrent().name) {
31+
return options.fn(name);
32+
}
33+
}
34+
}
35+
};
36+
};

build/renderer.md renamed to types/renderer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@parent bit-docs-generate-html/types
2-
@typedef {function(bit-docs/types/docObject)} bit-docs-generate-html/types/renderer(docObject) renderer
2+
@typedef {function(bit-docs/types/docObject)} bit-docs-generate-html/types/renderer(docObject) Renderer
33

44
A renderer built by [bit-docs-generate-html/build/renderer] that is used to
55
render each [bit-docs/types/docObject].

0 commit comments

Comments
 (0)