mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 06:43:06 +00:00
fix(ci): lazy-load dotenv in cli.mjs for deploy cooldown
vercel-deploy-cooldown.mjs only needs dieWithLabel from cli.mjs, but the module eagerly imported dotenv. The deploy job runs the cooldown check before pnpm install, so Node failed with ERR_MODULE_NOT_FOUND. Require dotenv inside loadCliEnv() so lightweight CI steps can import dieWithLabel without node_modules.
This commit is contained in:
parent
ced9441fee
commit
dcce160a4d
1 changed files with 3 additions and 1 deletions
|
|
@ -8,9 +8,10 @@
|
|||
*/
|
||||
import { createHash } from 'node:crypto'
|
||||
import { access, mkdir, readFile, writeFile } from 'node:fs/promises'
|
||||
import { createRequire } from 'node:module'
|
||||
import { dirname, join } from 'node:path'
|
||||
|
||||
import { config as loadEnv } from 'dotenv'
|
||||
const require = createRequire(import.meta.url)
|
||||
|
||||
/** Labelled `die` factory: `dieWithLabel('seed:tse')` → the script's `die`. */
|
||||
export const dieWithLabel = (label) => (message) => {
|
||||
|
|
@ -22,6 +23,7 @@ export const sha256Hex = (buffer) => createHash('sha256').update(buffer).digest(
|
|||
|
||||
/** The dotenv preamble every DB-touching script needs (.env.local wins over .env). */
|
||||
export const loadCliEnv = () => {
|
||||
const { config: loadEnv } = require('dotenv')
|
||||
loadEnv({ path: '.env.local' })
|
||||
loadEnv({ path: '.env' })
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue