Files
plainleaf/scripts/generate_fs_list.ts
T
MaksandGitHub 8a3782e946 improve dependency management (#770)
* use import_map.json instead of per-file import

* remove test_deps.ts in favor of import_map

* remove common/deps.ts in favor of import_map

* use import_map instead of server/deps.ts

* make all plug-api files usable without an import_map

* make all lib files usable without an import_map

* remove web/deps.ts in favor of import_map

* fix plug build

* remove plug-api/deps.ts in favor of lib/deps.ts

* fix server deps bundled in client deps
2024-03-16 15:29:24 +01:00

33 lines
920 B
TypeScript

import { walk } from "$std/fs/walk.ts";
import { resolve } from "$std/path/mod.ts";
import { mime } from "mimetypes";
import { FileMeta } from "../plug-api/types.ts";
const rootDir = resolve("website_build");
const lastModifiedTimestamp = +Deno.env.get("LAST_MODIFIED_TIMESTAMP")! ||
Date.now();
const allFiles: FileMeta[] = [];
for await (
const file of walk(rootDir, {
includeDirs: false,
// Exclude hidden files
skip: [
/^.*\/(\..+|_redirects|_headers|service_worker\.js.*|index\.json|_client\/.*)$/,
],
})
) {
const fullPath = file.path;
const s = await Deno.stat(fullPath);
allFiles.push({
name: fullPath.substring(rootDir.length + 1),
lastModified: lastModifiedTimestamp,
created: lastModifiedTimestamp,
contentType: mime.getType(fullPath) || "application/octet-stream",
size: s.size,
perm: "rw",
});
}
console.log(JSON.stringify(allFiles, null, 2));