这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@jamonholmgren
Copy link
Member

@jamonholmgren jamonholmgren commented Feb 24, 2018

This patch is backwards-compatible.

This change refactors the Builder class to allow options in any order. This builds on #357 and solves one of the annoyances I had with the builder API (which I, unfortunately, introduced in #307), which is that it became order-dependent. This now has an internal data object that holds the info until everything is loaded.

The one exception to the order-dependent is still the .brand() method (this was a requirement prior to #307 too). So I added an optional brand?: string argument to the build() function to make it more idiomatic to specify the brand up front.

// old way -- still works!
const cli = build()
  .brand('mycli')
  // ...
  .create()

// new way -- documented
const cli = build('mycli')
  // ...
  .create()

Copy link
Contributor

@skellock skellock left a comment

Choose a reason for hiding this comment

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

💯. I’m glad this bothered you too.

Bonus points for sentence one.

@jamonholmgren jamonholmgren merged commit c5189e2 into master Feb 24, 2018
@jamonholmgren jamonholmgren deleted the refactor/builder branch February 24, 2018 21:28
@jamonholmgren
Copy link
Member Author

Sweet. It's feeling goooooood now. Still have to work on some docs!

@jamonholmgren jamonholmgren added this to the 2.0.0-beta.5 milestone Feb 24, 2018
@infinitered-circleci
Copy link
Collaborator

🎉 This PR is included in version 0.22.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants