Skip to content

Commit

Permalink
fix: correct the restart build message (#4156)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Dec 9, 2024
1 parent 9135ef4 commit aa9c7c3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/core/src/server/restart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,23 @@ const clearConsole = () => {
const beforeRestart = async ({
filePath,
clear = true,
id,
}: {
filePath?: string;
clear?: boolean;
} = {}): Promise<void> => {
id: string;
}): Promise<void> => {
if (clear) {
clearConsole();
}

if (filePath) {
const filename = path.basename(filePath);
logger.info(
`Restart server because ${color.yellow(filename)} is changed.\n`,
`Restart ${id} because ${color.yellow(filename)} is changed.\n`,
);
} else {
logger.info('Restarting server...\n');
logger.info(`Restarting ${id}...\n`);
}

for (const cleaner of cleaners) {
Expand All @@ -53,7 +55,7 @@ export const restartDevServer = async ({
filePath?: string;
clear?: boolean;
} = {}): Promise<void> => {
await beforeRestart({ filePath, clear });
await beforeRestart({ filePath, clear, id: 'server' });

const rsbuild = await init({ isRestart: true });

Expand All @@ -73,7 +75,7 @@ export const restartBuild = async ({
filePath?: string;
clear?: boolean;
} = {}): Promise<void> => {
await beforeRestart({ filePath, clear });
await beforeRestart({ filePath, clear, id: 'build' });

const rsbuild = await init({ isRestart: true, isBuildWatch: true });

Expand Down

1 comment on commit aa9c7c3

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ran ecosystem CI: Open

suite result
modernjs ❌ failure
plugins ✅ success
rspress ✅ success
rslib ✅ success
examples ✅ success

Please sign in to comment.