Files
klz-cables.com/.pnpm-store/v10/files/8b/7a4e8effa5bdd16f1c080289173af3bcd87c436e616da6c5547409eb30093967c12cbd91e0ebfb46666b9f1633a54784090c1f93541e96bd07b6200acb8042
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

33 lines
1.2 KiB
Plaintext

import fs from 'fs';
import path from 'path';
import { dynamicImport } from '../../utilities/dynamicImport.js';
/**
* Read the migration files from disk
*/ export const readMigrationFiles = async ({ payload })=>{
if (!fs.existsSync(payload.db.migrationDir)) {
payload.logger.error({
msg: `No migration directory found at ${payload.db.migrationDir}`
});
return [];
}
payload.logger.info({
msg: `Reading migration files from ${payload.db.migrationDir}`
});
const files = fs.readdirSync(payload.db.migrationDir).sort().filter((f)=>{
return (f.endsWith('.ts') || f.endsWith('.js')) && f !== 'index.js' && f !== 'index.ts';
}).map((file)=>{
return path.resolve(payload.db.migrationDir, file);
});
return Promise.all(files.map(async (filePath)=>{
const migrationModule = await dynamicImport(filePath);
const migration = 'default' in migrationModule ? migrationModule.default : migrationModule;
const result = {
name: path.basename(filePath).split('.')[0],
down: migration.down,
up: migration.up
};
return result;
}));
};
//# sourceMappingURL=readMigrationFiles.js.map