diff --git a/package.json b/package.json index c909716..989bd6b 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dev:server": "vite", "dev": "run-p dev:*", "prepare": "husky install", - "fetch-youtube-playlists": "node --env-file .env scripts/fetch-youtube-data.mjs" + "fetch-youtube-playlists": "vite-node scripts/fetch-youtube-data.mjs" }, "browserslist": { "production": [ diff --git a/scripts/fetch-youtube-data/fetch-youtube.ts b/scripts/fetch-youtube-data/fetch-youtube.ts index d39ef75..fd8c329 100644 --- a/scripts/fetch-youtube-data/fetch-youtube.ts +++ b/scripts/fetch-youtube-data/fetch-youtube.ts @@ -1,9 +1,10 @@ /// import { URLSearchParams } from "url"; -import dotEnvRaw from "../../.env?raw"; import { parseDotEnv } from "../utils/dotEnv"; +import { readFile } from "fs/promises"; +const dotEnvRaw = await readFile("./.env", "utf-8"); const dotEnv = parseDotEnv(dotEnvRaw); const key = dotEnv.YOUTUBE_API_KEY;