index.js
1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
var _ = require('lodash');
var packages = require('./packages');
var elements = require('./elements');
var tags = require('./tags');
var guides = require('./guides');
var objectFromStreams = require('./utils/object-from-streams');
module.exports = function (options) {
var srcFilepath = options.src;
var destDir = options.destDir;
var root = path.resolve(__dirname, '../../');
var srcCatalog = fs.createReadStream(srcFilepath);
var guideFilepaths = [
path.resolve(process.cwd(), 'guides', '**.md')//,
//path.resolve(process.cwd(), 'bower_components', '**', 'guides', '**.md')
];
var elementsStream = srcCatalog.pipe(elements({root: root, destDir: destDir}));
var guidesStream = guides({
src: guideFilepaths,
destDir: destDir
});
return objectFromStreams({
packages: srcCatalog.pipe(packages({
root: root,
guides: guidesStream
})),
elements: elementsStream,
tags: {
data: elementsStream.pipe(tags()),
onArray: _.first
},
guides: guidesStream
});
};