mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-27 02:41:53 +00:00
* add error status * update types * ṗ̶̰̙̓͒̈́ͅü̵̢̙̫̣ŗ̷̪̺̺͛g̴̲͉͎̬̒̇e̵̪̎̅͌ ̶̡̜̘͐͛t̶͎͍̣̿̍̐h̴͕̩͗̈́̎̑e̵͚͒̂͝ ̸̛͙̦͈͝v̶̱͙̬̽̔ọ̶̧̡̒̓i̸̬̲͍̋̈́d̴͉̀ * fix some extra voids * add `package.rebuild` * introduce error status and pkg rebuild and fix mocks * minor fixes * fix build --------- Co-authored-by: Matt Hill <mattnine@protonmail.com>
26 lines
660 B
TypeScript
26 lines
660 B
TypeScript
import * as T from "../../../base/lib/types"
|
|
|
|
export type InstallFn<Manifest extends T.Manifest, Store> = (opts: {
|
|
effects: T.Effects
|
|
}) => Promise<null>
|
|
export class Install<Manifest extends T.Manifest, Store> {
|
|
private constructor(readonly fn: InstallFn<Manifest, Store>) {}
|
|
static of<Manifest extends T.Manifest, Store>(
|
|
fn: InstallFn<Manifest, Store>,
|
|
) {
|
|
return new Install(fn)
|
|
}
|
|
|
|
async install({ effects }: Parameters<T.ExpectedExports.packageInit>[0]) {
|
|
await this.fn({
|
|
effects,
|
|
})
|
|
}
|
|
}
|
|
|
|
export function setupInstall<Manifest extends T.Manifest, Store>(
|
|
fn: InstallFn<Manifest, Store>,
|
|
) {
|
|
return Install.of(fn)
|
|
}
|