Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies to fix security warnings #679

Merged
merged 6 commits into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/migrations
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ database.json
*.sublime-workspace
archive
.db-migraterc
coverage.html

# Vim swap files
.*.sw[a-z]
12 changes: 12 additions & 0 deletions .labrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
coverage: true,
threshold: 74,
lint: true,
globals: 'verbose,dryRun,SharedArrayBuffer,Atomics,BigUint64Array,BigInt64Array,BigInt,URL,URLSearchParams,TextEncoder,TextDecoder,queueMicrotask',
assert: '@hapi/code',
verbose: true,
'coverage-exclude': [
'lib/interface',
'lib/transitions',
]
};
8 changes: 0 additions & 8 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ module.exports.getInstance = function (
callback
) {
delete require.cache[require.resolve('./api.js')];
delete require.cache[require.resolve('optimist')];
delete require.cache[require.resolve('yargs')];
var Mod = require('./api.js');
var plugins = {};

Expand Down
4 changes: 2 additions & 2 deletions lib/commands/create-migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const log = require('db-migrate-shared').log;
const mkdirp = Promise.promisify(require('mkdirp'));
const fs = require('fs');
const stat = Promise.promisify(fs.stat);
const optimist = require('optimist');
const yargs = require('yargs');
const util = require('util');

async function createMigrationDir (dir) {
Expand Down Expand Up @@ -33,7 +33,7 @@ async function executeCreateMigration (internals, config) {
if (internals.argv._.length === 0) {
log.error("'migrationName' is required.");
if (!internals.isModule) {
optimist.showHelp();
yargs.showHelp();
}

throw new Error("'migrationName' is required.");
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/run.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var log = require('db-migrate-shared').log;
var optimist = require('optimist');
var yargs = require('yargs');
var load = require('./');
var transition = load('transition');

Expand Down Expand Up @@ -117,7 +117,7 @@ function run (internals, config) {
'Invalid Action: Must be [up|down|check|create|reset|sync|' +
'db|transition].'
);
optimist.showHelp();
yargs.showHelp();
process.exit(1);
}
break;
Expand Down
22 changes: 9 additions & 13 deletions lib/commands/set-default-argv.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var optimist = require('optimist');
var yargs = require('yargs');
var log = require('db-migrate-shared').log;

module.exports = function (internals, isModule) {
Expand All @@ -20,7 +20,7 @@ module.exports = function (internals, isModule) {
};

if (!isModule) {
internals.argv = optimist
internals.argv = yargs
.default(defaultConfig)
.usage(
'Usage: db-migrate [up|down|check|reset|sync|create|db|transition] ' +
Expand Down Expand Up @@ -110,29 +110,25 @@ module.exports = function (internals, isModule) {
.describe('ignore-completed-migrations', 'Start at the first migration')
.boolean('ignore-completed-migrations')
.describe('log-level', 'Set the log-level, for example sql|warn')
.string('log-level');
.string('log-level')
.parse();
} else {
const _internalsArgv = Object.assign(defaultConfig, internals.cmdOptions);
internals.argv = {
get argv () {
return _internalsArgv;
}
};
internals.argv = Object.assign(defaultConfig, internals.cmdOptions);
}

var plugins = internals.plugins;
var plugin = plugins.hook('init:cli:config:hook');
var _config = internals.argv.argv.config;
var _config = internals.argv.config;

if (plugin) {
plugin.forEach(function (plugin) {
// var configs = plugin['init:cli:config:hook']();
// if (!configs) return;
// hook not yet used, we look into migrating away from optimist first
// hook not yet used, we look into migrating away from yargs first
});
}

internals.argv = deepExtend(internals.argv.argv, rc('db-migrate', {}));
internals.argv = deepExtend(internals.argv, rc('db-migrate', {}));
internals.argv.rcconfig = internals.argv.config;
internals.argv.config = internals.argv.configFile || _config;

Expand All @@ -142,7 +138,7 @@ module.exports = function (internals, isModule) {
}

if (!isModule && (internals.argv.help || internals.argv._.length === 0)) {
optimist.showHelp();
yargs.showHelp();
process.exit(1);
}

Expand Down
Loading