diff --git a/commands/serve.ts b/commands/serve.ts index ba472208..6aca306d 100644 --- a/commands/serve.ts +++ b/commands/serve.ts @@ -30,7 +30,7 @@ export default class Serve extends BaseCommand { '', 'You can also start the server with HMR support using the following command.', '```', - '{{ binaryName }} serve --unstable-hmr', + '{{ binaryName }} serve --hmr', '```', '', 'The assets bundler dev server runs automatically after detecting vite config or webpack config files', @@ -47,7 +47,7 @@ export default class Serve extends BaseCommand { declare devServer: DevServer @flags.boolean({ description: 'Start the server with HMR support' }) - declare unstableHmr?: boolean + declare hmr?: boolean @flags.boolean({ description: 'Watch filesystem and restart the HTTP server on file change', @@ -120,14 +120,14 @@ export default class Serve extends BaseCommand { return } - if (this.watch && this.unstableHmr) { - this.logger.error('Cannot use --watch and --unstable-hmr flags together. Choose one of them') + if (this.watch && this.hmr) { + this.logger.error('Cannot use --watch and --hmr flags together. Choose one of them') this.exitCode = 1 return } this.devServer = new assembler.DevServer(this.app.appRoot, { - hmr: this.unstableHmr === true ? true : false, + hmr: this.hmr === true ? true : false, clearScreen: this.clear === false ? false : true, nodeArgs: this.parsed.nodeArgs, scriptArgs: [], diff --git a/tests/commands/serve.spec.ts b/tests/commands/serve.spec.ts index 6dce9483..0464a2b3 100644 --- a/tests/commands/serve.spec.ts +++ b/tests/commands/serve.spec.ts @@ -338,7 +338,7 @@ test.group('Serve command', () => { await sleep(1200) }) - test('error if --unstable-hmr and --watch are used together', async ({ assert, fs }) => { + test('error if --hmr and --watch are used together', async ({ assert, fs }) => { await fs.create('node_modules/ts-node/esm.js', '') const ace = await new AceFactory().make(fs.baseUrl, { @@ -347,15 +347,12 @@ test.group('Serve command', () => { ace.ui.switchMode('raw') - const command = await ace.create(Serve, ['--unstable-hmr', '--watch', '--no-clear']) + const command = await ace.create(Serve, ['--hmr', '--watch', '--no-clear']) await command.exec() assert.equal(command.exitCode, 1) assert.lengthOf(ace.ui.logger.getLogs(), 1) assert.equal(ace.ui.logger.getLogs()[0].stream, 'stderr') - assert.match( - ace.ui.logger.getLogs()[0].message, - /Cannot use --watch and --unstable-hmr flags together/ - ) + assert.match(ace.ui.logger.getLogs()[0].message, /Cannot use --watch and --hmr flags together/) }) })