switch to bun build instead of statics
This commit is contained in:
parent
8cbe93d74d
commit
adc3a38395
26 changed files with 357 additions and 230 deletions
30
build.ts
Normal file
30
build.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
import chalk from "chalk";
|
||||
import { generate } from "./generate";
|
||||
import { globSync } from "glob";
|
||||
import { rmSync, mkdirSync, cpSync } from "node:fs";
|
||||
|
||||
console.log(chalk.green`>> Cleaing up ./html ...`);
|
||||
rmSync("html", { recursive: true, force: true });
|
||||
mkdirSync("html");
|
||||
|
||||
const works = globSync("src/*/main.ts");
|
||||
|
||||
console.log(chalk.green`>> Building ...`);
|
||||
console.log(chalk.yellow(` Found ${works.length} works.`));
|
||||
|
||||
await Bun.build({
|
||||
entrypoints: works,
|
||||
outdir: "html",
|
||||
splitting: true,
|
||||
});
|
||||
|
||||
console.log(chalk.green`>> Generating HTML and Markdown ...`);
|
||||
await generate(works);
|
||||
|
||||
console.log(chalk.green`>> Copying public files ...`);
|
||||
const publics = globSync("src/public/*");
|
||||
for (const file of publics) {
|
||||
const dest = file.replace("src/public/", "html/");
|
||||
cpSync(file, dest);
|
||||
console.log(chalk.yellow(` -> html/${dest}...`));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue