Skip to content

Commit

Permalink
feat(core): skip up-to-date packages
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jan 23, 2025
1 parent dba602e commit 5d833d1
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions packages/core/src/plugins/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,21 @@ export function apply(ctx: Context) {
await ctx.yakumo.save(path)
}))
}
} else {
let progress = 0
spinner.start(`Loading workspaces (0/${paths.length})`)
paths = (await Promise.all(paths.map(async (path) => {
const meta = ctx.yakumo.workspaces[path]
spinner.text = `Loading workspaces (${++progress}/${paths.length})`
const version = await getVersion(meta.name, isNext(meta.version))
if (gt(meta.version, version)) return path
return null! // workaround silly strictNullChecks
}))).filter(Boolean)
spinner.succeed()
}
let progress = 0, skipped = 0
spinner.start(`Loading workspaces (0/${paths.length})`)
paths = (await Promise.all(paths.map(async (path) => {
const meta = ctx.yakumo.workspaces[path]
spinner.text = `Loading workspaces (${++progress}/${paths.length})`
const version = await getVersion(meta.name, isNext(meta.version))
if (gt(meta.version, version)) return path
skipped += 1
return null! // workaround silly strictNullChecks
}))).filter(Boolean)
spinner.succeed()

const total = paths.length
if (!argv.debug) spinner.start(`Publishing packages (0/${total})`)
if (!argv.debug && total > 0) spinner.start(`Publishing packages (0/${total})`)

let completed = 0, failed = 0
await (argv.debug ? serial : parallel)(paths, async (path) => {
Expand All @@ -125,10 +125,11 @@ export function apply(ctx: Context) {
}
})

const skippedText = skipped ? `, ${skipped} skipped` : ''
if (failed) {
spinner.fail(`Published ${total - failed} packages, ${failed} failed.`)
spinner.fail(`Published ${total - failed} packages, ${failed} failed${skippedText}.`)
} else {
spinner.succeed(`Published ${total} packages.`)
spinner.succeed(`Published ${total} packages${skippedText}.`)
}
}, {
boolean: ['debug'],
Expand Down

0 comments on commit 5d833d1

Please sign in to comment.