import path from 'node:path'
import { fileURLToPath } from 'node:url'

import { renderPublicSearchAssets } from './render-public-search-assets-lib.mjs'

const __dirname = path.dirname(fileURLToPath(import.meta.url))

const registryPath = path.join(__dirname, '..', 'src', 'public-route-registry.json')
const policyPath = path.join(__dirname, '..', 'src', 'public-search-policy.json')
const sitemapPath = path.join(__dirname, '..', 'public', 'sitemap.xml')
const robotsPath = path.join(__dirname, '..', 'public', 'robots.txt')

const rendered = await renderPublicSearchAssets({
  registryPath,
  policyPath,
  sitemapPath,
  robotsPath,
})

console.log(
  `Rendered public search assets for ${rendered.crawlableRoutes.length} crawlable routes and ${rendered.crawlerDisallowPaths.length} crawler disallow rules.`,
)
