Skip to content

Commit 3a0554d

Browse files
committed
docs: add docs user interface with docusarus react
1 parent 59a4f6a commit 3a0554d

62 files changed

Lines changed: 28594 additions & 1108 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 51 additions & 1106 deletions
Large diffs are not rendered by default.

docs/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

docs/docs/config.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Config
2+
3+
Global configuration management for logging, cache, and runtime settings. Provides type-safe access and mutation of config values, with sensible defaults and environment variable support.
4+
5+
## API Summary
6+
7+
- [**`setConfig(value: Partial<Config>): void`**](#setconfig) – update configuration at runtime.
8+
- [**`getConfig(): Config`**](#getconfig) – get the current configuration object.
9+
10+
---
11+
12+
## Function Documentation & Usage Examples
13+
14+
### `setConfig()`
15+
Updates configuration settings at runtime. Only provided keys are merged; others remain unchanged.
16+
17+
**Method Signature:**
18+
```ts
19+
function setConfig(value: Partial<Config>): void
20+
```
21+
22+
**Parameters:**
23+
- `value`: Partial configuration object to merge.
24+
25+
**Examples:**
26+
```ts
27+
import { setConfig, getConfig } from '@catbee/utils';
28+
29+
setConfig({
30+
logger: { level: "debug", name: "custom-logger", pretty: true }
31+
});
32+
```
33+
34+
---
35+
36+
### `getConfig()`
37+
Returns the current configuration object.
38+
39+
**Method Signature:**
40+
```ts
41+
function getConfig(): Config
42+
```
43+
44+
**Returns:**
45+
- The current configuration object.
46+
47+
**Examples:**
48+
```ts
49+
import { getConfig } from '@catbee/utils';
50+
51+
const currentConfig = getConfig();
52+
console.log(currentConfig.logger.level); // "info"
53+
console.log(currentConfig.cache.defaultTtl); // 3600000
54+
```
55+
56+
---
57+
58+
## Default Values
59+
60+
All configuration options have sensible defaults:
61+
62+
```ts
63+
const config = {
64+
logger: {
65+
level: "info", // Logging level
66+
name: "@catbee/utils", // Logger name
67+
pretty: true, // Pretty print logs (dev only)
68+
singleLine: false // Single line pretty print
69+
},
70+
cache: {
71+
defaultTtl: 3600000 // Default cache TTL (1 hour, in ms)
72+
}
73+
};
74+
```
75+
76+
---
77+
78+
## Types
79+
80+
### Logger Configuration
81+
82+
```ts
83+
interface LoggerConfig {
84+
level: "trace" | "debug" | "info" | "warn" | "error";
85+
name: string;
86+
pretty: boolean;
87+
singleLine: boolean;
88+
}
89+
```
90+
91+
### Cache Configuration
92+
93+
```ts
94+
interface CacheConfig {
95+
defaultTtl: number; // milliseconds
96+
}
97+
```
98+
99+
### Config Object
100+
101+
```ts
102+
interface Config {
103+
logger: LoggerConfig;
104+
cache: CacheConfig;
105+
}
106+
```

0 commit comments

Comments
 (0)