Skip to content

Commit 68087f1

Browse files
authored
docs(cli): changed README to notify the beta version (#1223)
* docs(cli): changed README to notify of beta version docs(init): changed `create` to `init` * tests(init): updated tests and snapshots
1 parent 76d2eb3 commit 68087f1

File tree

6 files changed

+57
-14
lines changed

6 files changed

+57
-14
lines changed

README.md

+44-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
</p>
1212
<br>
1313

14+
> ## This is the documentation of the beta version.
15+
>
16+
> We are working on reducing the number of arguments passed to the CLI,
17+
> please leave your feedback [here](https://github.com/webpack/webpack-cli/issues/1222)
18+
1419
[![npm][npm]][npm-url]
1520
[![Build Status][build-status]][build-status-url]
1621
[![Build2 Status][build-status-azure]][build-status-azure-url]
@@ -46,6 +51,44 @@ When you have followed the [Getting Started](https://webpack.js.org/guides/getti
4651

4752
Otherwise `npm install --save-dev webpack-cli` or `yarn add webpack-cli --dev` will install it.
4853

54+
# Supported arguments and commands
55+
56+
```
57+
58+
Available Commands
59+
60+
init Initialize a new webpack configuration
61+
migrate Migrate a configuration to a new version
62+
loader Scaffold a loader repository
63+
plugin Scaffold a plugin repository
64+
info Outputs information about your system and dependencies
65+
serve Run the webpack Dev Server
66+
67+
Options
68+
69+
--entry string The entry point of your application.
70+
-c, --config string Provide path to a webpack configuration file
71+
-m, --merge string Merge a configuration file using webpack-merge
72+
--progress Print compilation progress during build
73+
--silent Disable any output that webpack makes
74+
--help Outputs list of supported flags
75+
--defaults Allow webpack to set defaults aggresively
76+
-o, --output string Output location of the file generated by webpack
77+
--plugin string Load a given plugin
78+
-g, --global string[] Declares and exposes a global variable
79+
-t, --target string Sets the build target
80+
-w, --watch Watch for files changes
81+
-h, --hot Enables Hot Module Replacement
82+
-s, --sourcemap string Determine source maps to use
83+
--prefetch string Prefetch this request
84+
-j, --json Prints result as JSON
85+
--standard Prints standard output
86+
-d, --dev Run development build
87+
-p, --prod Run production build
88+
--version Get current version
89+
--node-args string[] NodeJS flags
90+
```
91+
4992
## Packages
5093

5194
We organize webpack CLI as a multi-package repository using [lerna](https://github.com/lerna/lerna). Every command has a dedicated subfolder in the `packages` Folder. Here's a summary of commands provided by the CLI.
@@ -54,7 +97,7 @@ We organize webpack CLI as a multi-package repository using [lerna](https://gith
5497

5598
Supporting developers is an important task for webpack CLI. Thus, webpack CLI provides different commands for many common tasks.
5699

57-
- [`webpack-cli create`](./packages/init/README.md#webpack-cli-create) - Create a new webpack configuration.
100+
- [`webpack-cli init`](./packages/init/README.md#webpack-cli-init) - Create a new webpack configuration.
58101
- [`webpack-cli info`](./packages/info/README.md#webpack-cli-info) - Returns information related to the local environment.
59102
- [`webpack-cli migrate`](./packages/migrate/README.md#webpack-cli-migrate) - Migrate project from one version to another.
60103
- [`webpack-cli generate-plugin`](./packages/generate-plugin/README.md#webpack-cli-generate-plugin) - Initiate new plugin project.

lib/utils/cli-flags.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ module.exports = {
1818
},
1919
commands: [
2020
{
21-
name: 'create',
21+
name: 'init',
2222
alias: 'c',
2323
type: String,
24-
usage: 'create | create <scaffold>',
24+
usage: 'init | init <scaffold>',
2525
description: 'Initialize a new webpack configuration',
2626
},
2727
{

packages/init/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# webpack-cli create
1+
# webpack-cli init
22

33
[![NPM Downloads][downloads]][downloads-url]
44

@@ -33,27 +33,27 @@ init([null, null, ...myPacakges]);
3333
**Via defaults**
3434

3535
```bash
36-
npx webpack-cli create
36+
npx webpack-cli init
3737
```
3838

3939
**To generate default configs**
4040

4141
```bash
42-
npx webpack-cli create --auto
42+
npx webpack-cli init --auto
4343
```
4444

4545
**Via custom scaffold**
4646

4747
1. Using package on `npm`
4848

4949
```bash
50-
npx webpack-cli create webpack-scaffold-[name]
50+
npx webpack-cli init webpack-scaffold-[name]
5151
```
5252

5353
2. Using path to a local directory
5454

5555
```bash
56-
npx webpack-cli create [path]
56+
npx webpack-cli init [path]
5757
```
5858

5959
[downloads]: https://img.shields.io/npm/dm/@webpack-cli/init.svg

test/help/__snapshots__/help-single-arg.test.js.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports[`single help flag creates a readable snapshot 1`] = `
1616
1717
Available Commands
1818
19-
create Initialize a new webpack configuration
19+
init Initialize a new webpack configuration
2020
migrate Migrate a configuration to a new version
2121
loader Scaffold a loader repository
2222
plugin Scaffold a plugin repository

test/help/help-commands.test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ describe('commands help', () => {
1010
expect(stderr).toHaveLength(0);
1111
});
1212
it('shows command help with valid command', () => {
13-
const { stdout, stderr } = run(__dirname, ['--help', 'create'], false);
13+
const { stdout, stderr } = run(__dirname, ['--help', 'init'], false);
1414
expect(stdout).not.toContain(helpHeader);
15-
expect(stdout).toContain('webpack create | create <scaffold>');
15+
expect(stdout).toContain('webpack init | init <scaffold>');
1616
expect(stderr).toHaveLength(0);
1717
});
1818

1919
it('gives precedence to earlier command in case of multiple commands', () => {
20-
const { stdout, stderr } = run(__dirname, ['--help', 'create', 'info'], false);
20+
const { stdout, stderr } = run(__dirname, ['--help', 'init', 'info'], false);
2121
expect(stdout).not.toContain(helpHeader);
22-
expect(stdout).toContain('webpack create | create <scaffold>');
22+
expect(stdout).toContain('webpack init | init <scaffold>');
2323
expect(stderr).toHaveLength(0);
2424
});
2525
});

test/help/help-multi-args.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('help flag with multiple arguments', () => {
1717
});
1818

1919
it('outputs info with multiple commands and with precedence', () => {
20-
const { stdout, stderr } = run(__dirname, ['create', 'help']);
20+
const { stdout, stderr } = run(__dirname, ['init', 'help']);
2121
expect(stdout).toContain(createDescription);
2222
expect(stderr).toHaveLength(0);
2323
});

0 commit comments

Comments
 (0)