fix: pass flags to dev (#5840)
* fix: pass flags to dev * add changeset * Update .changeset/eleven-bulldogs-provide.md Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
This commit is contained in:
parent
c4b0cb8bf2
commit
cf2de5422c
3 changed files with 9 additions and 1 deletions
5
.changeset/eleven-bulldogs-provide.md
Normal file
5
.changeset/eleven-bulldogs-provide.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Persist CLI flags when restarting the dev server
|
|
@ -189,6 +189,7 @@ async function runCommand(cmd: string, flags: yargs.Arguments) {
|
||||||
await devServer(settings, {
|
await devServer(settings, {
|
||||||
configFlag,
|
configFlag,
|
||||||
configFlagPath,
|
configFlagPath,
|
||||||
|
flags,
|
||||||
logging,
|
logging,
|
||||||
telemetry,
|
telemetry,
|
||||||
handleConfigError(e) {
|
handleConfigError(e) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ import type http from 'http';
|
||||||
import type { AddressInfo } from 'net';
|
import type { AddressInfo } from 'net';
|
||||||
import { performance } from 'perf_hooks';
|
import { performance } from 'perf_hooks';
|
||||||
import * as vite from 'vite';
|
import * as vite from 'vite';
|
||||||
|
import yargs from 'yargs-parser';
|
||||||
import type { AstroSettings } from '../../@types/astro';
|
import type { AstroSettings } from '../../@types/astro';
|
||||||
import { info, LogOptions, warn } from '../logger/core.js';
|
import { info, LogOptions, warn } from '../logger/core.js';
|
||||||
import * as msg from '../messages.js';
|
import * as msg from '../messages.js';
|
||||||
|
@ -12,6 +13,7 @@ import { createContainerWithAutomaticRestart } from './restart.js';
|
||||||
export interface DevOptions {
|
export interface DevOptions {
|
||||||
configFlag: string | undefined;
|
configFlag: string | undefined;
|
||||||
configFlagPath: string | undefined;
|
configFlagPath: string | undefined;
|
||||||
|
flags: yargs.Arguments | undefined;
|
||||||
logging: LogOptions;
|
logging: LogOptions;
|
||||||
telemetry: AstroTelemetry;
|
telemetry: AstroTelemetry;
|
||||||
handleConfigError: (error: Error) => void;
|
handleConfigError: (error: Error) => void;
|
||||||
|
@ -35,7 +37,7 @@ export default async function dev(
|
||||||
|
|
||||||
// Create a container which sets up the Vite server.
|
// Create a container which sets up the Vite server.
|
||||||
const restart = await createContainerWithAutomaticRestart({
|
const restart = await createContainerWithAutomaticRestart({
|
||||||
flags: {},
|
flags: options.flags ?? {},
|
||||||
handleConfigError: options.handleConfigError,
|
handleConfigError: options.handleConfigError,
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
beforeRestart: () => console.clear(),
|
beforeRestart: () => console.clear(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue