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 {} class UrlFetchFailedError extends BackwardCompatibleError {}

View file

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

View file

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

View file

@ -28,7 +28,7 @@ let webpackManifest
switch (process.env.NODE_ENV) { switch (process.env.NODE_ENV) {
case 'production': case 'production':
// Only load webpack manifest file in production. // Only load webpack manifest file in production.
webpackManifest = require(`../../../public/manifest.json`) webpackManifest = require('../../../public/manifest.json')
break break
case 'development': { case 'development': {
// In dev, fetch the manifest from the webpack container. // 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 Settings = require('@overleaf/settings')
const _ = require('underscore') 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 User = require('../../../../../test/acceptance/src/helpers/User')
const MockDocUpdaterApiClass = require('../../../../../test/acceptance/src/mocks/MockDocUpdaterApi') const MockDocUpdaterApiClass = require('../../../../../test/acceptance/src/mocks/MockDocUpdaterApi')

View file

@ -1,7 +1,6 @@
const { expect } = require('chai') const { expect } = require('chai')
const cheerio = require('cheerio') const cheerio = require('cheerio')
const WEB_PATH = '../../../../..' const UserHelper = require('../../../../../test/acceptance/src/helpers/UserHelper')
const UserHelper = require(`${WEB_PATH}/test/acceptance/src/helpers/UserHelper`)
describe('Launchpad', function () { describe('Launchpad', function () {
const adminEmail = 'admin@example.com' 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 { Certificate } = require('@fidm/x509')
const UKAMFDB = require('./ukamf-db') 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 { db, waitForDb } = require('../../app/src/infrastructure/mongodb')
const moment = require('moment') const moment = require('moment')

View file

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

View file

@ -4,7 +4,7 @@ const Path = require('path')
const fs = require('fs') const fs = require('fs')
const { Project } = require('../../../app/src/models/Project') 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 User = require('./helpers/User')
const MockDocStoreApiClass = require('./mocks/MockDocstoreApi') const MockDocStoreApiClass = require('./mocks/MockDocstoreApi')

View file

@ -1,5 +1,5 @@
const { expect } = require('chai') 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 request = require('./helpers/request')
const User = require('./helpers/User') const User = require('./helpers/User')

View file

@ -4,7 +4,7 @@ const SubscriptionUpdater = require('../../../../app/src/Features/Subscription/S
const SubscriptionModel = const SubscriptionModel =
require('../../../../app/src/models/Subscription').Subscription require('../../../../app/src/models/Subscription').Subscription
const DeletedSubscriptionModel = const DeletedSubscriptionModel =
require(`../../../../app/src/models/DeletedSubscription`).DeletedSubscription require('../../../../app/src/models/DeletedSubscription').DeletedSubscription
class DeletedSubscription { class DeletedSubscription {
constructor(options = {}) { 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 QueueWorkers = require('../../../../app/src/infrastructure/QueueWorkers')
const MongoHelper = require('./MongoHelper') const MongoHelper = require('./MongoHelper')
const RedisHelper = require('./RedisHelper') const RedisHelper = require('./RedisHelper')

View file

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

View file

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

View file

@ -1,7 +1,7 @@
const sinon = require('sinon') const sinon = require('sinon')
const modulePath = '../../../../app/src/Features/Docstore/DocstoreManager' const modulePath = '../../../../app/src/Features/Docstore/DocstoreManager'
const SandboxedModule = require('sandboxed-module') 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') const tk = require('timekeeper')
describe('DocstoreManager', function () { describe('DocstoreManager', function () {