mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 11:53:40 -05:00
eea27a36a4
* Add `unicorn/prefer-node-protocol` * Revert non-web changes * Run `npm run lint:fix` (prefer-node-protocol) GitOrigin-RevId: c3cdd88ff9e6b3de6a4397d45935c4d026c1c1ed
30 lines
787 B
JavaScript
30 lines
787 B
JavaScript
/* subscription.freeTrialExpiresAt
|
|
* Example script for a migration:
|
|
*
|
|
* This script demonstrates how to write a script that is runnable either via
|
|
* the CLI, or via a migration. The related migration is `script_example`
|
|
* in the migrations directory.
|
|
*/
|
|
|
|
import { User } from '../../app/src/models/User.js'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
// const somePackage = require('some-package')
|
|
|
|
const runScript = async () => {
|
|
const user = await User.findOne({}, { first_name: 1 }).exec()
|
|
const name = user ? user.first_name : 'World'
|
|
console.log(`Hello ${name}!`)
|
|
}
|
|
|
|
if (fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
try {
|
|
await runScript()
|
|
process.exit()
|
|
} catch (error) {
|
|
console.error(error)
|
|
process.exit(1)
|
|
}
|
|
}
|
|
|
|
export default runScript
|