2022-11-15 01:49:34 +00:00
|
|
|
import {Application, CommandLineApplication, Foreground} from '@extollo/lib'
|
2022-03-29 12:55:55 +00:00
|
|
|
import {Units} from './Units.extollo'
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Helper functions to bootstrap the Application instance for different uses.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the base application with no final-target unit.
|
|
|
|
*/
|
|
|
|
export function base(): Application {
|
|
|
|
const app = Application.getApplication()
|
|
|
|
app.scaffold(__dirname, Units.slice(0, -1))
|
|
|
|
return app
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the application with the final unit replaced with the CommandLineApplication
|
|
|
|
* for use on the CLI.
|
|
|
|
*/
|
|
|
|
export function cli(): Application {
|
|
|
|
const app = Application.getApplication()
|
|
|
|
app.forceStartupMessage = false
|
|
|
|
|
2022-11-15 01:49:34 +00:00
|
|
|
const units = [...Units, CommandLineApplication]
|
2022-03-29 12:55:55 +00:00
|
|
|
|
|
|
|
app.scaffold(__dirname, units)
|
|
|
|
return app
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the application as it should be run normally.
|
|
|
|
*/
|
|
|
|
export function app(): Application {
|
|
|
|
const app = Application.getApplication()
|
2022-11-15 01:49:34 +00:00
|
|
|
|
|
|
|
const units = [...Units]
|
|
|
|
units.push(Foreground)
|
|
|
|
|
|
|
|
app.scaffold(__dirname, units)
|
2022-03-29 12:55:55 +00:00
|
|
|
return app
|
|
|
|
}
|