Skip to content

Commit 480102d

Browse files
committed
refactor: remove console clearing option from dev command and clean up related code
1 parent cc4ef0c commit 480102d

2 files changed

Lines changed: 3 additions & 34 deletions

File tree

src/commands/project.commands.ts

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,11 @@ async function buildTsxArgs(opinionated: boolean): Promise<Array<string>> {
6868
*
6969
* @param opinionated - Whether to use opinionated configuration
7070
* @param verbose - Whether to show verbose nodemon output (for debugging)
71-
* @param clear - Whether to clear console on restart (default: true)
7271
* @returns The nodemon arguments array
7372
*/
7473
async function buildDevArgs(
7574
opinionated: boolean,
7675
verbose: boolean = false,
77-
clear: boolean = true,
7876
): Promise<Array<string>> {
7977
const tsxArgs = await buildTsxArgs(opinionated);
8078

@@ -85,14 +83,6 @@ async function buildDevArgs(
8583
args.push("--quiet");
8684
}
8785

88-
// Build the exec command with optional clear
89-
const clearCmd = clear
90-
? os.platform() === "win32"
91-
? "cls &&"
92-
: "clear &&"
93-
: "";
94-
const execCommand = `${clearCmd} tsx ${tsxArgs.join(" ")}`.trim();
95-
9686
// Core nodemon configuration
9787
args.push(
9888
"--signal",
@@ -108,7 +98,7 @@ async function buildDevArgs(
10898
"--ignore",
10999
"src/**/*.test.ts",
110100
"--exec",
111-
execCommand,
101+
`tsx ${tsxArgs.join(" ")}`,
112102
);
113103

114104
return args;
@@ -119,7 +109,6 @@ async function buildDevArgs(
119109
*/
120110
interface DevCommandOptions {
121111
verbose?: boolean;
122-
clear?: boolean;
123112
}
124113

125114
/**
@@ -137,19 +126,9 @@ export const devCommand: CommandModule<object, DevCommandOptions> = {
137126
default: false,
138127
description: "Show verbose nodemon output for debugging",
139128
},
140-
clear: {
141-
alias: "c",
142-
type: "boolean",
143-
default: true,
144-
description: "Clear console on restart (default: true)",
145-
},
146129
},
147130
handler: async (argv) => {
148-
await runCommand({
149-
command: "dev",
150-
verbose: argv.verbose,
151-
clear: argv.clear,
152-
});
131+
await runCommand({ command: "dev", verbose: argv.verbose });
153132
},
154133
};
155134

@@ -373,7 +352,6 @@ const clearScreen = () => {
373352
interface RunCommandOptions {
374353
command: string;
375354
verbose?: boolean;
376-
clear?: boolean;
377355
}
378356

379357
/**
@@ -383,7 +361,6 @@ interface RunCommandOptions {
383361
export const runCommand = async ({
384362
command,
385363
verbose = false,
386-
clear = true,
387364
}: RunCommandOptions): Promise<void> => {
388365
const { opinionated, entryPoint } = await Compiler.loadConfig();
389366
const outDir = getOutDir();
@@ -393,7 +370,7 @@ export const runCommand = async ({
393370
case "dev":
394371
await execCmd(
395372
"nodemon",
396-
await buildDevArgs(opinionated, verbose, clear),
373+
await buildDevArgs(opinionated, verbose),
397374
);
398375
break;
399376
case "build":

src/utils/cli-ui.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,6 @@ export async function printGenerateSuccess(
120120
log("INFO", schematic, `${file.split(".")[0]} created!`, "✔️");
121121
}
122122

123-
/**
124-
* Clear the console
125-
*/
126-
export function clearConsole(): void {
127-
// Clear console and move cursor to top-left
128-
stdout.write("\x1Bc");
129-
}
130-
131123
/**
132124
* Print the ExpressoTS CLI header
133125
*/

0 commit comments

Comments
 (0)