Skip to content

Commit cd435ab

Browse files
authored
refactor: remove redundant type & fix nested template literals
1 parent 5540430 commit cd435ab

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

packages/webpack-cli/src/plugins/cli-plugin.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class CLIPlugin {
7070

7171
setupHelpfulOutput(compiler: Compiler) {
7272
const pluginName = "webpack-cli";
73-
const getCompilationName = () => (compiler.name ? `'${compiler.name}'` : "");
73+
const getCompilationName = () => (compiler.name ? ` '${compiler.name}'` : "");
7474
const logCompilation = (message: string) => {
7575
if (process.env.WEBPACK_CLI_START_FINISH_FORCE_LOG) {
7676
process.stderr.write(message);
@@ -84,13 +84,11 @@ export class CLIPlugin {
8484
compiler.hooks.run.tap(pluginName, () => {
8585
const name = getCompilationName();
8686

87-
logCompilation(`Compiler${name ? ` ${name}` : ""} starting... `);
87+
logCompilation(`Compiler${name} starting... `);
8888

8989
if (configPath) {
9090
this.logger.log(
91-
`Compiler${name ? ` ${name}` : ""} is using config: ${configPath
92-
.map((path) => `'${path}'`)
93-
.join(", ")}`,
91+
`Compiler${name} is using config: ${configPath.map((path) => `'${path}'`).join(", ")}`,
9492
);
9593
}
9694
});
@@ -106,10 +104,10 @@ export class CLIPlugin {
106104

107105
const name = getCompilationName();
108106

109-
logCompilation(`Compiler${name ? ` ${name}` : ""} starting... `);
107+
logCompilation(`Compiler${name} starting... `);
110108

111109
if (configPath) {
112-
this.logger.log(`Compiler${name ? ` ${name}` : ""} is using config: '${configPath}'`);
110+
this.logger.log(`Compiler${name} is using config: '${configPath}'`);
113111
}
114112
});
115113

@@ -125,11 +123,11 @@ export class CLIPlugin {
125123
() => {
126124
const name = getCompilationName();
127125

128-
logCompilation(`Compiler${name ? ` ${name}` : ""} finished`);
126+
logCompilation(`Compiler${name} finished`);
129127

130128
process.nextTick(() => {
131129
if (compiler.watchMode) {
132-
this.logger.log(`Compiler${name ? `${name}` : ""} is watching files for updates...`);
130+
this.logger.log(`Compiler${name} is watching files for updates...`);
133131
}
134132
});
135133
},

packages/webpack-cli/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ type WebpackDevServerOptions = DevServerConfig &
166166
Argv & {
167167
nodeEnv?: string;
168168
watchOptionsStdin?: boolean;
169-
progress?: boolean | "profile" | undefined;
169+
progress?: boolean | "profile";
170170
analyze?: boolean;
171171
prefetch?: string;
172172
json?: boolean;

0 commit comments

Comments
 (0)