Releases: yamcodes/arkenv
arkenv@0.11.1
Patch Changes
-
Add
Infer<T>helper to resolve environment variable types#1092c6c30ab@yamcodesIntroduce the
Infer<T>type helper, allowing developers to extract the inferred output types of their environment schemas. It supports both declarative schema shapes and compiled schemas (like Zod or ArkType types).Usage:
import { createEnv, type Infer } from "arkenv"; import { type } from "arktype"; const schema = { PORT: type.number, }; export type Env = Infer<typeof schema>;
@arkenv/vite-plugin@0.1.1
Patch Changes
@arkenv/nextjs@0.0.6
@arkenv/nextjs@0.0.5
Patch Changes
-
Generate tailored
createEnvfactory in Next.js strict layout#1116b62ebbd@yamcodesGenerate a tailored
createEnvfactory helper inenv.gen.tswhen using the strict split-schema layout (instead of exporting a rawruntimeEnvobject).This eliminates the need to manually declare or reference the
runtimeEnvobject inside the client schemaclient.tsfile, aligning it closer to the corearkenvexperience of simply callingcreateEnv(schema, options).Example usage in
client.ts:import { createEnv } from "./generated/env.gen"; import { SharedSchema } from "./internal/shared"; export const env = createEnv( { NEXT_PUBLIC_API_URL: "string", }, { extends: [SharedSchema], } );
-
Support split schema layout in Next.js config wrapper
#1116b62ebbd@yamcodesAdd support for the strict split schema layout in the Next.js
withArkEnvconfiguration wrapper and update CLI scaffolding instructions:- Add a
layoutoption ("simple" | "strict") towithArkEnvconfiguration, which defaults to auto-detecting the strict layout if split files (env/internal/shared.ts,env/client.ts,env/server.ts) exist. - Implement key extraction from strict client and shared schema files.
- Update CLI next-steps messages to include
withArkEnvwrapping instructions for strict layout nextjs projects.
- Add a
@arkenv/nextjs@0.0.4
Patch Changes
-
Implement Next.js separate files mode, shared entry point, and native extends API
#1084d921785@yamcodesIntroduce dedicated entry points for
@arkenv/nextjs/server,@arkenv/nextjs/client, and@arkenv/nextjs/sharedto prevent metadata leakage and support compile-time bundler-enforced isolation. Add a nativeextendsAPI to merge validated outputs of extended proxies while maintaining proxy-level protections.Also update the CLI
initwizard to support interactive layout selection (Strict 3-file vs Simple 1-file) and--strict/--simpleflags to bypass interactive selection.Example server usage:
import { createEnv } from "@arkenv/nextjs/server"; import { env as clientEnv } from "./env.client"; export const env = createEnv( { DATABASE_URL: "string" }, { extends: [clientEnv] } );
Example client usage:
import { createEnv } from "@arkenv/nextjs/client"; export const env = createEnv( { NEXT_PUBLIC_API_URL: "string" }, { runtimeEnv: { NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL, }, } );
-
Add
withArkEnvconfiguration helper for Next.js#1092c6c30ab@yamcodesAdd a Next.js configuration wrapper in
@arkenv/nextjs/configthat automates client-side and shared environment variable destructuring in theruntimeEnvblock:// next.config.ts import { withArkEnv } from "@arkenv/nextjs/config"; import type { NextConfig } from "next"; const nextConfig: NextConfig = { reactStrictMode: true, }; export default withArkEnv(nextConfig);
Key features:
- Zero-Boilerplate Destructuring: Statically extract
clientandsharedkeys from yourenv.tsschema and generate a tailoredcreateEnvfactory ingenerated/env.gen.tsthat pre-fills theruntimeEnvblock. - Development Watcher: Automatically start a lightweight file watcher in development mode to regenerate
generated/env.gen.tson the fly whenenv.tschanges. - Customizable Output: Support custom schema and output paths, enabling developers to write generated files to a dedicated folder (e.g.,
src/generated/env.gen.ts). - Deprecate Direct Exports: Mark direct
createEnvand defaultarkenvexports from the main andreact-serverentry points as deprecated to steer developers toward the new codegen workflow.
Example usage in
env.ts:// env.ts import { createEnv } from "./generated/env.gen"; export const env = createEnv({ client: { NEXT_PUBLIC_API_URL: "string", }, shared: { NODE_ENV: "string", }, });
- Zero-Boilerplate Destructuring: Statically extract
@arkenv/cli@0.2.8
Patch Changes
-
Default Next.js layout selection to Simple (1-file) layout
#11209563b47@yamcodesChange the CLI prompt layout selection ordering to present "Simple" as the recommended first choice and "Strict" as the second choice. Update the non-interactive wizard flow to default to the simple (Unified) layout.
-
Fix env.gen import path in strict layout and export default alias
#1121e75194e@yamcodesCorrect the hardcoded import path to generated factory in Next.js 3-file strict mode client template. Also export
createEnvas default export (aliased asarkenv) in the generatedenv.gen.tsfile.
@arkenv/cli@0.2.7
Patch Changes
-
Format empty schema objects cleanly in scaffolding
#1116b62ebbd@yamcodesFormat empty schema objects cleanly as
{}on a single line (instead of multi-line empty blocks with trailing whitespace) during project scaffolding. -
Generate tailored
createEnvfactory in Next.js strict layout#1116b62ebbd@yamcodesGenerate a tailored
createEnvfactory helper inenv.gen.tswhen using the strict split-schema layout (instead of exporting a rawruntimeEnvobject).This eliminates the need to manually declare or reference the
runtimeEnvobject inside the client schemaclient.tsfile, aligning it closer to the corearkenvexperience of simply callingcreateEnv(schema, options).Example usage in
client.ts:import { createEnv } from "./generated/env.gen"; import { SharedSchema } from "./internal/shared"; export const env = createEnv( { NEXT_PUBLIC_API_URL: "string", }, { extends: [SharedSchema], } );
-
Support split schema layout in Next.js config wrapper
#1116b62ebbd@yamcodesAdd support for the strict split schema layout in the Next.js
withArkEnvconfiguration wrapper and update CLI scaffolding instructions:- Add a
layoutoption ("simple" | "strict") towithArkEnvconfiguration, which defaults to auto-detecting the strict layout if split files (env/internal/shared.ts,env/client.ts,env/server.ts) exist. - Implement key extraction from strict client and shared schema files.
- Update CLI next-steps messages to include
withArkEnvwrapping instructions for strict layout nextjs projects.
- Add a
@arkenv/cli@0.2.6
Patch Changes
-
Implement Next.js separate files mode, shared entry point, and native extends API
#1084d921785@yamcodesIntroduce dedicated entry points for
@arkenv/nextjs/server,@arkenv/nextjs/client, and@arkenv/nextjs/sharedto prevent metadata leakage and support compile-time bundler-enforced isolation. Add a nativeextendsAPI to merge validated outputs of extended proxies while maintaining proxy-level protections.Also update the CLI
initwizard to support interactive layout selection (Strict 3-file vs Simple 1-file) and--strict/--simpleflags to bypass interactive selection.Example server usage:
import { createEnv } from "@arkenv/nextjs/server"; import { env as clientEnv } from "./env.client"; export const env = createEnv( { DATABASE_URL: "string" }, { extends: [clientEnv] } );
Example client usage:
import { createEnv } from "@arkenv/nextjs/client"; export const env = createEnv( { NEXT_PUBLIC_API_URL: "string" }, { runtimeEnv: { NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL, }, } );
-
Update Next.js scaffolding template to use codegen workflow
#1092c6c30ab@yamcodesUpdate the CLI
nextjsscaffolding template to adopt the new@arkenv/nextjs/configcodegen workflow. The generatedenv.tsfile now imports the auto-generatedcreateEnvfactory fromenv.gen.tsinstead of directly importing from@arkenv/nextjs, which eliminates the need to manually destructureruntimeEnvvariables.Additionally, update the CLI usage instructions to guide developers on wrapping their Next.js configuration using the
withArkEnvhelper insidenext.config.ts.Add
--no-codegenCLI option and dedicated prompt for Next.js scaffoldingIntroduce a
--no-codegen(or-C) option and an interactive prompt to allow developers to opt out of the Next.js automatic environment variable code generation workflow. When opted out, the CLI scaffolds the project to use standard runtimeEnv destructuring and skips post-scaffold code generation bootstrapping.