Initial commit

This commit is contained in:
Endeavorance 2025-02-12 10:31:22 -05:00
commit 4e31f18045
15 changed files with 779 additions and 0 deletions

34
src/index.ts Normal file
View file

@ -0,0 +1,34 @@
import { Glob } from "bun";
import { loadBindingFile } from "./binding";
import type { AnyResource } from "./playbill-schema";
import { loadResourceFile } from "./resource";
const bindingPath = Bun.argv[2];
const binding = await loadBindingFile(bindingPath);
const fileGlobs = binding.files;
const bindingFileDirname = bindingPath.split("/").slice(0, -1).join("/");
const allFilePaths: string[] = [];
for (const thisGlob of fileGlobs) {
const glob = new Glob(thisGlob);
const results = glob.scanSync({
cwd: bindingFileDirname,
absolute: true,
followSymlinks: true,
onlyFiles: true,
});
allFilePaths.push(...results);
}
const loadedResources: AnyResource[] = [];
for (const filepath of allFilePaths) {
const loaded = await loadResourceFile(filepath);
loadedResources.push(...loaded);
}
console.log(loadedResources);