Skip to content

Commit f2c7781

Browse files
authored
docs(README, MIGRATION): Update README, add MIGRATION-GUIDE (#28)
- Update README file to reflect the changes of the new major version - Add a MIGRATION-GUIDE, explaining the breaking changes and their way of migration more detailed
1 parent d34f9f3 commit f2c7781

File tree

2 files changed

+366
-351
lines changed

2 files changed

+366
-351
lines changed

MIGRATION-GUIDE.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Migration Guide
2+
3+
Strictly following the principle of semantic versioning, breaking changes only occur between major versions. This Migration Guide gives
4+
developers a more detailed insight into the changes introduced with new major releases, in particular the breaking changes and their
5+
consequences, while also suggesting a migration strategy.
6+
7+
Also see then **[CHANGELOG](./CHANGELOG.md)** and **[GitHub releases](https://github.com/dominique-mueller/angular-notifier/releases)**.
8+
9+
<br>
10+
11+
## Migration from `1.x` to `2.x`
12+
13+
> The amount of breaking changes from `1.x` to `2.x` is rather small, a migration shouldn't take longer than 5 minutes.
14+
15+
#### Compatible with Angular 4+ only
16+
17+
The library is now compatible with Angular 4+, using the all new & improved Angular APIs (such as the new `Renderer2`). Consequently, this
18+
also means that the compatibility with Angualr 2 breaks. If you still want to stick to Angular 2, you can continue using the latest `1.x`
19+
release; however, all new development (inlcuding bug fixes and features) will happen in the new `2.x` releases.
20+
21+
#### Renaming of component selectors and classes
22+
23+
For consistency reasons, all component selectors and CSS class names got renamed to no longer use the `x-` prefix. To migrate your
24+
application, simply rename the `x-notifier-container` tag to `notifier-container`. Also, if you did write custom themes or overwrote the
25+
default styling, you should remove the `x-` prefix from all CSS class names. The SASS variables, however, are still named the same.
26+
27+
#### Renaming of module `forRoot()` method
28+
29+
The `NotifierModule.forRoot()` method was used for passing custom options to the notifier. While the functionality stays the exact same, the
30+
method is now called `NotifierModule.withConfig()` instead. This seemed to be the more semantic, meaningful name here.
31+
32+
#### Names & paths of published files
33+
34+
With Angular 4+, a new recommendation regarding the publishment of Angular libraries has been defined. This includes a different folder
35+
structure, and also different output files. Therefore, the published files now include:
36+
37+
- `angular-notifier.js` as the "rolled up" ES6 FESM (Flat ECMAScript Module) bundle
38+
- `angular-notifier.es5.js` as the "rolled up" ES5 FESM (Flat ECMAScript Module) bundle, however using ES6 import
39+
- `angular-notifier.umd.js` as the ES5 UMD (Universal Module Definition) bundle, here for compatibility reasons
40+
- Both the original `styles.scss` and compiled `styles.css` file exist, yet are available at the root path; sub-files are now located in the
41+
"styles" folder
42+
- Also, the places of all the sourcemaps and TypeScript definition files changed (which, however, shouldn't affect anyone)
43+
44+
*The only change affecting developers is probably the path change of the SASS / CSS files. When using SystemJS, a path change of JavaScript
45+
files might also be necessary. Most modern frontend build tools (such as Webpack or Rollup) will recognize and understand this library and
46+
its published files automatically.*
47+
48+
#### Web Animations API polyfill
49+
50+
The implementation of animations has been changed slightly, so that now the *default* Web Animations API polyfill should be sufficient to
51+
make this library work in older browsers. This is also the polyfill defined within Angular CLI based projects in the `polyfills.ts` file by
52+
default. While it for sure will save us a few bytes over the network line, it also prevents confusion amongst developers (such as
53+
**[#6](https://github.com/dominique-mueller/angular-notifier/issues/6)**,
54+
**[#10](https://github.com/dominique-mueller/angular-notifier/issues/10)**). In particular:
55+
56+
``` typescript
57+
// With 1.x
58+
import 'web-animations-js/web-animations-next.min.js';
59+
60+
// Now with 2.x
61+
import 'web-animations-js';
62+
// Same as: import 'web-animations-js/web-animations.min.js';
63+
```

0 commit comments

Comments
 (0)