migrate from underscore to lodash

This commit is contained in:
Brian Gough
2020-06-15 09:52:21 +01:00
parent 19690e7847
commit 9b92793b89
9 changed files with 10 additions and 18 deletions

View File

@@ -25,7 +25,7 @@ const async = require('async')
const LockManager = require('./DockerLockManager') const LockManager = require('./DockerLockManager')
const fs = require('fs') const fs = require('fs')
const Path = require('path') const Path = require('path')
const _ = require('underscore') const _ = require('lodash')
const metrics = require('metrics-sharelatex') const metrics = require('metrics-sharelatex')
logger.info('using docker runner') logger.info('using docker runner')

View File

@@ -19,7 +19,7 @@ const fs = require('fs')
const fse = require('fs-extra') const fse = require('fs-extra')
const Path = require('path') const Path = require('path')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const _ = require('underscore') const _ = require('lodash')
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const crypto = require('crypto') const crypto = require('crypto')

View File

@@ -19,7 +19,7 @@ const Path = require('path')
const { spawn } = require('child_process') const { spawn } = require('child_process')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const Metrics = require('./Metrics') const Metrics = require('./Metrics')
const _ = require('underscore') const _ = require('lodash')
module.exports = OutputFileOptimiser = { module.exports = OutputFileOptimiser = {
optimiseFile(src, dst, callback) { optimiseFile(src, dst, callback) {

View File

@@ -10,7 +10,7 @@
*/ */
const Sequelize = require('sequelize') const Sequelize = require('sequelize')
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const _ = require('underscore') const _ = require('lodash')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const options = _.extend({ logging: false }, Settings.mysql.clsi) const options = _.extend({ logging: false }, Settings.mysql.clsi)

10
package-lock.json generated
View File

@@ -6640,11 +6640,6 @@
"integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==",
"dev": true "dev": true
}, },
"underscore": {
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.2.tgz",
"integrity": "sha512-D39qtimx0c1fI3ya1Lnhk3E9nONswSKhnffBI0gME9C99fYOkNi04xs8K6pePLhvl1frbDemkaBQ5ikWllR2HQ=="
},
"universalify": { "universalify": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
@@ -6834,11 +6829,6 @@
"resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.4.1.tgz", "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.4.1.tgz",
"integrity": "sha512-3eBwRyEln6E1MSzcxcVpQIhRG8Q1jLvEqRmCZqS3dsfXEDR/AhOF4d+jHg1qvDCpYaVRZjENPQyrVxAkQqxPgQ==" "integrity": "sha512-3eBwRyEln6E1MSzcxcVpQIhRG8Q1jLvEqRmCZqS3dsfXEDR/AhOF4d+jHg1qvDCpYaVRZjENPQyrVxAkQqxPgQ=="
}, },
"when": {
"version": "3.7.8",
"resolved": "https://registry.npmjs.org/when/-/when-3.7.8.tgz",
"integrity": "sha1-xxMLan6gRpPoQs3J56Hyqjmjn4I="
},
"which": { "which": {
"version": "1.3.1", "version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",

View File

@@ -27,6 +27,7 @@
"fs-extra": "^8.1.0", "fs-extra": "^8.1.0",
"heapdump": "^0.3.15", "heapdump": "^0.3.15",
"lockfile": "^1.0.4", "lockfile": "^1.0.4",
"lodash": "^4.17.15",
"logger-sharelatex": "^1.9.1", "logger-sharelatex": "^1.9.1",
"lynx": "0.2.0", "lynx": "0.2.0",
"metrics-sharelatex": "^2.6.0", "metrics-sharelatex": "^2.6.0",
@@ -35,7 +36,6 @@
"sequelize": "^5.21.5", "sequelize": "^5.21.5",
"settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.1.0", "settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.1.0",
"sqlite3": "^4.1.1", "sqlite3": "^4.1.1",
"underscore": "^1.9.2",
"v8-profiler-node8": "^6.1.1", "v8-profiler-node8": "^6.1.1",
"wrench": "~1.5.9" "wrench": "~1.5.9"
}, },

View File

@@ -13,7 +13,7 @@ const request = require('request')
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const async = require('async') const async = require('async')
const fs = require('fs') const fs = require('fs')
const _ = require('underscore') const _ = require('lodash')
const concurentCompiles = 5 const concurentCompiles = 5
const totalCompiles = 50 const totalCompiles = 50

View File

@@ -70,7 +70,8 @@ describe('DockerRunner', function() {
return runner(callback) return runner(callback)
} }
} }
} },
globals: { Math } // used by lodash
}) })
this.Docker = Docker this.Docker = Docker
this.getContainer = Docker.prototype.getContainer this.getContainer = Docker.prototype.getContainer

View File

@@ -30,7 +30,8 @@ describe('OutputFileOptimiser', function() {
child_process: { spawn: (this.spawn = sinon.stub()) }, child_process: { spawn: (this.spawn = sinon.stub()) },
'logger-sharelatex': { log: sinon.stub(), warn: sinon.stub() }, 'logger-sharelatex': { log: sinon.stub(), warn: sinon.stub() },
'./Metrics': {} './Metrics': {}
} },
globals: { Math } // used by lodash
}) })
this.directory = '/test/dir' this.directory = '/test/dir'
return (this.callback = sinon.stub()) return (this.callback = sinon.stub())