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
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
8e44488
Add version changelog boilerplate
juanpprieto Sep 11, 2023
9626950
update
juanpprieto Sep 13, 2023
9723d91
update
juanpprieto Sep 19, 2023
8b6ae3a
.
juanpprieto Sep 21, 2023
d9d1020
Update package-lock.json
Sep 7, 2023
928dbd8
merge main
juanpprieto Oct 31, 2023
2579477
update oclif manifest
juanpprieto Oct 26, 2023
e662c72
Delete packages/cli/VERSION_CHANGELOG.md
juanpprieto Oct 26, 2023
c252cb1
merge
juanpprieto Nov 7, 2023
f10a462
merge main
juanpprieto Nov 8, 2023
a5afd29
Updage changelog to 2023.10
juanpprieto Oct 31, 2023
def07d8
remove groupings
juanpprieto Nov 1, 2023
3a6a8e8
add support for conditional npm installs and all remix packages
juanpprieto Nov 2, 2023
8f448d0
update changelog
juanpprieto Nov 2, 2023
c7fe3b7
WIP upgrade command tests
juanpprieto Nov 7, 2023
96f130d
upgrade command tests
juanpprieto Nov 7, 2023
33c5a74
delete reels
juanpprieto Nov 8, 2023
744a004
update changelog to the latest version
juanpprieto Nov 8, 2023
fde5833
cleanup
juanpprieto Nov 8, 2023
2d67336
add changeset
juanpprieto Nov 8, 2023
b290712
add createChangelogHandler boilerplate
juanpprieto Nov 8, 2023
5ff1249
Fixes
juanpprieto Nov 9, 2023
0612a3e
Updated --dry-run logic, support upgrading other outdated dependencies
juanpprieto Nov 16, 2023
0fccee0
update tests to match new logic
juanpprieto Nov 16, 2023
9427b8d
Simplify getSelectedRelease and tests
frandiox Nov 16, 2023
5629870
Stop using process.exit in favor of AbortError
frandiox Nov 16, 2023
a299670
Remove extra logs in dev command when there's nothing to do
frandiox Nov 16, 2023
de8bd0e
Hoist mocks
frandiox Nov 16, 2023
53e70f3
Use output mock instead of render mocks
frandiox Nov 16, 2023
5489f62
Fix going back to previous menu
frandiox Nov 16, 2023
5f2126a
Add --force flag to test in dirty git repos and fix typo
frandiox Nov 16, 2023
d9a8b68
add support and test for dependenciesMeta
juanpprieto Nov 16, 2023
a78651c
Add support for @next versions and add additional test for Remix and …
juanpprieto Nov 16, 2023
5d0b3fe
Change mocked package.json to use the skeleton template as base
juanpprieto Nov 16, 2023
7648c45
Use semver in getAbsoluteVersion
juanpprieto Nov 16, 2023
800049e
Merge branch 'main' into juanpprieto/upgrade-command
juanpprieto Nov 16, 2023
3489156
Fix displayUpgradeSummary when upgrading only dependencies
juanpprieto Nov 16, 2023
4e06191
update changeset for upgrade command
juanpprieto Nov 16, 2023
1647aba
Use local package.json instead of fetching it
frandiox Nov 17, 2023
b50acba
Merge branch 'main' into juanpprieto/upgrade-command
frandiox Nov 17, 2023
f18cd75
Use local changelog.json in tests
frandiox Nov 17, 2023
9e35ed5
Remove duplicated changelog.json
frandiox Nov 17, 2023
a18f76c
Update packages/cli/src/commands/hydrogen/upgrade.ts
juanpprieto Nov 17, 2023
aeaf02f
prep for release
juanpprieto Nov 17, 2023
a79572b
remove createChangelogHandler
juanpprieto Nov 17, 2023
db84cdb
Save instrunctions to .hydrogen instead of .shopify so that they can …
juanpprieto Nov 17, 2023
1debcaa
fix changelog
juanpprieto Nov 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .changeset/honest-apricots-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
'@shopify/cli-hydrogen': patch
---

# New `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

## Basic use

```bash
# from the base of the project run

h2 upgrade
```

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

```bash
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

```bash
h2 upgrade --version 2023.10.0
```

### Dev upgrade notice

Simply run dev as normal

```bash
npm run dev

# or
h2 dev
```

### `---no-version-check` flag

If you want to disable the development notice, simply run

```bash
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

```bash
h2 upgrade --dry-run

# this will output a new .md file inside the .shopify/ folder for a given upgrade
```
172 changes: 172 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions packages/cli/oclif.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,13 @@
"char": "e",
"description": "Specify an environment's branch name when using remote environment variables.",
"multiple": false
},
"disable-version-check": {
"name": "disable-version-check",
"type": "boolean",
"description": "Skip the version check when running `hydrogen dev`",
"required": false,
"allowNo": false
}
},
"args": {}
Expand Down Expand Up @@ -625,6 +632,47 @@
},
"args": {}
},
"hydrogen:upgrade": {
"id": "hydrogen:upgrade",
"description": "Upgrade Remix and Hydrogen npm dependencies.",
"strict": true,
"pluginName": "@shopify/cli-hydrogen",
"pluginAlias": "@shopify/cli-hydrogen",
"pluginType": "core",
"aliases": [],
"flags": {
"path": {
"name": "path",
"type": "option",
"description": "The path to the directory of the Hydrogen storefront. The default is the current directory.",
"multiple": false
},
"version": {
"name": "version",
"type": "option",
"char": "v",
"description": "A target hydrogen version to update to",
"required": false,
"multiple": false
},
"dry-run": {
"name": "dry-run",
"type": "boolean",
"char": "d",
"description": "Generate a summary and .md file with upgrade instructions without actually upgrading the dependencies",
"required": false,
"allowNo": false
},
"force": {
"name": "force",
"type": "boolean",
"char": "f",
"description": "Ignore warnings and force the upgrade to the target version",
"allowNo": false
}
},
"args": {}
},
"hydrogen:debug:cpu": {
"id": "hydrogen:debug:cpu",
"description": "Builds and profiles the server startup time the app.",
Expand Down
5 changes: 3 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
"@types/recursive-readdir": "^2.2.1",
"@types/stack-trace": "^0.0.30",
"@types/tar-fs": "^2.0.1",
"devtools-protocol": "^0.0.1177611",
"get-port": "^7.0.0",
"@vitest/coverage-v8": "^0.33.0",
"devtools-protocol": "^0.0.1177611",
"fast-glob": "^3.2.12",
"flame-chart-js": "2.3.1",
"get-port": "^7.0.0",
"type-fest": "^3.6.0",
"vitest": "^0.33.0"
},
Expand All @@ -40,6 +40,7 @@
"@shopify/mini-oxygen": "^2.2.3",
"@shopify/oxygen-cli": "2.6.1",
"ansi-escapes": "^6.2.0",
"cli-truncate": "^4.0.0",
"diff": "^5.1.0",
"fs-extra": "^11.1.0",
"get-port": "^7.0.0",
Expand Down
Loading