Update of multiple frontend libs.
This commit is contained in:
parent
de261dbde5
commit
a9c6ddc03b
276 changed files with 41257 additions and 19300 deletions
|
@ -1,55 +1,83 @@
|
|||
'use strict';
|
||||
|
||||
var _ = require('lodash'),
|
||||
docdown = require('docdown'),
|
||||
fs = require('fs-extra'),
|
||||
path = require('path');
|
||||
const _ = require('lodash');
|
||||
const docdown = require('docdown');
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
|
||||
var basePath = path.join(__dirname, '..', '..'),
|
||||
docPath = path.join(basePath, 'doc'),
|
||||
readmePath = path.join(docPath, 'README.md');
|
||||
const util = require('../common/util');
|
||||
|
||||
var pkg = require('../../package.json'),
|
||||
version = pkg.version;
|
||||
const basePath = path.join(__dirname, '..', '..');
|
||||
const docPath = path.join(basePath, 'doc');
|
||||
const readmePath = path.join(docPath, 'README.md');
|
||||
|
||||
var config = {
|
||||
const pkg = require('../../package.json');
|
||||
const version = pkg.version;
|
||||
|
||||
const config = {
|
||||
'base': {
|
||||
'entryLinks': [
|
||||
'<% if (name == "templateSettings" || !/^(?:methods|properties|seq)$/i.test(category)) {' +
|
||||
'print("[Ⓝ](https://www.npmjs.com/package/lodash." + name.toLowerCase() + " \\"See the npm package\\")")' +
|
||||
'} %>'
|
||||
],
|
||||
'path': path.join(basePath, 'lodash.js'),
|
||||
'title': '<a href="https://lodash.com/">lodash</a> <span>v' + version + '</span>',
|
||||
'title': `<a href="https://lodash.com/">lodash</a> <span>v${ version }</span>`,
|
||||
'toc': 'categories',
|
||||
'url': 'https://github.com/lodash/lodash/blob/' + version + '/lodash.js'
|
||||
'url': `https://github.com/lodash/lodash/blob/${ version }/lodash.js`
|
||||
},
|
||||
'github': {
|
||||
'hash': 'github'
|
||||
'style': 'github',
|
||||
'sublinks': [npmLink('Ⓝ', 'See the npm package')]
|
||||
},
|
||||
'site': {
|
||||
'tocLink': '#docs'
|
||||
'entryLink': '<a href="${entryHref}" class="fa fa-link"></a>',
|
||||
'sourceLink': '[source](${sourceHref})',
|
||||
'tocHref': '',
|
||||
'tocLink': '',
|
||||
'sublinks': [npmLink('npm package')]
|
||||
}
|
||||
};
|
||||
|
||||
function postprocess(string) {
|
||||
/**
|
||||
* Composes a npm link from `text` and optional `title`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} text The link text.
|
||||
* @param {string} [title] The link title.
|
||||
* @returns {string} Returns the composed npm link.
|
||||
*/
|
||||
function npmLink(text, title) {
|
||||
return (
|
||||
'<% if (name == "templateSettings" || !/^(?:methods|properties|seq)$/i.test(category)) {' +
|
||||
'print(' +
|
||||
'"[' + text + '](https://www.npmjs.com/package/lodash." + name.toLowerCase() + ' +
|
||||
'"' + (title == null ? '' : ' \\"' + title + '\\"') + ')"' +
|
||||
');' +
|
||||
'} %>'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Post-process `markdown` to make adjustments.
|
||||
*
|
||||
* @private
|
||||
* @param {string} markdown The markdown to process.
|
||||
* @returns {string} Returns the processed markdown.
|
||||
*/
|
||||
function postprocess(markdown) {
|
||||
// Wrap symbol property identifiers in brackets.
|
||||
return string.replace(/\.(Symbol\.(?:[a-z]+[A-Z]?)+)/g, '[$1]');
|
||||
return markdown.replace(/\.(Symbol\.(?:[a-z]+[A-Z]?)+)/g, '[$1]');
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
function onComplete(error) {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the documentation markdown formatted for 'github' or 'site'.
|
||||
*
|
||||
* @private
|
||||
* @param {string} type The format type.
|
||||
*/
|
||||
function build(type) {
|
||||
var options = _.defaults({}, config.base, config[type]),
|
||||
markdown = docdown(options);
|
||||
const options = _.defaults({}, config.base, config[type]);
|
||||
const markdown = docdown(options);
|
||||
|
||||
fs.writeFile(readmePath, postprocess(markdown), onComplete);
|
||||
fs.writeFile(readmePath, postprocess(markdown), util.pitch);
|
||||
}
|
||||
|
||||
build(_.last(process.argv));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue