mirror of
https://github.com/documenso/documenso.git
synced 2025-11-20 03:32:14 +10:00
fix: wip
This commit is contained in:
@ -1,28 +1,21 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
const seedDatabase = async () => {
|
||||
const files = fs.readdirSync(path.join(__dirname, './seed'));
|
||||
|
||||
for (const file of files) {
|
||||
const stat = fs.statSync(path.join(__dirname, './seed', file));
|
||||
|
||||
if (stat.isFile()) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const mod = require(path.join(__dirname, './seed', file));
|
||||
|
||||
if ('seedDatabase' in mod && typeof mod.seedDatabase === 'function') {
|
||||
console.log(`[SEEDING]: ${file}`);
|
||||
|
||||
try {
|
||||
await mod.seedDatabase();
|
||||
} catch (e) {
|
||||
console.log(`[SEEDING]: Seed failed for ${file}`);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// const files = fs.readdirSync(path.join(__dirname, './seed'));
|
||||
// for (const file of files) {
|
||||
// const stat = fs.statSync(path.join(__dirname, './seed', file));
|
||||
// if (stat.isFile()) {
|
||||
// // eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
// const mod = require(path.join(__dirname, './seed', file));
|
||||
// if ('seedDatabase' in mod && typeof mod.seedDatabase === 'function') {
|
||||
// console.log(`[SEEDING]: ${file}`);
|
||||
// try {
|
||||
// await mod.seedDatabase();
|
||||
// } catch (e) {
|
||||
// console.log(`[SEEDING]: Seed failed for ${file}`);
|
||||
// console.error(e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
};
|
||||
|
||||
seedDatabase()
|
||||
|
||||
Reference in New Issue
Block a user