@arundo/typed-env
Advanced tools
Comparing version 0.0.2 to 0.0.3
# @arunod/typed-env | ||
## 0.0.3 | ||
### Patch Changes | ||
- 2479ab3: bump version | ||
## 0.0.2 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"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 | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
9474
10
63
0