Skip to content
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

Send Hydrogen version in requests to Storefront API #471

Merged
merged 3 commits into from
Feb 10, 2023

Conversation

frandiox
Copy link
Contributor

@frandiox frandiox commented Feb 9, 2023

We do this in H1 so I'm adding the same behavior here.

However, a somewhat related problem is that this LIB_VERSION is updated after the package is built. Therefore, I think a newly released package always contains the version from the previous release.
It's been like this since H1, where we modified the "source" instead of the "dist".

Any ideas on how to fix that? We could modify the generated bundle but it doesn't feel right. Could we run changeset version before npm run build? Or would that problematic?

@frandiox frandiox requested a review from a team February 9, 2023 07:50
@jplhomer
Copy link
Contributor

jplhomer commented Feb 9, 2023

@frandiox the difference is that we used prepack scripts to build each individual package in Hydrogen v1: https://github.com/Shopify/hydrogen-v1/blob/95543dc81df986e20c40419e4ed7104e0b2436d3/packages/hydrogen/package.json#L67

I remember trying this right when we started v2, and we had all sorts of TS/dependency issues, so I gave up 🙃 I hadn't considered the LIB_VERSION constant being out of date by the time we needed it.

Could we try adding "prepack": "npm run build", to each of our released project scripts to ensure a fresh build happens right before being packed up to NPM?

@jplhomer
Copy link
Contributor

jplhomer commented Feb 9, 2023

I just pushed up a commit to do prepack. YOLO we'll see if it works next time!!!

This is to ensure we build one more time right before publishing, so the
version number is up to date in the distributed code.
@frandiox frandiox merged commit e9c5e13 into 2023-01 Feb 10, 2023
@frandiox frandiox deleted the fd-lib-version-fix branch February 10, 2023 05:53
@github-actions github-actions bot mentioned this pull request Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants