File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -51,13 +51,17 @@ module.exports = function(docMapPromise, siteConfig){
51
51
var searchMapPromise = docMapPromise . then ( function ( docMap ) {
52
52
return write . searchMap ( docMap , siteConfig ) ;
53
53
} ) ;
54
+ var docMapHash = docMapPromise . then ( function ( docMap ) {
55
+ return write . docMapHash ( docMap , siteConfig ) ;
56
+ } ) ;
54
57
55
58
var docsPromise = Q . all ( [
56
59
docMapPromise ,
57
60
build . renderer ( buildTemplatesPromise , siteConfig ) ,
58
61
helpersReadyPromise ,
59
62
mkdirs ( siteConfig . dest ) ,
60
- searchMapPromise
63
+ searchMapPromise ,
64
+ docMapHash
61
65
] ) . then ( function ( results ) {
62
66
var docMap = results [ 0 ] ,
63
67
renderer = results [ 1 ] ;
Original file line number Diff line number Diff line change
1
+ var fs = require ( 'fs' ) ,
2
+ path = require ( 'path' ) ,
3
+ Q = require ( 'q' ) ,
4
+ writeFile = Q . denodeify ( fs . writeFile ) ,
5
+ mkdirs = Q . denodeify ( require ( "fs-extra" ) . mkdirs ) ,
6
+ md5 = require ( 'md5' ) ;
7
+
8
+ /**
9
+ * @function bitDocs.generators.html.write.docMapHash
10
+ * @parent bitDocs.generators.html.write.methods
11
+ *
12
+ * Writes out file containing an md5 hash of the docmap
13
+ *
14
+ * @signature `.write.docMapHash(docMap, siteConfig)`
15
+ *
16
+ * @param {documentjs.process.docMap } docMap
17
+ * @param {Object } siteConfig
18
+ * @return {Promise } Resolves when docMapHash has been written.
19
+ */
20
+ module . exports = function ( docMap , siteConfig ) {
21
+ var docMapHashConfig = {
22
+ hash : md5 ( JSON . stringify ( docMap ) )
23
+ } ,
24
+ dest = path . join ( siteConfig . dest , 'docMapHash.json' ) ;
25
+
26
+ return mkdirs ( siteConfig . dest ) . then ( function ( ) {
27
+ return writeFile ( dest , JSON . stringify ( docMapHashConfig ) ) ;
28
+ } ) ;
29
+
30
+ } ;
Original file line number Diff line number Diff line change @@ -15,3 +15,4 @@ exports.docMap = require("./doc_map");
15
15
exports . docObject = require ( "./doc_object" ) ;
16
16
exports . staticDist = require ( "./static_dist" ) ;
17
17
exports . searchMap = require ( "./search_map" ) ;
18
+ exports . docMapHash = require ( "./doc_map_hash" ) ;
You can’t perform that action at this time.
0 commit comments