Make explorer env loading workspace-safe
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import "@peya-explorer/shared/load-env";
|
||||
import "./load-env.js";
|
||||
import { z } from "zod";
|
||||
|
||||
const envSchema = z.object({
|
||||
|
||||
@@ -5,5 +5,4 @@ import dotenv from "dotenv";
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const repoRoot = path.resolve(__dirname, "../../../");
|
||||
|
||||
// Workspace commands run from apps/*, so load the root-level .env explicitly.
|
||||
dotenv.config({ path: path.join(repoRoot, ".env") });
|
||||
@@ -1,4 +1,4 @@
|
||||
import "@peya-explorer/shared/load-env";
|
||||
import "./load-env.js";
|
||||
import { z } from "zod";
|
||||
|
||||
const envSchema = z.object({
|
||||
|
||||
8
apps/indexer/src/load-env.ts
Normal file
8
apps/indexer/src/load-env.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import dotenv from "dotenv";
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const repoRoot = path.resolve(__dirname, "../../../");
|
||||
|
||||
dotenv.config({ path: path.join(repoRoot, ".env") });
|
||||
@@ -4,10 +4,6 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./load-env": "./dist/load-env.js"
|
||||
},
|
||||
"types": "./dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc -p tsconfig.json"
|
||||
|
||||
Reference in New Issue
Block a user