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
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ArkEnv is a TypeScript library that provides typesafe environment variable parsi
- **Typesafe**: Full TypeScript support with inferred types
- **Runtime validation**: Catch missing or invalid environment variables early
- **Powered by ArkType**: Leverage ArkType's powerful type system
- **Lightweight**: Single dependency with minimal bundle size
- **Lightweight**: Zero external,tinyt bundle size
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix typo and punctuation in key feature.

User-facing docs: “tinyt” + stray comma.

- - **Lightweight**: Zero external,tinyt bundle size
+ - **Lightweight**: Zero external dependencies, tiny bundle size
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- **Lightweight**: Zero external,tinyt bundle size
- **Lightweight**: Zero external dependencies, tiny bundle size
🤖 Prompt for AI Agents
In .github/copilot-instructions.md around line 11, the "Lightweight" bullet
contains a typo and stray punctuation ("Zero external,tinyt bundle size"); fix
it by removing the stray comma, correcting "tinyt" to "tiny", and ensure spacing
is correct so the line reads something like "Zero external, tiny bundle size" or
better "Zero external dependencies, tiny bundle size" depending on intended
meaning.

- **Fast**: Optimized for performance with minimal overhead

## Repository Structure
Expand Down
2 changes: 1 addition & 1 deletion apps/www/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ArkEnv is a powerful TypeScript-first environment variable management library th
- 🚀 **Runtime validation**: Catch missing or invalid environment variables early in development
- 💪 **Powered by ArkType**: Built on top of ArkType's powerful type system
- 🛠️ **Type function**: Use `type()` to separate schema definition from validation
- 🪶 **Lightweight**: Only a single dependency ([see size](https://bundlephobia.com/package/arkenv))
- 🪶 **Lightweight**: Zero external dependencies ([see size](https://bundlephobia.com/package/arkenv))
- ⚡ **Fast**: Optimized for performance with minimal overhead

## Why ArkEnv?
Expand Down
1 change: 0 additions & 1 deletion examples/with-bun/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions examples/with-bun/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { styleText } from "node:util";
import arkenv from "arkenv";
import chalk from "chalk";

// Define our environment configuration
const env = arkenv({
Expand All @@ -10,12 +10,11 @@ const env = arkenv({

// Pretty print the configuration
console.log(
`🚀 Server running at ${chalk.bold(chalk.blue(env.HOST))}:${chalk.bold(
chalk.green(env.PORT),
)} in ${chalk.bold(
`🚀 Server running at ${styleText(["blue", "bold"], env.HOST)}:${styleText(["green", "bold"], String(env.PORT))} in ${styleText(
"bold",
env.NODE_ENV === "production"
? chalk.red(env.NODE_ENV)
: chalk.blue(env.NODE_ENV),
? styleText("red", env.NODE_ENV)
: styleText("blue", env.NODE_ENV),
)} mode`,
);

Expand Down
3 changes: 1 addition & 2 deletions examples/with-bun/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
},
"dependencies": {
"arkenv": "^0.5.0",
"arktype": "^2.1.22",
"chalk": "^5.6.2"
"arktype": "^2.1.22"
},
"devDependencies": {
"bun-types": "^1.2.2",
Expand Down
1 change: 1 addition & 0 deletions examples/with-vite-react-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"start": "vite",
"build": "tsc -b && vite build",
"preview": "vite preview"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/arkenv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ You can find more examples in the [examples](https://github.com/yamcodes/arkenv/
- 🔒 **Typesafe**: Full TypeScript support with inferred types
- 🚀 **Runtime validation**: Catch missing or invalid environment variables early
- 💪 **Powered by ArkType**: Leverage ArkType's powerful type system
- 🪶 **Lightweight**: Only a single dependency ([see size](https://bundlephobia.com/package/arkenv))
- 🪶 **Lightweight**: Zero dependencies, [tiny bundle size](https://bundlephobia.com/package/arkenv)
- ⚡ **Fast**: Optimized for performance with minimal overhead

## Documentation
Expand Down
3 changes: 0 additions & 3 deletions packages/arkenv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,5 @@
},
"peerDependencies": {
"arktype": "^2.1.22"
},
"dependencies": {
"chalk": "^5.6.2"
}
}
6 changes: 3 additions & 3 deletions packages/arkenv/src/create-env.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from "chalk";
import { styleText } from "node:util";
import { describe, expect, it } from "vitest";
import { createEnv } from "./create-env";
import { indent } from "./utils";
Expand All @@ -16,8 +16,8 @@ const expectedError = (
}[],
) => {
const formattedErrors = errors.map((error) => {
return `${chalk.red("Errors found while validating environment variables")}\n${indent(
`${chalk.yellow(error.name)} must be ${error.requiredType} (was ${error.providedType})`,
return `${styleText("red", "Errors found while validating environment variables")}\n${indent(
`${styleText("yellow", error.name)} must be ${error.requiredType} (was ${error.providedType})`,
)}\n`;
});

Expand Down
8 changes: 4 additions & 4 deletions packages/arkenv/src/errors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { styleText } from "node:util";
import type { ArkErrors } from "arktype";
import chalk from "chalk";
import { indent } from "./utils";

/**
Expand All @@ -19,11 +19,11 @@ export const formatErrors = (errors: ArkErrors): string =>
const formattedMessage = valueMatch
? messageWithoutPath.replace(
`(was "${valueMatch[1]}")`,
`(was ${chalk.cyan(`"${valueMatch[1]}"`)})`,
`(was ${styleText("cyan", `"${valueMatch[1]}"`)})`,
)
: messageWithoutPath;

return `${chalk.yellow(path)}${formattedMessage}`;
return `${styleText("yellow", path)}${formattedMessage}`;
})
.join("\n");

Expand All @@ -32,7 +32,7 @@ export class ArkEnvError extends Error {
errors: ArkErrors,
message = "Errors found while validating environment variables",
) {
super(`${chalk.red(message)}\n${indent(formatErrors(errors))}\n`);
super(`${styleText("red", message)}\n${indent(formatErrors(errors))}\n`);
this.name = "ArkEnvError";
}
}
9 changes: 0 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading