Skip to content

Commit

Permalink
Break apart function
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJaredWilcurt authored Feb 18, 2025
1 parent 345c97f commit e458d53
Show file tree
Hide file tree
Showing 4 changed files with 482 additions and 335 deletions.
25 changes: 17 additions & 8 deletions library.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,25 @@ function getManifestWithUpdatedVoltaObject () {
});
}

function saveNewManifest (mutatedManifest) {
return new Promise(async (resolve, reject) => {
try {
const manifestPath = await getManifestPath();
mutatedManifest = JSON.stringify(mutatedManifest, null, originalManifestIndentation);
mutatedManifest = mutatedManifest.replaceAll('\r\n', '\n').replaceAll('\n', originalManifestEOL);
mutatedManifest = mutatedManifest + originalManifestEOL;
await fs.promises.writeFile(manifestPath, mutatedManifest);
resolve();
} catch (error) {
reject(error);
}
});
}

export async function run () {
try {
const manifestPath = await getManifestPath();

let mutatedManifest = await getManifestWithUpdatedVoltaObject();
mutatedManifest = JSON.stringify(mutatedManifest, null, originalManifestIndentation);
mutatedManifest = mutatedManifest.replaceAll('\r\n', '\n').replaceAll('\n', originalManifestEOL);
mutatedManifest = mutatedManifest + originalManifestEOL;

await fs.promises.writeFile(manifestPath, mutatedManifest);
const mutatedManifest = await getManifestWithUpdatedVoltaObject();
await saveNewManifest(mutatedManifest);
} catch (error) {
console.error(error);
}
Expand Down
Loading

0 comments on commit e458d53

Please sign in to comment.