Skip to content

Commit 242318a

Browse files
committed
refactor: update package.json and TypeScript configurations for improved module handling and remove unnecessary files
1 parent 873a36c commit 242318a

9 files changed

Lines changed: 19 additions & 52 deletions

.github/workflows/npm-publish.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ jobs:
3838
- name: 🛠️ Build package
3939
run: npm run compile
4040

41-
- name: 📝 Remove devDependencies from package.json
41+
- name: 📝 Remove some fields from package.json
4242
run: |
4343
node -e "
4444
const fs = require('fs');
4545
const pkg = JSON.parse(fs.readFileSync('package.json','utf8'));
4646
delete pkg.devDependencies;
47+
delete pkg.scripts;
4748
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
48-
console.log('Removed devDependencies for publish');
49+
console.log('Removed devDependencies and scripts for publish');
4950
"
5051
5152
- name: 🚀 Publish to npm

package.json

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
"name": "@catbee/utils",
33
"version": "0.0.8-rc.1",
44
"description": "A modular, production-grade utility toolkit for Node.js and TypeScript, designed for robust, scalable applications (including Express-based services). All utilities are tree-shakable and can be imported independently.",
5-
"main": "build/src/index.js",
5+
"main": "build/esm/index.js",
66
"module": "build/esm/index.js",
7-
"esnext": "build/esnext/index.js",
8-
"types": "build/src/index.d.ts",
7+
"types": "build/esm/index.d.ts",
98
"publishConfig": {
109
"access": "public"
1110
},
@@ -15,10 +14,10 @@
1514
},
1615
"license": "MIT",
1716
"scripts": {
18-
"start": "node build/src/index.js",
17+
"start": "node build/esm/index.js",
1918
"prepack": "npm run compile",
20-
"compile": "npm run clean && tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
21-
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
19+
"compile": "npm run clean && tsc --build tsconfig.esm.json",
20+
"clean": "tsc --build --clean tsconfig.esm.json",
2221
"lint": "eslint src tests",
2322
"lint:fix": "eslint --fix src tests",
2423
"preversion": "npm run check-license && npm run lint && npm run test && npm run compile",
@@ -117,14 +116,7 @@
117116
},
118117
"files": [
119118
"build/esm/**/*.js",
120-
"build/esm/**/*.js.map",
121119
"build/esm/**/*.d.ts",
122-
"build/esnext/**/*.js",
123-
"build/esnext/**/*.js.map",
124-
"build/esnext/**/*.d.ts",
125-
"build/src/**/*.js",
126-
"build/src/**/*.js.map",
127-
"build/src/**/*.d.ts",
128120
"LICENSE",
129121
"README.md"
130122
]

src/utils/decorators.utils.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ type CachedRateLimiter = {
8686
/**
8787
* RateLimiter cache that uses TTLCache for automatic TTL and LRU handling.
8888
*/
89-
export class RateLimiterCache {
89+
class RateLimiterCache {
9090
private cache: TTLCache<string, CachedRateLimiter>;
9191

9292
constructor(maxSize = 100, ttlMs = 5 * 60 * 1000) {
@@ -1041,6 +1041,3 @@ export function registerControllers(router: Router, controllers: any[]) {
10411041
});
10421042
});
10431043
}
1044-
1045-
// Export for testing purposes
1046-
export { rateLimiterCache };

tests/utils/performance.utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('performance.utils', () => {
3434
return 'done';
3535
});
3636
expect(result).toBe('done');
37-
expect(timing.durationMs).toBeGreaterThanOrEqual(10);
37+
expect(Math.ceil(timing.durationMs)).toBeGreaterThanOrEqual(10);
3838
});
3939

4040
it('uses custom label and logs', async () => {

tsconfig.base.es5.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

tsconfig.base.esm.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
2-
"extends": "./tsconfig.base.es5.json",
2+
"extends": "./tsconfig.base.json",
33
"compilerOptions": {
4-
"module": "ES6",
5-
"moduleResolution": "node"
4+
"module": "ESNext",
5+
"moduleResolution": "node",
6+
"target": "ES2022",
7+
"sourceMap": false,
8+
"declarationMap": false
69
}
710
}

tsconfig.base.esnext.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

tsconfig.base.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"allowUnusedLabels": false,
55
"composite": true,
66
"declaration": true,
7-
"declarationMap": true,
7+
"declarationMap": false,
88
"forceConsistentCasingInFileNames": true,
99
"incremental": true,
10-
"inlineSources": true,
10+
"inlineSources": false,
1111
"module": "commonjs",
1212
"noEmitOnError": true,
1313
"noFallthroughCasesInSwitch": true,
@@ -16,7 +16,7 @@
1616
"noUnusedLocals": true,
1717
"pretty": true,
1818
"skipLibCheck": true,
19-
"sourceMap": true,
19+
"sourceMap": false,
2020
"strict": true,
2121
"strictNullChecks": true,
2222
"target": "es2017",

tsconfig.esnext.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)