cloud-run-functions 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@
2
2
  import "source-map-support/register.js";
3
3
  import functions from "@google-cloud/functions-framework";
4
4
  import esbuild from "esbuild";
5
+ import { findUpSync } from "find-up-simple";
5
6
  import fs2 from "node:fs";
6
7
  import { Module } from "node:module";
7
8
  import os from "node:os";
@@ -229,11 +230,14 @@ async function createBuild() {
229
230
  });
230
231
  await context.watch();
231
232
  console.log("[esbuild] Watching for changes...");
232
- try {
233
- const dotenv = await import("dotenv");
234
- dotenv.config();
235
- console.log("[dotenv] Environment variables loaded.");
236
- } catch {
233
+ const envPath = findUpSync(".env", { cwd: root });
234
+ if (envPath) {
235
+ try {
236
+ const dotenv = await import("dotenv");
237
+ dotenv.config({ path: envPath });
238
+ console.log("[dotenv] Environment variables loaded.");
239
+ } catch {
240
+ }
237
241
  }
238
242
  const taskStates = /* @__PURE__ */ new Map();
239
243
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-run-functions",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "bin": "./dist/main.js",
6
6
  "exports": {
7
7
  "types": "./dist/index.d.ts",