### npm Scripts for Project Development and Build
Source: https://context7.com/kaktaknet/n8n-mcp.ru/llms.txt
Standard npm scripts are provided for managing the project's lifecycle. This includes installing dependencies with `pnpm install`, starting a local development server with `pnpm dev`, building the production site with `pnpm build`, and previewing the production build locally using `pnpm preview`. The scripts also allow direct execution of Astro CLI commands via `pnpm astro`.
```bash
# Install dependencies
pnpm install
# Start development server at http://localhost:4321
pnpm dev
# Build production site with post-build cleanup
pnpm build
# Preview production build locally
pnpm preview
# Run Astro CLI commands directly
pnpm astro
```
--------------------------------
### Post-Build HTML Cleanup Script (JavaScript)
Source: https://context7.com/kaktaknet/n8n-mcp.ru/llms.txt
This Node.js script traverses a 'dist' directory to find and clean HTML files. It specifically removes meta tags generated by frameworks like Astro and Starlight to produce cleaner production output. The script uses Node.js built-in 'fs/promises' for file operations.
```javascript
import { readdir, readFile, writeFile, stat } from 'fs/promises'
import { join } from 'path'
const DIST_DIR = 'dist'
async function getHtmlFiles(dir) {
const files = []
const entries = await readdir(dir, { withFileTypes: true })
for (const entry of entries) {
const fullPath = join(dir, entry.name)
if (entry.isDirectory()) {
files.push(...(await getHtmlFiles(fullPath)))
} else if (entry.name.endsWith('.html')) {
files.push(fullPath)
}
}
return files
}
async function cleanHtmlFile(filePath) {
let content = await readFile(filePath, 'utf-8')
let modified = false
// Remove Astro generator meta tag
const astroRegex = //gi
if (astroRegex.test(content)) {
content = content.replace(astroRegex, '')
modified = true
}
// Remove Starlight generator meta tag
const starlightRegex = //gi
if (starlightRegex.test(content)) {
content = content.replace(starlightRegex, '')
modified = true
}
if (modified) {
content = content.replace(/\n\s*\n\s*\n/g, '\n\n')
await writeFile(filePath, content, 'utf-8')
console.log(`Cleaned: ${filePath}`)
}
}
async function main() {
console.log('Post-build: Removing generator meta tags...')
try {
const files = await getHtmlFiles(DIST_DIR)
console.log(`Found ${files.length} HTML files`)
for (const file of files) {
await cleanHtmlFile(file)
}
console.log('Post-build: Complete!')
} catch (error) {
console.error('Post-build error:', error)
process.exit(1)
}
}
main()
```
--------------------------------
### Astro SDKCard Component for Language-Specific SDKs
Source: https://context7.com/kaktaknet/n8n-mcp.ru/llms.txt
The SDKCard component displays information about SDKs for various programming languages, utilizing devicon integrations for visual representation. It supports languages like Python, TypeScript, PHP, Rust, and Go, along with others. The component takes language, title, description, and link as props, with an optional badge, and applies distinct accent colors based on the specified programming language.
```astro
---
import IconPython from '~icons/devicon/python'
import IconTypescript from '~icons/devicon/typescript'
import IconPhp from '~icons/devicon/php'
import IconRust from '~icons/devicon/rust'
import IconGo from '~icons/devicon/go'
interface Props {
lang: 'python' | 'typescript' | 'php' | 'rust' | 'go' | 'csharp' | 'java' | 'kotlin' | 'ruby' | 'swift';
title: string;
description: string;
href: string;
badge?: string;
}
const { lang, title, description, href, badge } = Astro.props;
const icons = {
python: IconPython,
typescript: IconTypescript,
php: IconPhp,
rust: IconRust,
go: IconGo,
// ... other languages
};
const langColors = {
python: '#3776AB',
typescript: '#3178C6',
php: '#777BB4',
rust: '#DEA584',
go: '#00ADD8',
// ... other colors
};
const IconComponent = icons[lang];
---
{description}{title}
{badge && {badge}}
{description}