1
- var fss = require ( '../fs_extras.js' ) ,
2
- Q = require ( 'q' ) ,
3
- path = require ( 'path' ) ,
4
- md5 = require ( 'md5' ) ,
5
- promiseLock = require ( "../promise_lock" ) ,
6
- npm = require ( "enpeem" ) ,
7
- fs = require ( "fs-extra" ) ,
8
- _ = require ( "lodash" ) ;
9
-
10
- var queue = promiseLock ( ) ,
11
- buildHash = require ( "./build_hash" ) ,
12
- remove = Q . denodeify ( fs . remove ) ;
1
+ var fss = require ( '../fs_extras.js' ) ;
2
+ var Q = require ( 'q' ) ;
3
+ var path = require ( 'path' ) ;
4
+ var md5 = require ( 'md5' ) ;
5
+ var promiseLock = require ( "../promise_lock" ) ;
6
+ var npm = require ( "enpeem" ) ;
7
+ var fs = require ( "fs-extra" ) ;
8
+ var _ = require ( "lodash" ) ;
9
+
10
+ var queue = promiseLock ( ) ;
11
+ var buildHash = require ( "./build_hash" ) ;
12
+ var remove = Q . denodeify ( fs . remove ) ;
13
13
14
14
/**
15
15
* @parent bit-docs-generate-html/modules
16
- * @module {function} bit-docs-generate-html/build/static_dist
16
+ * @module {function} bit-docs-generate-html/build/static_dist staticDist
17
17
*
18
- * Builds a static distributable which will eventually be copied
19
- * to the `static` folder of the generated output.
18
+ * Builds a static distributable which will eventually be copied to the
19
+ * `static` folder of the generated output.
20
20
*
21
21
* @signature `.build.staticDist(options)`
22
22
*
23
23
* Builds the static distributable with the following steps:
24
24
*
25
- * 1. Copies everything from _documentjs/site/ default/static_ to
26
- * _documentjs/site /static/build_.
27
- * 2. Copies the path in `options.dest` to _documentjs/site/ static/build_ .
28
- * 3. `require`s the module at _documentjs/site/static/build/build.js_.
29
- * 4. Calls that "build" module function with the options and returns the result.
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_ .
28
+ * 4. Calls that "build" module function with the options and returns the
29
+ * result.
30
30
*
31
- * The "build" module is expected to build a minified distributable
32
- * and copy the necessary contents to _documentjs/site/ static/dist_ and
33
- * return a promise that resolves when complete.
31
+ * 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.
34
34
*
35
35
* @param {{} } options
36
36
*
37
- * @option {Boolean} [forceBuild=false] If set to `true`, rebuilds the
38
- * static bundle even if it has already been built.
37
+ * @option {Boolean} [forceBuild=false] If set to `true`, rebuilds the static
38
+ * bundle even if it has already been built.
39
+ *
40
+ * @option {String} dest The final destination ouput of the static
41
+ * distributable.
39
42
*
40
- * @option {String} dest The final destination ouput of the static
41
- * distributable.
42
- *
43
- * @option {String} static The location of static content used to overwrite or
44
- * add to the default static content.
45
- *
46
- * @option {Boolean} [minifyBuild=true] If set to `false` the build will not
47
- * be minified. This behavior should be implemented by the "build" module.
48
- *
49
- * @return {Promise } A promise that resolves if the static dist was successfully created.
43
+ * @option {String} static The location of static content used to overwrite or
44
+ * add to the default static content.
45
+ *
46
+ * @option {Boolean} [minifyBuild=true] If set to `false` the build will not be
47
+ * minified. This behavior should be implemented by the "build" module.
50
48
*
49
+ * @return {Promise } A promise that resolves if the static dist was
50
+ * successfully created.
51
51
*/
52
52
module . exports = function ( options ) {
53
53
// only run one build at a time.
@@ -56,8 +56,8 @@ module.exports = function(options){
56
56
57
57
var hash = buildHash ( options ) ;
58
58
59
- var distFolder = path . join ( "site" , "static" , "dist" , hash ) ,
60
- buildFolder = path . join ( "site" , "static" , "build" , hash ) ;
59
+ var distFolder = path . join ( "site" , "static" , "dist" , hash ) ;
60
+ var buildFolder = path . join ( "site" , "static" , "build" , hash ) ;
61
61
62
62
var mkdirPromise = Q . all ( [
63
63
fss . mkdirs ( distFolder ) ,
@@ -103,8 +103,8 @@ module.exports = function(options){
103
103
104
104
} ;
105
105
106
- var readFile = Q . denodeify ( fs . readFile ) ,
107
- writeFile = Q . denodeify ( fs . writeFile ) ;
106
+ var readFile = Q . denodeify ( fs . readFile ) ;
107
+ var writeFile = Q . denodeify ( fs . writeFile ) ;
108
108
109
109
function addPackages ( siteConfig , buildFolder ) {
110
110
if ( siteConfig . html && siteConfig . html . dependencies ) {
@@ -167,7 +167,6 @@ function installPackages(options, buildFolder, distFolder, hash){
167
167
} ) ;
168
168
}
169
169
170
-
171
170
function callIfFunction ( value ) {
172
171
if ( typeof value === "function" ) {
173
172
value ( ) ;
0 commit comments