nose-pluto/app/nose/bin/ls.ts
2025-09-28 14:49:06 -07:00

20 lines
565 B
TypeScript

import { readdirSync } from "fs"
import { NOSE_WWW } from "app/src/config"
import { projectName, projectDir } from "@/project"
export default function () {
const project = projectName()
const root = projectDir()
let files: string[] = []
for (const file of readdirSync(root, { withFileTypes: true })) {
files.push(file.isDirectory() ? `${file.name}/` : file.name)
}
if (root === NOSE_WWW) {
files = files.filter(file => file.endsWith(`${project}.ts`) || file.endsWith(`${project}.tsx`))
}
return files.join(" ")
}