Skip to content

Commit

Permalink
fix(release-script): npm view in node 18
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ksem committed May 26, 2023
1 parent 4c4164c commit 3a460d9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/deploy/release-script/release-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,13 @@ const confirmTagAvailable = async (tagName: string): Promise<boolean> => {
return !result.match(new RegExp(`refs\\/tags\\/${tagName}\\b`))
}

const confirmNpmVersionAvailable = async (distTag: string): Promise<boolean> => {
return !await executeCommand(`npm view vuestic-ui@${distTag}`)
const checkIfNpmVersionExists = async (distTag: string): Promise<boolean> => {
try {
await executeCommand(`npm view vuestic-ui@${distTag}`)
return true
} catch (e) {
return false
}
}

// Check if we have correct state to go for release
Expand Down Expand Up @@ -162,7 +167,7 @@ const runReleaseChecks = async (releaseConfig: ReleaseConfig, dryRun: boolean) =
console.log(chalk.red(`Tag ${gitTag} is already on upstream. You can remove it if it was by mistake.`))
return false
}
if (!await confirmNpmVersionAvailable(version)) {
if (await checkIfNpmVersionExists(version)) {
console.log(chalk.red(`Version ${version} is already on NPM, you can bump version manually to fix that.`))
return false
}
Expand Down

0 comments on commit 3a460d9

Please sign in to comment.