Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions .changeset/cyan-loops-hear.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changeset/humble-lizards-judge.md

This file was deleted.

59 changes: 0 additions & 59 deletions .changeset/light-showers-wonder.md

This file was deleted.

8 changes: 0 additions & 8 deletions .changeset/open-spiders-tan.md

This file was deleted.

83 changes: 83 additions & 0 deletions packages/arkenv/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,88 @@
# ArkEnv

## 0.8.0

### Minor Changes

- ### Coercion _[`#569`](https://github.com/yamcodes/arkenv/pull/569) [`adaada4`](https://github.com/yamcodes/arkenv/commit/adaada4d214c152e8d23c983aea1747d81a0e539) [@yamcodes](https://github.com/yamcodes)_

Introduced **Schema-Directed Coercion**: now, environment variables defined as `number` or `boolean` in your schema are automatically parsed to their correct types.

If you want to opt-out of this feature, pass `config.coerce: false` to `createEnv()` (`arkenv()`). Example:

```ts
arkenv(schema, { coerce: false });
```

To learn more about the new coercion system, read [the docs](https://arkenv.js.org/docs/arkenv/coercion).

- **BREAKING**: The `createEnv()` function signature has changed to support a configuration object.
Instead of `createEnv(schema, env)`, use `createEnv(schema, config)` where `config` includes `env` (`process.env` by default, like before) and the newly added `coerce` option (`true` by default).
For example, Vite users might need to update their `vite.config.ts`:
```ts
const env = arkenv(Env, { env: loadEnv(mode, process.cwd(), "") });
```
- **BREAKING**: The custom `boolean` morph has been removed. We now use `arktype`'s standard `boolean` instead, which is coerced when used within `createEnv` / `arkenv`. This is only breaking if you specifically use `boolean` unrelated to `createEnv` / `arkenv` / our plugins and expect it to be coerced.
- **BREAKING**: `number.port` is now a strict numeric refinement (0-65535). It no longer parses strings automatically outside of `createEnv` / `arkenv`. This is only breaking if you specifically use `port` unrelated to `createEnv` / `arkenv` / our plugins and expect it to be parsed as a number.

### Patch Changes

- #### Fix error formatting _[`#582`](https://github.com/yamcodes/arkenv/pull/582) [`674a2ad`](https://github.com/yamcodes/arkenv/commit/674a2adfe8ffbb9bc3235f76c5d9d00e55ee37a4) [@aruaycodes](https://github.com/aruaycodes)_

The ArkEnv error message is now formatted better, using correct spacing and removing the `f` prefix.

Before:

```
apps/playgrounds/node on  main [$] via 🤖 v24.11.1
❯ ns

> node-playground@ start /Users/yamcodes/code/arkenv/apps/playgrounds/node
> tsx --env-file .env index.ts

/Users/yamcodes/code/arkenv/packages/arkenv/src/create-env.ts:49
throw new ArkEnvError(validatedEnv);
^

f [ArkEnvError]: Errors found while validating environment variables
ZED_ENV must be present (was missing)

at m (/Users/yamcodes/code/arkenv/packages/arkenv/src/create-env.ts:49:9)
at <anonymous> (/Users/yamcodes/code/arkenv/apps/playgrounds/node/index.ts:4:13)
at ModuleJob.run (node:internal/modules/esm/module_job:377:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:671:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)

Node.js v24.11.1
 ELIFECYCLE  Command failed with exit code 1.
```

After:

```
apps/playgrounds/node on  improve-error-formatting [$?] via 🤖 v24.11.1
❯ ns

> node-playground@ start /Users/yamcodes/code/arkenv/apps/playgrounds/node
> tsx --env-file .env index.ts

/Users/yamcodes/code/arkenv/packages/arkenv/src/create-env.ts:49
throw new ArkEnvError(validatedEnv);
^

ArkEnvError: Errors found while validating environment variables
ZED_ENV must be present (was missing)

at m (/Users/yamcodes/code/arkenv/packages/arkenv/src/create-env.ts:49:9)
at <anonymous> (/Users/yamcodes/code/arkenv/apps/playgrounds/node/index.ts:4:13)
at ModuleJob.run (node:internal/modules/esm/module_job:377:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:671:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)

Node.js v24.11.1
 ELIFECYCLE  Command failed with exit code 1.
```

## 0.7.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/arkenv/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "arkenv",
"type": "module",
"version": "0.7.8",
"version": "0.8.0",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
16 changes: 16 additions & 0 deletions packages/bun-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# @arkenv/bun-plugin

## 0.0.5

### Patch Changes

<details><summary>Updated 1 dependency</summary>

<small>

[`adaada4`](https://github.com/yamcodes/arkenv/commit/adaada4d214c152e8d23c983aea1747d81a0e539) [`674a2ad`](https://github.com/yamcodes/arkenv/commit/674a2adfe8ffbb9bc3235f76c5d9d00e55ee37a4)

</small>

- `arkenv@0.8.0`

</details>

## 0.0.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/bun-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arkenv/bun-plugin",
"version": "0.0.4",
"version": "0.0.5",
"author": "Yam Borodetsky <yam@yam.codes>",
"repository": {
"type": "git",
Expand Down
11 changes: 11 additions & 0 deletions packages/internal/keywords/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# @repo/keywords

## 0.1.0

### Minor Changes

- #### Simplify keywords for central coercion _[`#569`](https://github.com/yamcodes/arkenv/pull/569) [`adaada4`](https://github.com/yamcodes/arkenv/commit/adaada4d214c152e8d23c983aea1747d81a0e539) [@yamcodes](https://github.com/yamcodes)_

- **BREAKING**: The `boolean` keyword has been removed. Universal boolean coercion is now handled by the `arkenv` package.
- **BREAKING**: The `port` keyword has been changed from a `string -> number` morph to a pure `number` refinement. Numeric coercion is now handled centrally.
- Added `maybeParsedNumber` and `maybeParsedBoolean` internal morphs to support central coercion (including specific "NaN" support).
2 changes: 1 addition & 1 deletion packages/internal/keywords/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@repo/keywords",
"private": true,
"type": "module",
"version": "0.0.0",
"version": "0.1.0",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
23 changes: 23 additions & 0 deletions packages/internal/scope/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# @repo/scope

## 0.1.0

### Minor Changes

- #### Align scope with central coercion _[`#569`](https://github.com/yamcodes/arkenv/pull/569) [`adaada4`](https://github.com/yamcodes/arkenv/commit/adaada4d214c152e8d23c983aea1747d81a0e539) [@yamcodes](https://github.com/yamcodes)_

- **BREAKING**: Removed the custom `boolean` keyword from the root scope. ArkEnv now uses the standard ArkType `boolean` primitive combined with global coercion.
- Updated `number.port` to use the new strict numeric refinement, as string parsing is now handled by global coercion.

### Patch Changes

<details><summary>Updated 1 dependency</summary>

<small>

[`adaada4`](https://github.com/yamcodes/arkenv/commit/adaada4d214c152e8d23c983aea1747d81a0e539)

</small>

- `@repo/keywords@0.1.0`

</details>

## 0.0.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/internal/scope/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@repo/scope",
"private": true,
"type": "module",
"version": "0.0.1",
"version": "0.1.0",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
16 changes: 16 additions & 0 deletions packages/internal/types/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# @repo/types

## 1.0.0

### Patch Changes

<details><summary>Updated 1 dependency</summary>

<small>

[`adaada4`](https://github.com/yamcodes/arkenv/commit/adaada4d214c152e8d23c983aea1747d81a0e539)

</small>

- `@repo/scope@0.1.0`

</details>

## 0.0.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/internal/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@repo/types",
"version": "0.0.3",
"version": "1.0.0",
"type": "module",
"private": true,
"description": "Internal TypeScript types shared across ArkEnv packages",
Expand Down
16 changes: 16 additions & 0 deletions packages/vite-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# @arkenv/vite-plugin

## 0.0.22

### Patch Changes

<details><summary>Updated 1 dependency</summary>

<small>

[`adaada4`](https://github.com/yamcodes/arkenv/commit/adaada4d214c152e8d23c983aea1747d81a0e539) [`674a2ad`](https://github.com/yamcodes/arkenv/commit/674a2adfe8ffbb9bc3235f76c5d9d00e55ee37a4)

</small>

- `arkenv@0.8.0`

</details>

## 0.0.21

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arkenv/vite-plugin",
"version": "0.0.21",
"version": "0.0.22",
"author": "Yam Borodetsky <yam@yam.codes>",
"repository": {
"type": "git",
Expand Down
Loading