mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Merge pull request #21202 from overleaf/ls-scripts-to-esm-2
Migrate scripts folder to esm 2/x GitOrigin-RevId: 1698bc4f13e026fa281d37a4914a2f997849c761
This commit is contained in:
+15
-15
@@ -1,9 +1,10 @@
|
||||
const RecurlyWrapper = require('../../app/src/Features/Subscription/RecurlyWrapper')
|
||||
const minimist = require('minimist')
|
||||
const logger = require('@overleaf/logger')
|
||||
import RecurlyWrapper from '../../app/src/Features/Subscription/RecurlyWrapper.js'
|
||||
import minimist from 'minimist'
|
||||
import logger from '@overleaf/logger'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
const waitMs =
|
||||
require.main === module
|
||||
fileURLToPath(import.meta.url) === process.argv[1]
|
||||
? timeout => new Promise(resolve => setTimeout(() => resolve(), timeout))
|
||||
: () => Promise.resolve()
|
||||
|
||||
@@ -116,16 +117,15 @@ const main = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
main()
|
||||
.then(() => {
|
||||
logger.info('Done.')
|
||||
process.exit(0)
|
||||
})
|
||||
.catch(err => {
|
||||
logger.error({ err }, 'Error')
|
||||
process.exit(1)
|
||||
})
|
||||
if (fileURLToPath(import.meta.url) === process.argv[1]) {
|
||||
try {
|
||||
await main()
|
||||
logger.info('Done.')
|
||||
process.exit(0)
|
||||
} catch (error) {
|
||||
logger.error({ error }, 'Error')
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { main }
|
||||
export default { main }
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
const RecurlyWrapper = require('../../app/src/Features/Subscription/RecurlyWrapper')
|
||||
const async = require('async')
|
||||
const CSVParser = require('json2csv').Parser
|
||||
import RecurlyWrapper from '../../app/src/Features/Subscription/RecurlyWrapper.js'
|
||||
import async from 'async'
|
||||
import { Parser as CSVParser } from 'json2csv'
|
||||
|
||||
const NOW = new Date()
|
||||
|
||||
+11
-11
@@ -2,10 +2,11 @@
|
||||
// app/templates/plans/groups.json
|
||||
//
|
||||
// Usage example:
|
||||
// node scripts/recurly/get_recurly_group_prices.js
|
||||
// node scripts/recurly/get_recurly_group_prices.mjs
|
||||
|
||||
const recurly = require('recurly')
|
||||
const Settings = require('@overleaf/settings')
|
||||
import recurly from 'recurly'
|
||||
|
||||
import Settings from '@overleaf/settings'
|
||||
|
||||
const recurlySettings = Settings.apis.recurly
|
||||
const recurlyApiKey = recurlySettings ? recurlySettings.apiKey : undefined
|
||||
@@ -37,11 +38,10 @@ async function main() {
|
||||
console.log(JSON.stringify(prices, undefined, 2))
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => {
|
||||
process.exit(0)
|
||||
})
|
||||
.catch(error => {
|
||||
console.error({ error })
|
||||
process.exit(1)
|
||||
})
|
||||
try {
|
||||
await main()
|
||||
process.exit(0)
|
||||
} catch (error) {
|
||||
console.error({ error })
|
||||
process.exit(1)
|
||||
}
|
||||
Reference in New Issue
Block a user