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:
Liangjun Song
2024-10-25 08:05:41 +00:00
committed by Copybot
parent e3b93f0a22
commit 14cd8f5479
13 changed files with 140 additions and 125 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ The scripts will put the output results into the `output` folder.
### Create localized and group plan pricing
_Command_ `node plans.js -f fileName -o outputdir` - generates three json files:
_Command_ `node plans.mjs -f fileName -o outputdir` - generates three json files:
- `localizedPlanPricing.json` for `/services/web/config/settings.overrides.saas.js`
- `groups.json` for `/services/web/app/templates/plans/groups.json`
@@ -14,4 +14,4 @@ _Command_ `node plans.js -f fileName -o outputdir` - generates three json files:
The input file can be in `.csv` or `.json` format
- `.csv` csv format
- `.json` json format from the `recurly_prices.js --download` script output
- `.json` json format from the `recurly_prices.mjs --download` script output
@@ -1,10 +1,15 @@
// Creates data for localizedPlanPricing object in settings.overrides.saas.js
// and plans object in main/plans.js
const csv = require('csv/sync')
const fs = require('fs')
const path = require('path')
const minimist = require('minimist')
// https://github.com/import-js/eslint-plugin-import/issues/1810
// eslint-disable-next-line import/no-unresolved
import * as csv from 'csv/sync'
import fs from 'fs'
import path from 'path'
import minimist from 'minimist'
import { fileURLToPath } from 'url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
function readCSVFile(fileName) {
// Pick the csv file
@@ -156,7 +161,7 @@ if (argv.file) {
console.log('Invalid file type: must be csv or json')
}
} else {
console.log('usage: node plans.js -f <file.csv|file.json> -o <dir>')
console.log('usage: node plans.mjs -f <file.csv|file.json> -o <dir>')
process.exit(1)
}
// removes quotes from object keys