Skip to content

Commit d9b543a

Browse files
jaggederestclaude
andcommitted
fix: update tsconfig.json and convert pretty-bytes imports to standard ES6
- Updated tsconfig.json to use CommonJS module system with proper ES module interop - Converted dynamic imports of pretty-bytes to standard ES6 imports in remote.ts and storage.ts - Added integration test command to CLAUDE.md documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent adec211 commit d9b543a

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- Run all tests: `yarn test`
1111
- Run specific test: `vitest ./src/filename.test.ts`
1212
- CI test mode: `yarn test:ci`
13+
- Integration tests: `yarn test:integration`
1314

1415
## Code Style Guidelines
1516

src/remote.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import * as fs from "fs/promises";
66
import * as jsonc from "jsonc-parser";
77
import * as os from "os";
88
import * as path from "path";
9-
// Dynamic import for ESM module
10-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
11-
let prettyBytes: any;
9+
import prettyBytes from "pretty-bytes";
1210
import * as semver from "semver";
1311
import * as vscode from "vscode";
1412
import {
@@ -852,10 +850,6 @@ export class Remote {
852850
download_bytes_sec: number;
853851
using_coder_connect: boolean;
854852
}) => {
855-
// Load ESM module if not already loaded
856-
if (!prettyBytes) {
857-
prettyBytes = (await import("pretty-bytes")).default;
858-
}
859853
let statusText = "$(globe) ";
860854

861855
// Coder Connect doesn't populate any other stats

src/storage.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import { createWriteStream } from "fs";
33
import fs from "fs/promises";
44
import { IncomingMessage } from "http";
55
import path from "path";
6-
// Dynamic import for ESM module
7-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8-
let prettyBytes: any;
6+
import prettyBytes from "pretty-bytes";
97
import * as vscode from "vscode";
108
import { errToStr } from "./api-helper";
119
import * as cli from "./cliManager";
@@ -124,10 +122,6 @@ export class Storage {
124122
* downloads being disabled.
125123
*/
126124
public async fetchBinary(restClient: Api, label: string): Promise<string> {
127-
// Load ESM module if not already loaded
128-
if (!prettyBytes) {
129-
prettyBytes = (await import("pretty-bytes")).default;
130-
}
131125
const baseUrl = restClient.getAxiosInstance().defaults.baseURL;
132126

133127
// Settings can be undefined when set to their defaults (true in this case),

tsconfig.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
{
22
"compilerOptions": {
3-
"module": "Node16",
3+
"module": "commonjs",
44
"target": "ES2022",
5+
"moduleResolution": "node",
56
"outDir": "out",
67
// "dom" is required for importing the API from coder/coder.
78
"lib": ["ES2022", "dom"],
89
"sourceMap": true,
910
"strict": true,
10-
"skipLibCheck": true
11+
"esModuleInterop": true,
12+
"skipLibCheck": true,
13+
"forceConsistentCasingInFileNames": true
1114
},
12-
"exclude": ["vitest.config.ts"]
15+
"exclude": ["node_modules", "vitest.config.ts"],
16+
"include": ["src/**/*"]
1317
}

0 commit comments

Comments
 (0)