mcfly/packages/core/src/commands/prepare.ts
Ayo 08c2497fab feat: use fastify as server
- remove nitropack
- new @mcflyjs/fastify package
- test-core workspace for testing the new setup
2026-05-25 22:43:15 +02:00

44 lines
1,000 B
JavaScript
Executable file

#!/usr/bin/env node
import { consola } from 'consola'
import { defineCommand, type ParsedArgs } from 'citty'
import { resolve } from 'pathe'
import { getMcFlyConfig } from '../get-config.js'
async function prepare(args: ParsedArgs) {
consola.start('Preparing McFly workspace...')
let err
try {
// TODO: check for dir type (should be string)
const dir: string = args.dir?.toString() || args._dir?.toString() || '.'
const rootDir = resolve(dir)
const { mcflyConfig } = await getMcFlyConfig()
consola.info({ mcflyConfig, rootDir })
} catch (e) {
consola.error(e)
err = e
}
if (err) {
consola.fail(
'McFly workspace preparation failed. Please make sure dependencies are installed.\n'
)
} else consola.success('Done\n')
}
export default defineCommand({
meta: {
name: 'prepare',
description: 'Prepares the McFly workspace.',
},
async run({ args }) {
await prepare(args)
},
})
export const exportedForTest = {
prepare,
}