fix migrations (#414)
* refactor(config.ts): improve code readability by formatting array elements and conditions * fix(migrations): handle undefined values correctly when setting default config values * fix(migrations): ensure process exits with error code on migration failure * fix(commit.ts): update error handling to provide clearer feedback when commit message generation fails * feat(config.ts): add cleanUndefinedValues function to sanitize config values by converting 'undefined' and 'null' strings to actual values * refactor(config.ts): return cleaned config from getConfig function to ensure consistent data types * chore(migrations): log entriesToSet in migration to assist with debugging and tracking changes
This commit is contained in:
@@ -10,10 +10,12 @@ export default function () {
|
||||
const entriesToSet: [key: string, value: string | boolean | number][] = [];
|
||||
for (const entry of Object.entries(DEFAULT_CONFIG)) {
|
||||
const [key, _value] = entry;
|
||||
if (config[key] === 'undefined') entriesToSet.push(entry);
|
||||
if (config[key] === 'undefined' || config[key] === undefined)
|
||||
entriesToSet.push(entry);
|
||||
}
|
||||
|
||||
if (entriesToSet.length > 0) setConfig(entriesToSet);
|
||||
console.log(entriesToSet);
|
||||
};
|
||||
|
||||
setDefaultConfigValues(getGlobalConfig());
|
||||
|
||||
@@ -53,6 +53,7 @@ export const runMigrations = async () => {
|
||||
migration.name
|
||||
}: ${error}`
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
isMigrated = true;
|
||||
|
||||
Reference in New Issue
Block a user