@edirect/config 11.0.65 → 11.0.66

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/package.json CHANGED
@@ -1,41 +1,24 @@
1
1
  {
2
2
  "name": "@edirect/config",
3
- "version": "11.0.65",
4
- "packageScope": "@edirect",
5
- "main": "./dist/src/index.js",
6
- "types": "./dist/src/index.d.ts",
3
+ "version": "11.0.66",
4
+ "main": "./src/index.js",
5
+ "types": "./src/index.d.ts",
7
6
  "exports": {
8
7
  ".": {
9
- "import": "./dist/src/index.js",
10
- "default": "./dist/src/index.js",
11
- "require": "./dist/src/index.js",
12
- "types": "./dist/src/index.d.ts"
8
+ "import": "./src/index.js",
9
+ "default": "./src/index.js",
10
+ "require": "./src/index.js",
11
+ "types": "./src/index.d.ts"
13
12
  },
14
13
  "./package.json": "./package.json"
15
14
  },
16
15
  "files": [
17
- "dist"
16
+ "src"
18
17
  ],
19
18
  "dependencies": {
20
19
  "@nestjs/common": "^11.2.1",
21
20
  "dotenv": "17.4.2",
22
21
  "tslib": "^2.8.1"
23
22
  },
24
- "nx": {
25
- "name": "@edirect/config",
26
- "targets": {
27
- "build": {
28
- "executor": "@nx/js:tsc",
29
- "options": {
30
- "main": "{workspaceRoot}/packages/edirect-config/src/index.ts",
31
- "tsConfig": "{workspaceRoot}/packages/edirect-config/tsconfig.lib.json",
32
- "outputPath": "{workspaceRoot}/packages/edirect-config/dist",
33
- "assets": [
34
- "{workspaceRoot}/packages/edirect-config/package.json",
35
- "{workspaceRoot}/packages/edirect-config/README.md"
36
- ]
37
- }
38
- }
39
- }
40
- }
23
+ "type": "commonjs"
41
24
  }
package/dist/README.md DELETED
@@ -1,103 +0,0 @@
1
- # @edirect/config
2
-
3
- Global NestJS configuration module for eDirect applications. Provides environment variable loading via `dotenv` and a `ConfigService` for accessing configuration values across the application.
4
-
5
- ## Features
6
-
7
- - Loads `.{NODE_ENV}.env` file automatically on startup (e.g., `.development.env`, `.production.env`)
8
- - Global module — register once, inject `ConfigService` anywhere
9
- - Simple `get(key)` / `getConfig()` API
10
- - Dual injection tokens: class token (`ConfigService`) and string constant (`CONFIG_SERVICE_TOKEN`)
11
-
12
- ## Installation
13
-
14
- ```sh
15
- pnpm add @edirect/config
16
- # or
17
- npm install @edirect/config
18
- ```
19
-
20
- ## Usage
21
-
22
- ### Register in your AppModule
23
-
24
- ```ts
25
- import { Module } from '@nestjs/common';
26
- import { ConfigModule } from '@edirect/config';
27
-
28
- @Module({
29
- imports: [ConfigModule],
30
- })
31
- export class AppModule {}
32
- ```
33
-
34
- Because `ConfigModule` is decorated with `@Global()`, you only need to import it once at the root module. `ConfigService` will be available for injection in all feature modules automatically.
35
-
36
- ### Inject ConfigService
37
-
38
- ```ts
39
- import { Injectable } from '@nestjs/common';
40
- import { ConfigService } from '@edirect/config';
41
-
42
- @Injectable()
43
- export class MyService {
44
- constructor(private readonly config: ConfigService) {}
45
-
46
- doSomething() {
47
- const dbUrl = this.config.get('DATABASE_URL');
48
- const port = this.config.get('PORT') ?? '3000';
49
- }
50
- }
51
- ```
52
-
53
- ## API
54
-
55
- ### `ConfigService`
56
-
57
- | Method | Signature | Description |
58
- | ------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------- |
59
- | `constructor` | `(filePath?: string)` | Optionally pass a `.env` file path. Automatically called with `.{NODE_ENV}.env` by the module. |
60
- | `get` | `(key: string): string \| undefined` | Returns the value for the given environment variable key from `process.env`. |
61
- | `getConfig` | `(): IStringMapper` | Returns all environment variables as a `Record<string, string>`. |
62
-
63
- ### `CONFIG_SERVICE_TOKEN`
64
-
65
- An alternative injection token (string constant) for `ConfigService`. Useful when you need to inject by token rather than by class:
66
-
67
- ```ts
68
- import { Inject } from '@nestjs/common';
69
- import { CONFIG_SERVICE_TOKEN, ConfigService } from '@edirect/config';
70
-
71
- constructor(@Inject(CONFIG_SERVICE_TOKEN) private config: ConfigService) {}
72
- ```
73
-
74
- ## Environment File Convention
75
-
76
- The module automatically loads `.{NODE_ENV}.env` from the working directory:
77
-
78
- | `NODE_ENV` | File loaded |
79
- | ----------------------- | ------------------ |
80
- | `development` (default) | `.development.env` |
81
- | `staging` | `.staging.env` |
82
- | `production` | `.production.env` |
83
- | `test` | `.test.env` |
84
-
85
- **Example `.development.env`:**
86
-
87
- ```env
88
- PORT=3000
89
- DATABASE_URL=mongodb://localhost:27017/mydb
90
- REDIS_URL=redis://localhost:6379
91
- LOGS_LEVEL=debug
92
- ```
93
-
94
- > **Note:** Never commit `.env` files containing sensitive credentials to version control.
95
-
96
- ## Exports
97
-
98
- ```ts
99
- export { ConfigModule } from './config/config.module';
100
- export { ConfigService } from './config/config.service';
101
- export { CONFIG_SERVICE_TOKEN } from './config/config.constants';
102
- export type { IStringMapper } from './config/config.interfaces';
103
- ```
package/dist/package.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "name": "@edirect/config",
3
- "version": "11.0.65",
4
- "main": "./dist/src/index.js",
5
- "types": "./dist/src/index.d.ts",
6
- "exports": {
7
- ".": {
8
- "import": "./dist/src/index.js",
9
- "default": "./dist/src/index.js",
10
- "require": "./dist/src/index.js",
11
- "types": "./dist/src/index.d.ts"
12
- },
13
- "./package.json": "./package.json"
14
- },
15
- "files": [
16
- "dist"
17
- ],
18
- "dependencies": {
19
- "@nestjs/common": "^11.2.1",
20
- "dotenv": "17.4.2",
21
- "tslib": "^2.8.1"
22
- },
23
- "type": "commonjs"
24
- }
@@ -1 +0,0 @@
1
- {"version":"5.9.3"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes