Skip to content

Commit

Permalink
chore(peerDependencies): narrow angular peerDependencies to exclude v…
Browse files Browse the repository at this point in the history
…ersions with JSONP bug#13219

- add note in `README.md` regarding angular version and  angular/angular#13219
  • Loading branch information
tinesoft committed Feb 23, 2017
1 parent 32ce7a6 commit 1be94a8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ Install it with npm

`npm install ng2-sharebuttons --save`

> **Note**: Make sure you are using a version of `@angular` in the following ranges:
> * `>=2.0.0 and <2.4.6` or
> * `>=2.4.8 and <4.0.0-beta.6` or
> * `>=4.0.0-beta.8`
>
> In fact, a bug(#13219) in `@angular/http`(JSONP) was introduced in [`2.4.6`](https://github.com/angular/angular/commit/1eece50)(resp. [`4.0.0-beta.6`](https://github.com/angular/angular/commit/9e5617e)) and fixed in [`2.4.8`](https://github.com/angular/angular/commit/9ceb5d1)(resp. [`4.0.0-beta.8`](https://github.com/angular/angular/commit/4676df5)).
> It affects JSONP and the count of number of shares for some buttons (linkedin and tumblr).
>
> See angular's [CHANGELOG](https://github.com/angular/angular/blob/master/CHANGELOG.md) for details.
### SystemJS
If you are using SystemJS, you should also adjust your configuration to point to the UMD bundle.

Expand Down
11 changes: 10 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,16 @@ gulp.task('package', (cb) => {
// defines project's dependencies as 'peerDependencies' for final users
targetPkgJson.peerDependencies = {};
Object.keys(pkgJson.dependencies).forEach((dependency) => {
targetPkgJson.peerDependencies[dependency] = `^${pkgJson.dependencies[dependency]}`;
if (dependency.startsWith('@angular/')) {
// narrow version of @angular packages to address bug with JSONP inroduced in [2.4.6, 2.4.8[ && [4.0.0-beta.6, 4.0.0-beta.8[
// see https://github.com/angular/angular/pull/13219 and changelog
targetPkgJson.peerDependencies[dependency] = `>=2.0.0 <2.4.6 || >=2.4.8 <4.0.0-beta.6 || >=4.0.0-beta.8`;
}
else {
targetPkgJson.peerDependencies[dependency] = `^${pkgJson.dependencies[dependency]}`;

}

});

// copy the needed additional files in the 'dist' folder
Expand Down

0 comments on commit 1be94a8

Please sign in to comment.