Skip to content

Commit aab7dde

Browse files
author
Clement Denis
committed
fix: ignore publish failing because version already exist
1 parent 0858870 commit aab7dde

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

npm.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,20 @@ for await (const dir of Deno.readDir(root)) {
9292
Deno.copyFileSync(`${base}/README.md`, `${outDir}/README.md`)
9393
const publish = new Deno.Command('npm', {
9494
args: ['publish', '--verbose'],
95+
stderr: 'piped',
9596
cwd: outDir,
9697
})
9798
const result = await publish.spawn().output()
9899
if (result.code === 0) continue
100+
const stderr = new TextDecoder().decode(result.stderr)
101+
const isUpToDate = stderr.includes(
102+
'You cannot publish over the previously published versions',
103+
)
104+
if (isUpToDate) {
105+
console.log('package version not changed, package skipped')
106+
continue
107+
}
99108
console.log('failed to publish package')
109+
console.error(stderr)
100110
Deno.exit(1)
101111
}

0 commit comments

Comments
 (0)