Skip to content
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

migrate documentation #175

Conversation

thescientist13
Copy link
Contributor

@thescientist13 thescientist13 commented Jul 30, 2017

What kind of change does this PR introduce?

Documentation

Did you add tests for your changes?
No tests needed

If relevant, did you update the documentation?
Yes

Summary

This resolves issue #166 by adding documentation for the migrate command

Does this PR introduce a breaking change?

No breaking changes

Other information
I have created a sandbox repo that documents the research / approach / testing done for this PR
https://github.com/thescientist13/webpack-migrate-sandbox

I created a PR that shows the "after" effect of running webpack-cli migrate
thescientist13/webpack-migrate-sandbox#1

I also have a couple of questions / observations

  1. When running webpack-cli init, the prompt for location could make it clearer that an extension isn't required, as it seemed ambiguous if it should be provided or not. Is this something I could open an issue / PR for?
  2. Not sure if it's assumed or not from the community, but after I ran migrate I didn't think about dependencies. So just confirming that migrate will not update package.json, right? (see my Note: at the end of MIGRATE.md) If so, maybe the documentation (in the README?) could be clearer about any assumptions in regards to the scope of this specific command / feature? Maybe provide a checklist for users to make sure their entire project gets updated correctly? For example, UglifyJS should be pulled from webpack itself not the standalone npm package, webpack versions in package.json should be upgraded, e.g. npm install webpack@^2.0.0 webpack-dev-server@^2.0.0 etc
  3. Is there a plan for managing migrations for newer versions of webpack? As webpack is on v3 and will be releasing more often, would there need to be consideration for v1 -> v3 and / or v2 -> v3?

Thanks and let me know your thoughts on this PR and if you need anymore info from me:

cc: @okonet / @pksjce / @ev1stensberg

@jsf-clabot
Copy link

jsf-clabot commented Jul 30, 2017

CLA assistant check
All committers have signed the CLA.

@evenstensberg
Copy link
Member

Awesome! Great job @thescientist13 ! Will review later this week 💯

@thescientist13
Copy link
Contributor Author

thescientist13 commented Jul 31, 2017

Thanks @ev1stensberg !

In reviewing it a bit more, I think I should add a section that summarizes the changes to the config specifically, e.g.

  • loaders becomes rules
  • query becomes options

It should probably cover all possible changes, which essentially would just be a recap of the relevant bits from webpack v2+ changelog, I figure.

@evenstensberg
Copy link
Member

If you haven't already, could you do that?

@thescientist13
Copy link
Contributor Author

will do! I'll try and get that in tonight.

@thescientist13
Copy link
Contributor Author

all set @ev1stensberg

Copy link
Member

@evenstensberg evenstensberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments

MIGRATE.md Outdated
1. All loaders now have to have the *loader* suffix, e.g. `babel` -> `babel-loader`

**Note: This command does NOT handle updating dependencies in _package.json_, it is only a migration tool for the config
file itself. The user is expected to manage dependencies themselves.**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The users are?

Copy link
Contributor Author

@thescientist13 thescientist13 Aug 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case it would be whomever is running migrate.

I took inspiration from the language used in the README and used at the start of this guide (emphasis mine)

migrate also allows users to switch to the new version of webpack without having to extensively refactor.

Happy to update it though if you think it could be better expressed another way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last line is mixing plural and singular, isn't it?

Copy link
Contributor Author

@thescientist13 thescientist13 Aug 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see what you mean. So something like:

Users are expected to manage dependencies themselves.

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all set! 💥


Given a basic configuration file like so:

```javascript
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code samples are nice, maybe link to the migration guide at webpack.js.org too?

Copy link
Contributor Author

@thescientist13 thescientist13 Aug 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link is provided at the start of this doc, which is essentially lifted right from the README

The migrate feature eases the transition from version 1 to version 2. migrate
also allows users to switch to the new version of webpack without having to extensively refactor.

It's the link applied to refactor

Let me know if you feel it would be helpful to add it elsewhere as well or maybe instead explicitly call it out in the beginning as a link to the migration guide?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right! Nice 👍

@evenstensberg
Copy link
Member

@okonet LGTM from me, need your review first.

@okonet okonet merged commit c09be3b into webpack:master Sep 20, 2017
@thescientist13
Copy link
Contributor Author

🎉 😄

evenstensberg pushed a commit that referenced this pull request Oct 22, 2017
* initial draft of migrate documentation

* formatting

* formatting

* added summary of migrate changes

* maintain consistent usage of user through documentation
evenstensberg added a commit that referenced this pull request Oct 22, 2017
* chore: Use prettier (#173)

* build: Add webpack lint settings and style code with eslint --fix

We now use the webpack eslint settings that make
sense in the cli. Also use the new --fix of eslint
to automatically beautify the code

* Add additional .eslintrc to /bin to remove unrelated eslint errors

* build: Add jest-cli as dev dependency

* style: fix lintin errors and coding style according to webpack settings

* build: update dependencies and add package-lock to repo

* feat: Require quotes only in property names that require it

* chore: Add again removed settings by merge conflict solving

* tests: Fix failing test

* chore: Use husky instead of pre-commit

pre-commit package stopped working. See observing/pre-commit#113

husky also requires less boilerplate in the package.json

* [Feature] Added support to Flow inside transformations (#174)

* [FLOW] Implemented interfaces and flow types inside the transformations

* [FLOW] first commit

* Added flwo to two other files

* Reviewed interfaces

* Created different intefaces for expressions

* Fixed rest of trasformations

* More developments

* Updated code after code review

* Fixed failing tests

* Removed yarn file

* Applied linting

* Updated packages

* Applied lint style to the imports due to code review

* docs: Documentation for migrate (#175)

* initial draft of migrate documentation

* formatting

* formatting

* added summary of migrate changes

* maintain consistent usage of user through documentation

* Feature/generate loader (#183)

* Add template files for loader yeoman generator

* Create yeoman generator for a webpack loader project

* Add tests for loader-generator

* Add `mkdirp` dependency for loader-generator

* Add function to create yeoman env and run loader-generator

* Add `generate-loader` command to webpack-cli

* Copy loader templates from proper directory

* Add template files for plugin generator

* Create yeoman generator for webpack plugins

* Add function to create yeoman env and run plugin generator

* Add cli command to generate plugin

* Register generate- commands in yargs

* Add template files for loader examples and tests

* Copy loader test and example template files in generator

* Add template files for plugin examples and tests

* Copy plugin test and example template files in generator

* Refactor generator file copying, switch .includes with .indexOf in CLI arg parsing

* Change `indexOf('foo') > -1` to `indexOf('foo') >= 0`

* Factor out generator copy utilities into separate module

* Rewrite generators using a function that returns a customized generator class

* Fix linting errors

* Remove //eslint-disable lines from template files

* Add unit tests for CLI and add flow compilation (#186)

* add unit tests for everything and flow compilation

* add travis builds

* add cli to signature & add ignore to trash code

* port to jest

* remove redundant cli command

* Feature/generate loader (#183)

* Add template files for loader yeoman generator

* Create yeoman generator for a webpack loader project

* Add tests for loader-generator

* Add `mkdirp` dependency for loader-generator

* Add function to create yeoman env and run loader-generator

* Add `generate-loader` command to webpack-cli

* Copy loader templates from proper directory

* Add template files for plugin generator

* Create yeoman generator for webpack plugins

* Add function to create yeoman env and run plugin generator

* Add cli command to generate plugin

* Register generate- commands in yargs

* Add template files for loader examples and tests

* Copy loader test and example template files in generator

* Add template files for plugin examples and tests

* Copy plugin test and example template files in generator

* Refactor generator file copying, switch .includes with .indexOf in CLI arg parsing

* Change `indexOf('foo') > -1` to `indexOf('foo') >= 0`

* Factor out generator copy utilities into separate module

* Rewrite generators using a function that returns a customized generator class

* Fix linting errors

* Remove //eslint-disable lines from template files

* add unit tests for everything and flow compilation

* add travis builds

* add cli to signature & add ignore to trash code

* port to jest

* remove redundant cli command

* rebase against master

* ast for devServer (#185)

* feat: replace yarn backup w/ normal yarn (#160)

* feat: replace yarn backup w/ normal yarn

* upgrade npm & remove yarn

* Use yarn if available (#189)

* bump version to 1.3.4

* update package.json

* 1.3.5

* prepublish -> postinstall

* 1.3.6

* temp fix to prepublish issue

* 1.3.7

* add propper post install

* 1.3.8

* re-add manual build step

* 1.3.9

* refactor

* bump version

* disable published pkg

* add ignore patterns

* add more ignore patterns for npm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants