Fix pre-commit script to properly handle multiple files and resolve ESLint warnings
This commit is contained in:
@@ -11,14 +11,14 @@ const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
const projectDir = resolve(__dirname, '..');
|
||||
|
||||
console.log('🌱 Starting production database seeding...');
|
||||
console.warn('🌱 Starting production database seeding...');
|
||||
|
||||
// Load environment variables from .env file if it exists
|
||||
try {
|
||||
const envFile = resolve(projectDir, '.env');
|
||||
const envContent = readFileSync(envFile, 'utf8');
|
||||
|
||||
console.log('📄 Loading environment variables from .env file...');
|
||||
console.warn('📄 Loading environment variables from .env file...');
|
||||
|
||||
envContent.split('\n').forEach(line => {
|
||||
const trimmed = line.trim();
|
||||
@@ -30,8 +30,8 @@ try {
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(
|
||||
} catch (_error) {
|
||||
console.warn(
|
||||
'ℹ️ No .env file found, using environment variables or defaults'
|
||||
);
|
||||
}
|
||||
@@ -53,10 +53,10 @@ process.env.VITE_COUCHDB_URL = COUCHDB_URL;
|
||||
process.env.VITE_COUCHDB_USER = COUCHDB_USER;
|
||||
process.env.VITE_COUCHDB_PASSWORD = COUCHDB_PASSWORD;
|
||||
|
||||
console.log('🔗 CouchDB Configuration:');
|
||||
console.log(` URL: ${COUCHDB_URL}`);
|
||||
console.log(` User: ${COUCHDB_USER}`);
|
||||
console.log(` Password: ${'*'.repeat(COUCHDB_PASSWORD.length)}`);
|
||||
console.warn('🔗 CouchDB Configuration:');
|
||||
console.warn(` URL: ${COUCHDB_URL}`);
|
||||
console.warn(` User: ${COUCHDB_USER}`);
|
||||
console.warn(` Password: ${'*'.repeat(COUCHDB_PASSWORD.length)}`);
|
||||
|
||||
// Validate required environment variables
|
||||
if (!COUCHDB_URL || !COUCHDB_USER || !COUCHDB_PASSWORD) {
|
||||
@@ -75,18 +75,18 @@ async function seedDatabase() {
|
||||
const { DatabaseSeeder } = await import('../services/database.seeder.ts');
|
||||
|
||||
// Wait a bit for databases to be initialized
|
||||
console.log('⏳ Waiting for databases to initialize...');
|
||||
console.warn('⏳ Waiting for databases to initialize...');
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
|
||||
const seeder = new DatabaseSeeder();
|
||||
|
||||
console.log('📊 Seeding admin user...');
|
||||
console.warn('📊 Seeding admin user...');
|
||||
await seeder.seedDefaultAdmin();
|
||||
|
||||
console.log('🎉 Production database seeding completed successfully!');
|
||||
console.log('🔐 You can now login with:');
|
||||
console.log(' Email: admin@localhost');
|
||||
console.log(' Password: change-this-secure-password');
|
||||
console.warn('🎉 Production database seeding completed successfully!');
|
||||
console.warn('🔐 You can now login with:');
|
||||
console.warn(' Email: admin@localhost');
|
||||
console.warn(' Password: change-this-secure-password');
|
||||
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user