Jelajahi Sumber

Handle case when npm would return an error code (#3340)

Alexandru Dima 2 tahun lalu
induk
melakukan
9d4574b10b
2 mengubah file dengan 10 tambahan dan 6 penghapusan
  1. 8 4
      .github/workflows/publish/computeState.js
  2. 2 2
      package-lock.json

+ 8 - 4
.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;
 }

+ 2 - 2
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": {