@flightdev/adapter-static
v0.0.7
Published
Static adapter for Flight Framework - generate static HTML files
Readme
@flightdev/adapter-static
Static site generation adapter for Flight Framework. Pre-render all pages at build time.
Table of Contents
Installation
npm install @flightdev/adapter-staticQuick Start
// flight.config.ts
import { defineConfig } from '@flightdev/core';
import static_ from '@flightdev/adapter-static';
export default defineConfig({
adapter: static_(),
});Configuration
static_({
// Output directory
outDir: 'dist',
// Generate 404.html
fallback: '404.html',
// Prerender all routes
prerender: true,
// Routes to prerender (if not auto-detected)
pages: ['/', '/about', '/contact'],
// Trailing slashes
trailingSlash: true,
});Dynamic Routes
For routes like /blog/[slug], export generateStaticParams:
// src/routes/blog/[slug].page.tsx
export async function generateStaticParams() {
const posts = await getPosts();
return posts.map(post => ({
slug: post.slug,
}));
}
export default function BlogPost({ params }) {
// ...
}Build Output
dist/
├── index.html
├── about/
│ └── index.html
├── blog/
│ ├── hello-world/
│ │ └── index.html
│ └── another-post/
│ └── index.html
├── 404.html
└── assets/
├── style.css
└── main.jsHosting
GitHub Pages
# .github/workflows/deploy.yml
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci && npm run build
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./distNetlify / Vercel
Just configure the build command and publish directory in the dashboard.
Nginx
server {
listen 80;
root /var/www/mysite/dist;
location / {
try_files $uri $uri/ /index.html;
}
}License
MIT
