2.0.1 • Published 1 year ago

ember-cli-update v2.0.1

Weekly downloads
9,414
License
MIT
Repository
github
Last release
1 year ago

ember-cli-update

npm version npm.io Build status

logo

Update Ember CLI projects

The 2 use cases are: 1. Updating a project's boilerplate code from an older Ember version to a newer one like 3.4.0 to 3.20.0 for example. These are called base blueprints and there are 3 types officially provided by ember-cli: app, addon, and glimmer.

  • This is different from the existing ember init command. That command tries to reset your project back to a brand new project. It removes all your changes and additions.
  1. Updating boilerplate code for a blueprint from an Ember addon from an older version to a newer one. These are called custom blueprints.

Check out the wiki guide for more details.

You can run the CLI either as a global executable available to all projects or an Ember CLI command in a single project.

The CLI attempts to be a thin wrapper of boilerplate-update.

Installation

As a global executable:

npm install -g ember-cli-update

As an Ember CLI command:

ember install ember-cli-update

(You must commit the change to package.json before running the update command or else you get an error.)

Usage

Make sure your git working directory is clean before updating.

Inside your project directory, if you installed globally run

ember-cli-update

or if you installed as an Ember CLI command run

ember update

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.

This is different from the existing ember init command. That command tries to reset your project back to a brand new project. It removes all your changes and additions.

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.

This tool can also run codemods for you. The option --run-codemods will figure out what codemods apply to your current version of Ember.js, and download and run them for you.

Examples

(These examples assume you are using the global command.)

To update to the latest version of Ember CLI:

ember-cli-update

To update to a certain version of Ember CLI:

ember-cli-update --to 3.1.0

To run codemods:

