Skip to content

Commit

Permalink
fix(dependencies): update all dependencies (including for vulnerabili…
Browse files Browse the repository at this point in the history
…ties)
  • Loading branch information
JaredReisinger committed Aug 12, 2020
1 parent 39a9937 commit 501d12b
Show file tree
Hide file tree
Showing 11 changed files with 3,868 additions and 3,289 deletions.
19 changes: 7 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
## [1.0.12](https://github.com/JaredReisinger/order-fetcher/compare/v1.0.11...v1.0.12) (2020-06-02)


### Bug Fixes

* package.json, package-lock.json & .snyk to reduce vulnerabilities ([cb4910a](https://github.com/JaredReisinger/order-fetcher/commit/cb4910a6e8a1798875b9b5b197811f6ec3b12f14))
* package.json, package-lock.json & .snyk to reduce vulnerabilities ([c7723a8](https://github.com/JaredReisinger/order-fetcher/commit/c7723a8339b5f9d62d011e20f87550e1b22da2a0))
* package.json, package-lock.json & .snyk to reduce vulnerabilities ([bfea29d](https://github.com/JaredReisinger/order-fetcher/commit/bfea29d49c504aa94b3541a8f56f6c6fd05ca0a4))
- package.json, package-lock.json & .snyk to reduce vulnerabilities ([cb4910a](https://github.com/JaredReisinger/order-fetcher/commit/cb4910a6e8a1798875b9b5b197811f6ec3b12f14))
- package.json, package-lock.json & .snyk to reduce vulnerabilities ([c7723a8](https://github.com/JaredReisinger/order-fetcher/commit/c7723a8339b5f9d62d011e20f87550e1b22da2a0))
- package.json, package-lock.json & .snyk to reduce vulnerabilities ([bfea29d](https://github.com/JaredReisinger/order-fetcher/commit/bfea29d49c504aa94b3541a8f56f6c6fd05ca0a4))

## [1.0.11](https://github.com/JaredReisinger/order-fetcher/compare/v1.0.10...v1.0.11) (2020-03-17)


### Bug Fixes

* **vulnerabilities:** update dependencies ([ade6935](https://github.com/JaredReisinger/order-fetcher/commit/ade6935bf7c455195eb2c91bfd24b7ab8e49cf4e))
- **vulnerabilities:** update dependencies ([ade6935](https://github.com/JaredReisinger/order-fetcher/commit/ade6935bf7c455195eb2c91bfd24b7ab8e49cf4e))

## [1.0.10](https://github.com/JaredReisinger/order-fetcher/compare/v1.0.9...v1.0.10) (2020-03-17)


### Bug Fixes

* upgrade inquirer from 7.0.4 to 7.0.6 ([32a142f](https://github.com/JaredReisinger/order-fetcher/commit/32a142f1ab346d0c652c95977cf096e15e55ff87))
- upgrade inquirer from 7.0.4 to 7.0.6 ([32a142f](https://github.com/JaredReisinger/order-fetcher/commit/32a142f1ab346d0c652c95977cf096e15e55ff87))

## [1.0.9](https://github.com/JaredReisinger/order-fetcher/compare/v1.0.8...v1.0.9) (2020-03-17)


### Bug Fixes

* package.json & package-lock.json to reduce vulnerabilities ([06b5ff5](https://github.com/JaredReisinger/order-fetcher/commit/06b5ff5c5b8a6509de84a1c720ea731d320aa967))
- package.json & package-lock.json to reduce vulnerabilities ([06b5ff5](https://github.com/JaredReisinger/order-fetcher/commit/06b5ff5c5b8a6509de84a1c720ea731d320aa967))

## [1.0.8](https://github.com/JaredReisinger/order-fetcher/compare/v1.0.7...v1.0.8) (2020-01-19)


### Bug Fixes

* **dependencies:** update all dependencies ([02d6794](https://github.com/JaredReisinger/order-fetcher/commit/02d6794f6b027216887bc051f48b45ca9cc05907))
- **dependencies:** update all dependencies ([02d6794](https://github.com/JaredReisinger/order-fetcher/commit/02d6794f6b027216887bc051f48b45ca9cc05907))

## [1.0.7](https://github.com/JaredReisinger/order-fetcher/compare/v1.0.6...v1.0.7) (2020-01-17)

Expand Down
4 changes: 2 additions & 2 deletions lib/cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const readFileAsync = util.promisify(fs.readFile);

// You can't use 'await' outside of an 'async' function... so you have to use
// .then()/.catch() at the top level.
main().catch(e => {
main().catch((e) => {
helpers.err(e);
if (!(e instanceof helpers.UserError) && e.stack) {
helpers.err(e.stack, chalk.white);
Expand All @@ -38,7 +38,7 @@ async function main() {

const cmds = await commands.createCommands(cfg, handleGlobalOpts);
helpers.dbg(5, 'commands', { cmds });
cmds.forEach(cmd => yargs.command(cmd));
cmds.forEach((cmd) => yargs.command(cmd));

if (process.stdout.isTTY) {
// We could allow arbitrarily wide help output, but it looks pretty bad
Expand Down
16 changes: 9 additions & 7 deletions lib/commands/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class Config {
{
command: 'config',
describe: 'help manage the .order-fetcher.json configuration',
builder: yargs => {
builder: (yargs) => {
yargs.command({
command: 'view',
describe: 'view the current configuration',
Expand Down Expand Up @@ -78,8 +78,10 @@ export default class Config {
}

helpers.out(chalk`
timezone: {cyan ${!this.cfg.timezone ||
chalk`{yellow (none configured, using ${moment.tz.guess()})}`}}
timezone: {cyan ${
!this.cfg.timezone ||
chalk`{yellow (none configured, using ${moment.tz.guess()})}`
}}
{gray hosts}${Object.entries(this.cfg.hosts)
.map(
Expand Down Expand Up @@ -197,7 +199,7 @@ timezone: {cyan ${!this.cfg.timezone ||
message: 'What is the nickname for your WooCommerce site?',
type: hostName ? 'nop' : 'input',
default: hostName,
validate: name =>
validate: (name) =>
name && name.length > 0
? true
: 'Please provide a name, it will be used as a convenient subcommand.',
Expand Down Expand Up @@ -279,7 +281,7 @@ timezone: {cyan ${!this.cfg.timezone ||
}

function required(name) {
return input => {
return (input) => {
if (input) {
return true;
}
Expand All @@ -289,10 +291,10 @@ function required(name) {

function uncaseExact(substring) {
const lower = substring.toLowerCase();
return item => item.toLowerCase() === lower;
return (item) => item.toLowerCase() === lower;
}

function uncaseIncludes(substring) {
const lower = substring.toLowerCase();
return item => item.toLowerCase().includes(lower);
return (item) => item.toLowerCase().includes(lower);
}
47 changes: 23 additions & 24 deletions lib/commands/get.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export default class Get {
async createCommands() {
// create the base 'get' command, and also a per-host version that makes
// the command-line easier for the user.
const cmds = Object.keys(this.hosts).map(host => this.createCommand(host));
const cmds = Object.keys(this.hosts).map((host) =>
this.createCommand(host)
);

// now that we have host-specific variants, does the generic version matter
// any longer?
Expand Down Expand Up @@ -61,7 +63,7 @@ export default class Get {
const describe = `gets orders from ${
host ? `the ${host}` : 'a'
} WooCommerce site`;
const builder = yargs => {
const builder = (yargs) => {
if (!host) {
yargs.option('host', {
describe: 'Connect to the given host',
Expand All @@ -72,11 +74,11 @@ export default class Get {
yargs
.option('after', {
describe: 'Include only orders after the given date (inclusive)',
coerce: val => helpers.asMoment(val, this.timezone),
coerce: (val) => helpers.asMoment(val, this.timezone),
})
.option('before', {
describe: 'Include only orders before the given date (inclusive?)',
coerce: val => helpers.asMoment(val, this.timezone),
coerce: (val) => helpers.asMoment(val, this.timezone),
})
.option('status', {
describe: 'Include only orders with the given status',
Expand Down Expand Up @@ -211,9 +213,9 @@ Examples:
generatePretty(items, currencies) {
const ignoredFields = ['address', 'phone', 'method', 'transID'];
const fields = this.defineFields(items, currencies).filter(
f =>
(f) =>
!ignoredFields.includes(f.label) &&
items.some(i => this.getValue(i, f) !== '')
items.some((i) => this.getValue(i, f) !== '')
);

// If there are no items, the "hide columns with no data" will cause our
Expand All @@ -226,22 +228,20 @@ Examples:
// that *if* we know we'll be wrapping, use a 2-line date format and make
// the date column smaller than the calcuated "min" width.
helpers.dbg(0, 'fields', fields);
fields[1].value = item => {
fields[1].value = (item) => {
const date = moment(item.order.date)
.tz(this.timezone)
.format('YYYY-MM-DD');

const time = moment(item.order.date)
.tz(this.timezone)
.format('hh:mm a');
const time = moment(item.order.date).tz(this.timezone).format('hh:mm a');

// return chalk`${date} {gray ${time}}`;
return `${date} ${time}`;
};

const data = items.map(i => fields.map(f => this.getValue(i, f)));
const data = items.map((i) => fields.map((f) => this.getValue(i, f)));
// unshift the header labels into the beginning of the array
data.unshift(fields.map(f => f.label));
data.unshift(fields.map((f) => f.label));
helpers.dbg(2, 'data', data);

// TODO: determine the maximum width of each column, and then set column
Expand All @@ -253,7 +253,7 @@ Examples:
: undefined;

// very temporary better-than-nothing width calcs...
const columns = fields.map(f => {
const columns = fields.map((f) => {
const config = {};
if (process.stdout.isTTY) {
// prettier-ignore
Expand Down Expand Up @@ -294,7 +294,7 @@ Examples:
joinRight: '', // '|',
joinJoin: '', // '|',
},
drawHorizontalLine: index => index === 1,
drawHorizontalLine: (index) => index === 1,
});
}

Expand All @@ -320,7 +320,7 @@ Examples:
// key and label, or is a [label, key] pair (or [label, key, config]).
const fieldLabelKeys = [
['order#', 'order.id'],
['date', item => this.formatDate(item.order.date), { wrapWord: true }],
['date', (item) => this.formatDate(item.order.date), { wrapWord: true }],
['status', 'order.status'],
['name', 'order.billing.name', { wrapWord: true }],
['email', 'order.billing.email'],
Expand All @@ -331,13 +331,14 @@ Examples:
['qty', 'quantity', { alignment: 'right' }],
[
'total',
item => this.formatAmount(item.total, item.order.currency, currencies),
(item) =>
this.formatAmount(item.total, item.order.currency, currencies),
{ alignment: 'right' },
],
['line', item => item.order_line + 1],
['line', (item) => item.order_line + 1],
[
'fees',
item =>
(item) =>
item.fees &&
this.formatAmount(item.fees, item.order.currency, currencies),
{ alignment: 'right' },
Expand All @@ -348,7 +349,7 @@ Examples:
];

// map to { value: lookup-key, label: display-label } for csv
const defaultFields = fieldLabelKeys.map(lk =>
const defaultFields = fieldLabelKeys.map((lk) =>
Array.isArray(lk)
? { value: lk[1], label: lk[0], config: lk[2] || {} }
: { value: lk, label: lk }
Expand All @@ -370,9 +371,9 @@ Examples:
// attribute/variation *slug* as the key. There's not much we can do about
// this. (In theory, we could introspect the product, but we don't want
// that much detailed knowledge in this tool!)
const slugs = new Set([].concat(...items.map(i => Object.keys(i.meta))));
const slugs = new Set([].concat(...items.map((i) => Object.keys(i.meta))));
helpers.dbg(3, 'meta slugs', slugs);
const metaFields = [...slugs].map(s => ({
const metaFields = [...slugs].map((s) => ({
// value: `meta["${s}"].value`,
value: `meta["${s}"]`,
label: s,
Expand All @@ -385,9 +386,7 @@ Examples:
}

formatDate(d) {
return moment(d)
.tz(this.timezone)
.format(excelDateTimeFmt);
return moment(d).tz(this.timezone).format(excelDateTimeFmt);
}

// eslint-disable-next-line class-methods-use-this
Expand Down
2 changes: 1 addition & 1 deletion lib/wc/WooClient.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default class WooClient {
// seen.
let duplicates = 0;
// eslint-disable-next-line no-loop-func
body.forEach(d => {
body.forEach((d) => {
const key = d[keyName];
if (keys[key]) {
duplicates++;
Expand Down
4 changes: 2 additions & 2 deletions lib/wc/WooItem.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ export default class WooItem {
static fromOrdersJson(orders, skus) {
helpers.dbg(3, 'fromJson()', { orders, skus });

let items = [].concat(...orders.map(o => WooItem.itemize(o)));
let items = [].concat(...orders.map((o) => WooItem.itemize(o)));

helpers.dbg(1, `found ${items.length} total items in orders...`);
helpers.dbg(2, 'items', items);

if (skus) {
items = items.filter(i => skus.includes(i.sku));
items = items.filter((i) => skus.includes(i.sku));
helpers.out(`found ${items.length} ${skus.join(',')} items...`);
helpers.dbg(2, 'filtered items', items);
}
Expand Down
5 changes: 3 additions & 2 deletions lib/wc/WooOrder.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ export default class WooOrder {

static simplifyBilling(wcBilling) {
// eslint-disable-next-line camelcase
const name = `${wcBilling.first_name || ''} ${wcBilling.last_name ||
''}`.trim();
const name = `${wcBilling.first_name || ''} ${
wcBilling.last_name || ''
}`.trim();

// eslint-disable-next-line camelcase
const addressParts = [];
Expand Down
Loading

0 comments on commit 501d12b

Please sign in to comment.