Skip to content

Commit 56044fc

Browse files
committed
build complete and tsconfig and package.json updated
1 parent a366558 commit 56044fc

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

example/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ app.get('/bad-request', asyncHandler(async (req, res) => {
1515
}))
1616

1717
app.get('/error', asyncHandler(async (req, res) => {
18-
throw httpError('Custom error', 499, 'hi hasan, hi hossen');
19-
}))
20-
app.get('/error2', asyncHandler(async (req, res) => {
21-
throw new Error('Custom error');
18+
throw httpError('Custom error', 499, {info: 'extra info', details: 'extra details'});
2219
}))
2320

2421

2522

23+
2624
// not found handler
2725
app.use(notFoundHandler);
2826

@@ -31,7 +29,6 @@ app.use(globalErrorHandler);
3129

3230

3331

34-
3532
app.listen(3000, () => {
3633
console.log('Server is running on port 3000');
3734
});

package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"description": "A lightweight and developer-friendly toolkit for robust error handling in Express.js applications.\nIncludes ready-to-use custom error classes, an async route error handler wrapper, a global error handler middleware, and a convenient 'not found' route handler.\nDesigned to simplify error management, reduce boilerplate, and improve app reliability — all with TypeScript support and easy integration.",
55
"author": "Rashedin Islam <[email protected]>",
66
"license": "MIT",
7+
"engines": {
8+
"node": ">=14"
9+
},
710
"repository": {
811
"type": "git",
912
"url": "https://github.com/dev-rashedin/express-error-toolkit.git"
@@ -27,13 +30,21 @@
2730
"sideEffects": false,
2831
"scripts": {
2932
"build": "tsup src/index.ts --format cjs,esm --dts --out-dir dist",
33+
"prepare": "npm run build",
3034
"start": "node dist/index.js",
3135
"dev": "ts-node src/index.ts",
3236
"test": "jest",
3337
"check": "npm run build && npm run test",
3438
"example": "tsx example/index.ts"
3539
},
36-
"keywords": [],
40+
"keywords": [
41+
"express",
42+
"error-handling",
43+
"middleware",
44+
"typescript",
45+
"async-handler",
46+
"custom-errors"
47+
],
3748
"dependencies": {
3849
"http-status-toolkit": "^1.0.3"
3950
},

tsconfig.json

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
{
22
"compilerOptions": {
3-
// "target": "ES6",
43
"target": "ES2020",
54
"module": "ESNext",
65
"moduleResolution": "node",
76
"declaration": true,
87
"declarationDir": "dist",
98
"outDir": "./dist",
10-
// "rootDir": "./src",
11-
"rootDir": ".",
9+
"rootDir": "./src",
1210
"strict": true,
1311
"esModuleInterop": true,
1412
"forceConsistentCasingInFileNames": true,
15-
"skipLibCheck": true,
16-
"baseUrl": ".",
17-
"paths": {
18-
"express-error-toolkit": ["src/index.ts"]
19-
}
13+
"skipLibCheck": true
2014
},
2115
"ts-node": {
2216
"esm": true,
2317
"experimentalSpecifierResolution": "node"
2418
},
25-
"include": ["src", "example"]
19+
"include": ["src/**/*"],
20+
"exclude": ["node_modules", "dist", "example", "test", "**/*.test.ts"]
2621
}

0 commit comments

Comments
 (0)