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

misc(init-generator) cli improvements & refactor #817

Merged
merged 32 commits into from
May 30, 2019

Conversation

misterdev
Copy link
Contributor

@misterdev misterdev commented Apr 4, 2019

What kind of change does this PR introduce?
Fixes some problems and adds new features

Did you add tests for your changes?
Yes, for webpack-scaffold

Summary
Fixes: #884
Closes #814
Closes #788

From #814:

  • Init generator refactor
  • Improves command line defaults adding defaultChoice to Input and InputValidate
  • Improves generated webpack configuration (functionality & formatting)
  • Generate the entry file/files, package.json with a build script and a README
  • Update documentation (webpack-scaffold & init)
  • Add a prompt to tell the user what to do when the scaffolding completes
  • Add the possibility to choose between vanilla, es6 or typescript
  • Fixes:

    { parser: "babylon" } is deprecated; we now treat it as { parser: "babel" }

  • Updates init-generator to async/await ([Discussion] Recommend using async/await for prompting #836)

CLI output when selecting defaults:

  • Before
    before

  • After
    after

CLI output when multientry is chosen:

Naming the entries "app" and "vendor" seems to be discouraged in v4

  • Before
    beforemult

  • After
    aftermult

Does this PR introduce a breaking change?
No

INIT.md Outdated Show resolved Hide resolved
packages/generators/init-generator.ts Outdated Show resolved Hide resolved
packages/generators/init-generator.ts Outdated Show resolved Hide resolved
packages/generators/init-generator.ts Outdated Show resolved Hide resolved
packages/generators/init-generator.ts Show resolved Hide resolved
packages/generators/init-generator.ts Outdated Show resolved Hide resolved
packages/generators/templates/package.json.js Outdated Show resolved Hide resolved
packages/generators/utils/entry.ts Show resolved Hide resolved
packages/generators/utils/entry.ts Show resolved Hide resolved
@misterdev misterdev marked this pull request as ready for review April 18, 2019 22:37
@misterdev misterdev changed the title [WIP] improve init generator misc(init-generator) cli improvements & refactor Apr 18, 2019
@misterdev misterdev changed the title misc(init-generator) cli improvements & refactor [WIP] misc(init-generator) cli improvements & refactor Apr 18, 2019
@misterdev misterdev changed the title [WIP] misc(init-generator) cli improvements & refactor misc(init-generator) cli improvements & refactor Apr 19, 2019
@misterdev
Copy link
Contributor Author

Ok, I'm happy about the work so far, I would appreciate to also receive feedback on further works;

I see isProd and useDefaults in the code that are initialized to false and never updated. How are they meant to be used?

Would be desirable to:

  1. Have the possibility to choose between vanilla, es6 or typescript?
  2. Take the name of the project as an input from the user and generate the also the project folder?
  3. Have the possibility to choose the target (node, browser, electron, ...)?

Copy link
Contributor

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

I left some suggestions and questions

INIT.md Outdated Show resolved Hide resolved
packages/generators/utils/entry.ts Outdated Show resolved Hide resolved
packages/generators/utils/style.ts Outdated Show resolved Hide resolved
packages/generators/utils/style.ts Outdated Show resolved Hide resolved
packages/generators/utils/style.ts Outdated Show resolved Hide resolved
packages/generators/utils/style.ts Outdated Show resolved Hide resolved
packages/generators/types/yeoman-generator.d.ts Outdated Show resolved Hide resolved
packages/generators/init-generator.ts Outdated Show resolved Hide resolved
packages/generators/init-generator.ts Outdated Show resolved Hide resolved
packages/generators/init-generator.ts Outdated Show resolved Hide resolved
@ematipico
Copy link
Contributor

I would really love to have typescript in this enhancement of the init-generator!

@ematipico
Copy link
Contributor

Do you want to try to move promises to async/await?

@misterdev
Copy link
Contributor Author

Yes, what do you think about that?

@ematipico
Copy link
Contributor

It's a good opportunity doing it now as you're working on revamping the whole generator :)

Copy link
Member

@rishabh3112 rishabh3112 left a comment

Choose a reason for hiding this comment

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

LGTM, added some suggestions.

packages/generators/templates/index.js Show resolved Hide resolved
packages/generators/templates/index.js Outdated Show resolved Hide resolved
packages/generators/utils/language.ts Outdated Show resolved Hide resolved
packages/generators/utils/language.ts Outdated Show resolved Hide resolved
packages/generators/utils/language.ts Outdated Show resolved Hide resolved
packages/utils/run-prettier.ts Outdated Show resolved Hide resolved
packages/generators/utils/language.ts Outdated Show resolved Hide resolved
packages/generators/utils/language.ts Outdated Show resolved Hide resolved
packages/generators/utils/plugins.ts Outdated Show resolved Hide resolved
packages/webpack-scaffold/README.md Outdated Show resolved Hide resolved
packages/webpack-scaffold/__tests__/index.test.ts Outdated Show resolved Hide resolved
Copy link
Member

@rishabh3112 rishabh3112 left a comment

Choose a reason for hiding this comment

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

Left a few reviews.

packages/webpack-scaffold/README.md Outdated Show resolved Hide resolved
packages/utils/run-prettier.ts Show resolved Hide resolved
@misterdev
Copy link
Contributor Author

PS: @evenstensberg changing prettier parser to "babylon" will make appear a message every time we run init { parser: "babylon" } is deprecated; we now treat it as { parser: "babel" }

@evenstensberg
Copy link
Member

@misterdev Could you make it so that tsc doesn't complain while having parser: babel?

@misterdev
Copy link
Contributor Author

I don't have errors, but I remember I had that problem some times ago.
Sorry for asking, have you executed yarn bootstrap? It should install a new version of prettier and @types/prettier

@webpack-bot
Copy link

@evenstensberg Thanks for your update.

I labeled the Pull Request so reviewers will review it again.

@anshumanv Please review the new changes.

@evenstensberg
Copy link
Member

I didn't, had some old lockfiles, was fixed once I ran that. Thanks!

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.

lgtm, nice work!

@webpack-bot
Copy link

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@evenstensberg evenstensberg merged commit 5e27244 into webpack:master May 30, 2019
@misterdev misterdev deleted the misc/improve-init-generator branch May 30, 2019 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants