@config-bound/nestjs 0.3.0 → 1.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @config-bound/nestjs
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [87d2ab6]
8
+ - @config-bound/core@1.0.0
9
+
3
10
  ## 0.3.0
4
11
 
5
12
  ### Minor Changes
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Robert Keyser
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
@@ -5,7 +5,7 @@ NestJS integration for the ConfigBound configuration library. This package provi
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install @config-bound/nestjs @config-bound/config-bound
8
+ npm install @config-bound/nestjs @config-bound/core
9
9
  ```
10
10
 
11
11
  ## Quick Start
@@ -15,8 +15,8 @@ npm install @config-bound/nestjs @config-bound/config-bound
15
15
  ```typescript
16
16
  import { Module } from '@nestjs/common';
17
17
  import { ConfigBoundModule } from '@config-bound/nestjs';
18
- import { configItem, configSection } from '@config-bound/config-bound';
19
- import { EnvVarBind } from '@config-bound/config-bound/bind/binds/envVar';
18
+ import { configItem, configSection } from '@config-bound/core';
19
+ import { EnvVarBind } from '@config-bound/core/binds/env';
20
20
  import { z } from 'zod';
21
21
 
22
22
  const appConfig = {
@@ -46,7 +46,7 @@ const appConfig = {
46
46
  imports: [
47
47
  ConfigBoundModule.forRoot({
48
48
  schema: appConfig,
49
- binds: [new EnvVarBind({ prefix: 'APP' })],
49
+ binds: [await EnvVarBind.create({ prefix: 'APP' })],
50
50
  validateOnInit: true,
51
51
  isGlobal: true
52
52
  })
@@ -98,7 +98,7 @@ import { ConfigService } from '@nestjs/config';
98
98
  ): Promise<ConfigBoundModuleOptions> => {
99
99
  return {
100
100
  schema: appConfig,
101
- binds: [new EnvVarBind({ prefix: 'APP' })],
101
+ binds: [await EnvVarBind.create({ prefix: 'APP' })],
102
102
  validateOnInit: true
103
103
  };
104
104
  },
@@ -124,7 +124,7 @@ export class ConfigBoundConfigService implements ConfigBoundOptionsFactory {
124
124
  createConfigBoundOptions(): ConfigBoundModuleOptions {
125
125
  return {
126
126
  schema: appConfig,
127
- binds: [new EnvVarBind({ prefix: 'APP' })],
127
+ binds: [await EnvVarBind.create({ prefix: 'APP' })],
128
128
  validateOnInit: true
129
129
  };
130
130
  }
@@ -199,7 +199,7 @@ The service provides full type-safe access to your configuration:
199
199
  3. **Use `getOrThrow()`** for required configuration values
200
200
  4. **Use `get()`** for optional configuration values with proper fallback handling
201
201
  5. **Define your schema in a separate file** for reusability and better organization
202
- 6. **Use a prefix with `EnvVarBind`** to give a meaningful prefix to environment variable names (e.g., `new EnvVarBind({ prefix: "APP" })`)
202
+ 6. **Use a prefix with `EnvVarBind`** to give a meaningful prefix to environment variable names (e.g., `await EnvVarBind.create({ prefix: "APP" })`)
203
203
  7. **Remember top-level items go in the 'app' section**: Top-level `configItem` entries are automatically placed in a section named after the `name` option (default: 'app'), so access them with `config.getOrThrow("app", "port")`
204
204
 
205
205
  ## Type Safety
package/package.json CHANGED
@@ -1,24 +1,32 @@
1
1
  {
2
2
  "name": "@config-bound/nestjs",
3
- "version": "0.3.0",
3
+ "version": "1.0.0",
4
4
  "description": "NestJS integration for ConfigBound configuration library",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.mts",
7
9
  "exports": {
8
10
  ".": {
9
- "types": "./dist/index.d.ts",
10
- "require": "./dist/index.js",
11
- "import": "./dist/index.js"
11
+ "import": {
12
+ "types": "./dist/index.d.mts",
13
+ "default": "./dist/index.mjs"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
12
19
  }
13
20
  },
14
- "scripts": {
15
- "build": "tsc",
16
- "clean": "rimraf dist",
17
- "test": "jest",
18
- "lint": "eslint src/**/*.ts --fix",
19
- "lint:ci": "eslint src/**/*.ts",
20
- "format": "prettier --write --config ../../.config/.prettierrc --ignore-path ../../.config/.prettierignore src/**/*.ts",
21
- "format:ci": "prettier --check --config ../../.config/.prettierrc --ignore-path ../../.config/.prettierignore src/**/*.ts"
21
+ "sideEffects": false,
22
+ "files": [
23
+ "dist",
24
+ "README.md",
25
+ "LICENSE",
26
+ "CHANGELOG.md"
27
+ ],
28
+ "engines": {
29
+ "node": ">=20"
22
30
  },
23
31
  "keywords": [
24
32
  "nestjs",
@@ -30,7 +38,7 @@
30
38
  "author": "Robert Keyser",
31
39
  "license": "MIT",
32
40
  "dependencies": {
33
- "@config-bound/config-bound": "0.3.0"
41
+ "@config-bound/core": "1.0.0"
34
42
  },
35
43
  "peerDependencies": {
36
44
  "@nestjs/common": "^10.0.0 || ^11.0.0",
@@ -39,7 +47,6 @@
39
47
  "rxjs": "^7.0.0"
40
48
  },
41
49
  "devDependencies": {
42
- "@config-bound/eslint-config": "*",
43
50
  "@nestjs/common": "^11.1.8",
44
51
  "@nestjs/core": "^11.1.8",
45
52
  "@nestjs/testing": "^11.1.8",
@@ -49,14 +56,36 @@
49
56
  "jest": "^30.2.0",
50
57
  "rimraf": "^6.1.0",
51
58
  "ts-jest": "^29.4.5",
52
- "typescript": "^6.0.0"
59
+ "typescript": "^6.0.0",
60
+ "zod": "^4.4.1",
61
+ "@config-bound/eslint-config": "0.0.0",
62
+ "@config-bound/typescript-config": "0.0.0"
53
63
  },
54
64
  "publishConfig": {
55
65
  "access": "public",
56
66
  "registry": "https://registry.npmjs.org"
57
67
  },
68
+ "typedocOptions": {
69
+ "entryPoints": [
70
+ "./src/index.ts"
71
+ ],
72
+ "tsconfig": "./tsconfig.typedoc.json",
73
+ "exclude": [
74
+ "**/*.spec.ts"
75
+ ]
76
+ },
58
77
  "repository": {
59
78
  "type": "git",
60
- "url": "https://github.com/notr-ai/ConfigBound"
79
+ "url": "git+https://github.com/notr-ai/ConfigBound.git"
80
+ },
81
+ "scripts": {
82
+ "build": "tsdown",
83
+ "typecheck": "tsc --noEmit",
84
+ "clean": "rimraf dist",
85
+ "test": "jest --config jest.config.cjs",
86
+ "lint": "eslint src/**/*.ts --fix",
87
+ "lint:ci": "eslint src/**/*.ts",
88
+ "format": "prettier --write --config ../../.config/.prettierrc --ignore-path ../../.config/.prettierignore src/**/*.ts",
89
+ "format:ci": "prettier --check --config ../../.config/.prettierrc --ignore-path ../../.config/.prettierignore src/**/*.ts"
61
90
  }
62
- }
91
+ }
package/PUBLISHING.md DELETED
@@ -1,211 +0,0 @@
1
- # Publishing @config-bound/nestjs
2
-
3
- This document outlines the steps to publish the `@config-bound/nestjs` package to npm.
4
-
5
- ## Prerequisites
6
-
7
- 1. npm account with access to the `@config-bound` scope
8
- 2. Authentication configured: `npm login`
9
- 3. Package built successfully: `npm run build`
10
-
11
- ## Pre-publish Checklist
12
-
13
- - [ ] All tests pass
14
- - [ ] Build succeeds without errors
15
- - [ ] README.md is complete and accurate
16
- - [ ] Version number is updated in package.json
17
- - [ ] CHANGELOG.md is updated (if applicable)
18
- - [ ] LICENSE file is present
19
- - [ ] .npmignore is configured correctly
20
-
21
- ## Publishing Steps
22
-
23
- ### 1. Verify Package Contents
24
-
25
- Preview what will be published:
26
-
27
- ```bash
28
- cd packages/nestjs
29
- npm pack --dry-run
30
- ```
31
-
32
- This shows all files that will be included in the package.
33
-
34
- ### 2. Verify Package Configuration
35
-
36
- Check the package.json exports:
37
-
38
- ```bash
39
- cat package.json | grep -A 10 "exports"
40
- ```
41
-
42
- Should show:
43
-
44
- ```json
45
- "exports": {
46
- ".": {
47
- "types": "./dist/index.d.ts",
48
- "require": "./dist/index.js",
49
- "import": "./dist/index.js"
50
- }
51
- }
52
- ```
53
-
54
- ### 3. Test Installation Locally
55
-
56
- Create a test package and install from local directory:
57
-
58
- ```bash
59
- mkdir /tmp/test-nestjs-package
60
- cd /tmp/test-nestjs-package
61
- npm init -y
62
- npm install /path/to/configBound/packages/nestjs
63
- ```
64
-
65
- ### 4. Update Version
66
-
67
- Use semantic versioning:
68
-
69
- ```bash
70
- # For bug fixes
71
- npm version patch
72
-
73
- # For new features
74
- npm version minor
75
-
76
- # For breaking changes
77
- npm version major
78
- ```
79
-
80
- Or manually update `package.json`:
81
-
82
- ```json
83
- {
84
- "version": "0.0.2"
85
- }
86
- ```
87
-
88
- ### 5. Build the Package
89
-
90
- ```bash
91
- npm run clean
92
- npm run build
93
- ```
94
-
95
- ### 6. Publish to npm
96
-
97
- For the first release:
98
-
99
- ```bash
100
- npm publish --access public
101
- ```
102
-
103
- For subsequent releases:
104
-
105
- ```bash
106
- npm publish
107
- ```
108
-
109
- ### 7. Verify Publication
110
-
111
- ```bash
112
- npm view @config-bound/nestjs
113
- ```
114
-
115
- ### 8. Test Installation from npm
116
-
117
- ```bash
118
- cd /tmp/test-install
119
- npm init -y
120
- npm install @config-bound/nestjs @config-bound/config-bound @nestjs/common @nestjs/core
121
- ```
122
-
123
- ## Publishing from CI/CD
124
-
125
- If using GitHub Actions or similar:
126
-
127
- ```yaml
128
- name: Publish Package
129
-
130
- on:
131
- push:
132
- tags:
133
- - 'nestjs-v*'
134
-
135
- jobs:
136
- publish:
137
- runs-on: ubuntu-latest
138
- steps:
139
- - uses: actions/checkout@v3
140
-
141
- - uses: actions/setup-node@v3
142
- with:
143
- node-version: '22'
144
- registry-url: 'https://registry.npmjs.org'
145
-
146
- - name: Install dependencies
147
- run: npm ci
148
-
149
- - name: Build
150
- run: npm run build
151
-
152
- - name: Publish to npm
153
- working-directory: packages/nestjs
154
- run: npm publish --access public
155
- env:
156
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
157
- ```
158
-
159
- ## Post-publish
160
-
161
- 1. Create a GitHub release with the same version tag
162
- 2. Update documentation website (if applicable)
163
- 3. Announce on relevant channels
164
- 4. Update dependent packages to use new version
165
-
166
- ## Troubleshooting
167
-
168
- ### "Package already exists"
169
-
170
- You cannot republish the same version. Bump the version and try again.
171
-
172
- ### "403 Forbidden"
173
-
174
- Ensure you're logged in and have permission to publish to the `@config-bound` scope:
175
-
176
- ```bash
177
- npm whoami
178
- npm access list packages
179
- ```
180
-
181
- ### "EPERM: operation not permitted"
182
-
183
- Make sure you have write permissions in the package directory.
184
-
185
- ### Type definitions not working
186
-
187
- Verify that:
188
-
189
- - `declaration: true` in tsconfig.json
190
- - `types` field in package.json points to correct .d.ts file
191
- - Build process generates .d.ts files
192
-
193
- ## Version History
194
-
195
- - 0.0.1 - Initial release
196
-
197
- ## Related Commands
198
-
199
- ```bash
200
- # View package info
201
- npm view @config-bound/nestjs
202
-
203
- # Download package tarball
204
- npm pack
205
-
206
- # Deprecate a version
207
- npm deprecate @config-bound/nestjs@0.0.1 "Reason for deprecation"
208
-
209
- # Unpublish (only within 72 hours)
210
- npm unpublish @config-bound/nestjs@0.0.1
211
- ```
package/eslint.config.mjs DELETED
@@ -1,3 +0,0 @@
1
- import configBoundConfig from '@config-bound/eslint-config/package.eslint.mjs';
2
-
3
- export default configBoundConfig;
package/jest.config.js DELETED
@@ -1,23 +0,0 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */
2
-
3
- /** @type {import('ts-jest').JestConfigWithTsJest} **/
4
- module.exports = {
5
- testEnvironment: 'node',
6
- rootDir: './src',
7
- testMatch: ['**/*.spec.ts'],
8
- transform: {
9
- '^.+\\.tsx?$': [
10
- 'ts-jest',
11
- {
12
- tsconfig: {
13
- experimentalDecorators: true,
14
- emitDecoratorMetadata: true,
15
- isolatedModules: false
16
- },
17
- diagnostics: {
18
- ignoreCodes: [151002]
19
- }
20
- }
21
- ]
22
- }
23
- };