mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
.project.json -> .git/project.json
This commit is contained in:
1 file changed
+9
-8
@@ -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();
|
||||||
|
|||||||
Reference in new issue
Block a user