generate-block-index.mjs

_scripts/generate-block-index.mjs
import { readdir, writeFile } from 'fs/promises'
import { join, dirname } from 'path'
import { fileURLToPath } from 'url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const SRC_DIR = join(__dirname, '../src')
const APP_DIR = join(SRC_DIR, 'app')
const BLOCK_INDEX_PATH = join(
APP_DIR,
'(demo)/block/[[...slug]]/_block-index.ts'
)
// Recursively find all _blocks/ directories under src/app/
async function findBlocksDirs(dir) {
const entries = await readdir(dir, { withFileTypes: true })
const results = []
for (const entry of entries) {

Showing the first 20 lines.

Get full code

Support

Talk to the developers of this project to learn more

We have been building professional websites for big clients for over 15 years. Gallop templates and blocks is our best foundation for SEO websites and web apps.

© 2026 Web Plant Media, LLC