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

New upgrade CLI command #1458

Merged
merged 47 commits into from
Nov 17, 2023
Merged

New upgrade CLI command #1458

merged 47 commits into from
Nov 17, 2023

Conversation

juanpprieto
Copy link
Contributor

@juanpprieto juanpprieto commented Oct 26, 2023

Hydrogen upgrade command

Upgrading Hydrogen projects today is not as simple as running npm install @shopify/hydrogen because of the coupling between Hydrogen, Oxygen and Remix dependencies.

To determine an upgrade command for a specific Hydrogen version requires you need to know:

  • A compatible @shopify/cli-hydrogen version
  • A compatible @shopify/remix-oxygen version
  • A compatible @remix-run/react and @remix-run/dev version (and other optional
    remix packages)

Currently, the best approach to figure out this command is by looking at the package.json
dependencies inside the skeleton template or by visiting the releases notes
for a given hydrogen version and then manually writing down all the other package
versions compatible with a given hydrogen release.

This is not only cumbersome, but also prone to errors.

h2 upgrade command

We are introducing a new hydrogen cli upgrade command that:

  • Makes upgrading hydrogen as easy as typing h2 upgrade in your terminal
  • Provides a quick summary of the key features and fixes of any available
    hydrogen version(s)
  • Generates a TODO instructions file detailing all cumulative code changes required
    to adopt a given hydrogen version
  • Provides a gentle notice during development detailing when a hydrogen is outdated, as well as a quick glance into the number of hydrogen version available

Getting started

Basic use

# from the base of the project run

h2 upgrade

Alternatively, you can upgrade from another folder by using the --path flag

h2 upgrade --path /path-to-a-outdated-hydrogen-project

--version flag

The version flag let's you upgrade to a specific release version without any further
prompts. If an invalid version is provided you will be prompted to choose a hydrogen
version via a CLI prompt

h2 upgrade --version 2023.10.0

Dev upgrade notice

Simply run dev as normal

npm run dev

# or
h2 dev

---no-version-check flag

If you want to disable the development notice, simply run

h2 dev --no-version-check

--dry-run flag

If your are unsure about upgrading or just want to preview the TODO list of
changes to a given hydrogen version you can run

h2 upgrade --dry-run

# this will output a new .md file inside the .shopify/ folder for a given upgrade

Preview

Version selection prompt

Screenshot 2023-11-07 at 3 39 24 PM

Preview of Features and Fixes for a selected version

Screenshot 2023-11-07 at 3 39 47 PM

Upgrade success notice

Screenshot 2023-11-07 at 3 40 30 PM

Example instructions/TODO file

Screenshot 2023-11-07 at 3 41 17 PM

🎩 tophat:

  1. Checkout this branch
git checkout juanpprieto/upgrade-command
  1. Watch cli by running dev at /src/packages/cli
npm run dev
  1. On a separate terminal run:
h2 [dev|upgrade] [--dry-run|--disable-version-check|--version] --path /to-an-outdated-hydrogen-project

Co-authored-by: Graham F. Scott <gfscott@users.noreply.github.com>
@juanpprieto juanpprieto merged commit bca112e into main Nov 17, 2023
7 of 9 checks passed
@juanpprieto juanpprieto deleted the juanpprieto/upgrade-command branch November 17, 2023 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants