Skip to content

Commit

Permalink
improve build error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
51ngul4r1ty committed Jan 23, 2024
1 parent b1bfe4e commit a01a17d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/web-app/scripts/deploy-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ const fsExtra = require("fs-extra");

var inputPath = path.resolve("./package.json");
var outputPath = path.resolve("./build/deploy-package.json");
var textByLine = fs
.readFileSync(inputPath)
.toString()
.replace(/\r/g, "")
.split("\n");
var textByLine = fs.readFileSync(inputPath).toString().replace(/\r/g, "").split("\n");
var newLines = [];

const INDENT_SPACING = 2;
Expand Down Expand Up @@ -63,11 +59,17 @@ function buildDeployPackage() {

const allText = newLines.join("\r\n");

fs.writeFileSync(outputPath, allText, (err) => {
if (err) {
try {
fs.writeFileSync(outputPath, allText);
console.log(` ("${outputPath}" file built)`);
console.log();
} catch (err) {
if (err && err.message) {
console.error(`${err.message} occured writing ./build/deploy-package.json`);
} else {
console.error(`${err} occured writing ./build/deploy-package.json`);
}
});
}
}

function createDeployLaunchJson(deployFolder) {
Expand Down

0 comments on commit a01a17d

Please sign in to comment.