-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
cli(prompts): Add autocomplete support for config props #502
Conversation
packages/generators/add-generator.js
Outdated
const Confirm = require("@webpack-cli/webpack-scaffold").Confirm; | ||
const List = require("@webpack-cli/webpack-scaffold").List; | ||
const Input = require("@webpack-cli/webpack-scaffold").Input; | ||
const AutoComplete = require("@webpack-cli/webpack-scaffold").AutoComplete; |
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.
Trivial: at this point we could refactor with destructoring
const { Confirm, List, Input, AutoComplete }= require("@webpack-cli/webpack-scaffold")
@@ -14,6 +16,8 @@ const getPackageManager = require("@webpack-cli/utils/package-manager") | |||
const npmExists = require("@webpack-cli/utils/npm-exists"); | |||
const entryQuestions = require("./utils/entry"); | |||
|
|||
const PROPS = Array.from(PROP_TYPES.keys()); |
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.
.keys
already returns an array. Why did you use Array.from
?
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.
When using a Set, it returns an Iterator instead of array. Hence, we have to use Array.from
method.
In case of object, .keys
returns an array.
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.
Aaah it was a Set
! Fair enough, thanks!
packages/generators/add-generator.js
Outdated
*/ | ||
const searchProps = (answers, input) => { | ||
input = input || ""; | ||
return new Promise(resolve => { |
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.
Just a suggestion:
return Promise.resolve(
PROPS.filter(food =>
food.toLowerCase().includes(input.toLowerCase())
)
)
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.
Just few enhancements but it looks good!
This comment has been minimized.
This comment has been minimized.
packages/generators/add-generator.js
Outdated
) | ||
); | ||
}); | ||
return new Promise.resolve( |
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.
Without new
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.
Fixed. Thanks!
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.
Sweet jelly beans 😍 LGTM. I'm not on slack today, but could you start with ts?
Yes. I'll start with TS. 🎉 |
🎉 This PR is included in version 3.0.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What kind of change does this PR introduce?
Feature
Did you add tests for your changes?
If relevant, did you update the documentation?
Summary
Does this PR introduce a breaking change?
Other information