@stryke/env 0.5.4 → 0.6.1

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/README.md CHANGED
@@ -22,7 +22,7 @@ This package is part of Storm Software's **đŸŒŠī¸ Stryke** monorepo. Stryke pac
22
22
 
23
23
  <h3 align="center">đŸ’ģ Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
24
24
 
25
- [![Version](https://img.shields.io/badge/version-0.5.3-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/stryke/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
+ [![Version](https://img.shields.io/badge/version-0.6.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/stryke/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
26
26
 
27
27
  > [!IMPORTANT] This repository, and the apps, libraries, and tools contained
28
28
  > within, is still in it's initial development phase. As a result, bugs and
@@ -8,7 +8,7 @@ var _ciChecks = require("./ci-checks.cjs");
8
8
  const platform = exports.platform = globalThis.process?.platform || "",
9
9
  hasTTY = exports.hasTTY = !!(globalThis.process?.stdout && globalThis.process?.stdout.isTTY),
10
10
  isDebug = exports.isDebug = !!process.env.DEBUG;
11
- const o = process.env.STORM_MODE || process.env.NODE_ENV || "production";
11
+ const o = process.env.STORM_MODE || process.env.NEXT_PUBLIC_VERCEL_ENV || process.env.NODE_ENV || "production";
12
12
  const isProduction = exports.isProduction = ["prd", "prod", "production"].includes(o?.toLowerCase()),
13
13
  isStaging = exports.isStaging = ["stg", "stage", "staging"].includes(o?.toLowerCase()),
14
14
  isDevelopment = exports.isDevelopment = ["dev", "development"].includes(o?.toLowerCase()),
@@ -1 +1 @@
1
- import{isCI as s}from"./ci-checks";export const platform=globalThis.process?.platform||"",hasTTY=!!(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY),isDebug=!!process.env.DEBUG;const o=process.env.STORM_MODE||process.env.NODE_ENV||"production";export const isProduction=["prd","prod","production"].includes(o?.toLowerCase()),isStaging=["stg","stage","staging"].includes(o?.toLowerCase()),isDevelopment=["dev","development"].includes(o?.toLowerCase()),isTest=["tst","test","testing"].includes(o?.toLowerCase())||isStaging||!!process.env.TEST,isMinimal=!!process.env.MINIMAL||s()||isTest||!hasTTY,isWindows=/^win/i.test(platform),isLinux=/^linux/i.test(platform),isMacOS=/^darwin/i.test(platform),isColorSupported=!process.env.NO_COLOR&&(!!process.env.FORCE_COLOR||(hasTTY||isWindows)&&process.env.TERM!=="dumb"||s()),nodeVersion=(globalThis.process?.versions?.node||"").replace(/^v/,"")||null,nodeMajorVersion=Number(nodeVersion?.split(".")[0])||null;
1
+ import{isCI as s}from"./ci-checks";export const platform=globalThis.process?.platform||"",hasTTY=!!(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY),isDebug=!!process.env.DEBUG;const o=process.env.STORM_MODE||process.env.NEXT_PUBLIC_VERCEL_ENV||process.env.NODE_ENV||"production";export const isProduction=["prd","prod","production"].includes(o?.toLowerCase()),isStaging=["stg","stage","staging"].includes(o?.toLowerCase()),isDevelopment=["dev","development"].includes(o?.toLowerCase()),isTest=["tst","test","testing"].includes(o?.toLowerCase())||isStaging||!!process.env.TEST,isMinimal=!!process.env.MINIMAL||s()||isTest||!hasTTY,isWindows=/^win/i.test(platform),isLinux=/^linux/i.test(platform),isMacOS=/^darwin/i.test(platform),isColorSupported=!process.env.NO_COLOR&&(!!process.env.FORCE_COLOR||(hasTTY||isWindows)&&process.env.TERM!=="dumb"||s()),nodeVersion=(globalThis.process?.versions?.node||"").replace(/^v/,"")||null,nodeMajorVersion=Number(nodeVersion?.split(".")[0])||null;
@@ -13,47 +13,47 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
13
13
  const n = _nodeOs.default.homedir(),
14
14
  o = _nodeOs.default.tmpdir(),
15
15
  l = e => {
16
- const r = (0, _joinPaths.joinPaths)(n, "Library");
16
+ const a = (0, _joinPaths.joinPaths)(n, "Library");
17
17
  return {
18
- data: (0, _joinPaths.joinPaths)(r, "Application Support", e),
19
- config: (0, _joinPaths.joinPaths)(r, "Preferences", e),
20
- cache: (0, _joinPaths.joinPaths)(r, "Caches", e),
21
- log: (0, _joinPaths.joinPaths)(r, "Logs", e),
18
+ data: (0, _joinPaths.joinPaths)(a, "Application Support", e),
19
+ config: (0, _joinPaths.joinPaths)(a, "Preferences", e),
20
+ cache: (0, _joinPaths.joinPaths)(a, "Caches", e),
21
+ log: (0, _joinPaths.joinPaths)(a, "Logs", e),
22
22
  temp: (0, _joinPaths.joinPaths)(o, e)
23
23
  };
24
24
  },
25
- E = e => {
26
- const r = process.env.APPDATA || (0, _joinPaths.joinPaths)(n, "AppData", "Roaming"),
25
+ h = e => {
26
+ const a = process.env.APPDATA || (0, _joinPaths.joinPaths)(n, "AppData", "Roaming"),
27
27
  t = process.env.LOCALAPPDATA || (0, _joinPaths.joinPaths)(n, "AppData", "Local"),
28
- a = (0, _titleCase.titleCase)(e).trim().replace(/\s+/g, "");
28
+ r = (0, _titleCase.titleCase)(e).trim().replace(/\s+/g, "");
29
29
  return {
30
- data: (0, _joinPaths.joinPaths)(t, a, "Data"),
31
- config: (0, _joinPaths.joinPaths)(r, a, "Config"),
30
+ data: (0, _joinPaths.joinPaths)(t, r, "Data"),
31
+ config: (0, _joinPaths.joinPaths)(a, r, "Config"),
32
32
  cache: (0, _joinPaths.joinPaths)(t, "Cache", e),
33
- log: (0, _joinPaths.joinPaths)(t, a, "Log"),
33
+ log: (0, _joinPaths.joinPaths)(t, r, "Log"),
34
34
  temp: (0, _joinPaths.joinPaths)(o, e)
35
35
  };
36
36
  },
37
37
  O = e => {
38
- const r = _nodePath.default.basename(n);
38
+ const a = _nodePath.default.basename(n);
39
39
  return {
40
40
  data: (0, _joinPaths.joinPaths)(process.env.XDG_DATA_HOME || (0, _joinPaths.joinPaths)(n, ".local", "share"), e),
41
41
  config: (0, _joinPaths.joinPaths)(process.env.XDG_CONFIG_HOME || (0, _joinPaths.joinPaths)(n, ".config"), e),
42
42
  cache: (0, _joinPaths.joinPaths)(process.env.XDG_CACHE_HOME || (0, _joinPaths.joinPaths)(n, ".cache"), e),
43
43
  log: (0, _joinPaths.joinPaths)(process.env.XDG_STATE_HOME || (0, _joinPaths.joinPaths)(n, ".local", "state"), e),
44
- temp: (0, _joinPaths.joinPaths)(o, r, e)
44
+ temp: (0, _joinPaths.joinPaths)(o, a, e)
45
45
  };
46
46
  };
47
47
  function getEnvPaths(e = {}) {
48
- let r = e.orgId || "storm-software";
49
- if (!r) throw new Error("You need to provide an orgId to the `getEnvPaths` function");
50
- e.suffix && (r += `-${(0, _isString.isString)(e.suffix) ? e.suffix : "nodejs"}`);
48
+ let a = e.orgId || "storm-software";
49
+ if (!a) throw new Error("You need to provide an orgId to the `getEnvPaths` function");
50
+ e.suffix && (a += `-${(0, _isString.isString)(e.suffix) ? e.suffix : "nodejs"}`);
51
51
  let t = {};
52
- return process.platform === "darwin" ? t = l(r) : process.platform === "win32" ? t = E(r) : t = O(r), process.env.STORM_DATA_DIRECTORY ? t.data = process.env.STORM_DATA_DIRECTORY : process.env.STORM_CONFIG_DIRECTORY ? t.config = process.env.STORM_CONFIG_DIRECTORY : process.env.STORM_CACHE_DIRECTORY ? t.cache = process.env.STORM_CACHE_DIRECTORY : process.env.STORM_LOG_DIRECTORY ? t.log = process.env.STORM_LOG_DIRECTORY : process.env.STORM_TEMP_DIRECTORY && (t.temp = process.env.STORM_TEMP_DIRECTORY), e.workspaceRoot && (t.cache ??= (0, _joinPaths.joinPaths)(e.workspaceRoot, "node_modules", ".cache", r), t.temp ??= (0, _joinPaths.joinPaths)(e.workspaceRoot, "tmp", r), t.log ??= (0, _joinPaths.joinPaths)(t.temp, "logs"), t.config ??= (0, _joinPaths.joinPaths)(e.workspaceRoot, ".config", r)), Object.keys(t).reduce((a, c) => {
52
+ return process.platform === "darwin" ? t = l(a) : process.platform === "win32" ? t = h(a) : t = O(a), process.env.STORM_DATA_DIRECTORY ? t.data = process.env.STORM_DATA_DIRECTORY : process.env.STORM_CONFIG_DIRECTORY ? t.config = process.env.STORM_CONFIG_DIRECTORY : process.env.STORM_CACHE_DIRECTORY ? t.cache = process.env.STORM_CACHE_DIRECTORY : process.env.STORM_LOG_DIRECTORY ? t.log = process.env.STORM_LOG_DIRECTORY : process.env.STORM_TEMP_DIRECTORY && (t.temp = process.env.STORM_TEMP_DIRECTORY), e.workspaceRoot && (t.cache ??= (0, _joinPaths.joinPaths)(e.workspaceRoot, "node_modules", ".cache", a), t.temp ??= (0, _joinPaths.joinPaths)(e.workspaceRoot, "tmp", a), t.log ??= (0, _joinPaths.joinPaths)(t.temp, "logs"), t.config ??= (0, _joinPaths.joinPaths)(e.workspaceRoot, ".config", a)), Object.keys(t).reduce((r, c) => {
53
53
  if (t[c]) {
54
54
  const i = t[c];
55
- a[c] = e.appId && e.appId !== e.orgId && e.appId !== e.nestedDir ? (0, _joinPaths.joinPaths)(i, e.appId) : i, e.nestedDir && e.nestedDir !== e.orgId && e.nestedDir !== e.appId && (a[c] = (0, _joinPaths.joinPaths)(a[c], e.nestedDir));
55
+ r[c] = e.appId && e.appId !== e.orgId && e.appId !== e.nestedDir ? (0, _joinPaths.joinPaths)(i, e.appId) : i, e.nestedDir && e.nestedDir !== e.orgId && e.nestedDir !== e.appId && (r[c] = (0, _joinPaths.joinPaths)(r[c], e.nestedDir));
56
56
  }
57
- return a;
57
+ return r;
58
58
  }, {});
59
59
  }
@@ -1 +1 @@
1
- import{joinPaths as s}from"@stryke/path/join-paths";import{titleCase as f}from"@stryke/string-format/title-case";import{isString as R}from"@stryke/type-checks/is-string";import p from"node:os";import g from"node:path";const n=p.homedir(),o=p.tmpdir(),l=e=>{const r=s(n,"Library");return{data:s(r,"Application Support",e),config:s(r,"Preferences",e),cache:s(r,"Caches",e),log:s(r,"Logs",e),temp:s(o,e)}},E=e=>{const r=process.env.APPDATA||s(n,"AppData","Roaming"),t=process.env.LOCALAPPDATA||s(n,"AppData","Local"),a=f(e).trim().replace(/\s+/g,"");return{data:s(t,a,"Data"),config:s(r,a,"Config"),cache:s(t,"Cache",e),log:s(t,a,"Log"),temp:s(o,e)}},O=e=>{const r=g.basename(n);return{data:s(process.env.XDG_DATA_HOME||s(n,".local","share"),e),config:s(process.env.XDG_CONFIG_HOME||s(n,".config"),e),cache:s(process.env.XDG_CACHE_HOME||s(n,".cache"),e),log:s(process.env.XDG_STATE_HOME||s(n,".local","state"),e),temp:s(o,r,e)}};export function getEnvPaths(e={}){let r=e.orgId||"storm-software";if(!r)throw new Error("You need to provide an orgId to the `getEnvPaths` function");e.suffix&&(r+=`-${R(e.suffix)?e.suffix:"nodejs"}`);let t={};return process.platform==="darwin"?t=l(r):process.platform==="win32"?t=E(r):t=O(r),process.env.STORM_DATA_DIRECTORY?t.data=process.env.STORM_DATA_DIRECTORY:process.env.STORM_CONFIG_DIRECTORY?t.config=process.env.STORM_CONFIG_DIRECTORY:process.env.STORM_CACHE_DIRECTORY?t.cache=process.env.STORM_CACHE_DIRECTORY:process.env.STORM_LOG_DIRECTORY?t.log=process.env.STORM_LOG_DIRECTORY:process.env.STORM_TEMP_DIRECTORY&&(t.temp=process.env.STORM_TEMP_DIRECTORY),e.workspaceRoot&&(t.cache??=s(e.workspaceRoot,"node_modules",".cache",r),t.temp??=s(e.workspaceRoot,"tmp",r),t.log??=s(t.temp,"logs"),t.config??=s(e.workspaceRoot,".config",r)),Object.keys(t).reduce((a,c)=>{if(t[c]){const i=t[c];a[c]=e.appId&&e.appId!==e.orgId&&e.appId!==e.nestedDir?s(i,e.appId):i,e.nestedDir&&e.nestedDir!==e.orgId&&e.nestedDir!==e.appId&&(a[c]=s(a[c],e.nestedDir))}return a},{})}
1
+ import{joinPaths as s}from"@stryke/path/join-paths";import{titleCase as f}from"@stryke/string-format/title-case";import{isString as E}from"@stryke/type-checks/is-string";import p from"node:os";import R from"node:path";const n=p.homedir(),o=p.tmpdir(),l=e=>{const a=s(n,"Library");return{data:s(a,"Application Support",e),config:s(a,"Preferences",e),cache:s(a,"Caches",e),log:s(a,"Logs",e),temp:s(o,e)}},h=e=>{const a=process.env.APPDATA||s(n,"AppData","Roaming"),t=process.env.LOCALAPPDATA||s(n,"AppData","Local"),r=f(e).trim().replace(/\s+/g,"");return{data:s(t,r,"Data"),config:s(a,r,"Config"),cache:s(t,"Cache",e),log:s(t,r,"Log"),temp:s(o,e)}},O=e=>{const a=R.basename(n);return{data:s(process.env.XDG_DATA_HOME||s(n,".local","share"),e),config:s(process.env.XDG_CONFIG_HOME||s(n,".config"),e),cache:s(process.env.XDG_CACHE_HOME||s(n,".cache"),e),log:s(process.env.XDG_STATE_HOME||s(n,".local","state"),e),temp:s(o,a,e)}};export function getEnvPaths(e={}){let a=e.orgId||"storm-software";if(!a)throw new Error("You need to provide an orgId to the `getEnvPaths` function");e.suffix&&(a+=`-${E(e.suffix)?e.suffix:"nodejs"}`);let t={};return process.platform==="darwin"?t=l(a):process.platform==="win32"?t=h(a):t=O(a),process.env.STORM_DATA_DIRECTORY?t.data=process.env.STORM_DATA_DIRECTORY:process.env.STORM_CONFIG_DIRECTORY?t.config=process.env.STORM_CONFIG_DIRECTORY:process.env.STORM_CACHE_DIRECTORY?t.cache=process.env.STORM_CACHE_DIRECTORY:process.env.STORM_LOG_DIRECTORY?t.log=process.env.STORM_LOG_DIRECTORY:process.env.STORM_TEMP_DIRECTORY&&(t.temp=process.env.STORM_TEMP_DIRECTORY),e.workspaceRoot&&(t.cache??=s(e.workspaceRoot,"node_modules",".cache",a),t.temp??=s(e.workspaceRoot,"tmp",a),t.log??=s(t.temp,"logs"),t.config??=s(e.workspaceRoot,".config",a)),Object.keys(t).reduce((r,c)=>{if(t[c]){const i=t[c];r[c]=e.appId&&e.appId!==e.orgId&&e.appId!==e.nestedDir?s(i,e.appId):i,e.nestedDir&&e.nestedDir!==e.orgId&&e.nestedDir!==e.appId&&(r[c]=s(r[c],e.nestedDir))}return r},{})}
@@ -1,9 +1,9 @@
1
1
  export type ProviderName = "" | "appveyor" | "aws_amplify" | "azure_pipelines" | "azure_static" | "appcircle" | "bamboo" | "bitbucket" | "bitrise" | "buddy" | "buildkite" | "circle" | "cirrus" | "cloudflare_pages" | "codebuild" | "codefresh" | "drone" | "drone" | "dsari" | "github_actions" | "gitlab" | "gocd" | "layerci" | "hudson" | "jenkins" | "magnum" | "netlify" | "nevercode" | "render" | "sail" | "semaphore" | "screwdriver" | "shippable" | "solano" | "strider" | "teamcity" | "travis" | "vercel" | "appcenter" | "codesandbox" | "stackblitz" | "stormkit" | "cleavr" | "zeabur" | "codesphere" | "railway" | "deno-deploy" | "firebase_app_hosting";
2
- export type ProviderInfo = {
2
+ export interface ProviderInfo {
3
3
  name: ProviderName;
4
4
  ci?: boolean;
5
5
  [meta: string]: any;
6
- };
6
+ }
7
7
  /** Current provider info */
8
8
  export declare const providerInfo: ProviderInfo;
9
9
  export declare const provider: ProviderName;
@@ -1,7 +1,7 @@
1
1
  export type RuntimeName = "workerd" | "deno" | "netlify" | "node" | "bun" | "edge-light" | "fastly" | "";
2
- export type RuntimeInfo = {
2
+ export interface RuntimeInfo {
3
3
  name: RuntimeName;
4
- };
4
+ }
5
5
  /**
6
6
  * Indicates if running in Node.js or a Node.js compatible runtime.
7
7
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/env",
3
- "version": "0.5.4",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "description": "A package containing utility functions to handle environment specific processes",
6
6
  "repository": {
@@ -12,11 +12,11 @@
12
12
  "dependencies": {
13
13
  "@dotenvx/dotenvx": "1.35.0",
14
14
  "defu": "^6.1.4",
15
- "@stryke/fs": ">=0.10.5",
16
- "@stryke/json": ">=0.5.4",
17
- "@stryke/path": ">=0.4.7",
18
- "@stryke/string-format": ">=0.2.5",
19
- "@stryke/type-checks": ">=0.1.4"
15
+ "@stryke/fs": "^0.11.2",
16
+ "@stryke/json": "^0.7.1",
17
+ "@stryke/path": "^0.4.8",
18
+ "@stryke/string-format": "^0.4.1",
19
+ "@stryke/type-checks": "^0.3.1"
20
20
  },
21
21
  "devDependencies": { "@types/node": "^22.13.1" },
22
22
  "publishConfig": { "access": "public" },