Skip to content

Commit e1eecf1

Browse files
committed
chore: update jsdocs
1 parent bef59b8 commit e1eecf1

File tree

5 files changed

+44
-26
lines changed

5 files changed

+44
-26
lines changed

README.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Detects the current CI/CD provider based on environment variables.
3232
import { isCI, provider, providerInfo } from "std-env";
3333

3434
console.log({ isCI, provider, providerInfo });
35-
// { isCI: true, provider: "github_actions", providerInfo: { name: "github_actions", isCI: true } }
35+
// { isCI: true, provider: "github_actions", providerInfo: { name: "github_actions", ci: true } }
3636
```
3737

3838
Use `detectProvider()` to re-run detection. See [./src/providers.ts](./src/providers.ts) for the full list.
@@ -58,32 +58,33 @@ Supported agents: `cursor`, `claude`, `devin`, `replit`, `gemini`, `codex`, `aug
5858
import { env, isDevelopment, isProduction } from "std-env";
5959
```
6060

61-
| Export | Description |
62-
| ------------------ | ----------------------------------------- |
63-
| `hasTTY` | stdout TTY is available |
64-
| `hasWindow` | Global `window` is available |
65-
| `isCI` | Running in CI |
66-
| `isColorSupported` | Terminal color output supported |
67-
| `isDebug` | `DEBUG` env var is set |
68-
| `isDevelopment` | `NODE_ENV` is `dev` or `development` |
69-
| `isLinux` | Linux platform |
70-
| `isMacOS` | macOS (darwin) platform |
71-
| `isMinimal` | Minimal environment (CI, test, or no TTY) |
72-
| `isProduction` | `NODE_ENV` is `production` |
73-
| `isTest` | `NODE_ENV` is `test` |
74-
| `isWindows` | Windows platform |
75-
| `platform` | Value of `process.platform` |
76-
| `nodeVersion` | Node.js version string (e.g. `"22.0.0"`) |
77-
| `nodeMajorVersion` | Node.js major version number (e.g. `22`) |
61+
| Export | Description |
62+
| ------------------ | ------------------------------------------------------------ |
63+
| `hasTTY` | stdout TTY is available |
64+
| `hasWindow` | Global `window` is available |
65+
| `isCI` | Running in CI |
66+
| `isColorSupported` | Terminal color output supported |
67+
| `isDebug` | `DEBUG` env var is set |
68+
| `isDevelopment` | `NODE_ENV` is `dev`/`development` or `MODE` is `development` |
69+
| `isLinux` | Linux platform |
70+
| `isMacOS` | macOS (darwin) platform |
71+
| `isMinimal` | `MINIMAL` env is set, CI, test, or no TTY |
72+
| `isProduction` | `NODE_ENV` or `MODE` is `production` |
73+
| `isTest` | `NODE_ENV` is `test` or `TEST` env is set |
74+
| `isWindows` | Windows platform |
75+
| `platform` | Value of `process.platform` |
76+
| `nodeVersion` | Node.js version string (e.g. `"22.0.0"`) |
77+
| `nodeMajorVersion` | Node.js major version number (e.g. `22`) |
7878

7979
See [./src/flags.ts](./src/flags.ts) for details.
8080

8181
## Environment
8282

83-
| Export | Description |
84-
| --------- | --------------------------------------------------- |
85-
| `env` | Universal `process.env` (works across all runtimes) |
86-
| `nodeENV` | Current `NODE_ENV` value (undefined if unset) |
83+
| Export | Description |
84+
| --------- | ---------------------------------------------------- |
85+
| `env` | Universal `process.env` (works across all runtimes) |
86+
| `process` | Universal `process` shim (works across all runtimes) |
87+
| `nodeENV` | Current `NODE_ENV` value (undefined if unset) |
8788

8889
## License
8990

src/agents.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import { env } from "./env.ts";
44

5+
/**
6+
* Represents the name of an AI coding agent.
7+
*/
58
export type AgentName =
69
| (string & {})
710
| "cursor"

src/env.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
/**
2+
* Runtime-agnostic reference to environment variables.
3+
*
4+
* Resolves to `globalThis.process.env` when available, otherwise an empty object.
5+
*/
16
export const env: Record<string, string | undefined> =
27
globalThis.process?.env || Object.create(null);
38

9+
/**
10+
* Runtime-agnostic reference to the `process` global.
11+
*
12+
* Resolves to `globalThis.process` when available, otherwise a minimal shim containing only `env`.
13+
*/
414
export const process: Partial<typeof globalThis.process> = globalThis.process || { env };
515

616
/**

src/flags.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ export const isLinux: boolean = /^linux/i.test(platform);
3939
/** Detect if process.platform is macOS (darwin kernel) */
4040
export const isMacOS: boolean = /^darwin/i.test(platform);
4141

42-
/** Color Support */
42+
/** Detect if terminal color output is supported based on `NO_COLOR`, `FORCE_COLOR`, TTY, and CI environment */
4343
export const isColorSupported: boolean =
4444
!env.NO_COLOR && (!!env.FORCE_COLOR || ((hasTTY || isWindows) && env.TERM !== "dumb") || isCI);
4545

46-
/** Node.js versions */
46+
/** Node.js version string (e.g. `"20.11.0"`), or `null` if not running in Node.js */
4747
export const nodeVersion: string | null = (process.versions?.node || "").replace(/^v/, "") || null;
4848

49+
/** Node.js major version number (e.g. `20`), or `null` if not running in Node.js */
4950
export const nodeMajorVersion: number | null = Number(nodeVersion?.split(".")[0]) || null;

src/runtimes.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { process } from "./env.ts";
22

3-
// https://runtime-keys.proposal.wintercg.org/
3+
/**
4+
* Represents the name of a JavaScript runtime.
5+
*
6+
* @see https://runtime-keys.proposal.wintercg.org/
7+
*/
48
export type RuntimeName =
59
| (string & {})
610
| "workerd"
@@ -48,7 +52,6 @@ export const isFastly: boolean = "fastly" in globalThis;
4852
export const isNetlify: boolean = "Netlify" in globalThis;
4953

5054
/**
51-
*
5255
* Indicates if running in EdgeLight (Vercel Edge) runtime.
5356
*/
5457
export const isEdgeLight: boolean = "EdgeRuntime" in globalThis;

0 commit comments

Comments
 (0)