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

Commit 7f98792

Browse files
committed
Fix build command hang up in dev mode
1 parent cd1a438 commit 7f98792

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

cli.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { bold } from 'https://deno.land/[email protected]/fmt/colors.ts'
22
import { basename, resolve } from 'https://deno.land/[email protected]/path/mod.ts'
33
import { parse } from 'https://deno.land/[email protected]/flags/mod.ts'
44
import { loadImportMap } from './server/config.ts'
5+
import { checkAlephDevEnv } from './server/helper.ts'
56
import { existsDir, findFile } from './shared/fs.ts'
67
import log from './shared/log.ts'
78
import util from './shared/util.ts'
@@ -91,6 +92,8 @@ async function main() {
9192
log.fatal('No such directory:', workingDir)
9293
}
9394

95+
checkAlephDevEnv()
96+
9497
// run the command if import maps exists
9598
const importMapFile = await findFile(workingDir, ['import_map', 'import-map', 'importmap', 'importMap'].map(name => `${name}.json`))
9699
if (importMapFile) {
@@ -149,8 +152,11 @@ async function run(name: string, version: string, importMap?: string) {
149152
stdout: 'inherit',
150153
stderr: 'inherit'
151154
})
152-
const c = await p.status()
155+
await p.status()
153156
p.close()
157+
if (name === 'build') {
158+
Deno.exit(0)
159+
}
154160
}
155161

156162
if (import.meta.main) {

commands/build.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,4 @@ if (import.meta.main) {
2828

2929
const aleph = new Aleph(workingDir, 'production', Boolean(options.r || options.reload))
3030
await aleph.build()
31-
Deno.exit(0)
3231
}

server/aleph.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { Analyzer } from './analyzer.ts'
2525
import { cache } from './cache.ts'
2626
import { defaultConfig, fixConfig, getDefaultImportMap, loadConfig, loadImportMap } from './config.ts'
2727
import {
28-
checkAlephDev, checkDenoVersion, clearBuildCache, decoder, encoder, getAlephPkgUri,
28+
checkDenoVersion, clearBuildCache, decoder, encoder, getAlephPkgUri,
2929
getSourceType, isLocalhostUrl, loadPlugin, moduleExclude, toLocalPath, toRelativePath,
3030
} from './helper.ts'
3131
import { getContentType } from './mime.ts'
@@ -89,7 +89,6 @@ export class Aleph implements IAleph {
8989
reload = false
9090
) {
9191
checkDenoVersion()
92-
checkAlephDev()
9392
this.#mode = mode
9493
this.#workingDir = resolve(workingDir)
9594
this.#buildDir = join(this.#workingDir, '.aleph', mode)

server/helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function checkDenoVersion() {
5454
Deno.exit(1)
5555
}
5656

57-
export function checkAlephDev() {
57+
export function checkAlephDevEnv() {
5858
const v = Deno.env.get('ALEPH_DEV')
5959
if (v !== undefined && !_localProxy) {
6060
localProxy(Deno.cwd(), 2020)

0 commit comments

Comments
 (0)