Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@flags.boolean({ description: 'Watch for file changes and re-build the project', alias: 'w' })
public watch: boolean
/**
* Allows watching for file changes
*/
@flags.boolean({
description: 'Turn off Typescript compiler by passing --no-compile',
default: true,
})
public compile: boolean
/**
* Arguments to pass to the `node` binary
*/
@flags.array({ description: 'CLI options to pass to the node command line' })
public nodeArgs: string[] = []
public async handle () {
const { Watcher } = await import('../src/Watcher')
const { Compiler } = await import('../src/Compiler')
const { BuildWatcher } = await import('../src/BuildWatcher')
const { ADONIS_ACE_CWD, ADONIS_IS_TYPESCRIPT, ADONIS_BUILD_DIR } = await import('../config/env')
const cwd = ADONIS_ACE_CWD()
/**
* Dis-allow when CWD is missing. It will always be set by `node ace`
* commands
*/
if (!cwd) {
this.logger.error(
import { HttpServer } from '../Services/HttpServer'
import { BuildWatcher } from '../Services/BuildWatcher'
import { getRcContents, SEVER_ENTRY_FILE, OUTDIR } from '../helpers'
/**
* Command to compile and start HTTP server for AdonisJs
* applications.
*/
export default class Serve extends BaseCommand {
public static commandName = 'serve'
public static description = 'Compile Typescript project to Javascript and start the development HTTP server'
@flags.boolean({ description: 'Build the project and watch for file changes' })
public watch: boolean
@flags.array({ description: 'Pass arguments to the node command' })
public nodeArgs: string[]
@flags.boolean({
description: 'Enable/disable the Typescript compiler, but still start the HTTP server',
default: true,
})
public compile: boolean
/**
* Reference to the project root. It always have to be
* the current working directory
*/
public projectRoot = process.cwd()
/**
* Compile and serve the project