You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
6.3 KiB

4 years ago
  1. <div align="center">
  2. <a href="https://github.com/webpack/webpack-cli">
  3. <img width="200" height="200" src="https://webpack.js.org/assets/icon-square-big.svg">
  4. </a>
  5. </div>
  6. <h1 align="center">webpack CLI</h1>
  7. <p align="center">
  8. The official CLI of webpack
  9. </p>
  10. <br>
  11. [![npm][npm]][npm-url]
  12. [![Build Status][build-status]][build-status-url]
  13. [![Build2 Status][build-status-azure]][build-status-azure-url]
  14. [![deps][deps]][deps-url]
  15. [![Code Climate][maintainability]][maintainability-url]
  16. [![chat on gitter][chat]][chat-url]
  17. [![Install Size][size]][size-url]
  18. [![Downloads][downloads]][downloads-url]
  19. [![lerna][lerna]][lerna-url]
  20. [![GitHub contributors][contributors]][contributors-url]
  21. - [About](#about)
  22. - [How to install](#how-to-install)
  23. - [Packages](#packages)
  24. - [Commands](#commands)
  25. - [Utilities](#utilities)
  26. - [Getting started](#getting-started)
  27. - [webpack CLI Scaffolds](#webpack-cli-scaffolds)
  28. - [Contributing and Internal Documentation](#contributing-and-internal-documentation)
  29. - [Open Collective](#open-collective)
  30. ## About
  31. webpack CLI provides a flexible set of commands for developers to increase speed when setting up a custom webpack project. As of webpack v4, webpack is not expecting a configuration file, but often developers want to create a more custom webpack configuration based on their use-cases and needs. webpack CLI addresses these needs by providing a set of tools to improve the setup of custom webpack configuration.
  32. ### How to install
  33. When you have followed the [Getting Started](https://webpack.js.org/guides/getting-started/) guide of webpack then webpack CLI is already installed!
  34. Otherwise `npm install --save-dev webpack-cli` or `yarn add webpack-cli --dev` will install it.
  35. ## Packages
  36. 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.
  37. ### Commands
  38. Supporting developers is an important task for webpack CLI. Thus, webpack CLI provides different commands for many common tasks.
  39. - [`webpack-cli init`](./packages/init/README.md#webpack-cli-init) - Create a new webpack configuration.
  40. - [`webpack-cli info`](./packages/info/README.md#webpack-cli-info) - Returns information related to the local environment.
  41. - [`webpack-cli migrate`](./packages/migrate/README.md#webpack-cli-migrate) - Migrate project from one version to another.
  42. - [`webpack-cli generate-plugin`](./packages/generate-plugin/README.md#webpack-cli-generate-plugin) - Initiate new plugin project.
  43. - [`webpack-cli generate-loader`](./packages/generate-loader/README.md#webpack-cli-generate-loader) - Initiate new loader project.
  44. - [`webpack-cli serve`](./packages/serve/README.md#webpack-cli-serve) - Use webpack with a development server that provides live reloading.
  45. ### Utilities
  46. The project also has several utility packages which are used by other commands
  47. - [`utils`](./packages/utils/README.md) - Several utilities used across webpack-cli.
  48. - [`generators`](./packages/generators/README.md) - Contains all webpack-cli related yeoman generators.
  49. - [`webpack-scaffold`](./packages/webpack-scaffold/README.md) - Utilities to create a webpack scaffold.
  50. ## Getting started
  51. When you have followed the [Getting Started](https://webpack.js.org/guides/getting-started/) guide of webpack then webpack CLI is already installed! Otherwise, you would need to install webpack CLI and the packages you want to use. If we want to use the `init` command to create a new `webpack.config.js` configuration file:
  52. ```sh
  53. npm i webpack-cli @webpack-cli/init
  54. npx webpack-cli init
  55. ```
  56. You will be prompted for some questions about what how you want to generate your config file when running the `init` command so webpack CLI can provide the best fitting configuration.
  57. ## webpack CLI Scaffolds
  58. With v3 of webpack CLI, we introduced scaffolding as an integral part of the CLI. Our goal is to simplify the creation of webpack configurations for different purposes. Additionally, sharing such solutions with the community is beneficial and with webpack, we want to allow this. We provide `webpack-scaffold` as a utility suite for creating these scaffolds. It contains functions that could be of use for creating a scaffold yourself.
  59. You can read more about [Scaffolding](https://webpack.js.org/guides/scaffolding), learn [How to compose a webpack-scaffold?](https://webpack.js.org/contribute/writing-a-scaffold) or generate one with [webpack-scaffold-starter](https://github.com/rishabh3112/webpack-scaffold-starter).
  60. ## Contributing and Internal Documentation
  61. The webpack family welcomes any contributor, small or big. We are happy to elaborate, guide you through the source code and find issues you might want to work on! To get started have a look at our [documentation on contributing](./.github/CONTRIBUTING.md).
  62. ## Open Collective
  63. If you like **webpack**, please consider donating to our [Open Collective](https://opencollective.com/webpack) to help us maintain it.
  64. [build-status]: https://travis-ci.org/webpack/webpack-cli.svg
  65. [build-status-url]: https://travis-ci.org/webpack/webpack-cli
  66. [build-status-azure]: https://dev.azure.com/webpack/webpack/_apis/build/status/webpack.webpack-cli
  67. [build-status-azure-url]: https://dev.azure.com/webpack/webpack/_build/latest?definitionId=4
  68. [chat]: https://badges.gitter.im/webpack/webpack.svg
  69. [chat-url]: https://gitter.im/webpack/webpack
  70. [contributors]: https://img.shields.io/github/contributors/webpack/webpack-cli.svg
  71. [contributors-url]: https://github.com/webpack/webpack-cli/graphs/contributors
  72. [deps]: https://img.shields.io/david/webpack/webpack.svg
  73. [deps-url]: https://david-dm.org/webpack/webpack-cli
  74. [downloads]: https://img.shields.io/npm/dw/webpack-cli.svg
  75. [downloads-url]: https://www.npmjs.com/package/webpack-cli
  76. [lerna]: https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg
  77. [lerna-url]: http://www.lernajs.io/
  78. [npm]: https://img.shields.io/npm/v/webpack-cli.svg
  79. [npm-url]: https://www.npmjs.com/package/webpack-cli
  80. [maintainability]: https://codeclimate.com/github/webpack/webpack-cli/badges/gpa.svg
  81. [maintainability-url]: https://codeclimate.com/github/webpack/webpack-cli
  82. [size]: https://packagephobia.now.sh/badge?p=webpack-cli
  83. [size-url]: https://packagephobia.now.sh/result?p=webpack-cli