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:
GPT8
2024-09-07 18:10:15 +03:00
committed by GitHub
parent 03b570c85c
commit 31200609b6
6 changed files with 173 additions and 34 deletions
@@ -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());
+1
View File
@@ -53,6 +53,7 @@ export const runMigrations = async () => {
migration.name
}: ${error}`
);
process.exit(1);
}
isMigrated = true;