Skip to content

Commit 4234cf4

Browse files
committed
Update docs for /build, html and generate
1 parent f0d0897 commit 4234cf4

File tree

7 files changed

+97
-91
lines changed

7 files changed

+97
-91
lines changed

build/build.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
/**
2-
* @property {{}} documentjs.generators.html.build
3-
* @parent documentjs.generators.html.properties
2+
* @parent bit-docs-generate-html/modules
3+
* @module {{}} bit-docs-generate-html/build/build
44
*
5-
* @group documentjs.generators.html.build.methods 0 methods
6-
* @group documentjs.generators.html.build.types 1 types
7-
*
8-
* A collection of helpers used to build and compile the templates
9-
* used to render each [documentjs.process.docObject docObject] into
10-
* HTML and build the static JS and CSS used by that HTML.
5+
* A collection of helpers used to build and compile the templates used to
6+
* render each [bit-docs/types/docObject] into HTML and build the static JS and
7+
* CSS used by that HTML.
118
*
129
* @body
1310
*
11+
* Requires and exports these other modules:
12+
* - [bit-docs-generate-html/build/renderer] as `renderer`.
13+
* - [bit-docs-generate-html/build/static_dist] as `staticDist`.
14+
* - [bit-docs-generate-html/build/templates] as `templates`.
15+
* - [bit-docs-generate-html/build/helpers] as `helpers`.
1416
*/
15-
16-
17-
1817
exports.renderer = require("./renderer");
1918
exports.staticDist = require("./static_dist");
2019
exports.templates = require("./templates");
21-
exports.helpers = require("./helpers");
20+
exports.helpers = require("./helpers");

build/build_hash.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
11
var md5 = require('md5');
22

