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
|
* Call with the configuration to get a standard getConfig for the expected exports
|
||||||
* Assumption: start9/config.yaml is where the config will be stored
|
* Assumption: start9/config.yaml is where the config will be stored
|
||||||
* Throws: Error if there is no file
|
* 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
|
* @param spec
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
@@ -28,6 +28,7 @@ export const getConfig = (spec: ConfigSpec): ExpectedExports.getConfig =>
|
|||||||
effects.info(`Got error ${e} while trying to read the config`);
|
effects.info(`Got error ${e} while trying to read the config`);
|
||||||
return undefined;
|
return undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
result: {
|
result: {
|
||||||
config,
|
config,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export function updateConfig<
|
|||||||
version extends string,
|
version extends string,
|
||||||
type extends "up" | "down",
|
type extends "up" | "down",
|
||||||
>(
|
>(
|
||||||
fn: (config: T.Config) => T.Config,
|
fn: (config: T.Config, effects: T.Effects) => T.Config,
|
||||||
configured: boolean,
|
configured: boolean,
|
||||||
noRepeat?: NoRepeat<version, type>,
|
noRepeat?: NoRepeat<version, type>,
|
||||||
noFail = false,
|
noFail = false,
|
||||||
@@ -30,7 +30,7 @@ export function updateConfig<
|
|||||||
let config = util.unwrapResultType(await getConfig({})(effects)).config;
|
let config = util.unwrapResultType(await getConfig({})(effects)).config;
|
||||||
if (config) {
|
if (config) {
|
||||||
try {
|
try {
|
||||||
config = fn(config);
|
config = fn(config, effects);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!noFail) {
|
if (!noFail) {
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
Reference in New Issue
Block a user