Skip to content

Commit 7bd747a

Browse files
chore(init): remove --force flag (#2391)
1 parent 7092a72 commit 7bd747a

File tree

6 files changed

+3
-85
lines changed

6 files changed

+3
-85
lines changed

INIT.md

-6
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,6 @@ webpack-cli init
8181
webpack-cli init --auto
8282
```
8383

84-
**To force config generation**
85-
86-
```bash
87-
webpack-cli init --force
88-
```
89-
9084
**To scaffold in a specified path**
9185

9286
```bash

packages/generators/src/utils/modify-config-helper.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export function modifyHelperUtil(
3939
configFile: string = DEFAULT_WEBPACK_CONFIG_FILENAME,
4040
packages?: string[],
4141
autoSetDefaults = false,
42-
generateConfig = false,
4342
generationPath = '.',
4443
): void {
4544
const configPath: string | null = null;
@@ -135,7 +134,7 @@ export function modifyHelperUtil(
135134
) as TransformConfig;
136135

137136
// scaffold webpack config file from using .yo-rc.json
138-
return runTransform(transformConfig, 'init', generateConfig, generationPath);
137+
return runTransform(transformConfig, 'init', generationPath);
139138
} catch (error) {
140139
logger.error(error);
141140
process.exitCode = 2;

packages/generators/src/utils/scaffold.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,9 @@ function mapOptionsToTransform(config: Config): string[] {
3939
* and writes the file
4040
*/
4141

42-
export function runTransform(transformConfig: TransformConfig, action: string, generateConfig: boolean, generationPath: string): void {
42+
export function runTransform(transformConfig: TransformConfig, action: string, generationPath: string): void {
4343
// webpackOptions.name sent to nameTransform if match
4444
const webpackConfig = Object.keys(transformConfig).filter((p: string): boolean => {
45-
if (p == 'usingDefaults') {
46-
return generateConfig;
47-
}
48-
4945
return p !== 'configFile' && p !== 'configPath';
5046
});
5147
const initActionNotDefined = action && action !== 'init';

packages/init/README.md

-6
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ npx webpack-cli init
2828
npx webpack-cli init --auto
2929
```
3030

31-
**To force config generation**
32-
33-
```bash
34-
npx webpack-cli init --force
35-
```
36-
3731
**To scaffold in a specified path**
3832

3933
```bash

packages/init/src/index.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ class InitCommand {
1616
type: Boolean,
1717
description: 'To generate default config',
1818
},
19-
{
20-
name: 'force',
21-
type: Boolean,
22-
description: 'To force config generation',
23-
},
2419
{
2520
name: 'generation-path',
2621
type: String,
@@ -34,7 +29,7 @@ class InitCommand {
3429
return;
3530
}
3631

37-
modifyHelperUtil(initGenerator, null, null, options.auto, options.force, options.generationPath);
32+
modifyHelperUtil(initGenerator, null, null, options.auto, options.generationPath);
3833
},
3934
);
4035
}

test/init/force/init-force.test.js

-60
This file was deleted.

0 commit comments

Comments
 (0)