Skip to content

Commit

Permalink
Log error from npm command
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsnyder committed May 17, 2024
1 parent 8259788 commit a36fa0a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/helpers/publishToNpm.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ 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 }) => {
let publishVersionJson = "";
try {
const publishVersionJson = execSync(
publishVersionJson = execSync(
`npm view @adobe/alloy@${version} version --json`,
).toString();
if (publishVersionJson !== "") {
logger.warn(`NPM already has version ${version}.`);
}
} catch (e) {
logger.info(e.message);
}
if (publishVersionJson !== "") {
logger.warn(`NPM already has version ${version}.`);
} else {
logger.info("Publishing NPM package.");
await exec("npm publish", `npm publish -access public --tag ${npmTag}`);
}
Expand Down

0 comments on commit a36fa0a

Please sign in to comment.