0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-27 22:19:04 -05:00

fix bug in prompt logic

This commit is contained in:
Fred K. Schott 2024-02-04 00:44:52 -08:00
parent 54a981cd5c
commit 1c69feecf0

View file

@ -97,20 +97,21 @@ async function pushSchema({
const confirmations = missingMigrationContents.reduce((acc, curr) => { const confirmations = missingMigrationContents.reduce((acc, curr) => {
return [...acc, ...(curr.confirm || [])]; return [...acc, ...(curr.confirm || [])];
}, [] as string[]); }, [] as string[]);
if (confirmations.length > 0) {
const response = await prompts([ const response = await prompts([
...confirmations.map((message, index) => ({ ...confirmations.map((message, index) => ({
type: 'confirm' as const, type: 'confirm' as const,
name: String(index), name: String(index),
message: red('Warning: ') + message + '\nContinue?', message: red('Warning: ') + message + '\nContinue?',
initial: true, initial: true,
})), })),
]); ]);
if ( if (
Object.values(response).length === 0 || Object.values(response).length === 0 ||
Object.values(response).some((value) => value === false) Object.values(response).some((value) => value === false)
) { ) {
process.exit(1); process.exit(1);
}
} }
// combine all missing migrations into a single batch // combine all missing migrations into a single batch