update
This commit is contained in:
15
src/fs.ts
15
src/fs.ts
@@ -79,6 +79,7 @@ export async function createProject(app: App, name: string): Promise<void> {
|
||||
for (const file of PROJECT_FILES) {
|
||||
await ensureFile(app, normalizePath(`${root}/${file}`), "");
|
||||
}
|
||||
await createArea(app, name, "story");
|
||||
}
|
||||
|
||||
export async function createArea(app: App, project: string, area: string): Promise<void> {
|
||||
@@ -110,3 +111,17 @@ export async function createProjectFeature(
|
||||
export function isProjectRootFile(name: string): boolean {
|
||||
return (PROJECT_FILES as readonly string[]).includes(name);
|
||||
}
|
||||
|
||||
export interface ProjectFileLocation {
|
||||
project: string;
|
||||
area?: string;
|
||||
}
|
||||
|
||||
export function parseProjectFilePath(path: string): ProjectFileLocation | null {
|
||||
if (!path.endsWith(".md")) return null;
|
||||
const parts = normalizePath(path).split("/");
|
||||
if (parts[0] !== PROJECTS_ROOT) return null;
|
||||
if (parts.length === 3) return { project: parts[1] };
|
||||
if (parts.length === 4) return { project: parts[1], area: parts[2] };
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user