-
Notifications
You must be signed in to change notification settings - Fork 293
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
Add list
and link
commands to hydrogen-cli
#784
Conversation
66e8742
to
98fbe82
Compare
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.
Nice! 🤩 Few tweaks and questions, and I think I need to tophat it in the terminal to really get the full flavor, but some initial suggestions here.
|
||
if (configStorefront && !force) { | ||
const overwriteLink = await renderConfirmationPrompt({ | ||
message: `${configStorefront.title} is currently linked to your local environment. Do you want to change storefronts?`, |
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.
Maybe local project
here too?
Wondering if we need to introduce the idea and terminology of local/remote, or if we can get away with storefront
as the stand-in for the idea of "remote"
message: `${configStorefront.title} is currently linked to your local environment. Do you want to change storefronts?`, | |
message: `Your project is currently linked to ${configStorefront.title}. Do you want to re-link to a different Hydrogen storefront?`, |
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.
Yes, I've been struggling with the terminology here because I don't want to keep saying "Hydrogen storefront defined in the admin". Maybe we can include the word Shopify
to imply that it's a record we hold?
Your project is currently linked to ${title}. Do you want to re-link to a different Hydrogen storefront on Shopify?
Does "on Shopify" make sense?
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.
Maybe "a different Shopify Hydrogen storefront"?
|
||
export default class List extends Command { | ||
static description = | ||
"Returns a list of storefronts in your Shop's Hydrogen sales channel."; |
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 think it's a good idea to name the shop every time. Some people will work across multiple merchant clients etc. Let's just remove even the possibility of ambiguity here.
Also I think it makes sense to be specific across the board about Hydrogen storefronts
.
"Returns a list of storefronts in your Shop's Hydrogen sales channel."; | |
`Returns a list of Hydrogen storefronts available on ${shop}.`; |
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.
This description won't have access to any data so we can't insert things here, unfortunately. We can make this a little cleaner, though:
Returns a list of Hydrogen storefronts available on a given shop.
9606961
to
07dae0d
Compare
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 job, just adding minor comments here.
Should we keep these commands hidden from users until they can actually be used for something?
07dae0d
to
14f5479
Compare
Force Push Patch Notes
|
@frandiox exactly! I was going to keep them hidden until we've been able to get things merged in and have the whole flow tested. I understand anyone will be able to use them if they're watching these PRs (👋🏻) but marking them as |
cf81ec3
to
9fc0047
Compare
Force Push Patch Notes
|
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.
This looks great! Just a few comments.
}); | ||
|
||
describe('when a shop is passed via flag', () => { | ||
it('returns the shop', async () => { |
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 heads up, eventually I would like to add the shopify cli eslint configs to this package which will prefer we write test
instead of it
. We'll change the entire package over in one go when we add the rules.
|
||
import {newHydrogenStorefrontUrl} from './admin-urls.js'; | ||
|
||
export function missingStorefronts(adminSession: AdminSession) { |
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 like the idea of starting a more specific sub-set of cli-kit/node/ui
that is specific to custom-storefronts and lives inside this package (lib/ui
?). This should be a future thing, but for now I would call this renderMissingStorefronts
so that the name is more suggestive of what the function does (render things).
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.
Oooo I like that! Let's revisit that idea when this first batch of commands go in.
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'd say let's get this merged asap after checking comments from other reviewers 👍
9fc0047
to
0432916
Compare
Force Push Patch Notes
|
WHY are these changes introduced?
This is the first of many steps in updating the
hydrogen-cli
to better communicate and interact with Hydrogen storefronts created on Shopify. We want a seamless experience for developers when they are working on their storefront locally.WHAT is this pull request doing?
This PR introduces new commands to the CLI:
list
: list all of the Hydrogen storefronts on a shoplink
: link your local development to a specific Hydrogen storefrontunlink
: remove the link to a Hydrogen storefrontIn and of itself this change will not introduce any new functionality for developers but it lays a foundation for us to build other commands on top of (coming soon: environment variables). In addition to the commands this introduces a new concept of a Shopify project configuration file that lives inside of your local workspace (and is automatically added to your
.gitignore
).This PR is split into smaller, atomic commits that should make reviewing much easier.
List
Link
After selection:
✅ Success! Linked to Test Shop. Admin URL: https://test.myshopify.com/admin/custom_storefronts/2 Site URL: https://test-shop-2.o2.myshopify.dev
HOW to test your changes?
cli
directorynpm run build
export SHOPIFY_HYDROGEN_FLAG_PATH=../../templates/demo-store
so we're always targeting the demo storeh2 list
(note: ifh2
is unavailable runnpx shopify hydrogen shortcut
first) to see a list of your storefrontsh2 link
to link to a specific storefronth2 unlink
to remove the linkPost-merge steps
These commands are currently hidden.
Checklist