@bunary/core 0.0.7 → 0.1.0
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 +6 -66
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
# @bunary/core
|
|
2
2
|
|
|
3
|
-
Foundation
|
|
4
|
-
|
|
5
|
-
## Documentation
|
|
6
|
-
|
|
7
|
-
Canonical documentation for this package lives in [`docs/index.md`](./docs/index.md).
|
|
3
|
+
Foundation for the Bunary framework: config (defineConfig, createConfig), environment (env, isDev, isProd, isTest). Full reference: [docs/index.md](./docs/index.md).
|
|
8
4
|
|
|
9
5
|
## Installation
|
|
10
6
|
|
|
@@ -12,73 +8,17 @@ Canonical documentation for this package lives in [`docs/index.md`](./docs/index
|
|
|
12
8
|
bun add @bunary/core
|
|
13
9
|
```
|
|
14
10
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
### Environment Variables
|
|
18
|
-
|
|
19
|
-
```typescript
|
|
20
|
-
import { env, isDev, isProd, isTest } from '@bunary/core';
|
|
21
|
-
|
|
22
|
-
// Get environment variable with automatic type coercion
|
|
23
|
-
const port = env('PORT', 3000); // Returns number
|
|
24
|
-
const debug = env('DEBUG', false); // Returns boolean
|
|
25
|
-
const name = env('APP_NAME', 'myapp'); // Returns string
|
|
26
|
-
|
|
27
|
-
// Environment detection
|
|
28
|
-
if (isDev()) {
|
|
29
|
-
console.log('Running in development mode');
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Configuration
|
|
11
|
+
## Quick start
|
|
34
12
|
|
|
35
13
|
```typescript
|
|
36
|
-
import { createConfig, defineConfig } from
|
|
14
|
+
import { env, createConfig, defineConfig } from "@bunary/core";
|
|
37
15
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
name: 'MyApp',
|
|
41
|
-
env: 'development',
|
|
42
|
-
debug: true,
|
|
43
|
-
},
|
|
44
|
-
}));
|
|
45
|
-
|
|
46
|
-
// The resolved config object (use this in most app code)
|
|
16
|
+
const port = env("PORT", 3000);
|
|
17
|
+
const configStore = createConfig(defineConfig({ app: { name: "MyApp", env: "development", debug: true } }));
|
|
47
18
|
export default configStore.get();
|
|
48
|
-
|
|
49
19
|
```
|
|
50
20
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
### `env<T>(key: string, defaultValue?: T): T`
|
|
54
|
-
|
|
55
|
-
Get an environment variable with optional default and automatic type coercion.
|
|
56
|
-
|
|
57
|
-
### `isDev(): boolean`
|
|
58
|
-
|
|
59
|
-
Returns `true` if `NODE_ENV` is `"development"` or not set.
|
|
60
|
-
|
|
61
|
-
### `isProd(): boolean`
|
|
62
|
-
|
|
63
|
-
Returns `true` if `NODE_ENV` is `"production"`.
|
|
64
|
-
|
|
65
|
-
### `isTest(): boolean`
|
|
66
|
-
|
|
67
|
-
Returns `true` if `NODE_ENV` is `"test"`.
|
|
68
|
-
|
|
69
|
-
### `defineConfig(config: BunaryConfig): BunaryConfig`
|
|
70
|
-
|
|
71
|
-
Type-safe configuration helper with defaults.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
### `createConfig(config?: BunaryConfig): BunaryConfigStore`
|
|
75
|
-
|
|
76
|
-
Create an **instance-scoped** configuration store with `get()`, `set()`, and `clear()`.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
## Requirements
|
|
80
|
-
|
|
81
|
-
- Bun ≥1.0.0
|
|
21
|
+
For API details, see [docs/index.md](./docs/index.md).
|
|
82
22
|
|
|
83
23
|
## License
|
|
84
24
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @bunary/core
|
|
3
3
|
* Foundation module for Bunary - config, environment, and app helpers
|
|
4
4
|
*/
|
|
5
|
-
export { createConfig, defineConfig, getBunaryConfig,
|
|
5
|
+
export { clearBunaryConfig, createConfig, defineConfig, getBunaryConfig, } from "./config";
|
|
6
6
|
export { Environment, type EnvironmentType } from "./constants";
|
|
7
7
|
export { env, isDev, isProd, isTest } from "./environment";
|
|
8
|
-
export type {
|
|
8
|
+
export type { AppConfig, BunaryConfig, OrmConfig } from "./types";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,eAAe,GAChB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC3D,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bunary/core",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Foundation module for Bunary - config, environment, and app helpers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"bun": ">=1.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@biomejs/biome": "^
|
|
45
|
+
"@biomejs/biome": "^2.3.13",
|
|
46
46
|
"bun-types": "latest"
|
|
47
47
|
}
|
|
48
48
|
}
|