Skip to content

Commit 143f37c

Browse files
authored
Fix check package availability (#6029)
1 parent 5ac776b commit 143f37c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

release-scripts/checkIfPackageShouldBePublished.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
const execSync = require("child_process").execSync;
77

88
function checkVersion(packageName, version) {
9-
return execSync(`npm view ${packageName}@${version}`).toString().trim();
9+
// It is expected npm view will fail for packages that are about to be published. 2> dev/null/ is used to suppress the error.
10+
return execSync(`npm view ${packageName}@${version} 2> /dev/null`).toString().trim();
1011
}
1112

1213
const path = require("path");
1314
const libPath = path.join(__dirname, '..', process.argv[2]);
1415

15-
const {name, version} = require(`${libPath}/package.json`);
16+
const { name, version } = require(`${libPath}/package.json`);
1617

1718
const versionIsPublished = checkVersion(name, version);
1819

release-scripts/checkPackageAvailability.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
const execSync = require("child_process").execSync;
77

88
function getPublishedVersion(packageName) {
9-
return execSync(`npm view ${packageName} version`).toString().trim();
9+
return execSync(`npm view ${packageName}@${version}`).toString().trim();
1010
}
1111

1212
const path = require("path");

0 commit comments

Comments
 (0)