convex
Version:
Client for the Convex Cloud
20 lines (15 loc) • 511 B
JavaScript
// Import everything as ESM to make sure our imports are valid ESM
// (. -> ./index.js, ./foo -> ./foo.js, ./foo.ts -> ./foo.js
import fs from "fs";
import path from "path";
await import("./dist/esm/index.js");
for (const dir of fs.readdirSync("./dist/esm")) {
if (dir.endsWith("cli")) {
// CLI doesn't need to be importable as ESM (yet at least)
continue;
}
const index = path.join("./dist/esm", dir, "index.js");
if (fs.existsSync(index)) {
await import(`.${path.sep}${index}`);
}
}