-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(sample): describe jspm forks, closes #172
- Loading branch information
Showing
1 changed file
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,42 @@ | |
### 7. What you need to know | ||
<br> | ||
|
||
__To be written__ ... | ||
#### JSPM "forks" | ||
<br> | ||
|
||
JSPM allows for multiple versions of installed dependencies. When two dependencies | ||
import two different versions of the same library, JSPM may detect a conflict | ||
which it calls a "fork". In this case it issues a warning like this: | ||
|
||
``` | ||
Installed Forks | ||
github:systemjs/plugin-css 0.1.20 0.1.21 | ||
``` | ||
|
||
This example is taken from aurelia-skeleton-navigation 1.0.0-beta.1.2.2 (after installing the bridge) | ||
which has a dependency on `font-awesome@^4.5.0` - itself depending on `[email protected]`. | ||
Notice lack of the `^` indicator, meaning that JSPM will install **exactly this version**. | ||
|
||
When installing the bridge you install an indirect dependency of `[email protected]` | ||
which `Dogfalo/materialize` depends on. | ||
|
||
As the version numbers in both cases are static (no `^` indicator), both versions | ||
of `plugin-css` are installed, leading to a fork. | ||
|
||
There are two options to resolve this: | ||
* install with the `--lock` option | ||
* use `jspm resolve` | ||
|
||
##### Installing the bridge using `--lock` | ||
|
||
The `--lock` option keeps existing dependencies locked during a JSPM installation. | ||
So if you know the installation will introduce a fork and you want to keep | ||
the installed version of a library, use `jspm install --lock aurelia-materialize-bridge`. | ||
|
||
##### Using `jspm resolve` | ||
|
||
JSPM has a builtin command to change every used version of a dependency to the | ||
version you want. | ||
In the case above you'd issue `jspm resolve --only github:systemjs/[email protected]`. | ||
Please note that you *have to* give JSPM an exact package of the form `registry:pkg@version`. |