Skip to content

Commit

Permalink
Merge branch 'next' into rm/config
Browse files Browse the repository at this point in the history
  • Loading branch information
anshumanv committed May 22, 2020
2 parents f491969 + 7f99b1f commit d3b6838
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 66 deletions.
30 changes: 15 additions & 15 deletions packages/webpack-cli/lib/utils/cli-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,30 +72,30 @@ module.exports = {
core: [
{
name: 'entry',
usage: '--entry <path to entry file> e.g. ./src/main.js',
usage: '--entry <path to entry file>',
type: String,
defaultOption: true,
group: BASIC_GROUP,
description: 'The entry point of your application.',
description: 'The entry point of your application e.g. ./src/main.js',
link: 'https://webpack.js.org/concepts/#entry',
},
{
name: 'config',
usage: '--config <path to webpack configuration file> e.g. ./webpack.config.js',
usage: '--config <path to webpack configuration file>',
alias: 'c',
type: String,
defaultValue: null,
group: CONFIG_GROUP,
description: 'Provide path to a webpack configuration file',
description: 'Provide path to a webpack configuration file e.g. ./webpack.config.js',
link: 'https://webpack.js.org/configuration/',
},
{
name: 'merge',
usage: '--merge <path to configuration to be merged> e.g. ./webpack.config.js',
usage: '--merge <path to configuration to be merged>',
alias: 'm',
type: String,
group: CONFIG_GROUP,
description: 'Merge a configuration file using webpack-merge',
description: 'Merge a configuration file using webpack-merge e.g. ./webpack.config.js',
link: 'https://github.com/survivejs/webpack-merge',
},
{
Expand All @@ -121,28 +121,28 @@ module.exports = {
},
{
name: 'output',
usage: '--output <path to output directory> e.g. ./dist/',
usage: '--output <path to output directory>',
alias: 'o',
group: OUTPUT_GROUP,
type: String,
description: 'Output location of the file generated by webpack',
description: 'Output location of the file generated by webpack e.g. ./dist/',
link: 'https://webpack.js.org/concepts/#output',
},
{
name: 'plugin',
usage: '--plugin',
usage: '--plugin <pluginName>',
group: ADVANCED_GROUP,
type: String,
description: 'Load a given plugin',
description: 'Load a given plugin e.g. HtmlWebpackPlugin',
link: 'https://webpack.js.org/plugins/',
},
{
name: 'target',
usage: '--target',
usage: '--target <value>',
alias: 't',
type: String,
group: ADVANCED_GROUP,
description: 'Sets the build target',
description: 'Sets the build target e.g. node',
link: 'https://webpack.js.org/configuration/target/#target',
},
{
Expand All @@ -165,7 +165,7 @@ module.exports = {
},
{
name: 'sourcemap',
usage: '--sourcemap <sourcemap|eval|>',
usage: '--sourcemap <sourcemap | eval>',
type: String,
alias: 's',
defaultValue: undefined,
Expand Down Expand Up @@ -235,10 +235,10 @@ module.exports = {
},
{
name: 'stats',
usage: '--stats verbose',
usage: '--stats <value>',
type: String,
group: DISPLAY_GROUP,
description: 'It instructs webpack on how to treat the stats',
description: 'It instructs webpack on how to treat the stats e.g. verbose',
link: 'https://webpack.js.org/configuration/stats/#stats',
},
{
Expand Down
4 changes: 2 additions & 2 deletions test/help/help-flags.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ describe('commands help', () => {
it('shows flag help with valid flag', () => {
const { stdout, stderr } = run(__dirname, ['--help', '--merge'], false);
expect(stdout).not.toContain(helpHeader);
expect(stdout).toContain('webpack --merge <path to configuration to be merged> e.g. ./webpack.config.js');
expect(stdout).toContain('webpack --merge <path to configuration to be merged>');
expect(stderr).toHaveLength(0);
});

it('gives precedence to earlier flag in case of multiple flags', () => {
const { stdout, stderr } = run(__dirname, ['--help', '--entry', '--merge'], false);
expect(stdout).not.toContain(helpHeader);
expect(stdout).toContain('webpack --entry <path to entry file> e.g. ./src/main.js');
expect(stdout).toContain('webpack --entry <path to entry file>');
expect(stderr).toHaveLength(0);
});
});
Loading

0 comments on commit d3b6838

Please sign in to comment.