refactor(fastify): use ServerConfig type from core
This commit is contained in:
parent
97c04c21b9
commit
c4f8a2c779
4 changed files with 2389 additions and 6635 deletions
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -12,5 +12,8 @@
|
|||
"dependencies": {
|
||||
"@fastify/autoload": "6.3.1",
|
||||
"fastify": "5.8.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mcflyjs/core": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
9002
pnpm-lock.yaml
9002
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue