Просмотр исходного кода

Merge pull request #154 from overleaf/msm-dependency-update

Dependency update
Miguel Serrano 6 лет назад
Родитель
Сommit
77cc3b3cc6

+ 0 - 1
services/clsi/.eslintrc

@@ -1,7 +1,6 @@
 // this file was auto-generated, do not edit it directly.
 // instead run bin/update_build_scripts from
 // https://github.com/sharelatex/sharelatex-dev-environment
-// Version: 1.3.5
 {
   "extends": [
     "standard",

+ 0 - 1
services/clsi/.prettierrc

@@ -1,7 +1,6 @@
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.3.5
 {
   "semi": false,
   "singleQuote": true

+ 0 - 1
services/clsi/Dockerfile

@@ -1,7 +1,6 @@
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.3.5
 
 FROM node:10.19.0 as base
 

+ 0 - 1
services/clsi/Makefile

@@ -1,7 +1,6 @@
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.3.5
 
 BUILD_NUMBER ?= local
 BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)

+ 1 - 1
services/clsi/app/js/ProjectPersistenceManager.js

@@ -32,7 +32,7 @@ module.exports = ProjectPersistenceManager = {
       db.Project.findOrCreate({ where: { project_id } })
         .spread((project, created) =>
           project
-            .updateAttributes({ lastAccessed: new Date() })
+            .update({ lastAccessed: new Date() })
             .then(() => cb())
             .error(cb)
         )

+ 1 - 2
services/clsi/app/js/ResourceWriter.js

@@ -19,7 +19,6 @@ const UrlCache = require('./UrlCache')
 const Path = require('path')
 const fs = require('fs')
 const async = require('async')
-const mkdirp = require('mkdirp')
 const OutputFileFinder = require('./OutputFileFinder')
 const ResourceStateManager = require('./ResourceStateManager')
 const Metrics = require('./Metrics')
@@ -302,7 +301,7 @@ module.exports = ResourceWriter = {
       if (error != null) {
         return callback(error)
       }
-      return mkdirp(Path.dirname(path), function(error) {
+      return fs.mkdir(Path.dirname(path), { recursive: true }, function(error) {
         if (error != null) {
           return callback(error)
         }

+ 2 - 2
services/clsi/app/js/UrlCache.js

@@ -227,7 +227,7 @@ module.exports = UrlCache = {
       callback = function(error, urlDetails) {}
     }
     const job = cb =>
-      db.UrlCache.find({ where: { url, project_id } })
+      db.UrlCache.findOne({ where: { url, project_id } })
         .then(urlDetails => cb(null, urlDetails))
         .error(cb)
     return dbQueue.queue.push(job, callback)
@@ -241,7 +241,7 @@ module.exports = UrlCache = {
       db.UrlCache.findOrCreate({ where: { url, project_id } })
         .spread((urlDetails, created) =>
           urlDetails
-            .updateAttributes({ lastModified })
+            .update({ lastModified })
             .then(() => cb())
             .error(cb)
         )

+ 5 - 5
services/clsi/buildscript.txt

@@ -1,10 +1,10 @@
 clsi
---public-repo=True
---language=es
---env-add=
---node-version=10.19.0
 --acceptance-creds=None
 --dependencies=
 --docker-repos=gcr.io/overleaf-ops
+--env-add=
 --env-pass-through=TEXLIVE_IMAGE
---script-version=1.3.5
+--language=es
+--node-version=10.19.0
+--public-repo=True
+--script-version=2.0.0

+ 0 - 1
services/clsi/docker-compose.ci.yml

@@ -1,7 +1,6 @@
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.3.5
 
 version: "2.3"
 

+ 0 - 1
services/clsi/docker-compose.yml

@@ -1,7 +1,6 @@
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.3.5
 
 version: "2.3"
 

Разница между файлами не показана из-за своего большого размера
+ 389 - 236
services/clsi/package-lock.json


+ 28 - 29
services/clsi/package.json

@@ -14,37 +14,36 @@
     "test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
     "nodemon": "nodemon --config nodemon.json",
     "lint": "node_modules/.bin/eslint .",
-    "format": "node_modules/.bin/prettier-eslint '**/*.js' --list-different",
-    "format:fix": "node_modules/.bin/prettier-eslint '**/*.js' --write"
+    "format": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --list-different",
+    "format:fix": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --write"
   },
   "author": "James Allen <james@sharelatex.com>",
   "dependencies": {
-    "async": "0.2.9",
-    "body-parser": "^1.2.0",
-    "dockerode": "^2.5.3",
-    "express": "^4.2.0",
-    "fs-extra": "^0.16.3",
-    "heapdump": "^0.3.5",
-    "lockfile": "^1.0.3",
+    "async": "3.2.0",
+    "body-parser": "^1.19.0",
+    "dockerode": "^3.1.0",
+    "express": "^4.17.1",
+    "fs-extra": "^8.1.0",
+    "heapdump": "^0.3.15",
+    "lockfile": "^1.0.4",
     "logger-sharelatex": "^1.9.0",
-    "lynx": "0.0.11",
-    "metrics-sharelatex": "^2.3.0",
-    "mkdirp": "0.3.5",
-    "mysql": "2.6.2",
-    "request": "^2.21.0",
-    "sequelize": "^4.38.0",
+    "lynx": "0.2.0",
+    "metrics-sharelatex": "^2.6.0",
+    "mysql": "^2.18.1",
+    "request": "^2.88.2",
+    "sequelize": "^5.21.5",
     "settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.1.0",
     "smoke-test-sharelatex": "git+https://github.com/sharelatex/smoke-test-sharelatex.git#v0.2.0",
-    "sqlite3": "^4.0.6",
-    "underscore": "^1.8.2",
-    "v8-profiler-node8": "^6.0.1",
-    "wrench": "~1.5.4"
+    "sqlite3": "^4.1.1",
+    "underscore": "^1.9.2",
+    "v8-profiler-node8": "^6.1.1",
+    "wrench": "~1.5.9"
   },
   "devDependencies": {
-    "babel-eslint": "^10.0.3",
-    "bunyan": "^0.22.1",
-    "chai": "~1.8.1",
-    "eslint": "^6.6.0",
+    "babel-eslint": "^10.1.0",
+    "bunyan": "^1.8.12",
+    "chai": "~4.2.0",
+    "eslint": "^6.8.0",
     "eslint-config-prettier": "^6.10.0",
     "eslint-config-standard": "^14.1.0",
     "eslint-config-standard-jsx": "^8.1.0",
@@ -53,17 +52,17 @@
     "eslint-plugin-chai-friendly": "^0.5.0",
     "eslint-plugin-import": "^2.20.1",
     "eslint-plugin-jsx-a11y": "^6.2.3",
-    "eslint-plugin-mocha": "^6.2.2",
+    "eslint-plugin-mocha": "^6.3.0",
     "eslint-plugin-node": "^11.0.0",
     "eslint-plugin-prettier": "^3.1.2",
     "eslint-plugin-promise": "^4.2.1",
-    "eslint-plugin-react": "^7.18.3",
+    "eslint-plugin-react": "^7.19.0",
     "eslint-plugin-standard": "^4.0.1",
-    "mocha": "^4.0.1",
+    "mocha": "^7.1.0",
     "prettier": "^1.19.1",
     "prettier-eslint-cli": "^5.0.0",
-    "sandboxed-module": "~0.3.0",
-    "sinon": "~1.7.3",
-    "timekeeper": "0.0.4"
+    "sandboxed-module": "^2.0.3",
+    "sinon": "~9.0.1",
+    "timekeeper": "2.2.0"
   }
 }

+ 3 - 3
services/clsi/test/unit/js/CompileManagerTests.js

@@ -347,10 +347,10 @@ describe('CompileManager', function() {
           .should.equal(true)
       })
 
-      return it('should call the callback with an error from the stderr', function() {
-        this.callback.calledWith(new Error()).should.equal(true)
+      it('should call the callback with an error from the stderr', function() {
+        this.callback.calledWithExactly(sinon.match(Error)).should.equal(true)
 
-        return this.callback.args[0][0].message.should.equal(
+        this.callback.args[0][0].message.should.equal(
           `rm -r ${this.Settings.path.compilesDir}/${this.project_id}-${this.user_id} failed: ${this.error}`
         )
       })

+ 10 - 8
services/clsi/test/unit/js/DockerRunnerTests.js

@@ -464,8 +464,8 @@ describe('DockerRunner', function() {
         return this.createContainer.called.should.equal(false)
       })
 
-      return it('should call the callback with an error', function() {
-        return this.callback.calledWith(new Error()).should.equal(true)
+      it('should call the callback with an error', function() {
+        this.callback.calledWith(sinon.match(Error)).should.equal(true)
       })
     })
 
@@ -488,8 +488,8 @@ describe('DockerRunner', function() {
         return this.createContainer.called.should.equal(false)
       })
 
-      return it('should call the callback with an error', function() {
-        return this.callback.calledWith(new Error()).should.equal(true)
+      it('should call the callback with an error', function() {
+        this.callback.calledWith(sinon.match(Error)).should.equal(true)
       })
     })
 
@@ -582,10 +582,12 @@ describe('DockerRunner', function() {
         return this.container.kill.called.should.equal(true)
       })
 
-      return it('should call the callback with an error', function() {
-        const error = new Error('container timed out')
-        error.timedout = true
-        return this.callback.calledWith(error).should.equal(true)
+      it('should call the callback with an error', function() {
+        this.callback.calledWith(sinon.match(Error)).should.equal(true)
+
+        const errorObj = this.callback.args[0][0]
+        expect(errorObj.message).to.include('container timed out')
+        expect(errorObj.timedout).equal(true)
       })
     })
   })

+ 4 - 3
services/clsi/test/unit/js/LockManagerTests.js

@@ -84,9 +84,10 @@ describe('DockerLockManager', function() {
         return this.runner.called.should.equal(false)
       })
 
-      return it('should return an error', function() {
-        const error = new Errors.AlreadyCompilingError()
-        return this.callback.calledWithExactly(error).should.equal(true)
+      it('should return an error', function() {
+        this.callback
+          .calledWithExactly(sinon.match(Errors.AlreadyCompilingError))
+          .should.equal(true)
       })
     })
   })

+ 21 - 12
services/clsi/test/unit/js/ResourceStateManagerTests.js

@@ -11,6 +11,7 @@
  */
 const SandboxedModule = require('sandboxed-module')
 const sinon = require('sinon')
+const { expect } = require('chai')
 const should = require('chai').should()
 const modulePath = require('path').join(
   __dirname,
@@ -22,6 +23,7 @@ const Errors = require('../../../app/js/Errors')
 describe('ResourceStateManager', function() {
   beforeEach(function() {
     this.ResourceStateManager = SandboxedModule.require(modulePath, {
+      singleOnly: true,
       requires: {
         fs: (this.fs = {}),
         'logger-sharelatex': { log: sinon.stub(), err: sinon.stub() },
@@ -132,11 +134,13 @@ describe('ResourceStateManager', function() {
         )
       })
 
-      return it('should call the callback with an error', function() {
-        const error = new Errors.FilesOutOfSyncError(
-          'invalid state for incremental update'
-        )
-        return this.callback.calledWith(error).should.equal(true)
+      it('should call the callback with an error', function() {
+        this.callback
+          .calledWith(sinon.match(Errors.FilesOutOfSyncError))
+          .should.equal(true)
+
+        const message = this.callback.args[0][0].message
+        expect(message).to.include('invalid state for incremental update')
       })
     })
   })
@@ -174,11 +178,15 @@ describe('ResourceStateManager', function() {
         )
       })
 
-      return it('should call the callback with an error', function() {
-        const error = new Errors.FilesOutOfSyncError(
+      it('should call the callback with an error', function() {
+        this.callback
+          .calledWith(sinon.match(Errors.FilesOutOfSyncError))
+          .should.equal(true)
+
+        const message = this.callback.args[0][0].message
+        expect(message).to.include(
           'resource files missing in incremental update'
         )
-        return this.callback.calledWith(error).should.equal(true)
       })
     })
 
@@ -198,10 +206,11 @@ describe('ResourceStateManager', function() {
         )
       })
 
-      return it('should call the callback with an error', function() {
-        return this.callback
-          .calledWith(new Error('relative path in resource file list'))
-          .should.equal(true)
+      it('should call the callback with an error', function() {
+        this.callback.calledWith(sinon.match(Error)).should.equal(true)
+
+        const message = this.callback.args[0][0].message
+        expect(message).to.include('relative path in resource file list')
       })
     })
   })

+ 23 - 21
services/clsi/test/unit/js/ResourceWriterTests.js

@@ -12,6 +12,7 @@
  */
 const SandboxedModule = require('sandboxed-module')
 const sinon = require('sinon')
+const { expect } = require('chai')
 const should = require('chai').should()
 const modulePath = require('path').join(
   __dirname,
@@ -23,6 +24,7 @@ describe('ResourceWriter', function() {
   beforeEach(function() {
     let Timer
     this.ResourceWriter = SandboxedModule.require(modulePath, {
+      singleOnly: true,
       requires: {
         fs: (this.fs = {
           mkdir: sinon.stub().callsArg(1),
@@ -31,7 +33,6 @@ describe('ResourceWriter', function() {
         './ResourceStateManager': (this.ResourceStateManager = {}),
         wrench: (this.wrench = {}),
         './UrlCache': (this.UrlCache = {}),
-        mkdirp: (this.mkdirp = sinon.stub().callsArg(1)),
         './OutputFileFinder': (this.OutputFileFinder = {}),
         'logger-sharelatex': { log: sinon.stub(), err: sinon.stub() },
         './Metrics': (this.Metrics = {
@@ -346,6 +347,7 @@ describe('ResourceWriter', function() {
   describe('_writeResourceToDisk', function() {
     describe('with a url based resource', function() {
       beforeEach(function() {
+        this.fs.mkdir = sinon.stub().callsArg(2)
         this.resource = {
           path: 'main.tex',
           url: 'http://www.example.com/main.tex',
@@ -363,7 +365,7 @@ describe('ResourceWriter', function() {
       })
 
       it('should ensure the directory exists', function() {
-        return this.mkdirp
+        this.fs.mkdir
           .calledWith(
             path.dirname(path.join(this.basePath, this.resource.path))
           )
@@ -397,6 +399,7 @@ describe('ResourceWriter', function() {
           content: 'Hello world'
         }
         this.fs.writeFile = sinon.stub().callsArg(2)
+        this.fs.mkdir = sinon.stub().callsArg(2)
         return this.ResourceWriter._writeResourceToDisk(
           this.project_id,
           this.resource,
@@ -406,7 +409,7 @@ describe('ResourceWriter', function() {
       })
 
       it('should ensure the directory exists', function() {
-        return this.mkdirp
+        return this.fs.mkdir
           .calledWith(
             path.dirname(path.join(this.basePath, this.resource.path))
           )
@@ -446,10 +449,11 @@ describe('ResourceWriter', function() {
         return this.fs.writeFile.called.should.equal(false)
       })
 
-      return it('should return an error', function() {
-        return this.callback
-          .calledWith(new Error('resource path is outside root directory'))
-          .should.equal(true)
+      it('should return an error', function() {
+        this.callback.calledWith(sinon.match(Error)).should.equal(true)
+
+        const message = this.callback.args[0][0].message
+        expect(message).to.include('resource path is outside root directory')
       })
     })
   })
@@ -467,21 +471,18 @@ describe('ResourceWriter', function() {
 
     describe('with an invalid path', function() {
       beforeEach(function() {
-        return this.ResourceWriter.checkPath(
-          'foo',
-          'baz/../../bar',
-          this.callback
-        )
+        this.ResourceWriter.checkPath('foo', 'baz/../../bar', this.callback)
       })
 
-      return it('should return an error', function() {
-        return this.callback
-          .calledWith(new Error('resource path is outside root directory'))
-          .should.equal(true)
+      it('should return an error', function() {
+        this.callback.calledWith(sinon.match(Error)).should.equal(true)
+
+        const message = this.callback.args[0][0].message
+        expect(message).to.include('resource path is outside root directory')
       })
     })
 
-    return describe('with another invalid path matching on a prefix', function() {
+    describe('with another invalid path matching on a prefix', function() {
       beforeEach(function() {
         return this.ResourceWriter.checkPath(
           'foo',
@@ -490,10 +491,11 @@ describe('ResourceWriter', function() {
         )
       })
 
-      return it('should return an error', function() {
-        return this.callback
-          .calledWith(new Error('resource path is outside root directory'))
-          .should.equal(true)
+      it('should return an error', function() {
+        this.callback.calledWith(sinon.match(Error)).should.equal(true)
+
+        const message = this.callback.args[0][0].message
+        expect(message).to.include('resource path is outside root directory')
       })
     })
   })

+ 6 - 4
services/clsi/test/unit/js/UrlFetcherTests.js

@@ -10,6 +10,7 @@
  */
 const SandboxedModule = require('sandboxed-module')
 const sinon = require('sinon')
+const { expect } = require('chai')
 require('chai').should()
 const modulePath = require('path').join(__dirname, '../../../app/js/UrlFetcher')
 const { EventEmitter } = require('events')
@@ -140,10 +141,11 @@ describe('UrlFetcher', function() {
         return this.urlStream.emit('end')
       })
 
-      return it('should call the callback with an error', function() {
-        return this.callback
-          .calledWith(new Error('URL returned non-success status code: 404'))
-          .should.equal(true)
+      it('should call the callback with an error', function() {
+        this.callback.calledWith(sinon.match(Error)).should.equal(true)
+
+        const message = this.callback.args[0][0].message
+        expect(message).to.include('URL returned non-success status code: 404')
       })
     })
 

Некоторые файлы не были показаны из-за большого количества измененных файлов