mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 02:11:56 +00:00
feat: Add the effects to the migrations
This commit is contained in:
@@ -11,7 +11,7 @@ const matchConfig = dictionary([string, any]);
|
||||
* Call with the configuration to get a standard getConfig for the expected exports
|
||||
* Assumption: start9/config.yaml is where the config will be stored
|
||||
* Throws: Error if there is no file
|
||||
* Throws: Error if the config.yaml isn't yaml nor config shape
|
||||
* Throws: Error if the config.yaml isn't yaml nor config shape
|
||||
* @param spec
|
||||
* @returns
|
||||
*/
|
||||
@@ -28,6 +28,7 @@ export const getConfig = (spec: ConfigSpec): ExpectedExports.getConfig =>
|
||||
effects.info(`Got error ${e} while trying to read the config`);
|
||||
return undefined;
|
||||
});
|
||||
|
||||
return {
|
||||
result: {
|
||||
config,
|
||||
|
||||
@@ -20,7 +20,7 @@ export function updateConfig<
|
||||
version extends string,
|
||||
type extends "up" | "down",
|
||||
>(
|
||||
fn: (config: T.Config) => T.Config,
|
||||
fn: (config: T.Config, effects: T.Effects) => T.Config,
|
||||
configured: boolean,
|
||||
noRepeat?: NoRepeat<version, type>,
|
||||
noFail = false,
|
||||
@@ -30,7 +30,7 @@ export function updateConfig<
|
||||
let config = util.unwrapResultType(await getConfig({})(effects)).config;
|
||||
if (config) {
|
||||
try {
|
||||
config = fn(config);
|
||||
config = fn(config, effects);
|
||||
} catch (e) {
|
||||
if (!noFail) {
|
||||
throw e;
|
||||
|
||||
Reference in New Issue
Block a user