import * as T from "../types" export type InstallFn = (opts: { effects: T.Effects }) => Promise export class Install { private constructor(readonly fn: InstallFn) {} static of( fn: InstallFn, ) { return new Install(fn) } async init({ effects, previousVersion, }: Parameters[0]) { if (!previousVersion) await this.fn({ effects, }) } } export function setupInstall( fn: InstallFn, ) { return Install.of(fn) }