Optimization and potentially prevend leaving the repo in a broken state

This commit is contained in:
Joseph Garrone 2024-12-23 18:49:00 +01:00
parent cc3d0d61dd
commit 6de5fd4f96

View File

@ -60,6 +60,8 @@ export async function command(params: {
const ownedFilesRelativePaths_toAdd: string[] = [];
const writeActions: (() => Promise<void>)[] = [];
for (const { uiModuleMeta, fileRelativePaths } of arr) {
const uiModuleDirPath = await getInstalledModuleDirPath({
moduleName: uiModuleMeta.moduleName,
@ -84,9 +86,11 @@ export async function command(params: {
uiModuleVersion: uiModuleMeta.version
});
await fsPr.writeFile(
pathJoin(buildContext.themeSrcDirPath, fileRelativePath),
sourceCode
writeActions.push(() =>
fsPr.writeFile(
pathJoin(buildContext.themeSrcDirPath, fileRelativePath),
sourceCode
)
);
ownedFilesRelativePaths_toAdd.push(fileRelativePath);
@ -98,6 +102,8 @@ export async function command(params: {
process.exit(1);
}
await Promise.all(writeActions.map(action => action()));
await writeManagedGitignoreFile({
buildContext,
uiModuleMetas,