UNPKG

@embeddable.com/sdk-core

Version:

Core Embeddable SDK module responsible for web-components bundling and publishing.

25 lines (19 loc) 842 B
import * as fs from "node:fs"; import * as url from "node:url"; import { ResolvedEmbeddableConfig } from "./defineConfig"; export default async (): Promise<ResolvedEmbeddableConfig> => { const configFilePath = `${process.cwd()}/embeddable.config.js`; const tsConfigFilePath = `${process.cwd()}/embeddable.config.ts`; if (!fs.existsSync(configFilePath) && !fs.existsSync(tsConfigFilePath)) { console.log( "Please create a proper `embeddable.config.js` or `embeddable.config.ts` file in the root of your project.", ); process.exit(1); } const isWindows = process.platform === "win32"; const configPath = fs.existsSync(tsConfigFilePath) ? tsConfigFilePath : configFilePath; const pathOrUrl = isWindows ? url.pathToFileURL(configPath).href : configPath; return (await import(pathOrUrl)).default; };