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

Fix hydrogen init message for global cli #2200

Merged
merged 7 commits into from
Jun 6, 2024
Merged

Conversation

isaacroldan
Copy link
Contributor

WHY are these changes introduced?

When running hydrogen init from a global CLI, show shopify hydrogen dev as next step
Fixes #0000

WHAT is this pull request doing?

HOW to test your changes?

Post-merge steps

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

Copy link
Contributor

github-actions bot commented Jun 5, 2024

We detected some changes in packages/*/package.json or packages/*/src, and there are no updates in the .changeset.
If the changes are user-facing and should cause a version bump, run npm run changeset add to track your changes and include them in the next release CHANGELOG.
If you are making simple updates to examples or documentation, you do not need to add a changeset.

Copy link
Contributor

shopify bot commented Jun 5, 2024

Oxygen deployed a preview of your fixes-for-global-cli branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
optimistic-cart-ui ✅ Successful (Logs) Preview deployment Inspect deployment June 5, 2024 4:11 PM
third-party-queries-caching ✅ Successful (Logs) Preview deployment Inspect deployment June 5, 2024 4:10 PM
vite ✅ Successful (Logs) Preview deployment Inspect deployment June 5, 2024 4:10 PM
custom-cart-method ✅ Successful (Logs) Preview deployment Inspect deployment June 5, 2024 4:11 PM
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment June 5, 2024 4:10 PM
subscriptions ✅ Successful (Logs) Preview deployment Inspect deployment June 5, 2024 4:11 PM

Learn more about Hydrogen's GitHub integration.

@frandiox
Copy link
Contributor

frandiox commented Jun 6, 2024

I think it's better to keep using the package.json scripts, though:

  • It's more familiar to developers
  • It can add extra flags that depend on the template. For example, our main starter template is adding --codegen flag that would be missing in the new next step. And soonish it will start adding --customer-account-push as well I think.

Thoughts?

@isaacroldan
Copy link
Contributor Author

If you used shopify hydrogen init, it makes sense to recommend the same format of commands no?
You mean you are adding flags to package.json scripts?

I'm ok with showing npm run dev always (it will always work). But formatPackageManagerCommand is not prepared for that, when it detects that we are in a global CLI, it will try to not use the package manager. (that's why you are seeing just dev right now)

@frandiox
Copy link
Contributor

frandiox commented Jun 6, 2024

But formatPackageManagerCommand is not prepared for that, when it detects that we are in a global CLI, it will try to not use the package manager. (that's why you are seeing just dev right now)

Ugh I see 😬

You mean you are adding flags to package.json scripts?

Yes. If you run npm run dev you'll get shopify hydrogen dev --codegen --customer-account-push vs just a hardcoded shopify hydrogen dev.

In that case I think it's better to hardcode npm run dev when the CLI is global so that you get dev running with all the initial flags we have in the template?

@isaacroldan
Copy link
Contributor Author

That works for me :)

@frandiox frandiox merged commit a8b9c6c into main Jun 6, 2024
12 of 13 checks passed
@frandiox frandiox deleted the fixes-for-global-cli branch June 6, 2024 11:39
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