mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-30 12:24:25 +02: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:
@@ -6,7 +6,9 @@
|
||||
* in the migrations directory.
|
||||
*/
|
||||
|
||||
const { User } = require('../../app/src/models/User')
|
||||
import { User } from '../../app/src/models/User.js'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
// const somePackage = require('some-package')
|
||||
|
||||
const runScript = async () => {
|
||||
@@ -15,13 +17,14 @@ const runScript = async () => {
|
||||
console.log(`Hello ${name}!`)
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
runScript()
|
||||
.then(() => process.exit())
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
})
|
||||
if (fileURLToPath(import.meta.url) === process.argv[1]) {
|
||||
try {
|
||||
await runScript()
|
||||
process.exit()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = runScript
|
||||
export default runScript
|
||||
Reference in New Issue
Block a user