improve legacy config warning message (#3142)

This commit is contained in:
Fred K. Schott 2022-04-19 03:08:44 -07:00 committed by GitHub
parent 0682832a54
commit 385046aaa7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -233,16 +233,16 @@ export async function validateConfig(
process.exit(1);
}
let oldConfig = false;
let legacyConfigKey: string | undefined;
for (const key of Object.keys(userConfig)) {
if (LEGACY_ASTRO_CONFIG_KEYS.has(key)) {
oldConfig = true;
legacyConfigKey = key;
break;
}
}
if (oldConfig) {
if (legacyConfigKey) {
throw new Error(
`Legacy configuration detected. Please update your configuration to the new format!\nSee https://astro.build/config for more information.`
`Legacy configuration detected: "${legacyConfigKey}".\nPlease update your configuration to the new format!\nSee https://astro.build/config for more information.`
);
}
/* eslint-enable no-console */