-
Notifications
You must be signed in to change notification settings - Fork 125
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
[Themes] Theme Console - ensureReplEnv 1/2 - Storefront Password Prompting #4191
Conversation
Thanks for your contribution! Depending on what you are working on, you may want to request a review from a Shopify team:
|
Coverage report
Test suite run success1736 tests passing in 800 suites. Report generated by 🧪jest coverage report action from a2b6b54 |
bf0dad1
to
b21e712
Compare
b21e712
to
90fa445
Compare
90fa445
to
3e9c4e7
Compare
3e9c4e7
to
4e4b900
Compare
We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** and there are no updates in the .changeset. |
43e485e
to
4e4b900
Compare
export function promptPassword(prompt: string): Promise<string> { | ||
const readline = createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}) | ||
|
||
return new Promise((resolve) => { | ||
readline.question(prompt, (password) => { | ||
readline.close() | ||
resolve(password) | ||
}) | ||
}) | ||
} |
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.
Why are we prompting with readline
instead of using one of the prompts defined in cli-kit
?
We should be consistent with the style CLI prompts
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.
Good question - let me double check with @karreiro when he returns next week.
I agree that CLI UI-Kit should be used to prompt for the password. I have applied that change 🙂
I'm trying to get the cli-kit
for the REPL
loop, I would like a way to optionally hide the prompt message
Currently, the prompt looks like this if I pass an empty string in message
: renderTextPrompt({message: ''})
Desired State
I would like to hide the prompt to achieve something like this - this will bring us to parity with the current theme console
command
I have a PR enabling the above. Could you take a look and let me know what you think 🙏🏻 ? @isaacroldan
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.
Indeed, we should use cli-kit
prompts to get the store password. However, we really need to rely on readline
to power REPL DX, as readline
also supports history of commands (when users press ꜛ), the minimal UI component cohesive with other REPL tools, and the life cycle callbacks.
packages/theme/src/cli/utilities/theme-environment/storefront-session.ts
Outdated
Show resolved
Hide resolved
02bffa9
to
4a52e1a
Compare
packages/theme/src/cli/utilities/theme-environment/storefront-session.ts
Show resolved
Hide resolved
🎩 and works as expected |
Hello sir pls help.. mine keeps saying incorrect password even after I used the right one |
@sleekping can you ensure that you're accessing the correct storefront by passing the Could you also double check the password you set here? If that doesn't work, please open an issue :) |
WHY are these changes introduced?
WHAT is this pull request doing?
How to test your changes?
pnpm shopify theme console --dev-preview
a. Enter a couple of incorrect passwords, then the correct one
pnpm shopify theme console --dev-preview --store-password=<PASSWORD>
a. Try with some valid and invalid passwords.
iTerm2.-.jamesmeng@Jamess-MacBook-Pro-2_._src_github.com_Shopify_cli.mp4
Measuring impact
How do we know this change was effective? Please choose one:
Checklist