@quintal/environment 0.2.0 โ†’ 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,18 +9,25 @@ TO EDIT THE CONTENT, PLEASE MODIFY `/workspace.ts` OR `/scripts/generate.ts`
9
9
  [![NPM downloads](https://img.shields.io/npm/dt/@quintal/environment?style=flat-square)](https://npmjs.com/@quintal/environment)
10
10
  [![License](https://img.shields.io/npm/l/@quintal/environment?style=flat-square)](https://github.com/quintalwebsolutions/quintal-oss/blob/main/LICENSE)
11
11
  [![Bundle size](https://img.shields.io/bundlephobia/minzip/@quintal/environment?style=flat-square)](https://bundlephobia.com/package/@quintal/environment)
12
- [![Dependencies](https://img.shields.io/librariesio/release/npm/@quintal/environment?style=flat-square)](https://libraries.io/npm/%40quintal%2Fenvironment/)
13
- [![Code coverage](https://img.shields.io/codecov/c/github/quintalwebsolutions/quintal-oss?style=flat-square&token=3ORY9UP6H7&flag=environment&logo=codecov)](https://codecov.io/gh/quintalwebsolutions/quintal-oss)
12
+ [![Code coverage](https://img.shields.io/codecov/c/github/quintalwebsolutions/quintal-oss?style=flat-square&token=3ORY9UP6H7&flag=environment&logo=codecov)](https://app.codecov.io/gh/quintalwebsolutions/quintal-oss/flags?historicalTrend=LAST_7_DAYS&flags%5B0%5D=environment)
14
13
  [![Pull requests welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/quintalwebsolutions/quintal-oss/blob/main/CONTRIBUTING.md)
15
14
 
16
- Framework-agnostic environment variable validation for TypeScript
15
+ Framework-agnostic environment variable validation for TypeScript powered by Zod
17
16
 
18
- You can explore [the exposed functions and types on ts-docs](https://tsdocs.dev/docs/@quintal/environment)
17
+ ## Features
18
+
19
+ - ๐Ÿ” Use Zod to validate and transform environment variables,
20
+ - ๐Ÿ”’ Secure environment variables by marking them as server-only,
21
+ - ๐Ÿ“ฆ Nest environment variables into groups,
22
+ - โœ… CommonJS and ES Modules support,
23
+ - โš–๏ธ Super lightweight (only ~10kb gzipped),
24
+ - ๐Ÿงช 100% test coverage,
25
+ - ๐Ÿ›ก๏ธ Enjoy full type-safety in every step of the process.
19
26
 
20
27
  ## Table of Contents
21
28
 
22
29
  - [Getting Started](#getting-started)
23
- - [Kitchen Sink Example](#kitchen-sink-example)
30
+ - [Examples](#examples)
24
31
 
25
32
  ## Getting Started
26
33
 
@@ -34,74 +41,10 @@ yarn add @quintal/environment
34
41
  npm install @quintal/environment
35
42
  ```
36
43
 
37
- <!-- END AUTO-GENERATED: Add custom documentation after this comment -->
38
-
39
- ## Kitchen Sink Example
44
+ ## Examples
40
45
 
41
- ```ts
42
- export const environment = createEnvironment({
43
- values: {
44
- environment: {
45
- value: process.env.NEXT_PUBLIC_ENVIRONMENT,
46
- schema: z
47
- .enum(['DEVELOPMENT', 'PREVIEW', 'PRODUCTION'])
48
- .default('DEVELOPMENT'),
49
- },
50
- port: {
51
- value: process.env.PORT,
52
- schema: z.coerce.number().int().default(4000),
53
- isServerOnly: true,
54
- },
55
- simpleStringValue: process.env.SIMPLE_STRING_VALUE,
56
- isFeatureEnabled: {
57
- value: process.env.IS_FEATURE_ENABLED,
58
- schema: z.enum(['true', 'false']).transform((s) => s === 'true'),
59
- },
60
- baseUrl: {
61
- self: {
62
- value: process.env.NEXT_PUBLIC_BASE_URL_SELF,
63
- schema: z.string().url().default('http://localhost:3000'),
64
- },
65
- api: {
66
- value: process.env.NEXT_PUBLIC_BASE_URL_API,
67
- schema: z.string().url().default('http://localhost:4000'),
68
- },
69
- },
70
- database: {
71
- url: {
72
- value: process.env.DATABASE_URL,
73
- schema: z.string().url(),
74
- isServerOnly: true,
75
- },
76
- token: {
77
- value: process.env.DATABASE_TOKEN,
78
- isServerOnly: true,
79
- },
80
- },
81
- },
82
- });
83
- ```
46
+ Check out these examples to get started quickly:
84
47
 
85
- Every environment variable is defined as an object with the following properties
48
+ - [Kitchen sink](https://codesandbox.io/p/sandbox/x2slnv?file=%2Findex.ts)
86
49
 
87
- ```ts
88
- type EnvValue = {
89
- /**
90
- * The value
91
- * @example process.env.NODE_ENV
92
- * @example process.env.DATABASE_URL
93
- * @example process.env.NEXT_PUBLIC_ENVIRONMENT
94
- */
95
- value: string | undefined;
96
- /**
97
- * Zod schema that validates the value of the environment variable.
98
- * @defaultValue z.string()
99
- */
100
- schema?: ZodType;
101
- /**
102
- * Only make environment variable available for server-side usage.
103
- * @defaultValue false
104
- */
105
- isServerOnly?: boolean;
106
- };
107
- ```
50
+ <!-- END AUTO-GENERATED: Add custom documentation after this comment -->
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@quintal/environment",
3
- "version": "0.2.0",
3
+ "version": "1.0.1",
4
4
  "license": "MIT",
5
- "description": "Framework-agnostic environment variable validation for TypeScript",
5
+ "description": "Framework-agnostic environment variable validation for TypeScript powered by Zod",
6
6
  "keywords": [
7
7
  "environment",
8
8
  "validation",
@@ -28,18 +28,18 @@
28
28
  ".dist"
29
29
  ],
30
30
  "peerDependencies": {
31
- "zod": "^3.22.4"
31
+ "zod": "^3.23.8"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/node": "20.11.24",
35
- "@vitest/coverage-v8": "1.3.1",
36
- "happy-dom": "13.6.2",
37
- "typescript": "5.3.3",
38
- "typescript-coverage-report": "1.0.0",
39
- "vite": "5.1.4",
40
- "vitest": "1.3.1",
41
- "zod": "3.22.4",
42
- "@quintal/config": "0.2.0"
34
+ "@biomejs/biome": "1.8.3",
35
+ "@vitest/coverage-v8": "2.0.5",
36
+ "happy-dom": "15.7.3",
37
+ "npm-run-all": "4.1.5",
38
+ "shx": "0.3.4",
39
+ "vite": "5.4.2",
40
+ "vitest": "2.0.5",
41
+ "zod": "3.23.8",
42
+ "@quintal/config": "0.2.2"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "run-s build:*",
@@ -48,11 +48,9 @@
48
48
  "clean": "shx rm -rf .coverage .coverage-ts .dist .turbo node_modules",
49
49
  "dev": "vitest --watch",
50
50
  "lint": "pnpm lint:fix && pnpm lint:types",
51
- "lint:check": "biome ci .",
52
- "lint:fix": "biome check --apply .",
51
+ "lint:check": "biome ci",
52
+ "lint:fix": "biome check --write",
53
53
  "lint:types": "tsc --noEmit",
54
- "test": "run-s test:*",
55
- "test:source": "vitest",
56
- "test:types": "typescript-coverage-report --outputDir .coverage-ts --strict"
54
+ "test": "vitest"
57
55
  }
58
56
  }