feat: loading files from manifest

This commit is contained in:
Pihkaal
2024-01-28 01:11:56 +01:00
parent 73297d046a
commit 9bb6ccdd4f
8 changed files with 190 additions and 39 deletions

32
src/utils/filesystem.ts Normal file
View File

@@ -0,0 +1,32 @@
import { Cell } from "./terminal/cell";
import { theme } from "./terminal/theme";
export const FILE_STYLES = {
directory: {
char: "\ue6ad", // \ue6ad ||| \ueaf6
foreground: theme.blue,
},
md: {
char: "\ue73e",
foreground: theme.blue,
},
asc: {
char: "\uf43d",
foreground: theme.yellow,
},
} as const satisfies Record<string, Cell>;
export type FileType = keyof typeof FILE_STYLES;
export type File = {
name: string;
} & (
| {
type: Exclude<FileType, "directory">;
}
| {
type: "directory";
children: Array<File>;
folded: boolean;
}
);

6
src/utils/types.ts Normal file
View File

@@ -0,0 +1,6 @@
export type Manifest = {
projects: Array<{
name: string;
files: Array<string>;
}>;
};