-
Notifications
You must be signed in to change notification settings - Fork 149
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
addition of --env flag to cli-hydrogen preview #239
addition of --env flag to cli-hydrogen preview #239
Conversation
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.
Thanks for adding tests! Can we add a minor changeset for this?
@rennyG throwing this on your radar for documenting the new flag.
Thanks Matt! I've spun up this issue to address. |
Just signed the CLA as well if you want to re-run the job @cartogram |
What' the delivery by date for the updated docs, @cartogram? |
Changeset added |
shopify.dev PR, cc. @cartogram |
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.
As @matteodepalo pointed out, I'd use the existing utility in @shopify/cli-kit
to get the content of the .env
file into a Javascript object.
8a373fb
to
940d948
Compare
@matteodepalo @pepicrft @isaacroldan addressed your feedback. Only thing I'm not sure about is why the async version of |
@kcarra I think what is happening is that You can also try to play with |
@matteodepalo great ideas! check out 30322d1 vitest allows you to restore your mock to the actual implementation if you pass it as an arg to |
@kcarra nice! 👍 approved. |
@blittle @matteodepalo Any idea when this could get merged in? |
Merged! Apologies, I think we were waiting on each other to merge :) |
WHY are these changes introduced?
Currently when running
shopify hydrogen preview
the .env file is not included in the miniflare worker env andOxygen.env
never gets populated with those bindings. This pr adds the--env
flag to specify a .env file to be used when creating the preview Oxygen environment. Examples of use:Fixes Shopify/hydrogen/issues/1901
WHAT is this pull request doing?
This pr adds the
--env
flag to theshopify hydrogen preview
command to populate miniflare bindingsHow to test your changes?
Vitest:
yarn test packages/cli-hydrogen/src/cli/services/preview.test.ts
yarn link:
packages/cli-hydrogen
yarn link
yarn link "@shopify/cli-hydrogen"
shopify hydrogen preview --env=.env
Oxygen.env
is populated with values from .env file