SDK catalog / Self Update
Self Update
preview 0.3.0-alpha.1
Preview documentation for @workforce-sdk/self-update@0.3.0-alpha.1. Existing legacy downloads may use a different API; this page does not announce a new release.
import { cp } from 'node:fs/promises'
import { createSelfUpdater } from '@workforce-sdk/self-update'
// The app supplies its source, built files, and an entry that exits after --self-test.
const updater = createSelfUpdater(process.argv[2] ?? './self-update.yaml', {
runningCommit: process.env.APP_COMMIT ?? '',
build: directory => cp('./dist', directory, { recursive: true }),
})
try {
console.log(process.argv.includes('--apply') ? await updater.update() : await updater.check())
} finally {
await updater.dispose()
}