chore(deps): updating packages
This commit is contained in:
parent
f8abdefa66
commit
14df2a0136
15 changed files with 6625 additions and 28038 deletions
27846
package-lock.json
generated
27846
package-lock.json
generated
File diff suppressed because it is too large
Load diff
30
package.json
30
package.json
|
@ -27,13 +27,18 @@
|
|||
},
|
||||
"scripts": {
|
||||
"barrels": "barrelsby --delete --location all --directory src --exclude '(tests|cli|tools)'",
|
||||
"prebuild": "npm run barrels && npm run lint && npm run format && npm run clean",
|
||||
"prebuild": "yarn run barrels && yarn run lint && yarn run format && yarn run clean",
|
||||
"build": "tsc",
|
||||
"clean": "rimraf lib",
|
||||
"commitmsg": "commitlint -E GIT_PARAMS",
|
||||
"format": "tsfmt -r && sort-package-json package.json",
|
||||
"format": "prettier src --write \"**/*.ts\" --loglevel warn",
|
||||
"lint": "eslint -c .eslintrc.yml src/**/*.ts --fix",
|
||||
"prepack": "npm run build"
|
||||
"prepack": "yarn run build"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
||||
}
|
||||
},
|
||||
"commitlint": {
|
||||
"extends": [
|
||||
|
@ -46,38 +51,37 @@
|
|||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "^6.0.46",
|
||||
"add-commas": "0.0.4",
|
||||
"dotted": "^0.1.1",
|
||||
"gulp": "^3.9.1",
|
||||
"lodash": "^4.16.5",
|
||||
"markdown-table": "^1.0.0",
|
||||
"read-pkg-up": "^4.0.0",
|
||||
"yaml-front-matter": "^3.4.0",
|
||||
"yargs": "^12.0.1"
|
||||
"yargs": "^16.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^7.0.0",
|
||||
"@commitlint/config-conventional": "^7.0.1",
|
||||
"@semantic-release/changelog": "^3.0.0",
|
||||
"@commitlint/cli": "^11.0.0",
|
||||
"@commitlint/config-conventional": "^11.0.0",
|
||||
"@semantic-release/changelog": "^5.0.1",
|
||||
"@semantic-release/git": "^7.0.1",
|
||||
"@semantic-release/npm": "^5.0.1",
|
||||
"@types/lodash": "^4.14.116",
|
||||
"@types/node": "^6.0.46",
|
||||
"@types/read-pkg-up": "^3.0.1",
|
||||
"@types/yaml": "^1.9.7",
|
||||
"@types/yargs": "^11.1.1",
|
||||
"@typescript-eslint/eslint-plugin": "^3.7.0",
|
||||
"@typescript-eslint/parser": "^3.7.0",
|
||||
"barrelsby": "^1.0.2",
|
||||
"commitizen": "^2.10.1",
|
||||
"cz-conventional-changelog": "^2.1.0",
|
||||
"eslint": "^5.3.0",
|
||||
"eslint-plugin-typescript": "^0.12.0",
|
||||
"husky": "^0.14.3",
|
||||
"prettier": "^2.0.5",
|
||||
"rimraf": "^2.6.2",
|
||||
"semantic-release": "^15.9.8",
|
||||
"sort-package-json": "^1.48.1",
|
||||
"typescript": "^3.0.1",
|
||||
"typescript-eslint-parser": "^18.0.0",
|
||||
"typescript-formatter": "^7.2.2"
|
||||
"typescript": "^4.1.3"
|
||||
},
|
||||
"release": {
|
||||
"branch": "master",
|
||||
|
|
7
prettier.config.js
Normal file
7
prettier.config.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
endOfLine: "lf",
|
||||
semi: true,
|
||||
singleQuote: false,
|
||||
tabWidth: 4,
|
||||
trailingComma: "es5",
|
||||
};
|
|
@ -1,8 +1,4 @@
|
|||
import * as yargs from "yargs";
|
||||
|
||||
yargs
|
||||
.usage("$0 <cmd> [args]")
|
||||
.commandDir("tools")
|
||||
.demandCommand(1)
|
||||
.help("help")
|
||||
yargs.usage("$0 <cmd> [args]").commandDir("tools").demandCommand(1).help("help")
|
||||
.argv;
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./scanner";
|
||||
|
|
|
@ -6,12 +6,10 @@ import * as yamlFrontMatter from "yaml-front-matter";
|
|||
* Parses the input files and returns a list of YAML metadata with special
|
||||
* columns for calculated values.
|
||||
*/
|
||||
export function scanFiles(argv, files: string[])
|
||||
{
|
||||
export function scanFiles(argv, files: string[]) {
|
||||
var list: any[] = [];
|
||||
|
||||
for (var file of files)
|
||||
{
|
||||
for (var file of files) {
|
||||
// Load the metadata from the given file.
|
||||
var contents = fs.readFileSync(file, "utf8");
|
||||
var metadata = yamlFrontMatter.loadFront(contents);
|
||||
|
@ -21,8 +19,7 @@ export function scanFiles(argv, files: string[])
|
|||
metadata._basename = path.basename(file);
|
||||
metadata._words = metadata.__content
|
||||
.replace("'", "")
|
||||
.split(/\s+/g)
|
||||
.length;
|
||||
.split(/\s+/g).length;
|
||||
|
||||
// Add the metadata to the list.
|
||||
list.push(metadata);
|
||||
|
|
|
@ -6,36 +6,29 @@ import * as yargs from "yargs";
|
|||
export var command = "content";
|
||||
export var describe = "Extracts the content of the file without metadata";
|
||||
|
||||
export function builder(yargs: yargs.Arguments)
|
||||
{
|
||||
export function builder(yargs: yargs.Arguments) {
|
||||
return yargs
|
||||
.help("help")
|
||||
|
||||
.option(
|
||||
"output",
|
||||
{
|
||||
.option("output", {
|
||||
alias: "o",
|
||||
default: "-",
|
||||
describe: "Write output to a file or `-` for standard out",
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
.demand(1);
|
||||
}
|
||||
|
||||
export function handler(argv: any)
|
||||
{
|
||||
export function handler(argv: any) {
|
||||
// Parse through the files and retrieve the metadata.
|
||||
var files = argv._.splice(1);
|
||||
var data: any = scanner.scanFiles(argv, files);
|
||||
var output = data.map(x => x.__content).join("\n");
|
||||
var output = data.map((x) => x.__content).join("\n");
|
||||
|
||||
// Figure out where to write.
|
||||
if (argv.output === "-")
|
||||
{
|
||||
if (argv.output === "-") {
|
||||
console.log(output);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
fs.writeFileSync(argv.output, Buffer.from(output, "utf-8"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,7 @@ import * as table from "./table";
|
|||
export var command = "count";
|
||||
export var describe = "Counts the number of words in the given input";
|
||||
|
||||
export function builder(yargs: yargs.Arguments)
|
||||
{
|
||||
export function builder(yargs: yargs.Arguments) {
|
||||
return yargs
|
||||
.help("help")
|
||||
|
||||
|
@ -15,7 +14,8 @@ export function builder(yargs: yargs.Arguments)
|
|||
"fields",
|
||||
"The dotted fields in the metadata to display, or _basename for " +
|
||||
"the name of the file, or _words to count the number of words. " +
|
||||
"Appending a `:r` at the end right-aligns the output.")
|
||||
"Appending a `:r` at the end right-aligns the output."
|
||||
)
|
||||
|
||||
.default("table-start", "")
|
||||
.default("table-end", "")
|
||||
|
@ -30,7 +30,8 @@ export function builder(yargs: yargs.Arguments)
|
|||
.describe(
|
||||
"total",
|
||||
"If provided, adds a special entry with a _basename of Totals " +
|
||||
"that adds up all the words.")
|
||||
"that adds up all the words."
|
||||
)
|
||||
|
||||
.boolean("separator")
|
||||
.alias("s", "separator")
|
||||
|
@ -46,18 +47,15 @@ export function builder(yargs: yargs.Arguments)
|
|||
.demand(1);
|
||||
}
|
||||
|
||||
export function handler(argv: any)
|
||||
{
|
||||
export function handler(argv: any) {
|
||||
var files = argv._.splice(1);
|
||||
var data = scanner.scanFiles(argv, files);
|
||||
|
||||
if (argv.total)
|
||||
{
|
||||
if (argv.total) {
|
||||
argv.fields[1] += "t";
|
||||
}
|
||||
|
||||
if (argv.separator)
|
||||
{
|
||||
if (argv.separator) {
|
||||
argv.fields[1] += "s";
|
||||
}
|
||||
|
||||
|
|
|
@ -7,63 +7,47 @@ import * as yargs from "yargs";
|
|||
export var command = "extract";
|
||||
export var describe = "Extracts a YAML from a list of files";
|
||||
|
||||
export function builder(yargs: yargs.Arguments)
|
||||
{
|
||||
export function builder(yargs: yargs.Arguments) {
|
||||
return yargs
|
||||
.help("help")
|
||||
|
||||
.option(
|
||||
"list",
|
||||
{
|
||||
.option("list", {
|
||||
type: "boolean",
|
||||
default: true,
|
||||
describe: "Extract the data as a list of files, otherwise as a single file",
|
||||
}
|
||||
)
|
||||
.option(
|
||||
"output",
|
||||
{
|
||||
describe:
|
||||
"Extract the data as a list of files, otherwise as a single file",
|
||||
})
|
||||
.option("output", {
|
||||
alias: "o",
|
||||
default: "-",
|
||||
describe: "Write output to a file or `-` for standard out",
|
||||
}
|
||||
)
|
||||
.option(
|
||||
"yaml",
|
||||
{
|
||||
})
|
||||
.option("yaml", {
|
||||
alias: "y",
|
||||
type: "boolean",
|
||||
default: false,
|
||||
describe: "Extract the output as YAML instead of JSON",
|
||||
}
|
||||
)
|
||||
.option(
|
||||
"content",
|
||||
{
|
||||
})
|
||||
.option("content", {
|
||||
type: "string",
|
||||
describe: "Include the content as a property in the extracted data",
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
.demand(1);
|
||||
}
|
||||
|
||||
export function handler(argv: any)
|
||||
{
|
||||
export function handler(argv: any) {
|
||||
// Parse through the files and retrieve the metadata.
|
||||
var files = argv._.splice(1);
|
||||
var data: any = scanner.scanFiles(argv, files);
|
||||
|
||||
// Figure out how to handle the content property.
|
||||
if (!argv.content)
|
||||
{
|
||||
if (!argv.content) {
|
||||
// Remove the content from the parsed file.
|
||||
data.forEach(x => delete x.__content);
|
||||
} else if (argv.content !== "__content")
|
||||
{
|
||||
data.forEach((x) => delete x.__content);
|
||||
} else if (argv.content !== "__content") {
|
||||
// Rename the content property.
|
||||
data.forEach(x =>
|
||||
{
|
||||
data.forEach((x) => {
|
||||
x[argv.content] = x.__content;
|
||||
delete x.__content;
|
||||
});
|
||||
|
@ -72,9 +56,7 @@ export function handler(argv: any)
|
|||
// Determine if we are displaying a list of items. If we want a list, then
|
||||
// we wrap the data in another list (list of a list) so it writes out only
|
||||
// one item. Otherwise, we write out each one.
|
||||
const items = argv.list
|
||||
? [data]
|
||||
: data;
|
||||
const items = argv.list ? [data] : data;
|
||||
|
||||
// Figure the output of the results (JSON or YAML).
|
||||
const output = argv.yaml
|
||||
|
@ -82,11 +64,9 @@ export function handler(argv: any)
|
|||
: items.map((x: any) => JSON.stringify(x)).join("\n");
|
||||
|
||||
// Figure out where to write.
|
||||
if (argv.output === "-")
|
||||
{
|
||||
if (argv.output === "-") {
|
||||
console.log(output);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
fs.writeFileSync(argv.output, Buffer.from(output, "utf-8"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,7 @@ import * as scanner from "../scanner";
|
|||
export var command = "list";
|
||||
export var describe = "Extracts a YAML field into an order list";
|
||||
|
||||
export function builder(yargs: yargs.Arguments)
|
||||
{
|
||||
export function builder(yargs: yargs.Arguments) {
|
||||
return yargs
|
||||
.help("help")
|
||||
|
||||
|
@ -22,30 +21,23 @@ export function builder(yargs: yargs.Arguments)
|
|||
.demand(1);
|
||||
}
|
||||
|
||||
export function handler(argv: any)
|
||||
{
|
||||
export function handler(argv: any) {
|
||||
var files = argv._.splice(1);
|
||||
var data = scanner.scanFiles(argv, files);
|
||||
render(argv, data);
|
||||
}
|
||||
|
||||
export function render(argv, data)
|
||||
{
|
||||
for (var key in data)
|
||||
{
|
||||
export function render(argv, data) {
|
||||
for (var key in data) {
|
||||
var number = 1 + parseInt(key.toString());
|
||||
var item = data[key];
|
||||
var title = _.get(item, argv.title);
|
||||
var value = _.get(item, argv.field);
|
||||
|
||||
// Build up the parts so we can do this as a single line.
|
||||
const parts = [
|
||||
`${number}. `,
|
||||
title,
|
||||
];
|
||||
const parts = [`${number}. `, title];
|
||||
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
parts.push(": " + value.replace(/\n/g, " "));
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@ import * as scanner from "../scanner";
|
|||
export var command = "sections";
|
||||
export var describe = "Extracts a YAML field into sections";
|
||||
|
||||
export function builder(yargs: yargs.Arguments)
|
||||
{
|
||||
export function builder(yargs: yargs.Arguments) {
|
||||
return yargs
|
||||
.help("help")
|
||||
|
||||
|
@ -22,25 +21,21 @@ export function builder(yargs: yargs.Arguments)
|
|||
.demand(1);
|
||||
}
|
||||
|
||||
export function handler(argv: any)
|
||||
{
|
||||
export function handler(argv: any) {
|
||||
var files = argv._.splice(1);
|
||||
var data = scanner.scanFiles(argv, files);
|
||||
render(argv, data);
|
||||
}
|
||||
|
||||
export function render(argv, data)
|
||||
{
|
||||
for (var item of data)
|
||||
{
|
||||
export function render(argv, data) {
|
||||
for (var item of data) {
|
||||
var title = _.get(item, argv.title);
|
||||
var value = _.get(item, argv.field);
|
||||
|
||||
console.log(`# ${title}`);
|
||||
console.log();
|
||||
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
console.log(value.replace("\n", "\n\n"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,7 @@ import * as scanner from "../scanner";
|
|||
export var command = "table";
|
||||
export var describe = "Create a summary table of requested fields";
|
||||
|
||||
export function builder(yargs: yargs.Arguments)
|
||||
{
|
||||
export function builder(yargs: yargs.Arguments) {
|
||||
return yargs
|
||||
.help("help")
|
||||
|
||||
|
@ -37,23 +36,20 @@ export function builder(yargs: yargs.Arguments)
|
|||
.demand(1);
|
||||
}
|
||||
|
||||
export function handler(argv: any)
|
||||
{
|
||||
export function handler(argv: any) {
|
||||
var files = argv._.splice(1);
|
||||
var data = scanner.scanFiles(argv, files);
|
||||
render(argv, data);
|
||||
}
|
||||
|
||||
export function render(argv, data)
|
||||
{
|
||||
export function render(argv, data) {
|
||||
// Parse out the options and fields from the sources.
|
||||
var columns = parse(argv, argv.titles, argv.fields);
|
||||
|
||||
// Create the header row.
|
||||
var header: any[] = [];
|
||||
|
||||
for (var column1 of columns)
|
||||
{
|
||||
for (var column1 of columns) {
|
||||
header.push(column1.header);
|
||||
}
|
||||
|
||||
|
@ -63,35 +59,30 @@ export function render(argv, data)
|
|||
// Loop through the results and get the fields we need to display.
|
||||
var totals: any = ["Totals"];
|
||||
|
||||
for (var metadata of data)
|
||||
{
|
||||
for (var metadata of data) {
|
||||
// Add the row to the table.
|
||||
var row: any[] = [];
|
||||
table.push(row);
|
||||
|
||||
// Loop through our fields and retrieve each one.
|
||||
for (var index = 0; index < columns.length; index++)
|
||||
{
|
||||
for (var index = 0; index < columns.length; index++) {
|
||||
// Grab the value, even if nested.
|
||||
var column = columns[index];
|
||||
var value = _.get(metadata, column.ref);
|
||||
|
||||
// If we have a list, format it with spaces.
|
||||
if (Array.isArray(value))
|
||||
{
|
||||
if (Array.isArray(value)) {
|
||||
value = value.join(argv.listDelimiter);
|
||||
}
|
||||
|
||||
// If we have totals, then add them.
|
||||
if (column.total)
|
||||
{
|
||||
if (column.total) {
|
||||
totals[index] = totals[index] ? parseInt(totals[index]) : 0;
|
||||
totals[index] += parseInt(value);
|
||||
}
|
||||
|
||||
// If we have commas requested, then add those.
|
||||
if (column.comma)
|
||||
{
|
||||
if (column.comma) {
|
||||
value = comma(value);
|
||||
}
|
||||
|
||||
|
@ -101,14 +92,15 @@ export function render(argv, data)
|
|||
}
|
||||
|
||||
// If we have totals, then add it at the bottom.
|
||||
if (totals.length > 1)
|
||||
{
|
||||
for (var index2 = 0; index2 < columns.length && index2 < totals.length; index2++)
|
||||
{
|
||||
if (totals.length > 1) {
|
||||
for (
|
||||
var index2 = 0;
|
||||
index2 < columns.length && index2 < totals.length;
|
||||
index2++
|
||||
) {
|
||||
var column2 = columns[index2];
|
||||
|
||||
if (column2.comma)
|
||||
{
|
||||
if (column2.comma) {
|
||||
totals[index2] = comma(totals[index2]);
|
||||
}
|
||||
}
|
||||
|
@ -118,50 +110,45 @@ export function render(argv, data)
|
|||
|
||||
// Format the results in a table.
|
||||
var formattedTable = markdownTable(table, {
|
||||
align: columns.map(c => c.align),
|
||||
align: columns.map((c) => c.align),
|
||||
delimiter: argv.tableDelimiter,
|
||||
start: argv.tableStart,
|
||||
end: argv.tableEnd,
|
||||
rule: argv.tableRule
|
||||
rule: argv.tableRule,
|
||||
});
|
||||
|
||||
// If we don't want the header row, strip off the first line.
|
||||
if (!argv.tableHeader)
|
||||
{
|
||||
formattedTable = formattedTable.substring(formattedTable.indexOf("\n") + 1);
|
||||
if (!argv.tableHeader) {
|
||||
formattedTable = formattedTable.substring(
|
||||
formattedTable.indexOf("\n") + 1
|
||||
);
|
||||
}
|
||||
|
||||
console.log(formattedTable);
|
||||
}
|
||||
|
||||
class Column
|
||||
{
|
||||
class Column {
|
||||
ref: string;
|
||||
header: string;
|
||||
align: string = "l";
|
||||
comma: boolean = false;
|
||||
total: boolean = false;
|
||||
|
||||
public set(field, header)
|
||||
{
|
||||
public set(field, header) {
|
||||
this.ref = this.parseSpecifier(field);
|
||||
this.header = this.parseSpecifier(header ? header : field);
|
||||
}
|
||||
|
||||
private parseSpecifier(spec): string
|
||||
{
|
||||
private parseSpecifier(spec): string {
|
||||
// See if we have options.
|
||||
var m = spec.match(/^(.*?):([lcr.st]+)?$/);
|
||||
|
||||
if (m)
|
||||
{
|
||||
if (m) {
|
||||
// We have a match, so put the first part as the specifier.
|
||||
spec = m[1];
|
||||
|
||||
for (var s of m[2])
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
for (var s of m[2]) {
|
||||
switch (s) {
|
||||
case "c":
|
||||
case "l":
|
||||
case "r":
|
||||
|
@ -185,19 +172,18 @@ class Column
|
|||
}
|
||||
}
|
||||
|
||||
function parse(argv, titles, fields): Column[]
|
||||
{
|
||||
function parse(argv, titles, fields): Column[] {
|
||||
var columns: Column[] = [];
|
||||
|
||||
if (!titles) titles = [];
|
||||
|
||||
for (var index = 0; index < fields.length; index++)
|
||||
{
|
||||
for (var index = 0; index < fields.length; index++) {
|
||||
var column = new Column();
|
||||
|
||||
column.set(
|
||||
fields[index],
|
||||
titles.length >= index ? titles[index] : undefined);
|
||||
titles.length >= index ? titles[index] : undefined
|
||||
);
|
||||
|
||||
columns.push(column);
|
||||
}
|
||||
|
|
|
@ -4,15 +4,11 @@ import * as yargs from "yargs";
|
|||
export var command = "version";
|
||||
export var describe = "Displays version information about the program";
|
||||
|
||||
export function builder(yargs: yargs.Arguments)
|
||||
{
|
||||
return yargs
|
||||
.help("help")
|
||||
.demand(0);
|
||||
export function builder(yargs: yargs.Arguments) {
|
||||
return yargs.help("help").demand(0);
|
||||
}
|
||||
|
||||
export function handler(argv: any)
|
||||
{
|
||||
export function handler(argv: any) {
|
||||
const pkg: any = readPackage.sync();
|
||||
const json = pkg.pkg;
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"indentSize": 4,
|
||||
"tabSize": 4,
|
||||
"indentStyle": 2,
|
||||
"newLineCharacter": "\n",
|
||||
"convertTabsToSpaces": true,
|
||||
"placeOpenBraceOnNewLineForFunctions": true,
|
||||
"placeOpenBraceOnNewLineForControlBlocks": true
|
||||
}
|
Loading…
Reference in a new issue