Skip to content

Commit 51200bb

Browse files
committed
reduce reproduction code
1 parent 65238cd commit 51200bb

2 files changed

Lines changed: 2 additions & 22 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
node: [20, 22]
20+
node: [22]
2121
os: [ubuntu-latest, macos-latest, windows-latest]
2222
runs-on: ${{ matrix.os }}
2323
steps:

packages/codegen/src/runner.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
import chokidar, { type FSWatcher } from 'chokidar';
2-
import { type Project } from './project.js';
3-
4-
export interface Watcher {
5-
/** Exported for testing purposes */
6-
project: Project;
7-
}
82

93
/**
104
* Run css-modules-kit .d.ts generation in watch mode.
@@ -26,7 +20,7 @@ export async function runCMKInWatchMode(rootDir: string): Promise<void> {
2620
// Watch project files and report diagnostics on changes
2721
const readyPromises: Promise<void>[] = [];
2822
for (const wildcardDirectory of [{ fileName: rootDir }]) {
29-
const { promise, resolve } = promiseWithResolvers<void>();
23+
const { promise, resolve } = Promise.withResolvers<void>();
3024
readyPromises.push(promise);
3125
fsWatchers.push(
3226
chokidar
@@ -45,17 +39,3 @@ export async function runCMKInWatchMode(rootDir: string): Promise<void> {
4539
}
4640
await Promise.all(readyPromises);
4741
}
48-
49-
function promiseWithResolvers<T>() {
50-
let resolve;
51-
let reject;
52-
const promise = new Promise<T>((res, rej) => {
53-
resolve = res;
54-
reject = rej;
55-
});
56-
return {
57-
promise,
58-
resolve: resolve as unknown as (value: T) => void,
59-
reject: reject as unknown as (reason?: unknown) => void,
60-
};
61-
}

0 commit comments

Comments
 (0)