feat(housekeeping): cut over administration to ase
This commit is contained in:
1 parent
c9e35cf602
commit
2b8f73a91d
457 files changed
+589
-55936
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { readdirSync } from "node:fs";
|
||||
import { existsSync, readdirSync } from "node:fs";
|
||||
import { join, relative } from "node:path";
|
||||
import type { LegacyPage, LegacySurface } from "./types";
|
||||
|
||||
@@ -23,6 +23,7 @@ function discoverSurface(
|
||||
): LegacyPage[] {
|
||||
const surfaceDirectory = join(rootDir, "src", "app", surface);
|
||||
const pages: LegacyPage[] = [];
|
||||
if (!existsSync(surfaceDirectory)) return pages;
|
||||
|
||||
function walk(directory: string): void {
|
||||
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
||||
@@ -51,6 +52,22 @@ function discoverSurface(
|
||||
return pages;
|
||||
}
|
||||
|
||||
export function recordedLegacyPages(
|
||||
entries: readonly LegacyPage[],
|
||||
): LegacyPage[] {
|
||||
return entries
|
||||
.map(({ surface, legacyPath, sourceFile }) => ({
|
||||
surface,
|
||||
legacyPath,
|
||||
sourceFile,
|
||||
}))
|
||||
.sort((a, b) =>
|
||||
`${a.surface}:${a.legacyPath}:${a.sourceFile}`.localeCompare(
|
||||
`${b.surface}:${b.legacyPath}:${b.sourceFile}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function discoverLegacyPages(rootDir = process.cwd()): LegacyPage[] {
|
||||
return (["admin", "mod"] as const)
|
||||
.flatMap((surface) => discoverSurface(rootDir, surface))
|
||||
|
||||
Reference in new issue
Block a user