Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 7e0671e

Browse files
author
Je
committed
refactor: improve cli
1 parent 40617da commit 7e0671e

File tree

5 files changed

+12
-15
lines changed

5 files changed

+12
-15
lines changed

cli.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import { version } from './version.ts'
77

88
const commands = {
99
'init': 'Initiate a new aleph app.',
10-
'dev': 'Starts the aleph app in development mode.',
11-
'start': 'Starts the aleph app in production mode.',
12-
'build': 'Builds the aleph app in production mode.',
10+
'dev': 'Start the aleph app in development mode.',
11+
'start': 'Start the aleph app in production mode.',
12+
'build': 'Build the aleph app in production mode.',
1313
'upgrade': 'Upgrade the aleph command.'
1414
}
1515
const helpMessage = `Aleph.js v${version}

cli/build.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import Project from '../project.ts'
2-
31
export const helpMessage = `
42
Usage:
53
aleph build <dir> [...options]
@@ -13,6 +11,7 @@ Options:
1311
`
1412

1513
export default async function (appDir: string, options: Record<string, string | boolean>) {
14+
const { Project } = await import('../project.ts')
1615
const project = new Project(appDir, 'production')
1716
await project.build()
1817
Deno.exit(0)

cli/dev.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { start } from '../server.ts'
2-
31
export const helpMessage = `
42
Usage:
53
aleph dev <dir> [...options]
@@ -14,6 +12,7 @@ Options:
1412
-h, --help Prints help message
1513
`
1614

17-
export default function (appDir: string, options: { port?: string, p?: string }) {
15+
export default async function (appDir: string, options: { port?: string, p?: string }) {
16+
const { start } = await import('../server.ts')
1817
start(appDir, parseInt(options.port || options.p || '8080') || 8080, true)
1918
}

cli/init.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ export default async function (appDir: string, options: Record<string, string |
4040

4141
log.info('Done')
4242
log.info('---')
43-
log.info(colors.dim('Aleph is ready to Go.'))
43+
log.info(colors.dim('Aleph App is ready to Go.'))
4444
log.info(`${colors.dim('$')} cd ` + path.basename(appDir))
45-
log.info(`start(dev) : ${colors.dim('$')} ${colors.bold('aleph')} dev`)
46-
log.info(`start(prod): ${colors.dim('$')} ${colors.bold('aleph')} start`)
47-
log.info(`build(prod): ${colors.dim('$')} ${colors.bold('aleph')} build`)
45+
log.info(`${colors.dim('$')} aleph ${colors.bold('dev')} ${colors.dim('# start the app in development mode')}`)
46+
log.info(`${colors.dim('$')} aleph ${colors.bold('start')} ${colors.dim('# start the app in production mode')}`)
47+
log.info(`${colors.dim('$')} aleph ${colors.bold('build')} ${colors.dim('# build the app in production mode')}`)
4848
log.info('---')
4949
Deno.exit(0)
5050
}

cli/start.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { start } from '../server.ts'
2-
31
export const helpMessage = `
42
Usage:
53
aleph start <dir> [...options]
@@ -13,6 +11,7 @@ Options:
1311
-h, --help Prints help message
1412
`
1513

16-
export default function (appDir: string, options: Record<string, string | boolean>) {
14+
export default async function (appDir: string, options: Record<string, string | boolean>) {
15+
const { start } = await import('../server.ts')
1716
start(appDir, parseInt(String(options.port || options.p)) || 8080)
1817
}

0 commit comments

Comments
 (0)