Convert refresh_features to es module

GitOrigin-RevId: c3fd7ec4c0f3ce5560f6a8b4e3fff1d2eec5c4ab
This commit is contained in:
Andrew Rumble 2024-10-09 09:50:59 +01:00 committed by Copybot
parent fab69a16c4
commit e60297bd04

View file

@ -1,14 +1,13 @@
const { db, waitForDb } = require('../app/src/infrastructure/mongodb') import { db, waitForDb } from '../app/src/infrastructure/mongodb.js'
const minimist = require('minimist') import minimist from 'minimist'
const _ = require('lodash') import _ from 'lodash'
const async = require('async') import async from 'async'
const FeaturesUpdater = require('../app/src/Features/Subscription/FeaturesUpdater') import FeaturesUpdater from '../app/src/Features/Subscription/FeaturesUpdater.js'
const FeaturesHelper = require('../app/src/Features/Subscription/FeaturesHelper') import FeaturesHelper from '../app/src/Features/Subscription/FeaturesHelper.js'
const UserFeaturesUpdater = require('../app/src/Features/Subscription/UserFeaturesUpdater') import UserFeaturesUpdater from '../app/src/Features/Subscription/UserFeaturesUpdater.js'
const AnalyticsManager = require('../app/src/Features/Analytics/AnalyticsManager') import AnalyticsManager from '../app/src/Features/Analytics/AnalyticsManager.js'
const DropboxHandler = require('../modules/dropbox/app/src/DropboxHandler') import DropboxHandler from '../modules/dropbox/app/src/DropboxHandler.js'
const { OError } = require('../app/src/Features/Errors/Errors') import { OError } from '../app/src/Features/Errors/Errors.js'
const logger = require('@overleaf/logger')
const ScriptLogger = { const ScriptLogger = {
checkedUsersCount: 0, checkedUsersCount: 0,
@ -109,7 +108,7 @@ const checkAndUpdateUser = (user, callback) =>
}) })
) )
} }
logger.log({ userId: user._id }, 'Unlinked dropbox') console.log({ userId: user._id }, 'Unlinked dropbox')
callback(null, featuresChanged) callback(null, featuresChanged)
} }
) )
@ -180,7 +179,7 @@ const setup = () => {
console.log( console.log(
'NOTE: features can be automatically refreshed on login (using `featuresEpoch`)\n' + 'NOTE: features can be automatically refreshed on login (using `featuresEpoch`)\n' +
'Consider incrementing settings.featuresEpoch instead of running this script.\n' + 'Consider incrementing settings.featuresEpoch instead of running this script.\n' +
'If you really need to run this script, use refresh_features.js --force.' 'If you really need to run this script, use refresh_features.mjs --force.'
) )
process.exit(1) process.exit(1)
} }
@ -192,7 +191,6 @@ const setup = () => {
} }
} }
waitForDb().then(() => { await waitForDb()
setup() setup()
run() run()
})