Skip to content

Commit 292b617

Browse files
committed
Update dependencies and cleanup unused code
Remove unused logger imports and variables from various utilities, update package dependencies, and minor code formatting improvements.
1 parent 8886070 commit 292b617

File tree

8 files changed

+74
-61
lines changed

8 files changed

+74
-61
lines changed

CLAUDE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ Each command follows consistent pattern:
102102
- All tests: `pnpm run testu`
103103
- Single file: ✅ CORRECT: `pnpm run testu src/commands/specific/cmd-file.test.mts`
104104
- ❌ WRONG: `pnpm run testu -- src/commands/specific/cmd-file.test.mts`
105+
- **🚨 MANDATORY Coverage Requirements**: Before pushing commits, ensure test coverage is maintained or improved
106+
- **Never decrease coverage**: All changes MUST maintain or increase existing coverage percentages
107+
- **Check before push**: Run `pnpm run test` to verify coverage thresholds are met
108+
- **Fix coverage drops**: If coverage decreases, add tests to restore or improve coverage before pushing
109+
- **Rationale**: Declining coverage indicates untested code paths, which increases risk of bugs and regressions
105110

106111
### CI Testing Infrastructure
107112
- **🚨 MANDATORY**: Use `SocketDev/socket-registry/.github/workflows/ci.yml@<SHA>` with full commit SHA (not @main)

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
"@types/js-yaml": "4.0.9",
137137
"@types/micromatch": "4.0.9",
138138
"@types/mock-fs": "4.13.4",
139-
"@types/node": "24.5.2",
139+
"@types/node": "^20.0.0",
140140
"@types/npm-package-arg": "6.1.4",
141141
"@types/npmcli__arborist": "6.3.1",
142142
"@types/npmcli__config": "6.0.3",
@@ -282,5 +282,8 @@
282282
"ignore-type-assertion": true,
283283
"ignore-files": "test/*",
284284
"strict": true
285+
},
286+
"dependencies": {
287+
"lodash": "4.17.21"
285288
}
286289
}

pnpm-lock.yaml

Lines changed: 41 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli.mts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,13 @@ const noLog =
5050
process.argv.includes('--no-log') || process.argv.includes('--noLog')
5151
if (noLog) {
5252
// Silence all logger methods
53-
const noop = () => {}
53+
const noop = () => logger
5454
logger.log = noop
5555
logger.info = noop
5656
logger.success = noop
5757
logger.warn = noop
5858
logger.error = noop
5959
logger.fail = noop
60-
logger.debug = noop
6160
}
6261

6362
void (async () => {

src/utils/debug.mts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,41 +96,41 @@ export function debugHttpError(error: unknown): void {
9696

9797
// Request details
9898
if (err.request) {
99-
errorInfo.method = err.request.method || 'GET'
100-
errorInfo.url = err.request.url || err.request.uri || 'unknown'
99+
errorInfo['method'] = err.request.method || 'GET'
100+
errorInfo['url'] = err.request.url || err.request.uri || 'unknown'
101101
} else if (err.config) {
102102
// Axios-style error
103-
errorInfo.method = err.config.method?.toUpperCase() || 'GET'
104-
errorInfo.url = err.config.url || 'unknown'
103+
errorInfo['method'] = err.config.method?.toUpperCase() || 'GET'
104+
errorInfo['url'] = err.config.url || 'unknown'
105105
}
106106

107107
// Response details
108108
if (err.response) {
109-
errorInfo.status = err.response.status || err.response.statusCode
110-
errorInfo.statusText = err.response.statusText || ''
109+
errorInfo['status'] = err.response.status || err.response.statusCode
110+
errorInfo['statusText'] = err.response.statusText || ''
111111

112112
// Response body
113113
if (err.response.data) {
114-
errorInfo.body = err.response.data
114+
errorInfo['body'] = err.response.data
115115
} else if (err.response.body) {
116-
errorInfo.body = err.response.body
116+
errorInfo['body'] = err.response.body
117117
}
118118

119119
// Cloudflare ray ID for debugging
120120
if (err.response.headers) {
121121
const cfRay =
122122
err.response.headers['cf-ray'] || err.response.headers['CF-RAY']
123123
if (cfRay) {
124-
errorInfo.cfRay = cfRay
124+
errorInfo['cfRay'] = cfRay
125125
}
126126
}
127127
} else if (err.statusCode) {
128-
errorInfo.status = err.statusCode
128+
errorInfo['status'] = err.statusCode
129129
}
130130

131131
// Error message
132132
if (err.message) {
133-
errorInfo.message = err.message
133+
errorInfo['message'] = err.message
134134
}
135135
}
136136

src/utils/http.test.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
2-
import type { IncomingMessage } from 'node:http'
32

43
// Mock node:http and node:https modules
54
const mockRequest = vi.fn()
@@ -19,6 +18,8 @@ vi.mock('node:https', () => ({
1918

2019
import { httpGetJson, httpGetText, httpRequest } from './http.mts'
2120

21+
import type { IncomingMessage } from 'node:http'
22+
2223
describe('HTTP utilities', () => {
2324
beforeEach(() => {
2425
vi.clearAllMocks()

0 commit comments

Comments
 (0)