Skip to content

Commit

Permalink
Upgrade to lodash 4
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoftek committed Oct 27, 2018
1 parent 1cc2eac commit db2dc92
Show file tree
Hide file tree
Showing 20 changed files with 54 additions and 53 deletions.
8 changes: 4 additions & 4 deletions backends/mssql.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
'use strict';

var knex = require('knex');
var mapKeys = require('lodash/object/mapKeys');
var contains = require('lodash/collection/includes');
var camelCase = require('lodash/string/camelCase');
var pluck = require('lodash/collection/pluck');
var mapKeys = require('lodash/mapKeys');
var contains = require('lodash/includes');
var camelCase = require('lodash/camelCase');
var pluck = require('lodash/map');
var undef;

module.exports = function mssqlBackend(opts, callback) {
Expand Down
8 changes: 4 additions & 4 deletions backends/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
'use strict';

var knex = require('knex');
var pluck = require('lodash/collection/pluck');
var mapKeys = require('lodash/object/mapKeys');
var contains = require('lodash/collection/includes');
var camelCase = require('lodash/string/camelCase');
var pluck = require('lodash/map');
var mapKeys = require('lodash/mapKeys');
var contains = require('lodash/includes');
var camelCase = require('lodash/camelCase');
var undef;

module.exports = function mysqlBackend(opts, callback) {
Expand Down
10 changes: 5 additions & 5 deletions backends/postgres.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
'use strict';

var knex = require('knex');
var uniq = require('lodash/array/uniq');
var pluck = require('lodash/collection/pluck');
var mapKeys = require('lodash/object/mapKeys');
var contains = require('lodash/collection/includes');
var camelCase = require('lodash/string/camelCase');
var uniq = require('lodash/uniq');
var pluck = require('lodash/map');
var mapKeys = require('lodash/mapKeys');
var contains = require('lodash/includes');
var camelCase = require('lodash/camelCase');
var undef;

module.exports = function postgresBackend(opts, cb) {
Expand Down
4 changes: 2 additions & 2 deletions backends/sqlite.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
'use strict';

var knex = require('knex');
var pluck = require('lodash/collection/pluck');
var contains = require('lodash/collection/includes');
var pluck = require('lodash/map');
var contains = require('lodash/includes');

module.exports = function sqliteBackend(opts, callback) {
var sqlite = knex({
Expand Down
6 changes: 3 additions & 3 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ var path = require('path');
var async = require('async');
var opts = require('./cli/args');
var prompts = require('./cli/prompts');
var merge = require('lodash/object/merge');
var partial = require('lodash/function/partial');
var merge = require('lodash/merge');
var partial = require('lodash/partial');
var backends = require('./backends');
var mapValues = require('lodash/object/mapValues');
var mapValues = require('lodash/mapValues');
var steps = {
getTables: require('./steps/table-list'),
tableToObject: require('./steps/table-to-object'),
Expand Down
2 changes: 1 addition & 1 deletion cli/prompts.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var inquirer = require('inquirer');
var merge = require('lodash/object/merge');
var merge = require('lodash/merge');

module.exports = {
outputPath: function(cb) {
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"graphql": "^14.0.0",
"inquirer": "^6.2.0",
"knex": "^0.15.2",
"lodash": "^3.10.1",
"lodash": "^4.0.0",
"mkdirp": "^0.5.1",
"mysql": "^2.8.0",
"pg": "^7.5.0",
Expand Down
2 changes: 1 addition & 1 deletion steps/ast-builders/object.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var b = require('ast-types').builders;
var isPlainObject = require('lodash/lang/isPlainObject');
var isPlainObject = require('lodash/isPlainObject');

function buildObject(obj) {
var fields = [], key;
Expand Down
2 changes: 1 addition & 1 deletion steps/ast-builders/resolve-map.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var b = require('ast-types').builders;
var reduce = require('lodash/collection/reduce');
var reduce = require('lodash/reduce');
var buildObject = require('./object');
var buildStrict = require('./use-strict');
var buildVariable = require('./variable');
Expand Down
8 changes: 4 additions & 4 deletions steps/ast-builders/schema-imports.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

var b = require('ast-types').builders;
var uniq = require('lodash/array/uniq');
var flatten = require('lodash/array/flatten');
var reduce = require('lodash/collection/reduce');
var pluck = require('lodash/collection/pluck');
var uniq = require('lodash/uniq');
var flatten = require('lodash/flatten');
var reduce = require('lodash/reduce');
var pluck = require('lodash/map');
var getPrimaryKey = require('../../util/get-primary-key');
var typeMap = {
string: 'GraphQLString',
Expand Down
4 changes: 2 additions & 2 deletions steps/ast-builders/schema.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var camelCase = require('lodash/string/camelCase');
var map = require('lodash/collection/map');
var camelCase = require('lodash/camelCase');
var map = require('lodash/map');
var b = require('ast-types').builders;
var buildVar = require('./variable');
var buildQuery = require('./query');
Expand Down
2 changes: 1 addition & 1 deletion steps/ast-builders/type-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var b = require('ast-types').builders;
var buildStrict = require('./use-strict');
var pluck = require('lodash/collection/pluck');
var pluck = require('lodash/map');
var buildExports = require('./exports');

module.exports = function buildTypeIndex(data, opts) {
Expand Down
8 changes: 4 additions & 4 deletions steps/column-to-object.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

var merge = require('lodash/object/merge');
var indexBy = require('lodash/collection/indexBy');
var camelCase = require('lodash/string/camelCase');
var capitalize = require('lodash/string/capitalize');
var merge = require('lodash/merge');
var indexBy = require('lodash/keyBy');
var camelCase = require('lodash/camelCase');
var capitalize = require('lodash/capitalize');
var generics = ['type'], undef;

function columnToObject(col, opts) {
Expand Down
8 changes: 4 additions & 4 deletions steps/find-one-to-many-rels.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

var async = require('async');
var after = require('lodash/function/after');
var find = require('lodash/collection/find');
var camelCase = require('lodash/string/camelCase');
var capitalize = require('lodash/string/capitalize');
var after = require('lodash/after');
var find = require('lodash/find');
var camelCase = require('lodash/camelCase');
var capitalize = require('lodash/capitalize');
var pluralize = require('pluralize');

module.exports = function findOneToManyRelationships(adapter, models, callback) {
Expand Down
7 changes: 4 additions & 3 deletions steps/find-references.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

var filter = require('lodash/collection/filter');
var snakeCase = require('lodash/string/snakeCase');
var capitalize = require('lodash/string/capitalize');
var filter = require('lodash/filter');
var snakeCase = require('lodash/snakeCase');
var capitalize = require('lodash/capitalize');

function findReferences(models) {
for (var type in models) {
Expand All @@ -14,6 +14,7 @@ function findReferences(models) {
}

function findReferencesForModel(model, models) {
console.log(models)
// Find columns that end with "Id"
var refs = filter(model.fields, isIdColumn);
var fields = Object.keys(model.fields);
Expand Down
10 changes: 5 additions & 5 deletions steps/generate-types.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

var find = require('lodash/collection/find');
var where = require('lodash/collection/where');
var pluck = require('lodash/collection/pluck');
var capitalize = require('lodash/string/capitalize');
var snakeCase = require('lodash/string/snakeCase');
var find = require('lodash/find');
var where = require('lodash/filter');
var pluck = require('lodash/map');
var capitalize = require('lodash/capitalize');
var snakeCase = require('lodash/snakeCase');
var b = require('ast-types').builders;
var buildVar = require('./ast-builders/variable');
var buildResolver = require('./ast-builders/resolver');
Expand Down
2 changes: 1 addition & 1 deletion steps/output-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var fs = require('fs');
var path = require('path');
var merge = require('lodash/object/merge');
var merge = require('lodash/merge');
var recast = require('recast');
var mkdirp = require('mkdirp');
var buildType = require('./ast-builders/type');
Expand Down
2 changes: 1 addition & 1 deletion steps/table-list.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var diff = require('lodash/array/difference');
var diff = require('lodash/difference');

// Get available tables/verify specified tables
module.exports = function getTableList(adapter, opts, cb) {
Expand Down
6 changes: 3 additions & 3 deletions steps/table-to-object.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

var pluralize = require('pluralize');
var camelCase = require('lodash/string/camelCase');
var capitalize = require('lodash/string/capitalize');
var indexBy = require('lodash/collection/indexBy');
var camelCase = require('lodash/camelCase');
var capitalize = require('lodash/capitalize');
var indexBy = require('lodash/keyBy');
var columnToObject = require('./column-to-object');

function tableToObject(table, opts) {
Expand Down

0 comments on commit db2dc92

Please sign in to comment.