Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@arundo/typed-env

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arundo/typed-env - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

.github/workflows/changeset-pr-check.yml

6

CHANGELOG.md
# @arunod/typed-env
## 0.0.3
### Patch Changes
- 2479ab3: bump version
## 0.0.2

@@ -4,0 +10,0 @@

9

package.json
{
"name": "@arundo/typed-env",
"version": "0.0.2",
"version": "0.0.3",
"description": "Typed environment variables made easy 🚀",

@@ -10,3 +10,3 @@ "main": "dist/index.js",

"author": "",
"license": "ISC",
"license": "MIT",
"peerDependencies": {

@@ -17,3 +17,3 @@ "@types/node": "^20.10.0",

"devDependencies": {
"@changesets/cli": "^2.27.0",
"@changesets/cli": "^2.22.0",
"tsup": "^8.0.1",

@@ -27,5 +27,4 @@ "typescript": "^5.3.2",

"bundle": "tsup src/index.ts --format cjs,esm --dts --minify --clean",
"release": "pnpm bundle && changeset publish",
"changeset": "changeset"
"release": "pnpm run bundle && pnpm changeset publish"
}
}

@@ -21,3 +21,3 @@ # @arundo/typed-env

Create a environment file with a schema and use `typeEnvironment` to create a typed environment object.
Create a environment file with a schema and use `typeEnvironment` to create a typed environment object:

@@ -29,9 +29,11 @@ ```ts

export const environment = typeEnvironment(z.object({
export const envSchema = z.object({
NODE_ENV: z.enum(['test', 'development', 'production']),
PORT: z.coerse.number().int().default(3000),
}));
});
export const environment = typeEnvironment(envSchema);
```
Import the environment object and use it.
Import the environment object and use it:

@@ -45,1 +47,19 @@ ```ts

```
Set naming convention of environment variables:
```ts
// environment.ts
/* ... as usual ... */
export const environment = typeEnvironment(envSchema, 'camelcase');
```
```ts
// server.ts
import { environment } from './environment';
console.log(environment.nodeEnv); // 'development' - type string
console.log(environment.port); // 3000 - type number
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc