From b12d85b078725e8fc6b85e7a42706dedadb97f45 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Fri, 25 Apr 2025 15:49:38 -0400 Subject: [PATCH] Expanding a project doesn't write the project file propertly When exporting a project using the `--expand` comamnd line option, all of the assets are propertly expanded to the path. The main project file though is not properly updated. This results in a situation where by tyring to import the expanded folder will seem like none of the documents have changed. This is now fixed in this patch. --- internal/runners/projects.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/internal/runners/projects.go b/internal/runners/projects.go index be4509ee..fdb0898d 100644 --- a/internal/runners/projects.go +++ b/internal/runners/projects.go @@ -322,11 +322,13 @@ func (r *ProjectRunner) Import(in Request) (*Response, error) { }, nil } -////////////////////////////////////////////////////////////////////////////// -// Exporter Interface -// +/* +******************************************************************************* +Exporter interface +******************************************************************************* +*/ -// Export is the implementation of the command `export project ` +// Export implements the `export project ...` command func (r *ProjectRunner) Export(in Request) (*Response, error) { logger.Trace() @@ -571,6 +573,10 @@ func parseMember(member string) (*Member, error) { return m, nil } +// expandProject is responsible for expanding the project file into individual +// documents. The in argument is the Request object and the project argument +// is the project to exand. The path argument specifies the directory to +// expand the project into. func expandProject(in Request, project *services.Project, path string) error { logger.Trace() @@ -608,7 +614,9 @@ func expandProject(in Request, project *services.Project, path string) error { components[idx].(map[string]interface{})["filename"] = fn } + projectMap["components"] = components + fn := fmt.Sprintf("%s.project.json", strings.Replace(project.Name, "/", "_", -1)) - return utils.WriteJsonToDisk(project, fn, path) + return utils.WriteJsonToDisk(projectMap, fn, path) }