fix: make npm test and typecheck runnable / 修正 npm test 與 typecheck 可直接執行
This commit is contained in:
@@ -1,5 +1,17 @@
|
||||
import type { ReplyEndChoice } from "./types.js"
|
||||
import config from "../config/reply-end-controls.json"
|
||||
import fs from "node:fs"
|
||||
import path from "node:path"
|
||||
import { fileURLToPath } from "node:url"
|
||||
|
||||
const currentDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
const configPath = path.join(currentDir, "..", "config", "reply-end-controls.json")
|
||||
const config = JSON.parse(fs.readFileSync(configPath, "utf-8")) as {
|
||||
callbacks: Record<ReplyEndChoice, string>
|
||||
labels: Record<ReplyEndChoice, string>
|
||||
resolvedLabels: Record<ReplyEndChoice, string>
|
||||
ack: Record<ReplyEndChoice, string>
|
||||
stopPolicyText: string
|
||||
}
|
||||
|
||||
export const REPLY_END_CALLBACKS = config.callbacks as Record<ReplyEndChoice, string>
|
||||
|
||||
|
||||
8
src/node-shims.d.ts
vendored
8
src/node-shims.d.ts
vendored
@@ -7,3 +7,11 @@ declare module "node:path" {
|
||||
const path: any
|
||||
export default path
|
||||
}
|
||||
|
||||
declare module "node:url" {
|
||||
export function fileURLToPath(url: string | URL): string
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
url: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user