wip fix
This commit is contained in:
parent
5f07237610
commit
a3061f0876
|
|
@ -3,7 +3,8 @@ import brotliPromise from "brotli-wasm";
|
||||||
import { spawn } from "bun";
|
import { spawn } from "bun";
|
||||||
import { dir } from "dir";
|
import { dir } from "dir";
|
||||||
import { fdir } from "fdir";
|
import { fdir } from "fdir";
|
||||||
import { existsAsync, listAsync, removeAsync, writeAsync } from "fs-jetpack";
|
import { statSync } from "fs";
|
||||||
|
import { copyAsync, existsAsync, listAsync, removeAsync, writeAsync } from "fs-jetpack";
|
||||||
const brotli = await brotliPromise;
|
const brotli = await brotliPromise;
|
||||||
|
|
||||||
await removeAsync(dir.path("app/web/.parcel-cache"));
|
await removeAsync(dir.path("app/web/.parcel-cache"));
|
||||||
|
|
@ -61,41 +62,41 @@ const static_br = dir.path("app/static-br");
|
||||||
await removeAsync(static_br);
|
await removeAsync(static_br);
|
||||||
const files = await listAsync(dir.path("app/static"));
|
const files = await listAsync(dir.path("app/static"));
|
||||||
if (files) {
|
if (files) {
|
||||||
// await Promise.all(
|
await Promise.all(
|
||||||
// files
|
files
|
||||||
// .filter((file) => statSync(dir.path(`app/static/${file}`)).isFile())
|
.filter((file) => statSync(dir.path(`app/static/${file}`)).isFile())
|
||||||
// .map(async (file) => {
|
.map(async (file) => {
|
||||||
// if (!(await Bun.file(dir.path(`app/static-br/${file}`)).exists())) {
|
if (!(await Bun.file(dir.path(`app/static-br/${file}`)).exists())) {
|
||||||
// const br = brotli.compress(
|
const br = brotli.compress(
|
||||||
// new Uint8Array(
|
new Uint8Array(
|
||||||
// await Bun.file(dir.path(`app/static/${file}`)).arrayBuffer(),
|
await Bun.file(dir.path(`app/static/${file}`)).arrayBuffer(),
|
||||||
// ),
|
),
|
||||||
// { quality: 11 },
|
{ quality: 11 },
|
||||||
// );
|
);
|
||||||
// if (br) {
|
if (br) {
|
||||||
// console.log(`Compressing [static] ${file}`);
|
console.log(`Compressing [static] ${file}`);
|
||||||
// await writeAsync(
|
await writeAsync(
|
||||||
// dir.path(`app/static-br/${file}`),
|
dir.path(`app/static-br/${file}`),
|
||||||
// Buffer.from(br),
|
Buffer.from(br),
|
||||||
// );
|
);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }),
|
}),
|
||||||
// );
|
);
|
||||||
// const pub = await listAsync(dir.path("app/web/public-br"));
|
const pub = await listAsync(dir.path("app/web/public-br"));
|
||||||
// if (pub) {
|
if (pub) {
|
||||||
// await Promise.all(
|
await Promise.all(
|
||||||
// pub.map(async (file) => {
|
pub.map(async (file) => {
|
||||||
// if (await existsAsync(`app/static-br/${file}`)) {
|
if (await existsAsync(`app/static-br/${file}`)) {
|
||||||
// await removeAsync(`app/static-br/${file}`);
|
await removeAsync(`app/static-br/${file}`);
|
||||||
// }
|
}
|
||||||
// await copyAsync(
|
await copyAsync(
|
||||||
// dir.path(`app/web/public-br/${file}`),
|
dir.path(`app/web/public-br/${file}`),
|
||||||
// dir.path(`app/static-br/${file}`),
|
dir.path(`app/static-br/${file}`),
|
||||||
// );
|
);
|
||||||
// }),
|
}),
|
||||||
// );
|
);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await import("./build-site");
|
await import("./build-site");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue