From 49832f3723add4044d5bcfa6585b0842011df9dd Mon Sep 17 00:00:00 2001 From: Ossama Jouini Date: Fri, 17 Jan 2025 18:04:08 +0900 Subject: [PATCH] Version 1.0.0.0 --- build/publish.js | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/build/publish.js b/build/publish.js index 5b86f68..26c8616 100644 --- a/build/publish.js +++ b/build/publish.js @@ -1,5 +1,5 @@ import fs from "fs"; -import { execSync } from "child_process"; +import { execSync, exec } from "child_process"; import version from "../version.js"; import * as chalkUtils from "./chalkUtils.js"; import fromConsole from "./fromConsole.js"; @@ -42,24 +42,33 @@ export default function publish(type) { // commit changes process.env.FORCE_COLOR = "1"; - execSync(`npm run build`); - chalkUtils.newLine(); - chalkUtils.divider(); - chalkUtils.step("Pushing addon to git"); - execSync(`git add -A`); - try { - // if there are no changes, don't commit - execSync(`git commit -m "Version ${newVersion}"`); - } catch (e) { - chalkUtils.info("No changes to commit"); - return; - } - execSync(`git push`); + let build = exec(`npm run build`); + build.stdout.pipe(process.stdout); + build.stderr.pipe(process.stderr); + build.on("exit", (code) => { + if (code !== 0) { + chalkUtils.failed("Build failed"); + return; + } + + chalkUtils.newLine(); + chalkUtils.divider(); + chalkUtils.step("Pushing addon to git"); + execSync(`git add -A`); + try { + // if there are no changes, don't commit + execSync(`git commit -m "Version ${newVersion}"`); + } catch (e) { + chalkUtils.info("No changes to commit"); + return; + } + execSync(`git push`); - chalkUtils.newLine(); - chalkUtils.divider(); - chalkUtils.success(`Version ${newVersion} published`); - chalkUtils.newLine(); + chalkUtils.newLine(); + chalkUtils.divider(); + chalkUtils.success(`Version ${newVersion} published`); + chalkUtils.newLine(); + }); } if (fromConsole(import.meta.url)) {