@expressots/shared 4.0.0-preview.1 → 4.0.0-preview.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.
- package/LICENSE.md +21 -21
- package/README.md +51 -51
- package/lib/CHANGELOG.md +92 -89
- package/lib/README.md +51 -51
- package/lib/cjs/config/index.js +3 -0
- package/lib/cjs/config/project-config.js +17 -0
- package/lib/cjs/env/environment.js +7 -7
- package/lib/cjs/types/config/project-config.d.ts +1 -1
- package/lib/esm/config/index.js +1 -1
- package/lib/esm/config/project-config.js +16 -1
- package/lib/esm/env/environment.js +7 -7
- package/lib/esm/types/config/project-config.d.ts +1 -1
- package/lib/package.json +19 -6
- package/package.json +19 -6
package/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 Richard Zampieri
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Richard Zampieri
|
|
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,51 +1,51 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<a href="https://expresso-ts.com">
|
|
3
|
-
<img src="https://github.com/expressots/expressots/blob/main/media/expressots.png" alt="ExpressoTS" width="120">
|
|
4
|
-
</a>
|
|
5
|
-
|
|
6
|
-
<h1>@expressots/shared</h1>
|
|
7
|
-
|
|
8
|
-
<p>Shared types, interfaces, and utilities used across all ExpressoTS packages.</p>
|
|
9
|
-
|
|
10
|
-
<p>
|
|
11
|
-
<a href="https://www.npmjs.com/package/@expressots/shared"><img src="https://img.shields.io/npm/v/@expressots/shared?style=flat&color=0d0d0d" alt="npm"></a>
|
|
12
|
-
<a href="https://github.com/expressots/shared/blob/main/LICENSE.md"><img src="https://img.shields.io/github/license/expressots/shared?style=flat&color=0d0d0d" alt="License"></a>
|
|
13
|
-
<a href="https://discord.com/invite/PyPJfGK"><img src="https://img.shields.io/badge/Discord-join-0d0d0d?logo=discord&logoColor=white" alt="Discord"></a>
|
|
14
|
-
</p>
|
|
15
|
-
|
|
16
|
-
<p>
|
|
17
|
-
<a href="https://doc.expresso-ts.com">Documentation</a> ·
|
|
18
|
-
<a href="https://doc.expresso-ts.com/docs/core/first-steps">Getting Started</a> ·
|
|
19
|
-
<a href="https://discord.com/invite/PyPJfGK">Community</a>
|
|
20
|
-
</p>
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Install
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm i @expressots/shared
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## What This Package Does
|
|
32
|
-
|
|
33
|
-
This is the shared foundation layer for the ExpressoTS ecosystem. It provides common TypeScript interfaces, configuration types, environment utilities, and helper functions that `@expressots/core`, `@expressots/adapter-express`, and other packages depend on. Most applications consume it indirectly through the core package.
|
|
34
|
-
|
|
35
|
-
## Documentation
|
|
36
|
-
|
|
37
|
-
For guides, API reference, architecture patterns, and examples visit **[doc.expresso-ts.com](https://doc.expresso-ts.com)**.
|
|
38
|
-
|
|
39
|
-
## Contributing
|
|
40
|
-
|
|
41
|
-
See the [Contributing Guide](https://github.com/expressots/expressots/blob/main/CONTRIBUTING.md) for how to get involved.
|
|
42
|
-
|
|
43
|
-
## Support
|
|
44
|
-
|
|
45
|
-
- [GitHub Sponsors](https://github.com/sponsors/expressots)
|
|
46
|
-
- [Discord](https://discord.com/invite/PyPJfGK)
|
|
47
|
-
- [Report an Issue](https://github.com/expressots/shared/issues)
|
|
48
|
-
|
|
49
|
-
## License
|
|
50
|
-
|
|
51
|
-
MIT — see [LICENSE](./LICENSE.md).
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://expresso-ts.com">
|
|
3
|
+
<img src="https://github.com/expressots/expressots/blob/main/media/expressots.png" alt="ExpressoTS" width="120">
|
|
4
|
+
</a>
|
|
5
|
+
|
|
6
|
+
<h1>@expressots/shared</h1>
|
|
7
|
+
|
|
8
|
+
<p>Shared types, interfaces, and utilities used across all ExpressoTS packages.</p>
|
|
9
|
+
|
|
10
|
+
<p>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@expressots/shared"><img src="https://img.shields.io/npm/v/@expressots/shared?style=flat&color=0d0d0d" alt="npm"></a>
|
|
12
|
+
<a href="https://github.com/expressots/shared/blob/main/LICENSE.md"><img src="https://img.shields.io/github/license/expressots/shared?style=flat&color=0d0d0d" alt="License"></a>
|
|
13
|
+
<a href="https://discord.com/invite/PyPJfGK"><img src="https://img.shields.io/badge/Discord-join-0d0d0d?logo=discord&logoColor=white" alt="Discord"></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p>
|
|
17
|
+
<a href="https://doc.expresso-ts.com">Documentation</a> ·
|
|
18
|
+
<a href="https://doc.expresso-ts.com/docs/core/first-steps">Getting Started</a> ·
|
|
19
|
+
<a href="https://discord.com/invite/PyPJfGK">Community</a>
|
|
20
|
+
</p>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm i @expressots/shared
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## What This Package Does
|
|
32
|
+
|
|
33
|
+
This is the shared foundation layer for the ExpressoTS ecosystem. It provides common TypeScript interfaces, configuration types, environment utilities, and helper functions that `@expressots/core`, `@expressots/adapter-express`, and other packages depend on. Most applications consume it indirectly through the core package.
|
|
34
|
+
|
|
35
|
+
## Documentation
|
|
36
|
+
|
|
37
|
+
For guides, API reference, architecture patterns, and examples visit **[doc.expresso-ts.com](https://doc.expresso-ts.com)**.
|
|
38
|
+
|
|
39
|
+
## Contributing
|
|
40
|
+
|
|
41
|
+
See the [Contributing Guide](https://github.com/expressots/expressots/blob/main/CONTRIBUTING.md) for how to get involved.
|
|
42
|
+
|
|
43
|
+
## Support
|
|
44
|
+
|
|
45
|
+
- [GitHub Sponsors](https://github.com/sponsors/expressots)
|
|
46
|
+
- [Discord](https://discord.com/invite/PyPJfGK)
|
|
47
|
+
- [Report an Issue](https://github.com/expressots/shared/issues)
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT — see [LICENSE](./LICENSE.md).
|
package/lib/CHANGELOG.md
CHANGED
|
@@ -1,89 +1,92 @@
|
|
|
1
|
-
## [4.0.0](https://github.com/expressots/shared/compare/3.0.0...4.0.0) (2026-05-
|
|
2
|
-
|
|
3
|
-
Part of the ExpressoTS **v4.0.0
|
|
4
|
-
|
|
5
|
-
### Features
|
|
6
|
-
|
|
7
|
-
* extend `ExpressoConfig` with `scaffoldSchematics` covering all v4 schematics (`controller`, `usecase`, `dto`, `module`, `provider`, `entity`, `middleware`, `interceptor`, `event`, `handler`, `guard`, `config`).
|
|
8
|
-
* add type-safe `Pattern` enum
|
|
9
|
-
* expose shared content-negotiation primitives consumed by `@expressots/core` formatters.
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
- add
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
1
|
+
## [4.0.0-preview.3](https://github.com/expressots/shared/compare/3.0.0...4.0.0-preview.3) (2026-05-25)
|
|
2
|
+
|
|
3
|
+
Part of the ExpressoTS **v4.0.0 preview bundle**. See the [v4.0.0 release notes](https://expresso-ts.com/docs/4.0.0/prologue/release) and the [upgrade guide](https://expresso-ts.com/docs/4.0.0/prologue/upgrade_guide) for the full picture.
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* extend `ExpressoConfig` with `scaffoldSchematics` covering all v4 schematics (`controller`, `usecase`, `dto`, `module`, `provider`, `entity`, `middleware`, `interceptor`, `event`, `handler`, `guard`, `config`).
|
|
8
|
+
* add type-safe `Pattern` enum (regular `enum`, not `const enum`, so consumers compiling with `isolatedModules: true` such as Vite/Vitest/esbuild/SWC can import it).
|
|
9
|
+
* expose shared content-negotiation primitives consumed by `@expressots/core` formatters.
|
|
10
|
+
* add `Env.when(condition, value, fallback)` helper for environment-specific config resolution.
|
|
11
|
+
* publish dual ESM + CJS builds with subpath exports for both module systems.
|
|
12
|
+
* declare `engines.node: ">=20.18.0"`.
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* tighten the `IWebServer` / `IWebServerBuilder` typings so v4 adapters can declare their server contract without leaking Express types.
|
|
17
|
+
* `configDotenv()` is now safe to call with no arguments — null-guard added on `options.encoding` / `options.debug` (previously threw `TypeError: Cannot read properties of undefined`).
|
|
18
|
+
|
|
19
|
+
### Build System
|
|
20
|
+
|
|
21
|
+
* bump dev toolchain to TypeScript 5.5, ESLint 8.57, Jest 29.7, Prettier 3.5.
|
|
22
|
+
|
|
23
|
+
## [3.0.0](https://github.com/expressots/shared/compare/3.0.0-beta.3...3.0.0) (2024-12-04)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* refactor IWebServer interface, add IWebServerBuilder ([9a23fff](https://github.com/expressots/shared/commit/9a23fff1e7de8d3880ed90317ffde1037ef1947b))
|
|
29
|
+
* update initEnvironment method to return a Promise for better async handling ([6ae9525](https://github.com/expressots/shared/commit/6ae9525b5497dacf81c1861e467bf6e27421ad2e))
|
|
30
|
+
|
|
31
|
+
## [3.0.0](https://github.com/expressots/shared/compare/3.0.0-beta.3...3.0.0) (2024-12-03)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* refactor IWebServer interface, add IWebServerBuilder ([9a23fff](https://github.com/expressots/shared/commit/9a23fff1e7de8d3880ed90317ffde1037ef1947b))
|
|
37
|
+
|
|
38
|
+
## [3.0.0-beta.3](https://github.com/expressots/shared/compare/0.3.0...0.4.0) (2024-11-28)
|
|
39
|
+
|
|
40
|
+
### Features
|
|
41
|
+
|
|
42
|
+
- add close method to Server interface for graceful shutdown ([7d0cd8f](https://github.com/expressots/shared/commit/7d0cd8f1e05c5fed96e74b01dc715e5c7eb268d0))
|
|
43
|
+
|
|
44
|
+
## [0.3.0](https://github.com/expressots/shared/compare/0.2.0...0.3.0) (2024-11-24)
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
- add entryPoint property to ExpressoConfig interface ([324ac37](https://github.com/expressots/shared/commit/324ac37a7d407c491881998c6ed3288e04a0ae39))
|
|
49
|
+
|
|
50
|
+
## [0.2.0](https://github.com/expressots/shared/compare/0.1.0...0.2.0) (2024-11-16)
|
|
51
|
+
|
|
52
|
+
### Features
|
|
53
|
+
|
|
54
|
+
- add interfaces for console, middleware, and environment; update index exports ([30d7dbb](https://github.com/expressots/shared/commit/30d7dbb0c24af12e4537f626be816f2f5d8a81a0))
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
- standardize quotes in middleware interface file ([6b3f045](https://github.com/expressots/shared/commit/6b3f0459c3ba0bf58d1de920335c6ef7dd438e32))
|
|
59
|
+
|
|
60
|
+
### Tests
|
|
61
|
+
|
|
62
|
+
- enhance coverage for configDotenv function and add edge case handling ([58612bd](https://github.com/expressots/shared/commit/58612bd0040b592133bac687cfb29b9c6ece2a94))
|
|
63
|
+
|
|
64
|
+
## 0.1.0 (2024-11-10)
|
|
65
|
+
|
|
66
|
+
### Features
|
|
67
|
+
|
|
68
|
+
- add compiler and package definitions ([8352e66](https://github.com/expressots/shared/commit/8352e663c1a3429c70bbf7588380fe92f547e0a9))
|
|
69
|
+
- add early ai unit test generation and code coverage ([7eb5f38](https://github.com/expressots/shared/commit/7eb5f380f6b49ce6316a9749daaa7311fda74f04))
|
|
70
|
+
- add env and compiler modules ([f93f6c3](https://github.com/expressots/shared/commit/f93f6c3a719d1a1129112bee4e5e9cf6e42ddd89))
|
|
71
|
+
- add global config interface ([cbe2e12](https://github.com/expressots/shared/commit/cbe2e127db006273e9049220fe3ed20b964d697b))
|
|
72
|
+
- change to beta version ([4e835ca](https://github.com/expressots/shared/commit/4e835ca58933336bc78d66fb42935bf4d02ec641))
|
|
73
|
+
- update readme to include badges ([5995b1a](https://github.com/expressots/shared/commit/5995b1a3eab1481aa4552ca76683c6b16ae0dc60))
|
|
74
|
+
|
|
75
|
+
### Bug Fixes
|
|
76
|
+
|
|
77
|
+
- add express config file for testing ([d7ae7e1](https://github.com/expressots/shared/commit/d7ae7e1d91a73965be89a9f96df4dfdbc67575d4))
|
|
78
|
+
- change dependency installation from npm ci to npm install in CI workflow ([6bc1ece](https://github.com/expressots/shared/commit/6bc1ece4da3c9aca717e769a8d2f615058652579))
|
|
79
|
+
- remove compiler load lib ([c8f6085](https://github.com/expressots/shared/commit/c8f6085ffdd2af524522174789cfe51203827bbb))
|
|
80
|
+
- reorder build and test steps in CI workflow; update Jest config to ignore specific paths ([4500863](https://github.com/expressots/shared/commit/45008637af232929c8c20df24c3cf4d6b56a082e))
|
|
81
|
+
- update CI workflow to use npm ci for dependency installation; refine Jest configs ([356c232](https://github.com/expressots/shared/commit/356c232bbfcf6bad7254ee0ab3417fd82f831a9f))
|
|
82
|
+
- update package.json to use exact version numbers for dependencies ([7cdd924](https://github.com/expressots/shared/commit/7cdd924b468af56ccf5bdfaa36b7cad82034e007))
|
|
83
|
+
|
|
84
|
+
### Code Refactoring
|
|
85
|
+
|
|
86
|
+
- remove unused env property from ExpressoConfig interface ([97663e8](https://github.com/expressots/shared/commit/97663e8a386ece45111eba0c2f8b66d1eb9c90af))
|
|
87
|
+
|
|
88
|
+
## 0.0.1 (2023-09-05)
|
|
89
|
+
|
|
90
|
+
### Bug Fixes
|
|
91
|
+
|
|
92
|
+
- testing commitlint ([0e78653](https://github.com/expressots/<<repo_name>>/commit/0e786539402f69fdca3fe5b684d850e523db7698))
|
package/lib/README.md
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<a href="https://expresso-ts.com">
|
|
3
|
-
<img src="https://github.com/expressots/expressots/blob/main/media/expressots.png" alt="ExpressoTS" width="120">
|
|
4
|
-
</a>
|
|
5
|
-
|
|
6
|
-
<h1>@expressots/shared</h1>
|
|
7
|
-
|
|
8
|
-
<p>Shared types, interfaces, and utilities used across all ExpressoTS packages.</p>
|
|
9
|
-
|
|
10
|
-
<p>
|
|
11
|
-
<a href="https://www.npmjs.com/package/@expressots/shared"><img src="https://img.shields.io/npm/v/@expressots/shared?style=flat&color=0d0d0d" alt="npm"></a>
|
|
12
|
-
<a href="https://github.com/expressots/shared/blob/main/LICENSE.md"><img src="https://img.shields.io/github/license/expressots/shared?style=flat&color=0d0d0d" alt="License"></a>
|
|
13
|
-
<a href="https://discord.com/invite/PyPJfGK"><img src="https://img.shields.io/badge/Discord-join-0d0d0d?logo=discord&logoColor=white" alt="Discord"></a>
|
|
14
|
-
</p>
|
|
15
|
-
|
|
16
|
-
<p>
|
|
17
|
-
<a href="https://doc.expresso-ts.com">Documentation</a> ·
|
|
18
|
-
<a href="https://doc.expresso-ts.com/docs/core/first-steps">Getting Started</a> ·
|
|
19
|
-
<a href="https://discord.com/invite/PyPJfGK">Community</a>
|
|
20
|
-
</p>
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Install
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm i @expressots/shared
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## What This Package Does
|
|
32
|
-
|
|
33
|
-
This is the shared foundation layer for the ExpressoTS ecosystem. It provides common TypeScript interfaces, configuration types, environment utilities, and helper functions that `@expressots/core`, `@expressots/adapter-express`, and other packages depend on. Most applications consume it indirectly through the core package.
|
|
34
|
-
|
|
35
|
-
## Documentation
|
|
36
|
-
|
|
37
|
-
For guides, API reference, architecture patterns, and examples visit **[doc.expresso-ts.com](https://doc.expresso-ts.com)**.
|
|
38
|
-
|
|
39
|
-
## Contributing
|
|
40
|
-
|
|
41
|
-
See the [Contributing Guide](https://github.com/expressots/expressots/blob/main/CONTRIBUTING.md) for how to get involved.
|
|
42
|
-
|
|
43
|
-
## Support
|
|
44
|
-
|
|
45
|
-
- [GitHub Sponsors](https://github.com/sponsors/expressots)
|
|
46
|
-
- [Discord](https://discord.com/invite/PyPJfGK)
|
|
47
|
-
- [Report an Issue](https://github.com/expressots/shared/issues)
|
|
48
|
-
|
|
49
|
-
## License
|
|
50
|
-
|
|
51
|
-
MIT — see [LICENSE](./LICENSE.md).
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://expresso-ts.com">
|
|
3
|
+
<img src="https://github.com/expressots/expressots/blob/main/media/expressots.png" alt="ExpressoTS" width="120">
|
|
4
|
+
</a>
|
|
5
|
+
|
|
6
|
+
<h1>@expressots/shared</h1>
|
|
7
|
+
|
|
8
|
+
<p>Shared types, interfaces, and utilities used across all ExpressoTS packages.</p>
|
|
9
|
+
|
|
10
|
+
<p>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@expressots/shared"><img src="https://img.shields.io/npm/v/@expressots/shared?style=flat&color=0d0d0d" alt="npm"></a>
|
|
12
|
+
<a href="https://github.com/expressots/shared/blob/main/LICENSE.md"><img src="https://img.shields.io/github/license/expressots/shared?style=flat&color=0d0d0d" alt="License"></a>
|
|
13
|
+
<a href="https://discord.com/invite/PyPJfGK"><img src="https://img.shields.io/badge/Discord-join-0d0d0d?logo=discord&logoColor=white" alt="Discord"></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p>
|
|
17
|
+
<a href="https://doc.expresso-ts.com">Documentation</a> ·
|
|
18
|
+
<a href="https://doc.expresso-ts.com/docs/core/first-steps">Getting Started</a> ·
|
|
19
|
+
<a href="https://discord.com/invite/PyPJfGK">Community</a>
|
|
20
|
+
</p>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm i @expressots/shared
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## What This Package Does
|
|
32
|
+
|
|
33
|
+
This is the shared foundation layer for the ExpressoTS ecosystem. It provides common TypeScript interfaces, configuration types, environment utilities, and helper functions that `@expressots/core`, `@expressots/adapter-express`, and other packages depend on. Most applications consume it indirectly through the core package.
|
|
34
|
+
|
|
35
|
+
## Documentation
|
|
36
|
+
|
|
37
|
+
For guides, API reference, architecture patterns, and examples visit **[doc.expresso-ts.com](https://doc.expresso-ts.com)**.
|
|
38
|
+
|
|
39
|
+
## Contributing
|
|
40
|
+
|
|
41
|
+
See the [Contributing Guide](https://github.com/expressots/expressots/blob/main/CONTRIBUTING.md) for how to get involved.
|
|
42
|
+
|
|
43
|
+
## Support
|
|
44
|
+
|
|
45
|
+
- [GitHub Sponsors](https://github.com/sponsors/expressots)
|
|
46
|
+
- [Discord](https://discord.com/invite/PyPJfGK)
|
|
47
|
+
- [Report an Issue](https://github.com/expressots/shared/issues)
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT — see [LICENSE](./LICENSE.md).
|
package/lib/cjs/config/index.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Pattern = void 0;
|
|
4
|
+
var project_config_js_1 = require("./project-config.js");
|
|
5
|
+
Object.defineProperty(exports, "Pattern", { enumerable: true, get: function () { return project_config_js_1.Pattern; } });
|
|
@@ -1,2 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Pattern = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Enum representing different string patterns.
|
|
6
|
+
*
|
|
7
|
+
* - LOWER_CASE: Represents strings in all lowercase letters. E.g. "hello"
|
|
8
|
+
* - KEBAB_CASE: Represents strings separated by hyphens. E.g. "hello-world"
|
|
9
|
+
* - PASCAL_CASE: Represents strings where the first letter of each word is capitalized. E.g. "HelloWorld"
|
|
10
|
+
* - CAMEL_CASE: Represents strings where the first letter of the first word is lowercase and the first letter of subsequent words are capitalized. E.g. "helloWorld"
|
|
11
|
+
* @public API
|
|
12
|
+
*/
|
|
13
|
+
var Pattern;
|
|
14
|
+
(function (Pattern) {
|
|
15
|
+
Pattern["LOWER_CASE"] = "lowercase";
|
|
16
|
+
Pattern["KEBAB_CASE"] = "kebab-case";
|
|
17
|
+
Pattern["PASCAL_CASE"] = "PascalCase";
|
|
18
|
+
Pattern["CAMEL_CASE"] = "camelCase";
|
|
19
|
+
})(Pattern || (exports.Pattern = Pattern = {}));
|
|
@@ -186,19 +186,19 @@ function config(options) {
|
|
|
186
186
|
* @public API
|
|
187
187
|
*/
|
|
188
188
|
function configDotenv(options) {
|
|
189
|
-
const
|
|
190
|
-
const
|
|
191
|
-
const
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
: [_resolveHome(dotenvPath)];
|
|
189
|
+
const opts = options ?? {};
|
|
190
|
+
const dotenvPath = path_1.default.resolve(process.cwd(), String(opts.path ?? ".env"));
|
|
191
|
+
const encoding = (opts.encoding ?? "utf8");
|
|
192
|
+
const debug = !!opts.debug;
|
|
193
|
+
const paths = Array.isArray(opts.path) ? opts.path.map(_resolveHome) : [_resolveHome(dotenvPath)];
|
|
195
194
|
const parsed = {};
|
|
196
195
|
let lastError;
|
|
197
196
|
for (const envPath of paths) {
|
|
198
197
|
try {
|
|
199
198
|
const fileContent = fs_1.default.readFileSync(envPath, { encoding });
|
|
200
199
|
const parsedContent = parse(fileContent);
|
|
201
|
-
|
|
200
|
+
Object.assign(parsed, parsedContent);
|
|
201
|
+
populate(process.env, parsedContent, opts);
|
|
202
202
|
}
|
|
203
203
|
catch (error) {
|
|
204
204
|
lastError = error;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - CAMEL_CASE: Represents strings where the first letter of the first word is lowercase and the first letter of subsequent words are capitalized. E.g. "helloWorld"
|
|
8
8
|
* @public API
|
|
9
9
|
*/
|
|
10
|
-
export declare
|
|
10
|
+
export declare enum Pattern {
|
|
11
11
|
LOWER_CASE = "lowercase",
|
|
12
12
|
KEBAB_CASE = "kebab-case",
|
|
13
13
|
PASCAL_CASE = "PascalCase",
|
package/lib/esm/config/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { Pattern } from "./project-config.js";
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing different string patterns.
|
|
3
|
+
*
|
|
4
|
+
* - LOWER_CASE: Represents strings in all lowercase letters. E.g. "hello"
|
|
5
|
+
* - KEBAB_CASE: Represents strings separated by hyphens. E.g. "hello-world"
|
|
6
|
+
* - PASCAL_CASE: Represents strings where the first letter of each word is capitalized. E.g. "HelloWorld"
|
|
7
|
+
* - CAMEL_CASE: Represents strings where the first letter of the first word is lowercase and the first letter of subsequent words are capitalized. E.g. "helloWorld"
|
|
8
|
+
* @public API
|
|
9
|
+
*/
|
|
10
|
+
export var Pattern;
|
|
11
|
+
(function (Pattern) {
|
|
12
|
+
Pattern["LOWER_CASE"] = "lowercase";
|
|
13
|
+
Pattern["KEBAB_CASE"] = "kebab-case";
|
|
14
|
+
Pattern["PASCAL_CASE"] = "PascalCase";
|
|
15
|
+
Pattern["CAMEL_CASE"] = "camelCase";
|
|
16
|
+
})(Pattern || (Pattern = {}));
|
|
@@ -170,19 +170,19 @@ export function config(options) {
|
|
|
170
170
|
* @public API
|
|
171
171
|
*/
|
|
172
172
|
export function configDotenv(options) {
|
|
173
|
-
const
|
|
174
|
-
const
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
: [_resolveHome(dotenvPath)];
|
|
173
|
+
const opts = options ?? {};
|
|
174
|
+
const dotenvPath = path.resolve(process.cwd(), String(opts.path ?? ".env"));
|
|
175
|
+
const encoding = (opts.encoding ?? "utf8");
|
|
176
|
+
const debug = !!opts.debug;
|
|
177
|
+
const paths = Array.isArray(opts.path) ? opts.path.map(_resolveHome) : [_resolveHome(dotenvPath)];
|
|
179
178
|
const parsed = {};
|
|
180
179
|
let lastError;
|
|
181
180
|
for (const envPath of paths) {
|
|
182
181
|
try {
|
|
183
182
|
const fileContent = fs.readFileSync(envPath, { encoding });
|
|
184
183
|
const parsedContent = parse(fileContent);
|
|
185
|
-
|
|
184
|
+
Object.assign(parsed, parsedContent);
|
|
185
|
+
populate(process.env, parsedContent, opts);
|
|
186
186
|
}
|
|
187
187
|
catch (error) {
|
|
188
188
|
lastError = error;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - CAMEL_CASE: Represents strings where the first letter of the first word is lowercase and the first letter of subsequent words are capitalized. E.g. "helloWorld"
|
|
8
8
|
* @public API
|
|
9
9
|
*/
|
|
10
|
-
export declare
|
|
10
|
+
export declare enum Pattern {
|
|
11
11
|
LOWER_CASE = "lowercase",
|
|
12
12
|
KEBAB_CASE = "kebab-case",
|
|
13
13
|
PASCAL_CASE = "PascalCase",
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressots/shared",
|
|
3
|
-
"version": "4.0.0-preview.
|
|
3
|
+
"version": "4.0.0-preview.3",
|
|
4
4
|
"description": "Shared library for ExpressoTS modules 🐎",
|
|
5
5
|
"author": "Richard Zampieri <richard.zampieri@expresso-ts.com>",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=20.18.0"
|
|
41
|
+
},
|
|
39
42
|
"keywords": [
|
|
40
43
|
"expressots",
|
|
41
44
|
"nodejs",
|
|
@@ -55,13 +58,16 @@
|
|
|
55
58
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
56
59
|
"build:esm": "node scripts/build-esm.js",
|
|
57
60
|
"release": "release-it",
|
|
61
|
+
"release:prepare": "node scripts/release/prepare-publish.mjs",
|
|
62
|
+
"release:restore": "node scripts/release/restore-package-json.mjs",
|
|
63
|
+
"release:publish": "npm run build && npm run release:prepare && npm publish --tag next --access public && npm run release:restore",
|
|
58
64
|
"prepublish": "npm run build && npm pack",
|
|
59
65
|
"test": "jest",
|
|
60
66
|
"test:watch": "jest --watch",
|
|
61
67
|
"coverage": "jest --coverage",
|
|
62
68
|
"format": "prettier --write \"src/**/*.ts\" --cache",
|
|
63
|
-
"lint": "eslint \"src/**/*.ts\"",
|
|
64
|
-
"lint:fix": "eslint \"src/**/*.ts\" --fix"
|
|
69
|
+
"lint": "eslint \"src/**/*.ts\" --cache --cache-location node_modules/.cache/eslint/",
|
|
70
|
+
"lint:fix": "eslint \"src/**/*.ts\" --fix --cache --cache-location node_modules/.cache/eslint/"
|
|
65
71
|
},
|
|
66
72
|
"dependencies": {
|
|
67
73
|
"chalk": "4.1.2"
|
|
@@ -75,10 +81,9 @@
|
|
|
75
81
|
}
|
|
76
82
|
},
|
|
77
83
|
"devDependencies": {
|
|
78
|
-
"ts-node": "10.9.2",
|
|
79
84
|
"@commitlint/cli": "19.6.0",
|
|
80
85
|
"@commitlint/config-conventional": "19.6.0",
|
|
81
|
-
"@release-it/conventional-changelog": "
|
|
86
|
+
"@release-it/conventional-changelog": "^11.0.0",
|
|
82
87
|
"@types/express": "4.17.21",
|
|
83
88
|
"@types/jest": "29.5.13",
|
|
84
89
|
"@types/node": "20.14.10",
|
|
@@ -88,12 +93,20 @@
|
|
|
88
93
|
"eslint-config-prettier": "10.0.2",
|
|
89
94
|
"husky": "9.1.1",
|
|
90
95
|
"jest": "29.7.0",
|
|
96
|
+
"lint-staged": "^15.2.10",
|
|
91
97
|
"prettier": "3.5.3",
|
|
92
98
|
"reflect-metadata": "0.2.2",
|
|
93
|
-
"release-it": "
|
|
99
|
+
"release-it": "^20.0.1",
|
|
94
100
|
"ts-jest": "29.2.5",
|
|
101
|
+
"ts-node": "10.9.2",
|
|
95
102
|
"typescript": "5.5.3"
|
|
96
103
|
},
|
|
104
|
+
"lint-staged": {
|
|
105
|
+
"src/**/*.ts": [
|
|
106
|
+
"eslint --cache --cache-location node_modules/.cache/eslint/ --fix",
|
|
107
|
+
"prettier --write --cache"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
97
110
|
"release-it": {
|
|
98
111
|
"git": {
|
|
99
112
|
"commitMessage": "chore(release): ${version}"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressots/shared",
|
|
3
|
-
"version": "4.0.0-preview.
|
|
3
|
+
"version": "4.0.0-preview.3",
|
|
4
4
|
"description": "Shared library for ExpressoTS modules 🐎",
|
|
5
5
|
"author": "Richard Zampieri <richard.zampieri@expresso-ts.com>",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=20.18.0"
|
|
41
|
+
},
|
|
39
42
|
"keywords": [
|
|
40
43
|
"expressots",
|
|
41
44
|
"nodejs",
|
|
@@ -55,13 +58,16 @@
|
|
|
55
58
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
56
59
|
"build:esm": "node scripts/build-esm.js",
|
|
57
60
|
"release": "release-it",
|
|
61
|
+
"release:prepare": "node scripts/release/prepare-publish.mjs",
|
|
62
|
+
"release:restore": "node scripts/release/restore-package-json.mjs",
|
|
63
|
+
"release:publish": "npm run build && npm run release:prepare && npm publish --tag next --access public && npm run release:restore",
|
|
58
64
|
"prepublish": "npm run build && npm pack",
|
|
59
65
|
"test": "jest",
|
|
60
66
|
"test:watch": "jest --watch",
|
|
61
67
|
"coverage": "jest --coverage",
|
|
62
68
|
"format": "prettier --write \"src/**/*.ts\" --cache",
|
|
63
|
-
"lint": "eslint \"src/**/*.ts\"",
|
|
64
|
-
"lint:fix": "eslint \"src/**/*.ts\" --fix"
|
|
69
|
+
"lint": "eslint \"src/**/*.ts\" --cache --cache-location node_modules/.cache/eslint/",
|
|
70
|
+
"lint:fix": "eslint \"src/**/*.ts\" --fix --cache --cache-location node_modules/.cache/eslint/"
|
|
65
71
|
},
|
|
66
72
|
"dependencies": {
|
|
67
73
|
"chalk": "4.1.2"
|
|
@@ -75,10 +81,9 @@
|
|
|
75
81
|
}
|
|
76
82
|
},
|
|
77
83
|
"devDependencies": {
|
|
78
|
-
"ts-node": "10.9.2",
|
|
79
84
|
"@commitlint/cli": "19.6.0",
|
|
80
85
|
"@commitlint/config-conventional": "19.6.0",
|
|
81
|
-
"@release-it/conventional-changelog": "
|
|
86
|
+
"@release-it/conventional-changelog": "^11.0.0",
|
|
82
87
|
"@types/express": "4.17.21",
|
|
83
88
|
"@types/jest": "29.5.13",
|
|
84
89
|
"@types/node": "20.14.10",
|
|
@@ -88,12 +93,20 @@
|
|
|
88
93
|
"eslint-config-prettier": "10.0.2",
|
|
89
94
|
"husky": "9.1.1",
|
|
90
95
|
"jest": "29.7.0",
|
|
96
|
+
"lint-staged": "^15.2.10",
|
|
91
97
|
"prettier": "3.5.3",
|
|
92
98
|
"reflect-metadata": "0.2.2",
|
|
93
|
-
"release-it": "
|
|
99
|
+
"release-it": "^20.0.1",
|
|
94
100
|
"ts-jest": "29.2.5",
|
|
101
|
+
"ts-node": "10.9.2",
|
|
95
102
|
"typescript": "5.5.3"
|
|
96
103
|
},
|
|
104
|
+
"lint-staged": {
|
|
105
|
+
"src/**/*.ts": [
|
|
106
|
+
"eslint --cache --cache-location node_modules/.cache/eslint/ --fix",
|
|
107
|
+
"prettier --write --cache"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
97
110
|
"release-it": {
|
|
98
111
|
"git": {
|
|
99
112
|
"commitMessage": "chore(release): ${version}"
|