@controlfront/detect 0.0.2 → 0.0.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@controlfront/detect",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -14,6 +14,11 @@ dotenv.config({
14
14
  });
15
15
 
16
16
  export function getStoredEnvironment() {
17
+ // Explicit env var takes highest priority
18
+ if (process.env.CF_ENV) {
19
+ return process.env.CF_ENV === "prod" ? "prod" : "dev";
20
+ }
21
+
17
22
  try {
18
23
  const configPath = path.join(os.homedir(), ".cf", "config.json");
19
24
  if (fs.existsSync(configPath)) {
@@ -23,6 +28,12 @@ export function getStoredEnvironment() {
23
28
  } catch (e) {
24
29
  // ignore errors
25
30
  }
31
+
32
+ // In CI environments (e.g. GitHub Actions) with no local config, default to prod
33
+ if (process.env.CI) {
34
+ return "prod";
35
+ }
36
+
26
37
  return "dev";
27
38
  }
28
39