From 9d4574b10b7a82f57cd462d395cf1fdca0e93090 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Thu, 29 Sep 2022 14:53:09 +0200 Subject: [PATCH] Handle case when npm would return an error code (#3340) --- .github/workflows/publish/computeState.js | 12 ++++++++---- package-lock.json | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish/computeState.js b/.github/workflows/publish/computeState.js index ece60755..6eb18167 100644 --- a/.github/workflows/publish/computeState.js +++ b/.github/workflows/publish/computeState.js @@ -90,10 +90,14 @@ function npmGetLatestVersion(packageName) { * @returns {boolean} */ function npmExists(packageName, version) { - const output = cp.execSync(`npm show ${packageName}@${version} version`).toString(); - const result = output.split(/\r\n|\r|\n/g)[0]; - if (result.trim().length === 0) { + try { + const output = cp.execSync(`npm show ${packageName}@${version} version`).toString(); + const result = output.split(/\r\n|\r|\n/g)[0]; + if (result.trim().length === 0) { + return false; + } + return true; + } catch (err) { return false; } - return true; } diff --git a/package-lock.json b/package-lock.json index d7cfeeb6..f213b111 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "monaco-editor", - "version": "0.33.0", + "version": "0.34.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "monaco-editor", - "version": "0.33.0", + "version": "0.34.0", "hasInstallScript": true, "license": "MIT", "devDependencies": {