refactor(fastify): use ServerConfig type from core

This commit is contained in:
ayo 2026-06-04 15:50:44 +02:00
parent 97c04c21b9
commit c4f8a2c779
4 changed files with 2389 additions and 6635 deletions

View file

@ -1,6 +1,18 @@
#!/usr/bin/env node
import { defineCommand, runMain, type ArgsDef, type CommandDef } from 'citty'
export type Logger = {
log: Function
error: Function
}
export type ServerConfig = {
rootDir: string
apiDir: string
port: number
logger: Logger
}
const main: CommandDef<ArgsDef> = defineCommand({
meta: {
name: 'mcfly',

View file

@ -12,5 +12,8 @@
"dependencies": {
"@fastify/autoload": "6.3.1",
"fastify": "5.8.5"
},
"devDependencies": {
"@mcflyjs/core": "workspace:*"
}
}

View file

@ -2,6 +2,13 @@ import Fastify from 'fastify'
import AutoLoad from '@fastify/autoload'
import path from 'node:path'
/**
* @typedef {import('@mcflyjs/core').ServerConfig} ServerConfig
*/
/**
* @param {ServerConfig} param
*/
export default ({ rootDir, apiDir, logger, port }) => {
const server = Fastify()
const portNumber = port ?? 3000

File diff suppressed because it is too large Load diff