Merge pull request #15544 from overleaf/bg-misc-use-literal-paths

Replace APP_ROOT and other variables with literal paths in web imports

GitOrigin-RevId: 138f03ad9355c8c6c92a206b0e54573234a6f65d
This commit is contained in:
Brian Gough 2023-11-02 08:18:32 +00:00 committed by Copybot
parent 37817f89f4
commit d3adcff0f1
16 changed files with 23 additions and 26 deletions

View file

@ -1,4 +1,4 @@
const { BackwardCompatibleError } = require('../Errors/Errors.js')
const { BackwardCompatibleError } = require('../Errors/Errors')
class UrlFetchFailedError extends BackwardCompatibleError {}

View file

@ -9,7 +9,7 @@ const settings = require('@overleaf/settings')
const CollaboratorsGetter =
require('../Collaborators/CollaboratorsGetter').promises
const UserGetter = require('../User/UserGetter.js').promises
const UserGetter = require('../User/UserGetter').promises
const tpdsUrl = _.get(settings, ['apis', 'thirdPartyDataStore', 'url'])

View file

@ -1,13 +1,12 @@
const APP_ROOT = '../../../../app/src'
const UserAuditLogHandler = require(`${APP_ROOT}/Features/User/UserAuditLogHandler`)
const EmailHandler = require(`${APP_ROOT}/Features/Email/EmailHandler`)
const EmailOptionsHelper = require(`${APP_ROOT}/Features/Email/EmailOptionsHelper`)
const UserAuditLogHandler = require('../../../../app/src/Features/User/UserAuditLogHandler')
const EmailHandler = require('../../../../app/src/Features/Email/EmailHandler')
const EmailOptionsHelper = require('../../../../app/src/Features/Email/EmailOptionsHelper')
const Errors = require('../Errors/Errors')
const _ = require('lodash')
const logger = require('@overleaf/logger')
const OError = require('@overleaf/o-error')
const settings = require('@overleaf/settings')
const { User } = require(`${APP_ROOT}/models/User`)
const { User } = require('../../../../app/src/models/User')
const { promisifyAll } = require('@overleaf/promise-utils')
const oauthProviders = settings.oauthProviders || {}

View file

