Skip to content

Commit

Permalink
Npm check now returns a non-zero exit code if it can't find the version
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsnyder committed May 17, 2024
1 parent 9aa1ca2 commit 8259788
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions scripts/helpers/publishToNpm.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/
const publishToNpm = async ({ exec, execSync, logger, npmTag, version }) => {
const publishVersionJson = execSync(
`npm view @adobe/alloy@${version} version --json`,
).toString();
if (publishVersionJson !== "") {
logger.warn(`NPM already has version ${version}.`);
} else {
try {
const publishVersionJson = execSync(
`npm view @adobe/alloy@${version} version --json`,
).toString();
if (publishVersionJson !== "") {
logger.warn(`NPM already has version ${version}.`);
}
} catch (e) {
logger.info("Publishing NPM package.");
await exec("npm publish", `npm publish -access public --tag ${npmTag}`);
}
Expand Down

0 comments on commit 8259788

Please sign in to comment.