Skip to content

Commit 95afec1

Browse files
cah-danmonroeJen Weber
authored and
Jen Weber
committed
Port over upgrading (#13)
* Port over upgrading * Updates based on review
1 parent dc5780d commit 95afec1

File tree

1 file changed

+70
-4
lines changed

1 file changed

+70
-4
lines changed

guides/basic-use/upgrading.md

+70-4
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,77 @@ ember --version
2020

2121
## Upgrading an Ember app itself
2222

23-
There are automated Ember CLI tools available to help upgrade Ember apps, including codemods that help with syntax changes. Visit
24-
[ember-cli-update](https://github.com/ember-cli/ember-cli-update) for the latest instructions.
23+
To upgrade an Ember CLI app use `ember-cli-update`. Installation instructions can be found [here](https://github.com/ember-cli/ember-cli-update#installation).
2524

26-
<!-- Needs a section that describes a common upgrade experience, explains deprecations, links to Deprecations site, and hints that upgrades to get new features or jump major versions require changes to the codebase. Common misconception is that you can just jump versions in package.json. Pull in info from https://ember-cli.com/user-guide/#upgrading -->
25+
When it's done, if you installed `ember-cli-update` globally, run the following command inside your project directory,
26+
27+
```bash
28+
ember-cli-update
29+
```
30+
31+
or if you installed as an Ember CLI command, run
32+
33+
```bash
34+
ember update
35+
```
36+
37+
This will update your app or addon to the latest Ember CLI version. It does this by fetching the latest version and comparing it to your project's Ember CLI version. It then applies a diff of the changes from the latest version to your project. It will only modify the files if there are changes between your project's version and the latest version, and it will only change the section necessary, not the entire file.
38+
39+
You will probably encounter merge conflicts, in which the default behavior is to let you resolve conflicts on your own. You can supply the `--resolve-conflicts` option to run your system's git merge tool if any conflicts are found.
40+
41+
There's some other `ember-cli-update` options documented [here](https://github.com/ember-cli/ember-cli-update#options).
42+
43+
For example, to update to a specific version, use the `--to` option:
44+
```bash
45+
ember-cli-update --to 3.4.3
46+
```
47+
48+
Steps to upgrade to the latest version of Ember CLI are also included with the
49+
[release notes for each release](https://github.com/ember-cli/ember-cli/releases).
50+
51+
52+
53+
### Updating your code automatically
54+
55+
After running the normal update shown above, and after you've resolved any conflicts,
56+
you can run `ember-cli-update` again with the `--run-codemods` option.
57+
Codemods are tools that automatically make the tedious syntax changes to your code that
58+
you would normally have to do manually.
59+
They help to ensure you are using the latest patterns and platform features.
60+
61+
```bash
62+
ember-cli-update --run-codemods
63+
```
64+
The tool will examine your project and list the available codemods.
65+
Use the arrow keys to move the selector up and down. Press space to select the ones you want
66+
or you can press `a` to select them all. Press Enter to proceed.
67+
```js
68+
? These codemods apply to your project. Select which one's to run.
69+
Press <space> to select, <a> to toggle all, <i> to invert selection
70+
❯◯ ember-modules-codemod
71+
◯ ember-qunit-codemod
72+
◯ ember-test-helpers-codemod
73+
◯ es5-getter-ember-codemod
74+
◯ qunit-dom-codemod
75+
```
76+
77+
78+
#### Troubleshooting
79+
If you made a mistake during the update/conflict resolution, run these commands to undo everything and get you back to before the update:
80+
81+
```bash
82+
git reset --hard
83+
git clean -f
84+
```
85+
<!-- Needs a section that describes a common upgrade experience,
86+
explains deprecations,
87+
links to Deprecations site,
88+
and hints that upgrades to get new features or jump major versions require changes to the codebase.
89+
Common misconception is that you can just jump versions in package.json.
90+
Pull in info from https://ember-cli.com/user-guide/#upgrading -->
2791
2892
## Upgrading Addon Dependencies
2993
30-
<!-- very brief guidance on how to approach addons, and a note that sometimes deprecation warnings come from outdated addons rather than your app -->
94+
<!-- very brief guidance on how to approach addons,
95+
and a note that sometimes deprecation warnings come
96+
from outdated addons rather than your app -->

0 commit comments

Comments
 (0)