Skip to content

Commit 7cef995

Browse files
authored
Merge pull request #182 from expressots/feature/add-di-core-shared-lib
Feature/add di core shared lib
2 parents 570714a + 532b891 commit 7cef995

Some content is hidden

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

45 files changed

+2844
-602
lines changed

.eslintrc.cjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ module.exports = {
2020
"dist",
2121
"node_modules",
2222
".eslintrc.cjs",
23-
"**/__tests__/*.spec.ts",
2423
"vitest.config.ts",
24+
"jest.config.ts",
25+
"commitlint.config.ts",
26+
"**/*.spec.ts",
2527
],
2628
rules: {
2729
"@typescript-eslint/adjacent-overload-signatures": "error",

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,5 @@ templates/opinionated/public
5959
*.pem
6060

6161
# ignore pack files
62-
*.tgz
62+
*.tgz
63+
.early.coverage

jest.config.ts

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import type { JestConfigWithTsJest } from "ts-jest";
2+
3+
const config: JestConfigWithTsJest = {
4+
testEnvironment: "node",
5+
roots: ["<rootDir>/src"],
6+
testRegex: ".*\\.spec\\.ts$",
7+
testPathIgnorePatterns: ["/node_modules/", "/lib/"],
8+
collectCoverageFrom: ["src/**/*.ts", "!**/*.spec.ts", "src/**/index.ts"],
9+
moduleNameMapper: {
10+
"^@src/(.*)$": "<rootDir>/src/$1",
11+
},
12+
setupFiles: ["reflect-metadata"],
13+
transform: {
14+
"^.+\\.ts$": [
15+
"ts-jest",
16+
{
17+
tsconfig: "tsconfig.json",
18+
// Add any ts-jest specific options here
19+
},
20+
],
21+
},
22+
};
23+
24+
export default config;

package.json

+11-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@expressots/adapter-express",
3-
"version": "1.8.2",
3+
"version": "3.0.0-beta.1",
44
"description": "Expressots - modern, fast, lightweight nodejs web framework (@adapter-express)",
55
"author": "",
66
"main": "./lib/cjs/index.js",
@@ -46,9 +46,6 @@
4646
"framework",
4747
"server-side"
4848
],
49-
"engines": {
50-
"node": ">=18.18.0"
51-
},
5249
"scripts": {
5350
"prepare": "husky",
5451
"clean": "node scripts/rm.js lib",
@@ -58,39 +55,37 @@
5855
"release": "release-it",
5956
"prepublish": "npm run build && npm pack",
6057
"publish": "npm publish --tag latest",
61-
"test": "vitest run --reporter default",
62-
"test:watch": "vitest run --watch",
63-
"coverage": "vitest run --coverage",
58+
"test": "jest",
59+
"test:watch": "jest --watch",
60+
"coverage": "jest --coverage",
6461
"format": "prettier --write \"src/**/*.ts\" --cache",
6562
"lint": "eslint \"src/**/*.ts\"",
6663
"lint:fix": "eslint \"src/**/*.ts\" --fix"
6764
},
6865
"dependencies": {
69-
"dotenv": "16.4.5",
70-
"inversify": "6.0.2",
71-
"inversify-binding-decorators": "4.0.0",
66+
"express": "4.21.1",
7267
"reflect-metadata": "0.2.2"
7368
},
7469
"devDependencies": {
7570
"@codecov/vite-plugin": "^0.0.1-beta.6",
7671
"@commitlint/cli": "19.2.1",
7772
"@commitlint/config-conventional": "19.2.2",
78-
"@expressots/core": "2.16.1",
73+
"@expressots/core": "3.0.0-beta.1",
74+
"@expressots/shared": "0.2.0",
7975
"@release-it/conventional-changelog": "8.0.1",
8076
"@types/express": "4.17.21",
77+
"@types/jest": "^29.5.14",
8178
"@types/node": "20.14.10",
8279
"@typescript-eslint/eslint-plugin": "7.16.1",
8380
"@typescript-eslint/parser": "7.16.1",
84-
"@vitest/coverage-v8": "2.0.3",
8581
"eslint": "8.57.0",
8682
"eslint-config-prettier": "9.1.0",
8783
"husky": "9.1.1",
84+
"jest": "29.7.0",
8885
"prettier": "3.3.3",
8986
"release-it": "17.6.0",
90-
"typescript": "5.5.3",
91-
"vite": "5.3.4",
92-
"vite-tsconfig-paths": "4.3.2",
93-
"vitest": "2.0.3"
87+
"ts-jest": "29.2.5",
88+
"typescript": "5.5.3"
9489
},
9590
"release-it": {
9691
"git": {

src/adapter-express/__tests__/application-express.spec.ts

-7
This file was deleted.

src/adapter-express/application-express.base.ts

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { provide } from "inversify-binding-decorators";
2-
31
/**
42
* Abstract class ApplicationBase.
53
*
@@ -20,15 +18,27 @@ import { provide } from "inversify-binding-decorators";
2018
* @export
2119
* @abstract
2220
*/
23-
@provide(ApplicationBase)
2421
export abstract class ApplicationBase {
22+
/**
23+
* Implement this method to set up global configurations for the server.
24+
* This method is called before any other server initialization methods.
25+
* Use this method to configure global settings that apply to the entire
26+
* server application. Supports asynchronous setup with a Promise.
27+
*
28+
* @abstract
29+
* @returns {void | Promise<void>}
30+
* @public API
31+
*/
32+
protected abstract globalConfiguration(): void | Promise<void>;
33+
2534
/**
2635
* Implement this method to set up required services or configurations before
2736
* the server starts. This is essential for initializing dependencies or settings
2837
* necessary for server operation. Supports asynchronous setup with a Promise.
2938
*
3039
* @abstract
3140
* @returns {void | Promise<void>}
41+
* @public API
3242
*/
3343
protected abstract configureServices(): void | Promise<void>;
3444

@@ -39,6 +49,7 @@ export abstract class ApplicationBase {
3949
*
4050
* @abstract
4151
* @returns {void | Promise<void>}
52+
* @public API
4253
*/
4354
protected abstract postServerInitialization(): void | Promise<void>;
4455

@@ -47,6 +58,10 @@ export abstract class ApplicationBase {
4758
* is shutting down. Ideal for closing resources, stopping tasks, or other
4859
* cleanup procedures to ensure a graceful server shutdown. Supports asynchronous
4960
* cleanup with a Promise.
61+
*
62+
* @abstract
63+
* @returns {void | Promise<void>}
64+
* @public API
5065
*/
5166
protected abstract serverShutdown(): void | Promise<void>;
5267
}

src/adapter-express/application-express.interface.ts

-26
This file was deleted.

0 commit comments

Comments
 (0)