Files
klz-cables.com/.pnpm-store/v10/files/ac/cd9f09ba0dbc86b5f8987271365165980bd808578a02af5aabe9a44a3368f504e33e1081671478d54f28451407dfb91ae151f1f651cfd07fe5e492a0b34530
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

40 lines
1.2 KiB
Plaintext

import fs from 'fs';
import path from 'path';
/**
* Attempt to find migrations directory.
*
* Checks for the following directories in order:
* - `migrationDir` argument from Payload config
* - `src/migrations`
* - `dist/migrations`
* - `migrations`
*
* @param migrationDir
* @default src/migrations`, if the src folder does not exists - migrations.
* @returns
*/ export const findMigrationDir = (migrationDir)=>{
const cwd = process.cwd();
const srcMigrationsDir = path.resolve(cwd, 'src/migrations');
const distMigrationsDir = path.resolve(cwd, 'dist/migrations');
const relativeMigrations = path.resolve(cwd, 'migrations');
// Use arg if provided
if (migrationDir) {
return migrationDir;
}
// Check other common locations
if (fs.existsSync(srcMigrationsDir)) {
return srcMigrationsDir;
}
if (fs.existsSync(distMigrationsDir)) {
return distMigrationsDir;
}
if (fs.existsSync(relativeMigrations)) {
return relativeMigrations;
}
if (fs.existsSync(path.resolve(cwd, 'src'))) {
return srcMigrationsDir;
}
return relativeMigrations;
};
//# sourceMappingURL=findMigrationDir.js.map