mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #21097 from overleaf/ls-scripts-to-esm-1
Migrate scripts folder to esm 1/x GitOrigin-RevId: 4a4bc9a161f144fdb40ce3f2a0a9313b36c6df81
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import BatchedUpdateModule from './helpers/batchedUpdate.mjs'
|
||||
|
||||
const { batchedUpdate } = BatchedUpdateModule
|
||||
const oldImage = process.argv[2]
|
||||
const newImage = process.argv[3]
|
||||
|
||||
function usage() {
|
||||
console.log(
|
||||
`Usage: update_project_image_name.js <old_texlive_image> <new_texlive_image>`
|
||||
)
|
||||
console.log(
|
||||
'Environment variable ALL_TEX_LIVE_DOCKER_IMAGES must contain <new_texlive_image>.'
|
||||
)
|
||||
}
|
||||
|
||||
if (!oldImage || !newImage) {
|
||||
usage()
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
if (!process.env.ALL_TEX_LIVE_DOCKER_IMAGES) {
|
||||
console.error(
|
||||
'Error: environment variable ALL_TEX_LIVE_DOCKER_IMAGES is not defined.'
|
||||
)
|
||||
usage()
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
if (!process.env.ALL_TEX_LIVE_DOCKER_IMAGES.split(',').includes(newImage)) {
|
||||
console.error(`Error: ALL_TEX_LIVE_DOCKER_IMAGES doesn't contain ${newImage}`)
|
||||
usage()
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
try {
|
||||
await batchedUpdate(
|
||||
'projects',
|
||||
{ imageName: oldImage },
|
||||
{ $set: { imageName: newImage } }
|
||||
)
|
||||
console.log('Done')
|
||||
process.exit(0)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
}
|
||||
Reference in New Issue
Block a user