mirror of
https://github.com/nexu-io/open-design.git
synced 2026-05-31 19:04:39 +07:00
fix(daemon): update renamed artifact manifest entries
This commit is contained in:
parent
646fa370d2
commit
328d893b4f
1 changed files with 9 additions and 3 deletions
|
|
@ -974,16 +974,22 @@ async function prepareArtifactManifestRename(dir, oldName, newName) {
|
|||
}
|
||||
}
|
||||
|
||||
return { oldManifestPath, newManifestPath: targetManifestPath, raw };
|
||||
return { oldManifestPath, newManifestPath: targetManifestPath, raw, oldName };
|
||||
}
|
||||
|
||||
async function commitArtifactManifestRename(manifestRename, newName) {
|
||||
if (!manifestRename) return;
|
||||
const { oldManifestPath, newManifestPath, raw } = manifestRename;
|
||||
const { oldManifestPath, newManifestPath, raw, oldName } = manifestRename;
|
||||
await mkdir(path.dirname(newManifestPath), { recursive: true });
|
||||
const parsed = parseManifest(raw);
|
||||
if (parsed) {
|
||||
const validated = validateArtifactManifestInput(parsed, newName);
|
||||
const parsedEntry = typeof parsed.entry === 'string'
|
||||
? parsed.entry.replace(/\\/g, '/')
|
||||
: '';
|
||||
const renamedManifest = parsedEntry === oldName
|
||||
? { ...parsed, entry: newName }
|
||||
: parsed;
|
||||
const validated = validateArtifactManifestInput(renamedManifest, newName);
|
||||
if (validated.ok && validated.value) {
|
||||
await writeFile(oldManifestPath, JSON.stringify(validated.value, null, 2));
|
||||
await renameFilePath(oldManifestPath, newManifestPath, { noOverwrite: true });
|
||||
|
|
|
|||
Loading…
Reference in a new issue