mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-20 17:45:57 +00:00
Merge pull request #22580 from overleaf/ar-migrate-server-ce-scripts
Convert server-ce-scripts module to ES modules GitOrigin-RevId: 516247b25b5bdbfd89fee4b99a88431097c827de
This commit is contained in:
parent
d6e763bc57
commit
813946a693
15 changed files with 153 additions and 118 deletions
|
@ -11,22 +11,22 @@ cd /overleaf/services/web
|
|||
case "$TASK" in
|
||||
user:create-admin)
|
||||
echo "The grunt command is deprecated, run the create-user script using node instead"
|
||||
node modules/server-ce-scripts/scripts/create-user --admin "$@"
|
||||
node modules/server-ce-scripts/scripts/create-user.mjs --admin "$@"
|
||||
;;
|
||||
|
||||
user:delete)
|
||||
echo "The grunt command is deprecated, run the delete-user script using node instead"
|
||||
node modules/server-ce-scripts/scripts/delete-user "$@"
|
||||
node modules/server-ce-scripts/scripts/delete-user.mjs "$@"
|
||||
;;
|
||||
|
||||
check:mongo)
|
||||
echo "The grunt command is deprecated, run the check-mongodb script using node instead"
|
||||
node modules/server-ce-scripts/scripts/check-mongodb
|
||||
node modules/server-ce-scripts/scripts/check-mongodb.mjs
|
||||
;;
|
||||
|
||||
check:redis)
|
||||
echo "The grunt command is deprecated, run the check-redis script using node instead"
|
||||
node modules/server-ce-scripts/scripts/check-redis
|
||||
node modules/server-ce-scripts/scripts/check-redis.mjs
|
||||
;;
|
||||
|
||||
*)
|
||||
|
|
|
@ -3,6 +3,6 @@ set -e
|
|||
|
||||
echo "Checking can connect to mongo and redis"
|
||||
cd /overleaf/services/web
|
||||
node modules/server-ce-scripts/scripts/check-mongodb
|
||||
node modules/server-ce-scripts/scripts/check-redis
|
||||
node modules/server-ce-scripts/scripts/check-mongodb.mjs
|
||||
node modules/server-ce-scripts/scripts/check-redis.mjs
|
||||
echo "All checks passed"
|
||||
|
|
|
@ -3,4 +3,4 @@ set -e
|
|||
|
||||
echo "Checking texlive images"
|
||||
cd /overleaf/services/web
|
||||
node modules/server-ce-scripts/scripts/check-texlive-images
|
||||
node modules/server-ce-scripts/scripts/check-texlive-images.mjs
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import runScript from '../modules/server-ce-scripts/scripts/upgrade-user-features.mjs'
|
||||
|
||||
const tags = ['server-ce', 'server-pro']
|
||||
|
||||
const migrate = async () => {
|
||||
// Run-time import as SaaS does not ship with the server-ce-scripts module
|
||||
const { default: runScript } = await import(
|
||||
'../modules/server-ce-scripts/scripts/upgrade-user-features.js'
|
||||
)
|
||||
await runScript(false, {
|
||||
gitBridge: 1,
|
||||
})
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const minimist = require('minimist')
|
||||
const { db, ObjectId } = require('../../../app/src/infrastructure/mongodb')
|
||||
import minimist from 'minimist'
|
||||
import { db, ObjectId } from '../../../app/src/infrastructure/mongodb.js'
|
||||
|
||||
async function main() {
|
||||
const argv = minimist(process.argv.slice(2), {
|
||||
|
@ -15,7 +15,7 @@ async function main() {
|
|||
Number.isNaN(compileTimeout)
|
||||
) {
|
||||
console.error(
|
||||
`Usage: node ${__filename} --user-id=5a9414f259776c7900b300e6 --timeout=90`
|
||||
`Usage: node ${import.meta.filename} --user-id=5a9414f259776c7900b300e6 --timeout=90`
|
||||
)
|
||||
process.exit(101)
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
const { ObjectId } = require('mongodb-legacy')
|
||||
const {
|
||||
import mongodb from 'mongodb-legacy'
|
||||
import {
|
||||
connectionPromise,
|
||||
db,
|
||||
} = require('../../../app/src/infrastructure/mongodb')
|
||||
} from '../../../app/src/infrastructure/mongodb.js'
|
||||
|
||||
const { ObjectId } = mongodb
|
||||
|
||||
const MIN_MONGO_VERSION = [5, 0]
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
const RedisWrapper = require('../../../app/src/infrastructure/RedisWrapper')
|
||||
import RedisWrapper from '../../../app/src/infrastructure/RedisWrapper.js'
|
||||
const rclient = RedisWrapper.client('health_check')
|
||||
rclient.on('error', err => {
|
||||
console.error('Cannot connect to redis.')
|
|
@ -1,4 +1,4 @@
|
|||
const { db } = require('../../../app/src/infrastructure/mongodb')
|
||||
import { db } from '../../../app/src/infrastructure/mongodb.js'
|
||||
|
||||
async function readImagesInUse() {
|
||||
const projectCount = await db.projects.countDocuments()
|
|
@ -1,49 +1,13 @@
|
|||
const minimist = require('minimist')
|
||||
const { db } = require('../../../app/src/infrastructure/mongodb')
|
||||
const UserRegistrationHandler = require('../../../app/src/Features/User/UserRegistrationHandler')
|
||||
/**
|
||||
* WARNING
|
||||
* This file has been replaced by create-user.mjs. It is left in place for backwards compatibility with previous versions of Overleaf.
|
||||
* This will be used by the e2e tests that check the upgrade from the older versions, if these tests are updated or removed,
|
||||
* this file can be removed as well.
|
||||
*/
|
||||
|
||||
async function main() {
|
||||
const argv = minimist(process.argv.slice(2), {
|
||||
string: ['email'],
|
||||
boolean: ['admin'],
|
||||
})
|
||||
|
||||
const { admin, email } = argv
|
||||
if (!email) {
|
||||
console.error(`Usage: node ${__filename} [--admin] --email=joe@example.com`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
UserRegistrationHandler.registerNewUserAndSendActivationEmail(
|
||||
email,
|
||||
(error, user, setNewPasswordUrl) => {
|
||||
if (error) {
|
||||
return reject(error)
|
||||
}
|
||||
db.users.updateOne(
|
||||
{ _id: user._id },
|
||||
{ $set: { isAdmin: admin } },
|
||||
error => {
|
||||
if (error) {
|
||||
return reject(error)
|
||||
}
|
||||
|
||||
console.log('')
|
||||
console.log(`\
|
||||
Successfully created ${email} as ${admin ? 'an admin' : 'a'} user.
|
||||
|
||||
Please visit the following URL to set a password for ${email} and log in:
|
||||
|
||||
${setNewPasswordUrl}
|
||||
|
||||
`)
|
||||
resolve()
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
})
|
||||
const { default: createUser } = await import('./create-user.mjs')
|
||||
await createUser()
|
||||
}
|
||||
|
||||
main()
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
import minimist from 'minimist'
|
||||
import { db } from '../../../app/src/infrastructure/mongodb.js'
|
||||
import UserRegistrationHandler from '../../../app/src/Features/User/UserRegistrationHandler.js'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
|
||||
export default async function main() {
|
||||
const argv = minimist(process.argv.slice(2), {
|
||||
string: ['email'],
|
||||
boolean: ['admin'],
|
||||
})
|
||||
|
||||
const { admin, email } = argv
|
||||
if (!email) {
|
||||
console.error(`Usage: node ${filename} [--admin] --email=joe@example.com`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
UserRegistrationHandler.registerNewUserAndSendActivationEmail(
|
||||
email,
|
||||
(error, user, setNewPasswordUrl) => {
|
||||
if (error) {
|
||||
return reject(error)
|
||||
}
|
||||
db.users.updateOne(
|
||||
{ _id: user._id },
|
||||
{ $set: { isAdmin: admin } },
|
||||
error => {
|
||||
if (error) {
|
||||
return reject(error)
|
||||
}
|
||||
|
||||
console.log('')
|
||||
console.log(`\
|
||||
Successfully created ${email} as ${admin ? 'an admin' : 'a'} user.
|
||||
|
||||
Please visit the following URL to set a password for ${email} and log in:
|
||||
|
||||
${setNewPasswordUrl}
|
||||
|
||||
`)
|
||||
resolve()
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
|
@ -1,10 +1,13 @@
|
|||
const UserGetter = require('../../../app/src/Features/User/UserGetter')
|
||||
const UserDeleter = require('../../../app/src/Features/User/UserDeleter')
|
||||
import UserGetter from '../../../app/src/Features/User/UserGetter.js'
|
||||
import UserDeleter from '../../../app/src/Features/User/UserDeleter.js'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
|
||||
async function main() {
|
||||
const email = (process.argv.slice(2).pop() || '').replace(/^--email=/, '')
|
||||
if (!email) {
|
||||
console.error(`Usage: node ${__filename} --email=joe@example.com`)
|
||||
console.error(`Usage: node ${filename} --email=joe@example.com`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
|
@ -9,15 +9,15 @@
|
|||
// Intended for Server Pro customers migrating user emails from one domain to
|
||||
// another.
|
||||
|
||||
const minimist = require('minimist')
|
||||
import minimist from 'minimist'
|
||||
|
||||
const os = require('os')
|
||||
const fs = require('fs')
|
||||
const csv = require('csv/sync')
|
||||
const { parseEmail } = require('../../../app/src/Features/Helpers/EmailHelper')
|
||||
const UserGetter = require('../../../app/src/Features/User/UserGetter')
|
||||
const UserUpdater = require('../../../app/src/Features/User/UserUpdater')
|
||||
const UserSessionsManager = require('../../../app/src/Features/User/UserSessionsManager')
|
||||
import os from 'os'
|
||||
import fs from 'fs'
|
||||
import * as csv from 'csv/sync'
|
||||
import { parseEmail } from '../../../app/src/Features/Helpers/EmailHelper.js'
|
||||
import UserGetter from '../../../app/src/Features/User/UserGetter.js'
|
||||
import UserUpdater from '../../../app/src/Features/User/UserUpdater.js'
|
||||
import UserSessionsManager from '../../../app/src/Features/User/UserSessionsManager.js'
|
||||
|
||||
const hostname = os.hostname()
|
||||
const scriptTimestamp = new Date().toISOString()
|
||||
|
@ -39,7 +39,7 @@ const argv = minimist(process.argv.slice(2), {
|
|||
// display usage if no CSV file is provided
|
||||
if (argv._.length === 0) {
|
||||
console.log(
|
||||
'Usage: node migrate_user_emails.js [--commit] [--continue|--ignore-missing] [--admin-id=ADMIN_USER_ID] <csv_file>'
|
||||
'Usage: node migrate_user_emails.mjs [--commit] [--continue|--ignore-missing] [--admin-id=ADMIN_USER_ID] <csv_file>'
|
||||
)
|
||||
console.log(' --commit: actually do the migration (default: false)')
|
||||
console.log(
|
|
@ -1,5 +1,8 @@
|
|||
const minimist = require('minimist')
|
||||
const { db } = require('../../../app/src/infrastructure/mongodb')
|
||||
import minimist from 'minimist'
|
||||
import { db } from '../../../app/src/infrastructure/mongodb.js'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
|
||||
async function main() {
|
||||
const argv = minimist(process.argv.slice(2), {
|
||||
|
@ -9,7 +12,7 @@ async function main() {
|
|||
const { 'user-id': userId, 'old-name': oldName, 'new-name': newName } = argv
|
||||
if (!userId || !oldName || !newName) {
|
||||
console.error(
|
||||
`Usage: node ${__filename} --user-id=5a9414f259776c7900b300e6 --old-name=my-folder --new-name=my-folder-renamed`
|
||||
`Usage: node ${filename} --user-id=5a9414f259776c7900b300e6 --old-name=my-folder --new-name=my-folder-renamed`
|
||||
)
|
||||
process.exit(101)
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
const Settings = require('@overleaf/settings')
|
||||
const logger = require('@overleaf/logger')
|
||||
const { db } = require('../../../app/src/infrastructure/mongodb')
|
||||
const {
|
||||
import Settings from '@overleaf/settings'
|
||||
import logger from '@overleaf/logger'
|
||||
import { db } from '../../../app/src/infrastructure/mongodb.js'
|
||||
import {
|
||||
mergeFeatures,
|
||||
compareFeatures,
|
||||
} = require('../../../app/src/Features/Subscription/FeaturesHelper')
|
||||
} from '../../../app/src/Features/Subscription/FeaturesHelper.js'
|
||||
import { fileURLToPath } from 'url'
|
||||
const DRY_RUN = !process.argv.includes('--dry-run=false')
|
||||
|
||||
async function main(DRY_RUN, defaultFeatures) {
|
||||
|
@ -38,9 +39,11 @@ async function main(DRY_RUN, defaultFeatures) {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = main
|
||||
export default main
|
||||
|
||||
if (require.main === module) {
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
|
||||
if (filename === process.argv[1]) {
|
||||
if (DRY_RUN) {
|
||||
console.error('---')
|
||||
console.error('Dry-run enabled, use --dry-run=false to commit changes')
|
|
@ -1,9 +1,11 @@
|
|||
const { execSync } = require('child_process')
|
||||
const fs = require('fs')
|
||||
const Settings = require('@overleaf/settings')
|
||||
const { expect } = require('chai')
|
||||
const { db } = require('../../../../../app/src/infrastructure/mongodb')
|
||||
const User = require('../../../../../test/acceptance/src/helpers/User').promises
|
||||
import { execSync } from 'node:child_process'
|
||||
import fs from 'node:fs'
|
||||
import Settings from '@overleaf/settings'
|
||||
import { expect } from 'chai'
|
||||
import { db } from '../../../../../app/src/infrastructure/mongodb.js'
|
||||
import UserHelper from '../../../../../test/acceptance/src/helpers/User.js'
|
||||
|
||||
const { promises: User } = UserHelper
|
||||
|
||||
/**
|
||||
* @param {string} cmd
|
||||
|
@ -42,7 +44,7 @@ async function getUser(email) {
|
|||
describe('ServerCEScripts', function () {
|
||||
describe('check-mongodb', function () {
|
||||
it('should exit with code 0 on success', function () {
|
||||
run('node modules/server-ce-scripts/scripts/check-mongodb')
|
||||
run('node modules/server-ce-scripts/scripts/check-mongodb.mjs')
|
||||
})
|
||||
|
||||
it('should exit with code 1 on error', function () {
|
||||
|
@ -50,7 +52,7 @@ describe('ServerCEScripts', function () {
|
|||
run(
|
||||
'MONGO_SERVER_SELECTION_TIMEOUT=1' +
|
||||
'MONGO_CONNECTION_STRING=mongodb://127.0.0.1:4242 ' +
|
||||
'node modules/server-ce-scripts/scripts/check-mongodb'
|
||||
'node modules/server-ce-scripts/scripts/check-mongodb.mjs'
|
||||
)
|
||||
} catch (e) {
|
||||
expect(e.status).to.equal(1)
|
||||
|
@ -62,12 +64,14 @@ describe('ServerCEScripts', function () {
|
|||
|
||||
describe('check-redis', function () {
|
||||
it('should exit with code 0 on success', function () {
|
||||
run('node modules/server-ce-scripts/scripts/check-redis')
|
||||
run('node modules/server-ce-scripts/scripts/check-redis.mjs')
|
||||
})
|
||||
|
||||
it('should exit with code 1 on error', function () {
|
||||
try {
|
||||
run('REDIS_PORT=42 node modules/server-ce-scripts/scripts/check-redis')
|
||||
run(
|
||||
'REDIS_PORT=42 node modules/server-ce-scripts/scripts/check-redis.mjs'
|
||||
)
|
||||
} catch (e) {
|
||||
expect(e.status).to.equal(1)
|
||||
return
|
||||
|
@ -79,28 +83,28 @@ describe('ServerCEScripts', function () {
|
|||
describe('create-user', function () {
|
||||
it('should exit with code 0 on success', function () {
|
||||
const out = run(
|
||||
'node modules/server-ce-scripts/scripts/create-user --email=foo@bar.com'
|
||||
'node modules/server-ce-scripts/scripts/create-user.js --email=foo@bar.com'
|
||||
)
|
||||
expect(out).to.include('/user/activate?token=')
|
||||
})
|
||||
|
||||
it('should create a regular user by default', async function () {
|
||||
run(
|
||||
'node modules/server-ce-scripts/scripts/create-user --email=foo@bar.com'
|
||||
'node modules/server-ce-scripts/scripts/create-user.js --email=foo@bar.com'
|
||||
)
|
||||
expect(await getUser('foo@bar.com')).to.deep.equal({ isAdmin: false })
|
||||
})
|
||||
|
||||
it('should create an admin user with --admin flag', async function () {
|
||||
run(
|
||||
'node modules/server-ce-scripts/scripts/create-user --admin --email=foo@bar.com'
|
||||
'node modules/server-ce-scripts/scripts/create-user.js --admin --email=foo@bar.com'
|
||||
)
|
||||
expect(await getUser('foo@bar.com')).to.deep.equal({ isAdmin: true })
|
||||
})
|
||||
|
||||
it('should exit with code 1 on missing email', function () {
|
||||
try {
|
||||
run('node modules/server-ce-scripts/scripts/create-user')
|
||||
run('node modules/server-ce-scripts/scripts/create-user.js')
|
||||
} catch (e) {
|
||||
expect(e.status).to.equal(1)
|
||||
return
|
||||
|
@ -119,19 +123,26 @@ describe('ServerCEScripts', function () {
|
|||
it('should log missing user', function () {
|
||||
const email = 'does-not-exist@example.com'
|
||||
const out = run(
|
||||
'node modules/server-ce-scripts/scripts/delete-user --email=' + email
|
||||
'node modules/server-ce-scripts/scripts/delete-user.mjs --email=' +
|
||||
email
|
||||
)
|
||||
expect(out).to.include('not in database, potentially already deleted')
|
||||
})
|
||||
|
||||
it('should exit with code 0 on success', function () {
|
||||
const email = user.email
|
||||
run('node modules/server-ce-scripts/scripts/delete-user --email=' + email)
|
||||
run(
|
||||
'node modules/server-ce-scripts/scripts/delete-user.mjs --email=' +
|
||||
email
|
||||
)
|
||||
})
|
||||
|
||||
it('should have deleted the user on success', async function () {
|
||||
const email = user.email
|
||||
run('node modules/server-ce-scripts/scripts/delete-user --email=' + email)
|
||||
run(
|
||||
'node modules/server-ce-scripts/scripts/delete-user.mjs --email=' +
|
||||
email
|
||||
)
|
||||
const dbEntry = await user.get()
|
||||
expect(dbEntry).to.not.exist
|
||||
const softDeletedEntry = await db.deletedUsers.findOne({
|
||||
|
@ -143,7 +154,7 @@ describe('ServerCEScripts', function () {
|
|||
|
||||
it('should exit with code 1 on missing email', function () {
|
||||
try {
|
||||
run('node modules/server-ce-scripts/scripts/delete-user')
|
||||
run('node modules/server-ce-scripts/scripts/delete-user.mjs')
|
||||
} catch (e) {
|
||||
expect(e.status).to.equal(1)
|
||||
return
|
||||
|
@ -199,7 +210,7 @@ describe('ServerCEScripts', function () {
|
|||
|
||||
it('should do a dry run by default', async function () {
|
||||
run(
|
||||
`node modules/server-ce-scripts/scripts/migrate-user-emails.js ${csv}`
|
||||
`node modules/server-ce-scripts/scripts/migrate-user-emails.mjs ${csv}`
|
||||
)
|
||||
for (const user of usersToMigrate) {
|
||||
const dbEntry = await user.get()
|
||||
|
@ -213,13 +224,13 @@ describe('ServerCEScripts', function () {
|
|||
|
||||
it('should exit with code 0 when successfully migrating user emails', function () {
|
||||
run(
|
||||
`node modules/server-ce-scripts/scripts/migrate-user-emails.js --commit ${csv}`
|
||||
`node modules/server-ce-scripts/scripts/migrate-user-emails.mjs --commit ${csv}`
|
||||
)
|
||||
})
|
||||
|
||||
it('should migrate the user emails with the --commit option', async function () {
|
||||
run(
|
||||
`node modules/server-ce-scripts/scripts/migrate-user-emails.js --commit ${csv}`
|
||||
`node modules/server-ce-scripts/scripts/migrate-user-emails.mjs --commit ${csv}`
|
||||
)
|
||||
for (const user of usersToMigrate) {
|
||||
const dbEntry = await user.get()
|
||||
|
@ -233,7 +244,7 @@ describe('ServerCEScripts', function () {
|
|||
|
||||
it('should leave other user emails unchanged', async function () {
|
||||
run(
|
||||
`node modules/server-ce-scripts/scripts/migrate-user-emails.js --commit ${csv}`
|
||||
`node modules/server-ce-scripts/scripts/migrate-user-emails.mjs --commit ${csv}`
|
||||
)
|
||||
for (const user of otherUsers) {
|
||||
const dbEntry = await user.get()
|
||||
|
@ -244,7 +255,7 @@ describe('ServerCEScripts', function () {
|
|||
it('should exit with code 1 when there are failures migrating user emails', function () {
|
||||
try {
|
||||
run(
|
||||
`node modules/server-ce-scripts/scripts/migrate-user-emails.js --commit ${csvfail}`
|
||||
`node modules/server-ce-scripts/scripts/migrate-user-emails.mjs --commit ${csvfail}`
|
||||
)
|
||||
} catch (e) {
|
||||
expect(e.status).to.equal(1)
|
||||
|
@ -256,12 +267,12 @@ describe('ServerCEScripts', function () {
|
|||
it('should migrate other users when there are failures with the --continue option', async function () {
|
||||
try {
|
||||
run(
|
||||
`node modules/server-ce-scripts/scripts/migrate-user-emails.js --commit ${csvfail}`
|
||||
`node modules/server-ce-scripts/scripts/migrate-user-emails.mjs --commit ${csvfail}`
|
||||
)
|
||||
} catch (e) {
|
||||
expect(e.status).to.equal(1)
|
||||
run(
|
||||
`node modules/server-ce-scripts/scripts/migrate-user-emails.js --commit --continue ${csvfail}`
|
||||
`node modules/server-ce-scripts/scripts/migrate-user-emails.mjs --commit --continue ${csvfail}`
|
||||
)
|
||||
for (const user of usersToMigrate) {
|
||||
const dbEntry = await user.get()
|
||||
|
@ -301,7 +312,7 @@ describe('ServerCEScripts', function () {
|
|||
expect(await getTagNames()).to.deep.equal([oldName])
|
||||
|
||||
run(
|
||||
`node modules/server-ce-scripts/scripts/rename-tag --user-id=${user.id} --old-name=${oldName} --new-name=${newName}`
|
||||
`node modules/server-ce-scripts/scripts/rename-tag.mjs --user-id=${user.id} --old-name=${oldName} --new-name=${newName}`
|
||||
)
|
||||
|
||||
expect(await getTagNames()).to.deep.equal([newName])
|
||||
|
@ -334,7 +345,7 @@ describe('ServerCEScripts', function () {
|
|||
beforeEach('run script on user a', function () {
|
||||
newUserATimeout = userATimeout - 1
|
||||
run(
|
||||
`node modules/server-ce-scripts/scripts/change-compile-timeout --user-id=${userA.id} --compile-timeout=${newUserATimeout}`
|
||||
`node modules/server-ce-scripts/scripts/change-compile-timeout.mjs --user-id=${userA.id} --compile-timeout=${newUserATimeout}`
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -353,7 +364,7 @@ describe('ServerCEScripts', function () {
|
|||
it('should reject zero timeout', async function () {
|
||||
try {
|
||||
run(
|
||||
`node modules/server-ce-scripts/scripts/change-compile-timeout --user-id=${userA.id} --compile-timeout=0`
|
||||
`node modules/server-ce-scripts/scripts/change-compile-timeout.mjs --user-id=${userA.id} --compile-timeout=0`
|
||||
)
|
||||
expect.fail('should error out')
|
||||
} catch (err) {
|
||||
|
@ -366,7 +377,7 @@ describe('ServerCEScripts', function () {
|
|||
it('should reject a 20min timeout', async function () {
|
||||
try {
|
||||
run(
|
||||
`node modules/server-ce-scripts/scripts/change-compile-timeout --user-id=${userA.id} --compile-timeout=1200`
|
||||
`node modules/server-ce-scripts/scripts/change-compile-timeout.mjs --user-id=${userA.id} --compile-timeout=1200`
|
||||
)
|
||||
expect.fail('should error out')
|
||||
} catch (err) {
|
||||
|
@ -410,13 +421,13 @@ describe('ServerCEScripts', function () {
|
|||
|
||||
beforeEach('downgrade userCustomTimeoutLower', async function () {
|
||||
run(
|
||||
`node modules/server-ce-scripts/scripts/change-compile-timeout --user-id=${userCustomTimeoutLower.id} --compile-timeout=42`
|
||||
`node modules/server-ce-scripts/scripts/change-compile-timeout.mjs --user-id=${userCustomTimeoutLower.id} --compile-timeout=42`
|
||||
)
|
||||
})
|
||||
|
||||
beforeEach('upgrade userCustomTimeoutHigher', async function () {
|
||||
run(
|
||||
`node modules/server-ce-scripts/scripts/change-compile-timeout --user-id=${userCustomTimeoutHigher.id} --compile-timeout=360`
|
||||
`node modules/server-ce-scripts/scripts/change-compile-timeout.mjs --user-id=${userCustomTimeoutHigher.id} --compile-timeout=360`
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -451,7 +462,7 @@ describe('ServerCEScripts', function () {
|
|||
let output
|
||||
beforeEach('run script', function () {
|
||||
output = run(
|
||||
`node modules/server-ce-scripts/scripts/upgrade-user-features`
|
||||
`node modules/server-ce-scripts/scripts/upgrade-user-features.mjs`
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -480,7 +491,7 @@ describe('ServerCEScripts', function () {
|
|||
let output
|
||||
beforeEach('run script', function () {
|
||||
output = run(
|
||||
`node modules/server-ce-scripts/scripts/upgrade-user-features --dry-run=false`
|
||||
`node modules/server-ce-scripts/scripts/upgrade-user-features.mjs --dry-run=false`
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -537,7 +548,7 @@ describe('ServerCEScripts', function () {
|
|||
cmd += ` OVERLEAF_IS_SERVER_PRO=${OVERLEAF_IS_SERVER_PRO}`
|
||||
}
|
||||
return (
|
||||
cmd + ' node modules/server-ce-scripts/scripts/check-texlive-images'
|
||||
cmd + ' node modules/server-ce-scripts/scripts/check-texlive-images.mjs'
|
||||
)
|
||||
}
|
||||
|
Loading…
Add table
Reference in a new issue