@ -28,7 +28,7 @@ let webpackManifest
switch (process.env.NODE_ENV) {
case 'production':
// Only load webpack manifest file in production.
webpackManifest = require(`../../../public/manifest.json`)
webpackManifest = require('../../../public/manifest.json')
break
case 'development': {
// In dev, fetch the manifest from the webpack container.

View file

@ -5,7 +5,7 @@ const fs = require('fs')
const Settings = require('@overleaf/settings')
const _ = require('underscore')
const ProjectGetter = require('../../../../../app/src/Features/Project/ProjectGetter.js')
const ProjectGetter = require('../../../../../app/src/Features/Project/ProjectGetter')
const User = require('../../../../../test/acceptance/src/helpers/User')
const MockDocUpdaterApiClass = require('../../../../../test/acceptance/src/mocks/MockDocUpdaterApi')

View file

@ -1,7 +1,6 @@
const { expect } = require('chai')
const cheerio = require('cheerio')
const WEB_PATH = '../../../../..'
const UserHelper = require(`${WEB_PATH}/test/acceptance/src/helpers/UserHelper`)
const UserHelper = require('../../../../../test/acceptance/src/helpers/UserHelper')
describe('Launchpad', function () {
const adminEmail = 'admin@example.com'

View file

@ -1 +1 @@
require(`../../../../../test/acceptance/src/helpers/InitApp`)
require('../../../../../test/acceptance/src/helpers/InitApp')

View file

@ -12,7 +12,7 @@
const { Certificate } = require('@fidm/x509')
const UKAMFDB = require('./ukamf-db')
const V1Api = require(`../../app/src/Features/V1/V1Api`).promises
const V1Api = require('../../app/src/Features/V1/V1Api').promises
const { db, waitForDb } = require('../../app/src/infrastructure/mongodb')
const moment = require('moment')

View file

@ -11,13 +11,12 @@
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const APP_PATH = '../../../app/src'
const LockManager = require(`${APP_PATH}/infrastructure/LockManager`)
const ProjectCreationHandler = require(`${APP_PATH}/Features/Project/ProjectCreationHandler.js`)
const ProjectGetter = require(`${APP_PATH}/Features/Project/ProjectGetter.js`)
const ProjectEntityMongoUpdateHandler = require(`${APP_PATH}/Features/Project/ProjectEntityMongoUpdateHandler.js`)
const UserCreator = require(`${APP_PATH}/Features/User/UserCreator.js`)
const LockManager = require('../../../app/src/infrastructure/LockManager')
const ProjectCreationHandler = require('../../../app/src/Features/Project/ProjectCreationHandler')
const ProjectGetter = require('../../../app/src/Features/Project/ProjectGetter')
const ProjectEntityMongoUpdateHandler = require('../../../app/src/Features/Project/ProjectEntityMongoUpdateHandler')
const UserCreator = require('../../../app/src/Features/User/UserCreator')
const { expect } = require('chai')
const _ = require('lodash')

View file

@ -4,7 +4,7 @@ const Path = require('path')
const fs = require('fs')
const { Project } = require('../../../app/src/models/Project')
const ProjectGetter = require('../../../app/src/Features/Project/ProjectGetter.js')
const ProjectGetter = require('../../../app/src/Features/Project/ProjectGetter')
const User = require('./helpers/User')
const MockDocStoreApiClass = require('./mocks/MockDocstoreApi')

View file

@ -1,5 +1,5 @@
const { expect } = require('chai')
const ProjectGetter = require('../../../app/src/Features/Project/ProjectGetter.js')
const ProjectGetter = require('../../../app/src/Features/Project/ProjectGetter')
const request = require('./helpers/request')
const User = require('./helpers/User')

View file

@ -4,7 +4,7 @@ const SubscriptionUpdater = require('../../../../app/src/Features/Subscription/S
const SubscriptionModel =
require('../../../../app/src/models/Subscription').Subscription
const DeletedSubscriptionModel =
require(`../../../../app/src/models/DeletedSubscription`).DeletedSubscription
require('../../../../app/src/models/DeletedSubscription').DeletedSubscription
class DeletedSubscription {
constructor(options = {}) {

View file

@ -1,4 +1,4 @@
const App = require('../../../../app.js')
const App = require('../../../../app')
const QueueWorkers = require('../../../../app/src/infrastructure/QueueWorkers')
const MongoHelper = require('./MongoHelper')
const RedisHelper = require('./RedisHelper')

View file

@ -7,7 +7,7 @@ const PermissionsManager = require('../../../../app/src/Features/Authorization/P
const SubscriptionModel =
require('../../../../app/src/models/Subscription').Subscription
const DeletedSubscriptionModel =
require(`../../../../app/src/models/DeletedSubscription`).DeletedSubscription
require('../../../../app/src/models/DeletedSubscription').DeletedSubscription
class Subscription {
constructor(options = {}) {

View file

@ -2,7 +2,7 @@ const sinon = require('sinon')
const { expect } = require('chai')
const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb')
const Errors = require('../../../../app/src/Features/Errors/Errors.js')
const Errors = require('../../../../app/src/Features/Errors/Errors')
const MODULE_PATH =
'../../../../app/src/Features/Authorization/AuthorizationMiddleware.js'

View file

@ -1,7 +1,7 @@
const sinon = require('sinon')
const modulePath = '../../../../app/src/Features/Docstore/DocstoreManager'
const SandboxedModule = require('sandboxed-module')
const Errors = require('../../../../app/src/Features/Errors/Errors.js')
const Errors = require('../../../../app/src/Features/Errors/Errors')
const tk = require('timekeeper')
describe('DocstoreManager', function () {