Skip to content

Commit

Permalink
fix(publish): Correctly get latest published version when there is on…
Browse files Browse the repository at this point in the history
…ly release (#14735)

`npm view version` not always returns the array, it might return a
single string if there was only one version published
  • Loading branch information
SevInf committed Aug 10, 2022
1 parent 2b22d03 commit 44c47cb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/ci/publish.ts
Expand Up @@ -736,14 +736,16 @@ async function tagEnginesRepo(
const [major, minor] = patchBranch.split('.')
const majorMinor = [major, minor].join('.')
// ['3.2.0', '3.2.1']
const patchesPublished: string[] = JSON.parse(
const patchesPublished: string | string[] = JSON.parse(
// TODO this line is useful for retrieving versions
await runResult('.', `npm view @prisma/client@${majorMinor} version --json`),
)

console.log({ patchesPublished })

if (patchesPublished.length > 0) {
if (typeof patchesPublished === 'string') {
previousTag = patchesPublished
} else if (patchesPublished.length > 0) {
// 3.2.0
previousTag = patchesPublished.pop() as string
} else {
Expand Down

0 comments on commit 44c47cb

Please sign in to comment.