nose-pluto/app/nose/bin/touch.ts

12 lines
359 B
TypeScript

import { join } from "path"
import { projectDir, projectFiles } from "@/project"
export default async function (path: string) {
if (path.endsWith("/")) path = path.slice(0, path.length - 1)
for (const file of projectFiles())
if (file.name === path) throw `${path} exists`
await Bun.write(join(projectDir(), path), "")
return `${path} created`
}