-
Notifications
You must be signed in to change notification settings - Fork 290
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
Improve login command to show a list of shops #1023
Conversation
We detected some changes in |
const CurrentUserAccountQuery = `#graphql | ||
query currentUserAccount { | ||
currentUserAccount { | ||
organizations(first: 100) { |
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.
I'm not handling pagination at the moment. Showing many shops might not look nice in the terminal... perhaps we should just add a select choice at the end for "Can't see my shop in this list", and then prompt a text input?
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.
Actually, I just remembered there's a renderAutocompletePrompt
that might be nice for this...
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.
Worked great!
packages/cli/package.json
Outdated
@@ -35,7 +35,7 @@ | |||
"@graphql-codegen/cli": "3.3.1", | |||
"@oclif/core": "2.1.4", | |||
"@remix-run/dev": "1.17.1", | |||
"@shopify/cli-kit": "3.46.3", | |||
"@shopify/cli-kit": "3.47.0-pre.0", |
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.
Do we want to ship with a -pre
?
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.
Yeah I mentioned Blocked by: stable release of [email protected]
but tbh I think it wouldn't be a problem to release it like this. In any case, will ask the cli-kit folks about 3.47 stable first.
shop = await renderTextPrompt({ | ||
message: | ||
'Specify which Store you would like to use (e.g. {store}.myshopify.com)', | ||
allowEmpty: false, | ||
}); |
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.
🔥
Co-authored-by: Gray Gilmore <[email protected]>
@graygilmore So I've modified a bit the local Shopify config file to store I've updated to [email protected] stable and I'm merging now to prevent more conflicts, but feel free to check the last changes. |
* Add login and logout commands * Refactor graphql client and requests, add unit tests * Update shopify-config methods and tests * Update renderErrors to use cli Command * Rework env-pull to call login and remove silent param * Rework link command to call login and remove --shop flag * Update list command to call login and remove --shop flag * Update env-list command to call login and remove --shop flag * Oclif manifest * Cleanup * Rework log replacer * Mute cli-kit auth logs * Fix mock * Update cli-kit version * Add GraphQL schema generator for local development * Use business platform login to render a list of shops * Merge main branch * Fix tests * Minor changes * Update package-lock * Apply suggestions from code review Co-authored-by: Gray Gilmore <[email protected]> * Skip writing config when no directory is passed to login * Improve unit tests * Changesets * Refactor to getUserAccount and add tests * Store shopName and email in local config * Show shopName and email after login * Force prompt during login when not passing --shop flag * Fix tests * Update cli-kit version and its deps * Cleanup --------- Co-authored-by: Gray Gilmore <[email protected]>
* Add login and logout commands * Refactor graphql client and requests, add unit tests * Update shopify-config methods and tests * Update renderErrors to use cli Command * Rework env-pull to call login and remove silent param * Rework link command to call login and remove --shop flag * Update list command to call login and remove --shop flag * Update env-list command to call login and remove --shop flag * Oclif manifest * Cleanup * Rework log replacer * Mute cli-kit auth logs * Fix mock * Update cli-kit version * Add GraphQL schema generator for local development * Use business platform login to render a list of shops * Merge main branch * Fix tests * Minor changes * Update package-lock * Apply suggestions from code review Co-authored-by: Gray Gilmore <[email protected]> * Skip writing config when no directory is passed to login * Improve unit tests * Changesets * Refactor to getUserAccount and add tests * Store shopName and email in local config * Show shopName and email after login * Force prompt during login when not passing --shop flag * Fix tests * Update cli-kit version and its deps * Cleanup --------- Co-authored-by: Gray Gilmore <[email protected]>
Builds on top of #1022
Closes https://github.com/Shopify/core-issues/issues/56398
Blocked by: stable release of [email protected]
WHY are these changes introduced?
We want to show a list of shops available in the user account instead of asking them to type the shop name.
WHAT is this pull request doing?
Uses the new business platform authentication to request the list of shops and renders a select prompt.
It also adds a script to generate business platform GraphQL schema for local development.
HOW to test your changes?
Try
h2 logout
andh2 login
. You should be prompted with a list of shops instead of a text input.Checklist