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:
Liangjun Song
2024-10-21 08:04:42 +00:00
committed by Copybot
parent 8bc374c916
commit 26f3f3e2e2
94 changed files with 916 additions and 847 deletions
@@ -78,7 +78,7 @@ describe('BackFillDeletedFiles', function () {
try {
result = await promisify(exec)(
['LET_USER_DOUBLE_CHECK_INPUTS_FOR=1', 'VERBOSE_LOGGING=true']
.concat(['node', 'scripts/back_fill_deleted_files'])
.concat(['node', 'scripts/back_fill_deleted_files.mjs'])
.concat(args)
.join(' ')
)
@@ -67,7 +67,7 @@ describe('BackFillDocNameForDeletedDocs', function () {
try {
result = await promisify(exec)(
['LET_USER_DOUBLE_CHECK_INPUTS_FOR=1']
.concat(['node', 'scripts/back_fill_doc_name_for_deleted_docs'])
.concat(['node', 'scripts/back_fill_doc_name_for_deleted_docs.mjs'])
.concat(args)
.join(' ')
)
@@ -24,7 +24,7 @@ describe('BackFillDocRevTests', function () {
[
'VERBOSE_LOGGING=true',
'node',
'scripts/back_fill_doc_rev',
'scripts/back_fill_doc_rev.mjs',
dryRun,
].join(' ')
)
@@ -121,7 +121,7 @@ describe('BackFillDummyDocMeta', function () {
result = await promisify(exec)(
Object.entries(options)
.map(([key, value]) => `${key}=${value}`)
.concat(['node', 'scripts/back_fill_dummy_doc_meta.js'])
.concat(['node', 'scripts/back_fill_dummy_doc_meta.mjs'])
.join(' ')
)
} catch (error) {
@@ -22,8 +22,9 @@ describe('BatchedUpdateTests', function () {
})
spawnSync(process.argv0, [
'--input-type=module',
'-e',
'require("./scripts/helpers/batchedUpdate").batchedUpdateWithResultHandling("systemmessages", { content: { $ne: "42" }}, { $set: { content: "42" } })',
'import BatchedUpdateModule from "./scripts/helpers/batchedUpdate.mjs"; BatchedUpdateModule.batchedUpdateWithResultHandling("systemmessages", { content: { $ne: "42" }}, { $set: { content: "42" } })',
])
await expect(
@@ -120,7 +120,7 @@ describe('ConvertArchivedState', function () {
beforeEach(function (done) {
exec(
'CONNECT_DELAY=1 node scripts/convert_archived_state.js FIRST,SECOND',
'CONNECT_DELAY=1 node scripts/convert_archived_state.mjs FIRST,SECOND',
error => {
if (error) {
return done(error)
@@ -121,7 +121,7 @@ describe('DeleteOrphanedDocsOnlineCheck', function () {
// Hide deprecation warnings for calling `db.collection.count`
'NODE_OPTIONS=--no-deprecation',
])
.concat(['node', 'scripts/delete_orphaned_docs_online_check.js'])
.concat(['node', 'scripts/delete_orphaned_docs_online_check.mjs'])
.join(' ')
)
} catch (error) {
@@ -96,7 +96,7 @@ describe('RegenerateDuplicateReferralIds', function () {
// actual command
'node',
'scripts/regenerate_duplicate_referral_ids',
'scripts/regenerate_duplicate_referral_ids.mjs',
].join(' ')
)
} catch (err) {
@@ -54,7 +54,7 @@ describe('RemoveDeletedUsersFromTokenAccessRefsTests', function () {
[
'VERBOSE_LOGGING=true',
'node',
'scripts/remove_deleted_users_from_token_access_refs',
'scripts/remove_deleted_users_from_token_access_refs.mjs',
dryRun,
projectsList,
].join(' ')