Skip to content

Commit 21944fd

Browse files
committed
Merge remote-tracking branch 'origin/dev' into v1
# Conflicts: # apps/www/content/docs/nextjs/layouts/simple.mdx
2 parents 825a229 + 98300b3 commit 21944fd

20 files changed

Lines changed: 786 additions & 998 deletions

File tree

apps/www/content/docs/arkenv/examples.mdx

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,9 @@ import { SiGithub as GitHub } from "@icons-pack/react-simple-icons";
88

99
Use the [ArkEnv CLI](/docs/cli) to bootstrap an example with your favorite tooling.
1010

11-
<Tabs items={['npm', 'pnpm', 'yarn', 'bun']}>
12-
<Tab value="npm">
13-
```bash
14-
npx @arkenv/cli@latest init --example <example-name>
15-
```
16-
</Tab>
17-
18-
<Tab value="pnpm">
19-
```bash
20-
pnx @arkenv/cli@latest init --example <example-name>
21-
```
22-
</Tab>
23-
24-
<Tab value="yarn">
25-
```bash
26-
yarn dlx @arkenv/cli@latest init --example <example-name>
27-
```
28-
</Tab>
29-
30-
<Tab value="bun">
31-
```bash
32-
bunx @arkenv/cli@latest init --example <example-name>
33-
```
34-
</Tab>
35-
</Tabs>
11+
```npm
12+
npx @arkenv/cli@latest init --example <example-name>
13+
```
3614

3715
<include cwd>../../examples/README.md#examples</include>
3816

apps/www/content/docs/arkenv/index.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ description: Introducing ArkEnv, an environment variable validator that stays ou
66
At its core, ArkEnv is a single export that creates a ready-to-use, typesafe environment variable object:
77

88
```ts twoslash
9+
// @noErrors
910
import arkenv from "arkenv";
1011

1112
const env = arkenv({
@@ -19,7 +20,10 @@ const env = arkenv({
1920
const host = env.HOST;
2021
const port = env.PORT;
2122
const nodeEnv = env.NODE_ENV;
22-
const debugging = env.DEBUGGING;
23+
24+
// Type "env." to see autocomplete
25+
const debugging = env.
26+
// ^|
2327
```
2428

