@zh-moody/safe-env 0.1.0 → 0.1.3

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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +20 -3
  3. package/package.json +11 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Moody (https://github.com/zhMoody)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,4 +1,8 @@
1
- # safe-env 🔒
1
+ # @zh-moody/safe-env 🛡️
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@zh-moody/safe-env.svg?style=flat-square)](https://www.npmjs.com/package/@zh-moody/safe-env)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
5
+ [![GitHub stars](https://img.shields.io/github/stars/zhMoody/safe-env?style=flat-square)](https://github.com/zhMoody/safe-env)
2
6
 
3
7
  **告别 `undefined`!在应用启动的第一行,拦截所有错误配置。**
4
8
 
@@ -6,6 +10,13 @@
6
10
 
7
11
  ---
8
12
 
13
+ ### 🔗 链接 (Links)
14
+
15
+ - **GitHub Repository**: [https://github.com/zhMoody/safe-env](https://github.com/zhMoody/safe-env)
16
+ - **NPM Package**: [https://www.npmjs.com/package/@zh-moody/safe-env](https://www.npmjs.com/package/@zh-moody/safe-env)
17
+
18
+ ---
19
+
9
20
  ### 🚀 核心特性
10
21
 
11
22
  - **类型安全**:自动推断配置对象类型,拥有完美的 IDE 补全。
@@ -29,7 +40,7 @@ VITE_PORT=3000
29
40
 
30
41
  **2. 定义配置 (`src/env.ts`):**
31
42
  ```typescript
32
- import { safeEnv, s } from 'safe-env';
43
+ import { safeEnv, s } from '@zh-moody/safe-env';
33
44
 
34
45
  export const config = safeEnv({
35
46
  apiUrl: s.string().from('VITE_API_URL'), // 别名映射
@@ -52,7 +63,7 @@ DB_PORT=5432
52
63
 
53
64
  **2. 定义配置 (`src/db.ts`):**
54
65
  ```typescript
55
- import { safeEnv, s } from 'safe-env';
66
+ import { safeEnv, s } from '@zh-moody/safe-env';
56
67
 
57
68
  const dbConfig = safeEnv({
58
69
  DB_HOST: s.string('localhost'),
@@ -125,3 +136,9 @@ export default dbConfig;
125
136
  ### 📦 跨平台支持
126
137
  - **前端**: Vite (Vue/React/Vanilla)。
127
138
  - **后端**: Node.js (ESM/CJS)。
139
+
140
+ ---
141
+
142
+ ### 📄 开源协议 (License)
143
+
144
+ [MIT License](./LICENSE) - Copyright (c) 2025 Moody.
package/package.json CHANGED
@@ -1,8 +1,17 @@
1
1
  {
2
2
  "name": "@zh-moody/safe-env",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "description": "",
5
5
  "author": "Moody",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/zhMoody/safe-env#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/zhMoody/safe-env.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/zhMoody/safe-env/issues"
14
+ },
6
15
  "type": "module",
7
16
  "main": "./dist/index.cjs",
8
17
  "module": "./dist/index.js",
@@ -28,6 +37,7 @@
28
37
  "dist"
29
38
  ],
30
39
  "devDependencies": {
40
+ "@types/node": "^20.0.0",
31
41
  "tsup": "^8.5.1",
32
42
  "typescript": "^5.9.3",
33
43
  "vitest": "^4.1.2"