nexus site path corrected
[portal.git] / ecomp-portal-FE / client / bower_components / lodash / lib / main / build-doc.js
1 'use strict';
2
3 var _ = require('lodash'),
4     docdown = require('docdown'),
5     fs = require('fs-extra'),
6     path = require('path');
7
8 var basePath = path.join(__dirname, '..', '..'),
9     docPath = path.join(basePath, 'doc'),
10     readmePath = path.join(docPath, 'README.md');
11
12 var pkg = require('../../package.json'),
13     version = pkg.version;
14
15 var config = {
16   'base': {
17     'entryLinks': [
18       '<% if (name == "templateSettings" || !/^(?:methods|properties|seq)$/i.test(category)) {' +
19       'print("[&#x24C3;](https://www.npmjs.com/package/lodash." + name.toLowerCase() + " \\"See the npm package\\")")' +
20       '} %>'
21     ],
22     'path': path.join(basePath, 'lodash.js'),
23     'title': '<a href="https://lodash.com/">lodash</a> <span>v' + version + '</span>',
24     'toc': 'categories',
25     'url': 'https://github.com/lodash/lodash/blob/' + version + '/lodash.js'
26   },
27   'github': {
28     'hash': 'github'
29   },
30   'site': {
31     'tocLink': '#docs'
32   }
33 };
34
35 function postprocess(string) {
36   // Wrap symbol property identifiers in brackets.
37   return string.replace(/\.(Symbol\.(?:[a-z]+[A-Z]?)+)/g, '[$1]');
38 }
39
40 /*----------------------------------------------------------------------------*/
41
42 function onComplete(error) {
43   if (error) {
44     throw error;
45   }
46 }
47
48 function build(type) {
49   var options = _.defaults({}, config.base, config[type]),
50       markdown = docdown(options);
51
52   fs.writeFile(readmePath, postprocess(markdown), onComplete);
53 }
54
55 build(_.last(process.argv));