.project.json -> .git/project.json

This commit is contained in:
Alex Gleason committed 2025-07-20 17:43:25 -05:00
1 parent 87f5d6a117
commit a7d44e7ec5
1 file changed
+9 -8
+9 -8
View File
@@ -50,15 +50,16 @@ export class ProjectsManager {
lastModified: new Date(), lastModified: new Date(),
}; };
// Save project metadata // Clone the template first
await this.cloneTemplate(projectPath);
// Save project metadata in .git directory to keep it out of source tree
const gitDir = `${projectPath}/.git`;
await this.fs.writeFile( await this.fs.writeFile(
`${projectPath}/.project.json`, `${gitDir}/project.json`,
JSON.stringify(project, null, 2) JSON.stringify(project, null, 2)
); );
// Clone the template
await this.cloneTemplate(projectPath);
return project; return project;
} }
@@ -80,7 +81,7 @@ export class ProjectsManager {
for (const dir of projectDirs) { for (const dir of projectDirs) {
const projectPath = `${this.dir}/${dir}`; const projectPath = `${this.dir}/${dir}`;
const projectFile = `${projectPath}/.project.json`; const projectFile = `${projectPath}/.git/project.json`;
try { try {
const projectData = await this.fs.readFile(projectFile, 'utf8'); const projectData = await this.fs.readFile(projectFile, 'utf8');
@@ -103,7 +104,7 @@ export class ProjectsManager {
async getProject(id: string): Promise<Project | null> { async getProject(id: string): Promise<Project | null> {
try { try {
const projectFile = `${this.dir}/${id}/.project.json`; const projectFile = `${this.dir}/${id}/.git/project.json`;
const projectData = await this.fs.readFile(projectFile, 'utf8'); const projectData = await this.fs.readFile(projectFile, 'utf8');
const project = JSON.parse(projectData); const project = JSON.parse(projectData);
return { return {
@@ -189,7 +190,7 @@ export class ProjectsManager {
private async updateProjectLastModified(projectId: string): Promise<void> { private async updateProjectLastModified(projectId: string): Promise<void> {
try { try {
const projectFile = `${this.dir}/${projectId}/.project.json`; const projectFile = `${this.dir}/${projectId}/.git/project.json`;
const projectData = await this.fs.readFile(projectFile, 'utf8'); const projectData = await this.fs.readFile(projectFile, 'utf8');
const project = JSON.parse(projectData); const project = JSON.parse(projectData);
project.lastModified = new Date().toISOString(); project.lastModified = new Date().toISOString();