mirror of
https://github.com/StepanovPlaton/AboutMe.git
synced 2026-04-03 20:30:49 +04:00
Fixes
This commit is contained in:
@@ -19,12 +19,12 @@ function detectPlatform() {
|
||||
if (process.env.GITHUB_ACTIONS) {
|
||||
return 'github';
|
||||
}
|
||||
|
||||
|
||||
// Check if specific directories exist
|
||||
if (existsSync('.vercel')) {
|
||||
return 'vercel';
|
||||
}
|
||||
|
||||
|
||||
// Default to standard dist directory
|
||||
return 'default';
|
||||
}
|
||||
@@ -38,7 +38,7 @@ function getPagefindOutputDir(platform) {
|
||||
github: 'dist',
|
||||
default: 'dist'
|
||||
};
|
||||
|
||||
|
||||
return outputDirs[platform] || 'dist';
|
||||
}
|
||||
|
||||
@@ -46,34 +46,34 @@ function getPagefindOutputDir(platform) {
|
||||
function main() {
|
||||
const platform = detectPlatform();
|
||||
const outputDir = getPagefindOutputDir(platform);
|
||||
|
||||
|
||||
console.log(`🚀 Detected deployment platform: ${platform}`);
|
||||
console.log(`📁 Pagefind output directory: ${outputDir}`);
|
||||
|
||||
|
||||
try {
|
||||
// Run Astro build
|
||||
console.log('🔨 Running Astro build...');
|
||||
execSync(`npx astro build`.trim(), {
|
||||
execSync(`npx astro build`.trim(), {
|
||||
stdio: 'inherit',
|
||||
cwd: process.cwd() // Ensure in the correct directory
|
||||
});
|
||||
|
||||
|
||||
// Check if output directory exists
|
||||
if (!existsSync(outputDir)) {
|
||||
console.error(`❌ Output directory does not exist: ${outputDir}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
// Run Pagefind
|
||||
console.log(`🔍 Running Pagefind search index generation...`);
|
||||
execSync(`npx pagefind --site ${outputDir}`, {
|
||||
stdio: 'inherit',
|
||||
cwd: process.cwd() // Ensure in the correct directory
|
||||
});
|
||||
|
||||
|
||||
console.log('✅ Build completed!');
|
||||
console.log(`📊 Search index generated at: ${outputDir}/pagefind/`);
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Build failed:', error.message);
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user