chore: Updated Flow.js dependency on 0.52.0 (#862)

This commit is contained in:
Anton 2017-08-09 00:28:19 +03:00 committed by Tom MacWright
parent aa3496af90
commit e73dd982a7
6 changed files with 24 additions and 19 deletions

View File

@ -70,7 +70,7 @@
"eslint": "^4.1.1",
"eslint-config-prettier": "^2.3.0",
"eslint-plugin-flowtype": "^2.34.1",
"flow-bin": "^0.46.0",
"flow-bin": "^0.52.0",
"fs-extra": "^4.0.0",
"husky": "^0.14.0",
"jest": "^20.0.4",
@ -102,7 +102,7 @@
"precommit": "lint-staged --verbose",
"prepublish": "npm run build",
"format": "prettier --write '{src,__tests__,declarations,bin,default_theme}/**/*.js' --single-quote",
"doc": "./bin/documentation.js build src/index.js -f md --access=public > docs/NODE_API.md",
"doc": "node ./bin/documentation.js build src/index.js -f md --access=public > docs/NODE_API.md",
"self-lint": "node ./bin/documentation.js lint src",
"test": "npm run build && eslint . && are-we-flow-yet src && flow check && jest",
"test-ci": "npm run build && eslint . && are-we-flow-yet src && flow check && jest --runInBand"
@ -139,4 +139,4 @@
"yargs"
]
}
}
}

View File

@ -17,7 +17,8 @@ module.exports.description = 'inject documentation into your README.md';
* @private
*/
module.exports.builder = {
usage: 'Usage: documentation readme [--readme-file=README.md] --section "API"' +
usage:
'Usage: documentation readme [--readme-file=README.md] --section "API"' +
' [--compare-only] [other documentationjs options]',
example: 'documentation readme index.js -s "API Docs" --github',
'readme-file': {
@ -26,12 +27,14 @@ module.exports.builder = {
},
section: {
alias: 's',
describe: 'The section heading after which to inject generated documentation',
describe:
'The section heading after which to inject generated documentation',
required: true
},
'diff-only': {
alias: 'd',
describe: 'Instead of updating the given README with the generated documentation,' +
describe:
'Instead of updating the given README with the generated documentation,' +
' just check if its contents match, exiting nonzero if not.',
default: false
},
@ -42,8 +45,6 @@ module.exports.builder = {
}
};
function noop() {}
/**
* Insert API documentation into a Markdown readme
* @private
@ -68,9 +69,11 @@ module.exports.handler = function readme(argv: Object) {
argv.format = 'remark';
/* eslint no-console: 0 */
var log = argv.q
? noop
: console.log.bind(console, '[documentation-readme] ');
const log: Function = (...data: Array<string>) => {
if (!argv.q) {
console.log.apply(console, data);
}
};
var readmeContent = fs.readFileSync(argv.readmeFile, 'utf8');

View File

@ -184,7 +184,7 @@ function getCachedData(dataCache, filePath) {
var value = dataCache.get(path);
if (!value) {
var input = fs.readFileSync(path, 'utf-8');
var ast = parseToAst(input, path);
var ast = parseToAst(input);
value = {
data: {
file: path,

View File

@ -414,9 +414,10 @@ function todo() {}
* @param {string} key the eventual destination key
* @returns {Function} a flattener that remembers that key
*/
function synonym(key) {
return function(result, tag) {
return flatteners[key](result, tag, key);
function synonym(key: string) {
return function(result: Object, tag: Object) {
const fun = flatteners[key];
fun.apply(null, [result, tag, key].slice(0, fun.length));
};
}

View File

@ -37,7 +37,7 @@ function leftPad(str, width) {
function parseJavaScript(data: Object, config: DocumentationConfig) {
var visited = new Set();
var ast = parseToAst(data.source, data.file);
var ast = parseToAst(data.source);
var addComment = _addComment.bind(null, visited);
return _.flatMap(

View File

@ -86,7 +86,8 @@ function resolveFileGlobPatterns(patterns, extensions) {
* @returns Resolved absolute filenames.
*/
function listFilesToProcess(globPatterns: Array<string>): Array<string> {
var files = [], added = new Set();
var files = [],
added = new Set();
var cwd = process.cwd();
@ -107,7 +108,7 @@ function listFilesToProcess(globPatterns: Array<string>): Array<string> {
globPatterns.forEach(function(pattern) {
var file = path.resolve(cwd, pattern);
if (shell.test('-f', file)) {
addFile(fs.realpathSync(file), !shell.test('-d', file));
addFile(fs.realpathSync(file));
} else {
var globOptions = {
nodir: true,
@ -116,7 +117,7 @@ function listFilesToProcess(globPatterns: Array<string>): Array<string> {
};
glob.sync(pattern, globOptions).forEach(function(globMatch) {
addFile(path.resolve(cwd, globMatch), false);
addFile(path.resolve(cwd, globMatch));
});
}
});