2529
> ArkEnv defaults to [ArkType](https://arktype.io/) notation, the closest match to TypeScript syntax for editor-to-runtime typesafety. You can also use any [Standard Schema](https://standardschema.dev/schema) validator, including Zod, Valibot, and Typia.

apps/www/content/docs/arkenv/integrations/ai/skills.mdx

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,9 @@ Skills give AI assistants like Claude Code on-demand procedural knowledge about
99

1010
## Installation
1111

12-
<Tabs items={['npm', 'pnpm', 'yarn', 'bun']}>
13-
<Tab value="npm">
14-
```bash
15-
npx skills add yamcodes/arkenv
16-
```
17-
</Tab>
18-
19-
<Tab value="pnpm">
20-
```bash
21-
pnx skills add yamcodes/arkenv
22-
```
23-
</Tab>
24-
25-
<Tab value="yarn">
26-
```bash
27-
yarn dlx skills add yamcodes/arkenv
28-
```
29-
</Tab>
30-
31-
<Tab value="bun">
32-
```bash
33-
bunx skills add yamcodes/arkenv
34-
```
35-
</Tab>
36-
</Tabs>
12+
```npm
13+
npx skills add yamcodes/arkenv
14+
```
3715

3816
This installs the ArkEnv skill into your project. Once installed, your AI assistant automatically loads it when working with ArkEnv schemas.
3917

apps/www/content/docs/arkenv/options.mdx

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@ The second argument to `arkenv()` is an optional configuration object.
99
All options listed below apply to both `arkenv` (ArkType mode) and `arkenv/standard` (Standard Schema mode).
1010
:::
1111

12-
## `env`
12+
## Configuration options
1313

14-
The environment variables to parse. Defaults to `process.env`.
14+
<AutoTypeTable path="../../packages/arkenv/src/create-env.ts" name="ArkEnvConfig" />
15+
16+
## Examples
17+
18+
### Custom env source
19+
20+
You can pass a custom object instead of `process.env`. This is particularly useful in environments like Cloudflare Workers where variables are passed via a context object, or when testing.
1521

1622
```ts twoslash
1723
import arkenv from "arkenv";
@@ -22,9 +28,9 @@ const env = arkenv(
2228
);
2329
```
2430

25-
## `coerce`
31+
### Disabling coercion
2632

27-
Whether to coerce environment variables to their defined types. Defaults to `true`.
33+
By default, ArkEnv automatically coerces string environment variables to numbers or booleans if the schema requires it. You can disable this behavior:
2834

2935
```ts twoslash
3036
import arkenv from "arkenv";
@@ -37,20 +43,9 @@ const env = arkenv(
3743

3844
See the [coercion docs](/docs/arkenv/coercion) for more details.
3945

40-
## `onUndeclaredKey`
41-
42-
Control how ArkEnv handles environment variables that are not defined in your schema. Defaults to `"delete"`.
46+
### Custom array format
4347

44-
- `"delete"` — Undeclared keys are allowed on input but stripped from the output.
45-
- `"ignore"` — Undeclared keys are allowed and preserved in the output.
46-
- `"reject"` — Undeclared keys will cause validation to fail.
47-
48-
## `arrayFormat`
49-
50-
The format to use for array parsing when coercion is enabled. Defaults to `"comma"`.
51-
52-
- `"comma"` — Strings are split by comma and trimmed.
53-
- `"json"` — Strings are parsed as JSON.
48+
When coercion is enabled, you can specify how array strings are parsed.
5449

5550
```ts twoslash
5651
import arkenv from "arkenv";
@@ -61,11 +56,9 @@ const env = arkenv(
6156
);
6257
```
6358

64-
## `emptyAsUndefined`
65-
66-
Whether to treat empty strings (`""`) as `undefined` before validation. Defaults to `false`.
59+
### Empty strings as undefined
6760

68-
When enabled, an environment variable set to an empty value (e.g., `PORT=` in a `.env` file) will be treated as if it were missing, allowing defaults to apply and preventing validation errors for numeric or boolean types.
61+
When `emptyAsUndefined` is enabled, an environment variable set to an empty value (e.g., `PORT=` in a `.env` file) will be treated as if it were missing. This allows defaults to apply and prevents validation errors for numeric or boolean types.
6962

7063
```ts twoslash
7164
import arkenv from "arkenv";

apps/www/content/docs/arkenv/quickstart.mdx

Lines changed: 40 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -11,93 +11,63 @@ ArkEnv is tested on [**Next.js** **16.x**](https://github.com/yamcodes/arkenv/tr
1111

1212
The easiest way to get started is with the [ArkEnv CLI](/docs/cli). It automatically configures ArkEnv for your project, installs dependencies, and scaffolds your initial schema.
1313

14-
<Tabs items={['npm', 'pnpm', 'yarn', 'bun']}>
15-
<Tab value="npm">
16-
```bash
17-
npx @arkenv/cli@latest init
18-
```
19-
</Tab>
20-
21-
<Tab value="pnpm">
22-
```bash
23-
pnx @arkenv/cli@latest init
24-
```
25-
</Tab>
26-
27-
<Tab value="yarn">
28-
```bash
29-
yarn dlx @arkenv/cli@latest init
30-
```
31-
</Tab>
32-
33-
<Tab value="bun">
34-
```bash
35-
bunx @arkenv/cli@latest init
36-
```
37-
</Tab>
38-
</Tabs>
14+
```npm
15+
npx @arkenv/cli@latest init
16+
```
3917

4018
<Accordions>
4119
<Accordion title="Manual Installation">
42-
<Steps>
43-
<Step>
44-
### Install ArkEnv
20+
### Install ArkEnv [step] [!toc]
4521

46-
<Accordions defaultValue="Install ArkEnv + ArkType (recommended) + Plugins (optional)">
47-
<Accordion title="Install ArkEnv + ArkType (recommended) + Plugins (optional)">
48-
ArkEnv works best when paired with [ArkType](https://arktype.io):
22+
<Accordions defaultValue="Install ArkEnv + ArkType (recommended) + Plugins (optional)">
23+
<Accordion title="Install ArkEnv + ArkType (recommended) + Plugins (optional)">
24+
ArkEnv works best when paired with [ArkType](https://arktype.io):
4925

50-
```package-install
51-
arkenv arktype
52-
```
26+
```package-install
27+
arkenv arktype
28+
```
5329

54-
If you're using Vite, see [ArkEnv for Vite](/docs/vite-plugin).
30+
If you're using Vite, see [ArkEnv for Vite](/docs/vite-plugin).
5531

56-
If you're using Bun, see [ArkEnv for Bun](/docs/bun-plugin).
57-
</Accordion>
32+
If you're using Bun, see [ArkEnv for Bun](/docs/bun-plugin).
33+
</Accordion>
5834

59-
<Accordion title="Install ArkEnv only">
60-
```package-install
61-
arkenv
62-
```
35+
<Accordion title="Install ArkEnv only">
36+
```package-install
37+
arkenv
38+
```
6339

64-
Import from [arkenv/standard](/docs/arkenv/standard) to use ArkEnv without ArkType.
65-
</Accordion>
66-
</Accordions>
67-
</Step>
40+
Import from [arkenv/standard](/docs/arkenv/standard) to use ArkEnv without ArkType.
41+
</Accordion>
42+
</Accordions>
6843

69-
<Step>
70-
### Configure TypeScript (recommended)
44+
### Configure TypeScript (recommended) [step] [!toc]
7145

72-
ArkEnv expects **TypeScript >= 5.1** and `strict` mode in your `tsconfig.json`.
46+
ArkEnv expects **TypeScript >= 5.1** and `strict` mode in your `tsconfig.json`.
7347

74-
You're also expected to use a [modern TypeScript module resolution](https://www.typescriptlang.org/tsconfig/#moduleResolution).
48+
You're also expected to use a [modern TypeScript module resolution](https://www.typescriptlang.org/tsconfig/#moduleResolution).
7549

76-
```json title="tsconfig.json"
77-
// [!code word:config]
78-
{
79-
"compilerOptions": {
80-
"strict": true, // [!code focus]
81-
"moduleResolution": "bundler" // [!code focus] or "node16" / "nodenext"
82-
}
83-
}
84-
```
50+
```json title="tsconfig.json"
51+
// [!code word:config]
52+
{
53+
"compilerOptions": {
54+
"strict": true, // [!code focus]
55+
"moduleResolution": "bundler" // [!code focus] or "node16" / "nodenext"
56+
}
57+
}
58+
```
8559

86-
:::note
87-
While ArkEnv [can](https://github.com/yamcodes/arkenv/tree/main/examples/basic-js) work with plain JavaScript, TypeScript is strongly recommended for the best experience.
88-
:::
89-
</Step>
60+
:::note
61+
While ArkEnv [can](https://github.com/yamcodes/arkenv/tree/main/examples/basic-js) work with plain JavaScript, TypeScript is strongly recommended for the best experience.
62+
:::
9063

91-
<Step>
92-
### Setup ArkType (optional)
64+
### Setup ArkType (optional) [step] [!toc]
9365

94-
While ArkEnv [works with any Standard Schema validator](/docs/arkenv/integrations/standard-schema), we
95-
recommend using ArkType for the ultimate ArkEnv experience.
66+
While ArkEnv [works with any Standard Schema validator](/docs/arkenv/integrations/standard-schema), we
67+
recommend using ArkType for the ultimate ArkEnv experience.
9668

97-
Follow the [ArkType setup](https://arktype.io/docs/intro/setup) to complete your configuration. We
98-
recommend installing the ArkType syntax highlighting extension if your IDE supports it.
99-
</Step>
100-
</Steps>
69+
Follow the [ArkType setup](https://arktype.io/docs/intro/setup) to complete your configuration. We
70+
recommend installing the ArkType syntax highlighting extension if your IDE supports it.
10171
</Accordion>
10272
</Accordions>
10373

0 commit comments

Comments
 (0)