mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
Merge pull request #21282 from overleaf/ls-scripts-to-esm-5
Migrate rest of the scripts to esm GitOrigin-RevId: 421f3ccd15342d34113be8d22e343d08533177ea
This commit is contained in:
+11
-11
@@ -1,11 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const minimist = require('minimist')
|
||||
|
||||
const InstitutionsAPI =
|
||||
require('../../app/src/Features/Institutions/InstitutionsAPI').promises
|
||||
import fs from 'fs'
|
||||
import minimist from 'minimist'
|
||||
import InstitutionsAPIModule from '../../app/src/Features/Institutions/InstitutionsAPI.js'
|
||||
|
||||
const { promises: InstitutionsAPI } = InstitutionsAPIModule
|
||||
const argv = minimist(process.argv.slice(2))
|
||||
const commit = argv.commit !== undefined
|
||||
const ignoreNulls = !!argv['ignore-nulls']
|
||||
@@ -17,10 +14,6 @@ if (!commit) {
|
||||
const userEntitlements = loadUserEntitlements(argv['user-entitlements'])
|
||||
const cachedEntitlements = loadCachedEntitlements(argv['cached-entitlements'])
|
||||
|
||||
syncUserEntitlements(userEntitlements, cachedEntitlements)
|
||||
.catch(err => console.error(err.stack))
|
||||
.then(() => process.exit())
|
||||
|
||||
async function syncUserEntitlements(userEntitlements, cachedEntitlements) {
|
||||
// check for user entitlements in mongo but not in postgres
|
||||
for (const key of Object.keys(userEntitlements)) {
|
||||
@@ -194,3 +187,10 @@ function loadCachedEntitlements(cachedEntitlementsFilename) {
|
||||
|
||||
return cachedEntitlements
|
||||
}
|
||||
|
||||
try {
|
||||
await syncUserEntitlements(userEntitlements, cachedEntitlements)
|
||||
} catch (error) {
|
||||
console.error(error.stack)
|
||||
}
|
||||
process.exit()
|
||||
Reference in New Issue
Block a user