|
| 1 | +--- |
| 2 | +title: Ember 4.5 Released |
| 3 | +authors: |
| 4 | + - jen-weber |
| 5 | + - chris-krycho |
| 6 | +date: 2022-07-13T21:00:00.000Z |
| 7 | +tags: |
| 8 | + - releases |
| 9 | + - '2022' |
| 10 | + - version-4-x |
| 11 | +--- |
| 12 | + |
| 13 | +Today the Ember project is releasing version 4.5 of Ember.js and Ember CLI. |
| 14 | + |
| 15 | +Version 4.4 of Ember is now promoted to LTS (Long Term Support). |
| 16 | +An LTS version of Ember continues to receive security updates for 9 release cycles (54 weeks) and bugfixes for 6 cycles (36 weeks). |
| 17 | +LTS releases typically occur every four minor versions. |
| 18 | +The previous LTS version of Ember was 3.28. |
| 19 | + |
| 20 | +This release kicks off the 4.5 beta cycle for all sub-projects. We encourage our community (especially addon authors) to help test these beta builds and report any bugs before they are published as a final release in six weeks' time. The [ember-try](https://github.com/ember-cli/ember-try) addon is a great way to continuously test your projects against the latest Ember releases. |
| 21 | + |
| 22 | +You can read more about our general release process here: |
| 23 | + |
| 24 | +- [Release Dashboard](http://emberjs.com/releases/) |
| 25 | +- [The Ember Release Cycle](https://blog.emberjs.com/new-ember-release-process/) |
| 26 | +- [The Ember Project](https://blog.emberjs.com/ember-project-at-2-0/) |
| 27 | +- [Ember LTS Releases](https://blog.emberjs.com/announcing-embers-first-lts/) |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## Ember.js |
| 32 | + |
| 33 | +Ember.js is the core framework for building ambitious web applications. |
| 34 | + |
| 35 | +### Changes in Ember.js 4.5 |
| 36 | + |
| 37 | +Ember.js 4.5 is an incremental, backwards compatible release of Ember with bug fixes, performance improvements, and minor deprecations. |
| 38 | + |
| 39 | +#### Bug Fixes |
| 40 | + |
| 41 | +Ember.js 4.5 introduced 0 bug fixes. |
| 42 | + |
| 43 | +#### Features |
| 44 | + |
| 45 | +Ember.js 4.5 introduced 2 new features. |
| 46 | + |
| 47 | +1. Plain function as helpers |
| 48 | +2. A new `renderSettled` test helper |
| 49 | + |
| 50 | +##### 1. Plain functions as helpers |
| 51 | + |
| 52 | +You can now use plain functions as helpers in your component templates. This helps make the relationship between Ember component templates and their JavaScript class more intuitive. |
| 53 | + |
| 54 | +For example, here we create a method `double` and use it directly in a template: |
| 55 | + |
| 56 | +```js |
| 57 | +// my-component.js |
| 58 | + |
| 59 | +import Component from '@glimmer/component'; |
| 60 | + |
| 61 | +export default class MyComponent extends Component { |
| 62 | + double = num => num * 2; |
| 63 | +} |
| 64 | +``` |
| 65 | + |
| 66 | +```hbs |
| 67 | +// my-component.hbs |
| 68 | +
|
| 69 | +{{this.double 2}} |
| 70 | +
|
| 71 | +<SomeComponent @foo={{this.double 2}} /> |
| 72 | +``` |
| 73 | + |
| 74 | +Previously, you could define this locally, but still had to [use the `helper()`](https://guides.emberjs.com/release/components/helper-functions/#toc_writing-a-helper-function) function to accomplish this. |
| 75 | + |
| 76 | +We're working on updating the Guides to cover this pattern. |
| 77 | +For background, check out [RFC 756](https://rfcs.emberjs.com/id/0756-helper-default-manager), which designed this feature. |
| 78 | +Also, keep your eyes on this blog: we will have a dedicated blog post with a deep dive on this new capability in the next week or two! |
| 79 | + |
| 80 | +##### 2. A new `renderSettled` test helper |
| 81 | + |
| 82 | +<!--alex ignore waiters-waitresses--> |
| 83 | +Under the hood, Ember's tests use a "test waiters" system to allow you to control the flow of your tests in terms of the actual framework behavior. |
| 84 | +That way that your tests match exactly what the app does at runtime. |
| 85 | + |
| 86 | +<!-- alex ignore just waiters-waitresses--> |
| 87 | +However, making this work depends on Ember providing all the necessary hooks for test helpers to use, and there was one significant missing public API. |
| 88 | +You could wait for *all* of the test waiters to finish with `settled`, but there was no public way to wait for *just rendering* to finish. |
| 89 | +For example, you might want to wait for rendering to finish but *not* for an Ember Data `save` operation to finish, as part of testing a loading screen. |
| 90 | + |
| 91 | +Ember 4.5 introduces a new function, `renderSettled`, as a public way for test helpers to interact with the rendering phase of the application. |
| 92 | +`renderSettled` returns returns a promise which fulfills as soon as rendering has completed. |
| 93 | +It can be used in any rendering or application test. |
| 94 | +(It also works in other tests where you set up the rendering hooks manually, but this is unusual!) |
| 95 | + |
| 96 | +```js |
| 97 | +import { renderSettled } from '@ember/renderer'; |
| 98 | +``` |
| 99 | + |
| 100 | +An recent release of `@ember/test-helpers`, [v2.8.0](https://github.com/emberjs/ember-test-helpers/blob/master/CHANGELOG.md#v280-2022-05-17), takes advantage of this to provide a new `await rerender()` helper. |
| 101 | +For more details, and how this fits into improvements to Ember's testing story, see [RFC 785](https://rfcs.emberjs.com/id/0785-remove-set-get-in-tests). |
| 102 | + |
| 103 | +#### Deprecations |
| 104 | + |
| 105 | +Ember.js 4.5 introduced 0 deprecations. |
| 106 | + |
| 107 | + |
| 108 | +For more details on changes in Ember.js 4.5, please review the [Ember.js 4.5.0 release page](https://github.com/emberjs/ember.js/releases/tag/v4.5.0). |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +## Ember Data |
| 113 | + |
| 114 | +Ember Data is the official data persistence library for Ember.js |
| 115 | + |
| 116 | +Due to low availability for the Ember Data team this cycle, Ember Data does not have a new release, so it remains at 4.4. |
| 117 | + |
| 118 | +Please see the [Ember 4.4 release blog post](https://blog.emberjs.com/ember-released-4-4) for details about `v4.4` of Ember Data. |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +## Ember CLI |
| 123 | + |
| 124 | +Ember CLI is the command line interface for managing and packaging Ember.js applications. |
| 125 | + |
| 126 | +### Upgrading Ember CLI |
| 127 | + |
| 128 | +You may upgrade Ember CLI using the `ember-cli-update` project: |
| 129 | + |
| 130 | +```bash |
| 131 | +npx ember-cli-update |
| 132 | +``` |
| 133 | + |
| 134 | +This utility will help you to update your app or addon to the latest Ember CLI version. You will probably encounter merge conflicts, in which the default behavior is to let you resolve conflicts on your own. For more information on the `ember-cli-update` project, see [the GitHub README](https://github.com/ember-cli/ember-cli-update). |
| 135 | + |
| 136 | +While it is recommended to keep Ember CLI versions in sync with Ember and Ember Data, this is not required. After updating ember-cli, you can keep your current version(s) of Ember or Ember Data by editing `package.json` to revert the changes to the lines containing `ember-source` and `ember-data`. |
| 137 | + |
| 138 | +### Changes in Ember CLI 4.5 |
| 139 | + |
| 140 | +#### Bug Fixes |
| 141 | + |
| 142 | +Ember CLI 4.5 introduced a variety of small bug fixes and documentation improvements. |
| 143 | +You can find the full list in the [Ember CLI 4.5.0 release page](https://github.com/ember-cli/ember-cli/releases/tag/v4.5.0). |
| 144 | + |
| 145 | +#### Features |
| 146 | + |
| 147 | +Ember CLI 4.5 introduced 0 features. |
| 148 | + |
| 149 | +#### Deprecations |
| 150 | + |
| 151 | +Ember CLI 4.5 introduced 2 deprecations. |
| 152 | + |
| 153 | +- Using the terms `whitelist` and `blacklist` build options are deprecated. Please use |
| 154 | +`include` and `exclude` instead. Only the name of the option has changed, and |
| 155 | +the functionality is unchanged. This work to add the |
| 156 | +new option naming was initially planned in |
| 157 | +[RFC 639](https://rfcs.emberjs.com/id/0639-replace-blacklist-whitelist), |
| 158 | +and the deprecation RFC is |
| 159 | +[RFC 801](https://rfcs.emberjs.com/id/0801-deprecate-blacklist-and-whitelist-build-options). |
| 160 | +- Support for [`ember-cli-jshint` is deprecated](https://github.com/ember-cli/ember-cli/pull/9909). |
| 161 | + |
| 162 | +The `addonJsFiles` method that was previously deprecated in `v3.13` of Ember CLI [has now been removed](https://github.com/ember-cli/ember-cli/pull/9898). |
| 163 | + |
| 164 | + |
| 165 | +For more details on the changes in Ember CLI 4.5 and detailed upgrade |
| 166 | +instructions, please review the [Ember CLI 4.5.0 release page](https://github.com/ember-cli/ember-cli/releases/tag/v4.5.0). |
| 167 | + |
| 168 | +## Thank You! |
| 169 | + |
| 170 | +As a community-driven open-source project with an ambitious scope, each of these releases serves as a reminder that the Ember project would not have been possible without your continued support. We are extremely grateful to our contributors for their efforts. |
0 commit comments