(This should be run after running the normal update shown above, and after you've resolved any conflicts.)

ember-cli-update --run-codemods

Commands

ember-cli-update

Commands:
  ember-cli-update bootstrap        saves the detected blueprint state
  ember-cli-update codemods         Run codemods to help update your code
  ember-cli-update compare          Show the changes between different versions
                                    without updating
  ember-cli-update init             initialize a blueprint
  ember-cli-update install <addon>  install an addon
  ember-cli-update reset            reset a blueprint
  ember-cli-update save             save old blueprint state
  ember-cli-update stats            list blueprint version updates

Options:
      --help                     Show help                             [boolean]
      --version                  Show version number                   [boolean]
  -p, --package-name, --package  Provide a package that can contain many
                                 blueprints ("@glimmer/blueprint", "git+https://
                                 git@github.com/tildeio/libkit.git",
                                 "../blueprint")                        [string]
  -b, --blueprint                Provide a custom blueprint for use in the
                                 update ("@glimmer/blueprint", "git+https://git@
                                 github.com/tildeio/libkit.git", "../blueprint")
                                                                        [string]
      --from                     Use a starting version that is different than
                                 what is in your package.json ("2.9.1") [string]
      --to                       Update to a version that isn't latest
                                 ("2.14.1", "~2.15", "latest", "beta")  [string]
      --resolve-conflicts        Automatically run git mergetool if conflicts
                                 found                [boolean] [default: false]
      --run-codemods             Run codemods to help update your code
                                                      [boolean] [default: false]
      --codemods-source          Supply your own codemods manifest via URL
                                 ("ember-app-codemods-manifest@*",
                                 "git+https://github.com/ember-cli/ember-app-cod
                                 emods-manifest.git#semver:*")          [string]
      --codemods-json            Supply your own codemods manifest via JSON (`{
                                 /* json */ }`)                         [string]
      --reset                    Reset your code to the default blueprint at the
                                 new version          [boolean] [default: false]
      --compare-only             Show the changes between different versions
                                 without updating     [boolean] [default: false]
      --stats-only               Show all calculated values regarding your
                                 project              [boolean] [default: false]
      --list-codemods            List available codemods
                                                      [boolean] [default: false]
      --output-repo              An output repository of changes over time
                                                                        [string]

ember-cli-update bootstrap

saves the detected blueprint state

Options:
  --help     Show help                                                 [boolean]
  --version  Show version number                                       [boolean]

ember-cli-update codemods

Run codemods to help update your code

Options:
      --help                    Show help                              [boolean]
      --version                 Show version number                    [boolean]
  -p, --packageName, --package  Provide a package that can contain many
                                blueprints ("@glimmer/blueprint",
                                "git+https://git@github.com/tildeio/libkit.git",
                                "../blueprint")                         [string]
  -b, --blueprint               Provide a custom blueprint for use in the update
                                ("@glimmer/blueprint",
                                "git+https://git@github.com/tildeio/libkit.git",
                                "../blueprint")                         [string]
      --source-json             Supply your own codemods manifest via JSON (`{
                                /* json */ }`)                          [string]
      --list                    List available codemods
                                                      [boolean] [default: false]

ember-cli-update compare

Show the changes between different versions without updating

Options:
      --help                    Show help                              [boolean]
      --version                 Show version number                    [boolean]
  -p, --packageName, --package  Provide a package that can contain many
                                blueprints ("@glimmer/blueprint",
                                "git+https://git@github.com/tildeio/libkit.git",
                                "../blueprint")                         [string]
  -b, --blueprint               Provide a custom blueprint for use in the update
                                ("@glimmer/blueprint",
                                "git+https://git@github.com/tildeio/libkit.git",
                                "../blueprint")                         [string]
      --to                      Update to a version that isn't latest ("2.14.1",
                                "~2.15", "latest", "beta")              [string]

ember-cli-update init

initialize a blueprint

Options:
      --help              Show help                                    [boolean]
      --version           Show version number                          [boolean]
  -b, --blueprint         Provide a custom blueprint for use in the update
                          ("@glimmer/blueprint",
                          "git+https://git@github.com/tildeio/libkit.git",
                          "../blueprint")                               [string]
      --to                Update to a version that isn't latest ("2.14.1",
                          "~2.15", "latest", "beta")                    [string]
      --resolveConflicts  Automatically run git mergetool if conflicts found
                                                      [boolean] [default: false]
      --outputRepo        An output repository of changes over time     [string]
      --codemodsSource    Supply your own codemods manifest via URL
                          ("ember-app-codemods-manifest@*",
                          "git+https://github.com/ember-cli/ember-app-codemods-m
                          anifest.git#semver:*")                        [string]

ember-cli-update install <addon>

install an addon

Options:
      --help       Show help                                           [boolean]
      --version    Show version number                                 [boolean]
  -b, --blueprint  Provide a custom blueprint for use in the update
                   ("@glimmer/blueprint",
                   "git+https://git@github.com/tildeio/libkit.git",
                   "../blueprint")                                      [string]

ember-cli-update reset

reset a blueprint

Options:
      --help                    Show help                              [boolean]
      --version                 Show version number                    [boolean]
  -p, --packageName, --package  Provide a package that can contain many
                                blueprints ("@glimmer/blueprint",
                                "git+https://git@github.com/tildeio/libkit.git",
                                "../blueprint")                         [string]
  -b, --blueprint               Provide a custom blueprint for use in the update
                                ("@glimmer/blueprint",
                                "git+https://git@github.com/tildeio/libkit.git",
                                "../blueprint")                         [string]
      --to                      Update to a version that isn't latest ("2.14.1",
                                "~2.15", "latest", "beta")              [string]

ember-cli-update save

save old blueprint state

Options:
      --help                    Show help                              [boolean]
      --version                 Show version number                    [boolean]
  -p, --packageName, --package  Provide a package that can contain many
                                blueprints ("@glimmer/blueprint",
                                "git+https://git@github.com/tildeio/libkit.git",
                                "../blueprint")                         [string]
  -b, --blueprint               Provide a custom blueprint for use in the update
                                ("@glimmer/blueprint",
                                "git+https://git@github.com/tildeio/libkit.git",
                                "../blueprint")                         [string]
      --from                    Use a starting version that is different than
                                what is in your package.json ("2.9.1")  [string]
      --outputRepo              An output repository of changes over time
                                                                        [string]
      --codemodsSource          Supply your own codemods manifest via URL
                                ("ember-app-codemods-manifest@*",
                                "git+https://github.com/ember-cli/ember-app-code
                                mods-manifest.git#semver:*")            [string]

ember-cli-update stats

list blueprint version updates

Options:
      --help                    Show help                              [boolean]
      --version                 Show version number                    [boolean]
  -p, --packageName, --package  Provide a package that can contain many
                                blueprints ("@glimmer/blueprint",
                                "git+https://git@github.com/tildeio/libkit.git",
                                "../blueprint")                         [string]
  -b, --blueprint               Provide a custom blueprint for use in the update
                                ("@glimmer/blueprint",
                                "git+https://git@github.com/tildeio/libkit.git",
                                "../blueprint")                         [string]

Power User Guide

Let's update from Ember CLI 2.18.2 to Ember CLI 3.1.4

First, make sure you are on the latest ember-cli-update version for good measure.

npm install -g ember-cli-update

Then, run all compatible codemods against your current version. Since codemods are downloaded on the fly, they can be updated (and new ones added) without even getting a new version of ember-cli-update. Also, we may add additional codemods targeting your older version of Ember.js.

ember-cli-update --run-codemods

Assuming you are multiple versions behind of Ember CLI, you may want to update in stages. Unless you have a really simple app, updating in stages can help isolate upgrade issues.

ember-cli-update --to 3.0

Once you resolve conflicts and commit, You again want to run codemods. This is because new codemods targeting Ember.js 3.0 will now apply.

ember-cli-update --run-codemods

Now you are ready to update again. (If your final update is going to be the latest version of Ember CLI, you don't need the --to option.)

ember-cli-update --to 3.1

Again, after you resolve conflicts and commit, you want to run codemods because of new Ember.js 3.1 codemods.

ember-cli-update --run-codemods

And then you're done! You have a freshly updated app (or addon). As noted, you can consolidate these steps by doing a direct update, but then you may be confused if you encounter issues which version is to blame.

Hints

Need help using git mergetool? Here are some starting points:

If you made a mistake during the update/conflict resolution, run these commands to undo everything and get you back to before the update:

git reset --hard
git clean -f

If you notice ".orig" files lying around after a merge and don't want that behavior, run git config --global mergetool.keepBackup false.

To avoid being prompted "Hit return to start merge resolution tool (vimdiff):" for every conflict, set a merge tool like git config --global merge.tool "vimdiff".

If you run into an error like error: unrecognized input, you may need to update your git config color option like git config --global color.ui auto.

Troubleshooting

If you are getting an error or unexpected results, running the command with the debug flag:

  • Unix (global):   DEBUG=ember-cli-update,boilerplate-update,git-diff-apply ember-cli-update
  • Windows (global):   set DEBUG=ember-cli-update,boilerplate-update,git-diff-apply && ember-cli-update
  • Unix (command):   DEBUG=ember-cli-update,boilerplate-update,git-diff-apply ember update
  • Windows (command):   set DEBUG=ember-cli-update,boilerplate-update,git-diff-apply && ember update

will give you more detailed logging.

2.0.1

1 year ago

2.0.0

1 year ago

1.0.1

3 years ago

1.0.0

4 years ago

0.56.0

4 years ago

0.55.2

4 years ago

0.55.1

4 years ago

0.55.0

4 years ago

0.54.6

5 years ago

0.54.5

5 years ago

0.54.4

5 years ago

0.54.3

5 years ago

0.54.1

5 years ago

0.54.2

5 years ago

0.54.0

5 years ago

0.53.2

5 years ago

0.53.3

5 years ago

0.53.1

5 years ago

0.53.0

5 years ago

0.52.1

5 years ago

0.52.0

5 years ago

0.51.0

5 years ago

0.50.0

5 years ago

0.49.7

5 years ago

0.49.8

5 years ago

0.49.6

5 years ago

0.49.5

5 years ago

0.49.4

5 years ago

0.48.3

5 years ago

0.49.1

5 years ago

0.49.2

5 years ago

0.49.0

5 years ago

0.49.3

5 years ago

0.48.2

5 years ago

0.48.1

5 years ago

0.48.0

5 years ago

0.47.19

5 years ago

0.47.18

5 years ago

0.47.17

5 years ago

0.47.16

5 years ago

0.47.15

5 years ago

0.47.14

5 years ago

0.47.13

5 years ago

0.47.12

5 years ago

0.47.11

5 years ago

0.47.10

5 years ago

0.47.9

5 years ago

0.47.8

5 years ago

0.47.7

5 years ago

0.47.6

5 years ago

0.47.5

5 years ago

0.47.4

5 years ago

0.47.3

5 years ago

0.47.2

5 years ago

0.47.1

5 years ago

0.47.0

5 years ago

0.46.6

5 years ago

0.46.5

5 years ago

0.46.4

5 years ago

0.46.3

5 years ago

0.46.2

5 years ago

0.46.1

5 years ago

0.46.0

5 years ago

0.45.0

5 years ago

0.44.0

5 years ago

0.43.10

5 years ago

0.43.9

5 years ago

0.43.8

5 years ago

0.43.7

5 years ago

0.43.6

5 years ago

0.43.5

5 years ago

0.43.4

5 years ago

0.43.3

5 years ago

0.43.2

5 years ago

0.43.1

5 years ago

0.43.0

5 years ago

0.42.1

5 years ago

0.42.0

5 years ago

0.41.0

5 years ago

0.40.0

5 years ago

0.39.1

5 years ago

0.39.0

5 years ago

0.38.0

5 years ago

0.37.3

5 years ago

0.37.2

5 years ago

0.37.1

5 years ago

0.37.0

5 years ago

0.36.1

5 years ago

0.36.0

5 years ago

0.35.5

5 years ago

0.35.4

5 years ago

0.35.3

5 years ago

0.35.2

5 years ago

0.35.1

5 years ago

0.35.0

5 years ago

0.34.13

5 years ago

0.34.12

5 years ago

0.34.11

5 years ago

0.34.10

6 years ago

0.34.9

6 years ago

0.34.8

6 years ago

0.34.7

6 years ago

0.34.6

6 years ago

0.34.5

6 years ago

0.34.4

6 years ago

0.34.3

6 years ago

0.34.2

6 years ago

0.34.1

6 years ago

0.34.0

6 years ago

0.33.3

6 years ago

0.33.2

6 years ago

0.33.1

6 years ago

0.33.0

6 years ago

0.32.5

6 years ago

0.32.4

6 years ago

0.32.3

6 years ago

0.32.2

6 years ago

0.32.1

6 years ago

0.32.0

6 years ago

0.31.6

6 years ago

0.31.5

6 years ago

0.31.4

6 years ago

0.31.3

6 years ago

0.31.2

6 years ago

0.31.1

6 years ago

0.31.0

6 years ago

0.30.0

6 years ago

0.29.5

6 years ago

0.29.4

6 years ago

0.29.3

6 years ago

0.29.2

6 years ago

0.29.1

6 years ago

0.29.0

6 years ago

0.28.0

6 years ago

0.27.18

6 years ago

0.27.17

6 years ago

0.27.16

6 years ago

0.27.15

6 years ago

0.27.14

6 years ago

0.27.11

6 years ago

0.27.10

6 years ago

0.27.9

6 years ago

0.27.8

6 years ago

0.27.7

6 years ago

0.27.6

6 years ago

0.27.5

6 years ago

0.27.4

6 years ago

0.27.3

6 years ago

0.27.2

6 years ago

0.27.1

6 years ago

0.27.0

6 years ago

0.26.0

6 years ago

0.25.0

6 years ago

0.24.0

6 years ago

0.23.0

6 years ago

0.22.0

6 years ago

0.21.4

7 years ago

0.21.3

7 years ago

0.21.2

7 years ago

0.21.1

7 years ago

0.21.0

7 years ago

0.20.5

7 years ago

0.20.4

7 years ago

0.20.3

7 years ago

0.20.2

7 years ago

0.20.1

7 years ago

0.20.0

7 years ago

0.19.0

7 years ago

0.18.0

7 years ago

0.17.2

7 years ago

0.17.1

7 years ago

0.16.0

7 years ago

0.15.0

7 years ago

0.14.0

7 years ago

0.13.4

7 years ago

0.13.3

7 years ago

0.13.2

7 years ago

0.13.1

7 years ago

0.13.0

7 years ago

0.12.0

7 years ago

0.11.0

7 years ago

0.10.1

7 years ago

0.10.0

7 years ago

0.9.5

7 years ago

0.9.4

7 years ago

0.9.3

7 years ago

0.9.2

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago

0.8.4

7 years ago

0.8.3

7 years ago

0.8.2

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.7.2

7 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.8

7 years ago

0.6.7

7 years ago

0.6.6

7 years ago

0.6.5

7 years ago

0.6.4

7 years ago

0.6.3

7 years ago

0.6.2

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.0

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.4

7 years ago

0.3.3

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago