-
-
Notifications
You must be signed in to change notification settings - Fork 620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: init documentaion #547
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,54 @@ | ||
## webpack init | ||
# webpack-cli init | ||
|
||
Through [yeoman](http://yeoman.io/), the `webpack-cli init` feature allows people to create scaffolds and generate new projects quickly. An npm dependency that scaffolds a `webpack.config.js` through `webpack-cli` is what we refer to as an **addon**. | ||
`webpack-cli init` is used to initialize `webpack` projects quickly by scaffolding configuration and installing modules required for the project as per user preferences. | ||
|
||
We ask several questions in the default generator to get you started. | ||
## Initial Setup | ||
A. **Local setup** | ||
|
||
--- | ||
Follow given steps to locally setup `webpack-cli init` by installing dependencies: | ||
1. Create `package.json` through npm | ||
|
||
```shell | ||
$ npm init | ||
``` | ||
|
||
2. Install `webpack` and `webpack-cli` as devDependencies | ||
|
||
```shell | ||
$ npm install --save-dev webpack webpack-cli | ||
``` | ||
|
||
3. Install @webpack-cli/init package to add init addon | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
```shell | ||
$ npm install -D @webpack-cli/init | ||
``` | ||
|
||
B. **Global Setup** | ||
|
||
Follow following steps to setup `webpack-cli init` globally: | ||
1. Install `webpack` and `webpack-cli` globally | ||
```shell | ||
$ sudo npm install -g webpack webpack-cli | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why doing If you get errors in permission if you remove sudo then you probably have installed node/npm incorrectly in your local machine. Find the fix on Google. For now, remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I was getting errors, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dhruvdutt , also I wasn't able to install There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What error are you getting? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On running this: npm WARN checkPermissions Missing write access to /usr/lib/node_modules/webpack-cli
npm WARN webpack-cli@3.0.8 requires a peer of webpack@^4.x.x but none is installed. You must install peer dependencies yourself. I have webpack@4.16.1 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This issue is not related to webpack-cli. It happens because you've installed node/npm with incorrect permission. This is a common issue which I've also experienced it. You can Google it and find a fix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I was able to fix it by setting it up using nvm . |
||
``` | ||
|
||
2. Install @webpack-cli/init package to add init addon | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
```shell | ||
$ sudo npm install -g @webpack-cli/init | ||
``` | ||
|
||
## Usage | ||
A. **For local setup**: | ||
```shell | ||
$ npx webpack-cli init | ||
``` | ||
|
||
B. **For global setup** | ||
```shell | ||
$ webpack-cli init | ||
``` | ||
|
||
### Questions asked by generator | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice work. 💯 🥇 How about mentioning which specific property/key the question is related to and also provide a link to webpack docs for every question? Similar to how you did for entry. :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I will where ever possible in next commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this has been resolved @dhruvdutt ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks good. Why have we skipped mentioning property for the last question? |
||
|
||
1. `Will your application have multiple bundles? (Y/n)` | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be consistent and would write
--save-dev
or-D
, not both. They are basically the same.-D
is just an aliasThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated it @ematipico