chore: update the version and add the setupInit section

This commit is contained in:
BluJ
2023-04-25 14:36:43 -06:00
parent 5107d38547
commit 1b9e2cf503
11 changed files with 155 additions and 58 deletions

24
lib/inits/setupInit.ts Normal file
View File

@@ -0,0 +1,24 @@
import { ExpectedExports } from "../types";
import { Migrations } from "./migrations/setupMigrations";
import { Install } from "./setupInstall";
import { Uninstall } from "./setupUninstall";
export function setupInit<WrapperData>(
migrations: Migrations,
install: Install<WrapperData>,
uninstall: Uninstall<WrapperData>,
): {
init: ExpectedExports.init;
uninit: ExpectedExports.uninit;
} {
return {
init: async (opts) => {
await migrations.init(opts);
await install.init(opts);
},
uninit: async (opts) => {
await migrations.uninit(opts);
await uninstall.uninit(opts);
},
};
}