diff --git a/src/index.js b/src/index.js index 57d39e3..7514208 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,6 @@ +import { readFile } from "node:fs/promises"; import os from "node:os"; import path from "node:path"; -import { pathToFileURL } from "node:url"; export function getUserConfigDir() { if (process.platform === "win32") { @@ -18,11 +18,11 @@ export async function loadConfig(type) { switch (configType) { case "public": case "p": - configFileName = "public-config.js"; + configFileName = "public-config.json"; break; case "confidential": case "c": - configFileName = "confidential-config.js"; + configFileName = "confidential-config.json"; break; default: configFileName = null; @@ -35,7 +35,6 @@ export async function loadConfig(type) { } const configPath = path.join(configBaseDir, "sk-az-tools", configFileName); - const configUrl = pathToFileURL(configPath).href; - const { config } = await import(configUrl); - return config; + const configJson = await readFile(configPath, "utf8"); + return JSON.parse(configJson); }