From b48b737e936db9d0d1c41907d02a8ccd3c800812 Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Tue, 4 Nov 2025 16:49:39 +0100 Subject: [PATCH] Refactor npm audit error handling to throw errors instead of silently finish --- make-util.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/make-util.js b/make-util.js index 38ac1efff79f..5162acf36a15 100644 --- a/make-util.js +++ b/make-util.js @@ -180,20 +180,20 @@ function performNpmAudit(taskPath) { shell: true }); - if (auditResult.error) { + if (auditResult.status) { console.log(`\x1b[A\x1b[K❌ npm audit failed because the build task at "${taskPath}" has vulnerable dependencies.`); console.log('👉 Please see details by running the command'); console.log(`\tnpm audit --prefix ${taskPath}`); console.log('or execute the command with --BypassNpmAudit argument to skip the auditing'); - console.log(`\tnode make.js --build --task ${args.task} --BypassNpmAudit`); - process.exit(1); + console.log(`\tnode make.js build --task ${args.task} --BypassNpmAudit`); + throw new Error(`npm audit failed with exit code: ${auditResult.status}`); } else { console.log('\x1b[A\x1b[K✅ npm audit completed successfully.'); } } catch (error) { console.error('\x1b[A\x1b[K❌ "performNpmAudit" failed.'); console.error(error.message); - process.exit(1); + throw error; } } @@ -916,10 +916,10 @@ var validateUuid = function (uuid) { try { const uuidLib = require('node-uuid'); - + // node-uuid.parse() returns a buffer if valid, throws if invalid var parsed = uuidLib.parse(uuid); - + // If parse succeeds and returns a 16-byte buffer, the UUID is valid return parsed && parsed.length === 16; } catch (error) { @@ -1902,7 +1902,7 @@ var processGeneratedTasks = function (baseConfigToolPath, taskList, makeOptions, } if (useSemverBuildConfig === true || useSemverBuildConfig === 'true') { writeUpdateArg += " --use-semver-build-config"; - } + } var debugAgentDirArg = ""; if(debugAgentDir) {