33
/**
4-
* @function documentjs.generators.html.build.buildHash
5-
* @parent documentjs.generators.html.build.methods
4+
* @parent bit-docs-generate-html/modules
5+
* @module {function} bit-docs-generate-html/build/build_hash
66
*
77
* Returns a unique hash for the options that control the build.
88
*
9-
* @signature `.build.buildHash(options)`
9+
* @signature `buildHash(options)`
1010
*
1111
* @param {{}} options Options that might change the characteristic of the build:
1212
*
13-
* @option {Boolean} [minifyBuild=true] If set to `false` the build will not
14-
* be minified. This behavior should be implemented by the "build" module.
13+
* @option {Boolean} [minifyBuild=true] If set to `false` the build will not be
14+
* minified. This behavior should be implemented by the "build" module.
15+
*
16+
* @option {Boolean} [devBuild=false] If set to `true` the build will not be
17+
* built and copied in "development" mode.
18+
*
19+
* @option {String} static The location of static content used to overwrite or
20+
* add to the default static content.
21+
*
22+
* @option {String} [templates] The location of templates used to overwrite or
23+
* add to the default templates.
1524
*
16-
* @option {Boolean} [devBuild=false] If set to `true` the build will not be built
17-
* and copied in "development" mode.
18-
*
19-
* @option {String} static The location of static content used to overwrite or
20-
* add to the default static content.
21-
*
22-
* @option {String} [templates] The location of templates used to overwrite or
23-
* add to the default templates.
25+
* @return {String} a hash that represents this build.
2426
*
27+
* @body
2528
*
26-
* @return {String} a hash that represents this build.
29+
* The generated hash will be something like `917c51373c902dc4a003c7fd949774c5`.
2730
*/
2831
module.exports = function(options){
2932
var values = {};

build/helpers.js

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

99
/**
1010
* @parent bit-docs-generate-html/modules
11-
* @module {Promise} bit-docs-generate-html/build/helpers helpers
11+
* @module {Promise} bit-docs-generate-html/build/helpers
1212
*
13-
* Gets the default helpers, and helpers in the _{buildHash}/site/templates_
14-
* folder, and registers them with Handlebars.
13+
* Gets the default helpers, and helpers in the
14+
* [bit-docs-generate-html/site/templates/buildHash] folder, and registers them
15+
* with Handlebars.
1516
*
1617
* @signature `build.helpers(buildTemplatesPromise, docMap, options, getCurrent)`
1718
*
@@ -22,21 +23,20 @@ var buildHash = require("./build_hash");
2223
* after the templates have been copied over. Passing this argument enforces
2324
* that.
2425
*
25-
* @param {documentjs.process.docMap} docMap The docMap which contains all
26-
* docObjects that will be documented.
26+
* @param {bit-docs/types/docMap} docMap The [bit-docs/types/docMap] which
27+
* contains all [bit-docs/types/docObject]s that will be documented.
2728
*
2829
* @param {Object} options
2930
*
31+
* @param {function():bit-docs/types/docObject} getCurrent
3032
*
31-
* @param {function():documentjs.process.docObject} getCurrent
33+
* A function that when called, returns the [bit-docs/types/docObject]
34+
* currently being generated.
3235
*
33-
* A function that when called, returns the `docObject` currently being
34-
* generated.
35-
*
36-
* @return {Promise} A promise that resolves when helpers have been added to Handlebars.
36+
* @return {Promise} A promise that resolves when helpers have been added to
37+
* Handlebars.
3738
*
3839
* @body
39-
*
4040
*/
4141
module.exports = function(buildTemplatesPromise, docMap, options, getCurrent){
4242

build/static_dist.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,38 @@ var remove = Q.denodeify(fs.remove);
1313

1414
/**
1515
* @parent bit-docs-generate-html/modules
16-
* @module {function} bit-docs-generate-html/build/static_dist staticDist
16+
* @module {function} bit-docs-generate-html/build/static_dist
1717
*
1818
* Builds a static distributable which will eventually be copied to the
1919
* `static` folder of the generated output.
2020
*
21-
* @signature `.build.staticDist(options)`
21+
* @signature `staticDist(options)`
2222
*
2323
* Builds the static distributable with the following steps:
2424
*
25-
* 1. Copies everything from _site/default/static_ to _site/static/build_.
26-
* 2. Copies the path in `options.dest` to _site/static/build_.
27-
* 3. `require`s the module at _site/static/build/build.js_.
25+
* 1. Copies everything from [bit-docs-generate-html/site/default/static] to
26+
* [bit-docs-generate-html/site/static/build/buildHash].
27+
*
28+
* 2. Copies the path in `options.dest` to
29+
* [bit-docs-generate-html/site/static/build/buildHash].
30+
*
31+
* 3. `require`s the "build" module at
32+
* [bit-docs-generate-html/site/static/build/buildHash/build.js].
33+
*
2834
* 4. Calls that "build" module function with the options and returns the
2935
* result.
3036
*
3137
* The "build" module is expected to build a minified distributable and copy
32-
* the necessary contents to _site/static/dist_ and return a promise that
33-
* resolves when complete.
38+
* the necessary contents to
39+
* [bit-docs-generate-html/site/static/dist/buildHash] and return a promise
40+
* that resolves when complete.
3441
*
3542
* @param {{}} options
3643
*
3744
* @option {Boolean} [forceBuild=false] If set to `true`, rebuilds the static
3845
* bundle even if it has already been built.
3946
*
40-
* @option {String} dest The final destination ouput of the static
47+
* @option {String} dest The final destination output of the static
4148
* distributable.
4249
*
4350
* @option {String} static The location of static content used to overwrite or

build/templates.js

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,38 @@ var Q = require('q');
33
var md5 = require('md5');
44
var path = require('path');
55
var promiseLock = require("../promise_lock");
6-
var queue = promiseLock(),
7-
buildHash = require("./build_hash"),
8-
_ = require("lodash");
6+
var queue = promiseLock();
7+
var buildHash = require("./build_hash");
8+
var _ = require("lodash");
99

1010
/**
11-
* @function documentjs.generators.html.build.templates
12-
* @parent documentjs.generators.html.build.methods
11+
* @parent bit-docs-generate-html/modules
12+
* @module {function} bit-docs-generate-html/build/templates
1313
*
14-
* Creates a folder with all the templates used to generate
15-
* the documentation.
14+
* Creates a folder with all the templates used to generate the documentation.
1615
*
17-
* @signature `.build.templates(siteConfig)`
16+
* @signature `build.templates(siteConfig)`
1817
*
19-
* Builds the _documentjs/site/templates_ folder with the following
20-
* steps:
18+
* Builds the [bit-docs-generate-html/site/templates/buildHash] folder with the
19+
* following steps:
2120
*
22-
* 1. Copies _documentjs/site/default/templates_ to _documentjs/site/templates_.
23-
* 2. Copies `siteConfig.templates` to _documentjs/site/templates_.
21+
* 1. Copies [bit-docs-generate-html/site/default/templates] to
22+
* [bit-docs-generate-html/site/templates/buildHash].
23+
* 2. Copies `siteConfig.templates` to
24+
* [bit-docs-generate-html/site/templates/buildHash].
2425
*
2526
* @param {{}} siteConfig
2627
*
2728
* siteConfig used to configure the behavior of the templates.
2829
*
29-
* @option {Boolean} [forceBuild=false] If set to `true`, rebuilds the
30-
* static bundle even if it has already been built.
31-
*
32-
* @option {String} [templates] The location of templates used to overwrite or
33-
* add to the default templates.
34-
*
35-
* @return {Promise} A promise that resolves if the static dist was successfully created.
30+
* @option {Boolean} [forceBuild=false] If set to `true`, rebuilds the static
31+
* bundle even if it has already been built.
32+
*
33+
* @option {String} [templates] The location of templates used to overwrite or
34+
* add to the default templates.
3635
*
36+
* @return {Promise} A promise that resolves if the static dist was
37+
* successfully created.
3738
*/
3839
module.exports = function(siteConfig){
3940

generate.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11

2-
var build = require("./build/build"),
3-
write = require("./write/write"),
4-
Q = require("q"),
5-
fs = require("fs-extra"),
6-
mkdirs = Q.denodeify(fs.mkdirs),
7-
Handlebars = require("handlebars");
2+
var build = require("./build/build");
3+
var write = require("./write/write");
4+
var Q = require("q");
5+
var fs = require("fs-extra");
6+
var mkdirs = Q.denodeify(fs.mkdirs);
7+
var Handlebars = require("handlebars");
88

99
/**
10-
* @function documentjs.generators.html.generate
11-
* @parent documentjs.generators.html.methods
10+
* @parent bit-docs-generate-html/modules
11+
* @module {function} bit-docs-generate-html/generate
1212
*
13-
* Generates an HTML site for a [documentjs.process.docMap docMap]
13+
* Generates an HTML site for a [bit-docs/types/docMap]
1414
* given configuration siteConfig.
1515
*
16-
* @signature `.generate(docMapPromise, siteConfig)`
16+
* @signature `generate(docMapPromise, siteConfig)`
1717
*
18-
* @param {Promise<documentjs.process.docMap>} docMapPromise A promise that
19-
* contains a `docMap` created by [documentjs.process.files].
18+
* @param {Promise<bit-docs/types/docMap>} docMapPromise A promise that
19+
* contains a `docMap` created by [bit-docs-glob-finder/index].
20+
*
2021
* @param {Object} siteConfig Configuration siteConfig.
2122
*
2223
* @return {Promise} A promise that resolves when the site has been built.

html.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
/**
2-
* @property {{}} documentjs.generators.html generators.html
3-
* @parent DocumentJS.apis.internal
2+
* @parent bit-docs-generate-html/modules
3+
* @module {{}} bit-docs-generate-html/html
44
*
5-
* @group documentjs.generators.html.properties 0 properties
6-
* @group documentjs.generators.html.methods 1 methods
7-
* @group documentjs.generators.html.defaultHelpers 2 default helpers
8-
*
9-
* A collection of helpers used to build and compile the templates
10-
* used to render each [documentjs.process.docObject docObject] into
11-
* HTML and build the static JS and CSS used by that HTML.
5+
* A collection of helpers used to build and compile the templates used to
6+
* render each [bit-docs/types/docObject] into HTML and build the static JS and
7+
* CSS used by that HTML.
128
*
139
* @body
1410
*
15-
* ## Use
16-
*
17-
* var documentjs = require("documentjs");
18-
* documentjs.process.file(...)
11+
* Requires and exports these other modules:
12+
* - [bit-docs-generate-html/build/build] as `build`.
13+
* - [bit-docs-generate-html/write/write] as `write`.
14+
* - [bit-docs-generate-html/generate] as `generate`.
1915
*/
20-
2116
exports.build = require("./build/build");
2217
exports.write = require("./write/write");
23-
exports.generate = require("./generate");
18+
exports.generate = require("./generate");

0 commit comments

Comments
 (0)