Comments (12)
We changed hammerjs
to hammer
because generally it is better for names not to include the js part.
This can be fixed for jquery.hammer.js
by locally naming the dependency in its package.json or package.json override:
{
"registry": "jspm",
"dependencies": {
"hammerjs": "hammer@^x.y.z"
}
}
That way the require will work correctly.
Perhaps try the above override and let me know if that works ok for this package, and if so we can add that override here.
from registry.
hmm i am having trouble with this... is this what you meant ?
i've also added this to the .jspm.json file
I tried some variations but the only way it works for me is by changing the config.js
from registry.
I guess the .jspm.json
file isn't necessary.
Regarding the override, from a functionality point of view, you don't need to duplicate all the properties of the original package.json file as the content of the original package.json file is used and only the properties you specify in the jspm/registry override file are overriding (replacing) the original properties (or the properties get created if they weren't present in the original package.json in the first place).
I'm a bit skeptical of the x
characters in "hammerjs": "hammer@^2.0.x", "jquery": "2.1.x"
. Is that semver compliant? Maybe @guybedford knows if jspm can handle this.
I'd rather use something like "main": "jquery.hammer.js", "dependencies": { "hammerjs": "hammer@^2.0.4", "jquery": "jquery@^2.1.2" }
Oh, and in this case do not omit the alias/endpoint name hammer
in the value ("hammer@^2.0.4"
) of the dependency property .. as otherwise I assume hammerjs
will be used instead .. for which there is no alias in the registry (anymore).
from registry.
Oh i didn't duplicate the properties or anything.
I created a new project , and downloaded hammer and jquery.hammer and created a little test in lib/app.js
The package.json and .jspm.json file i reffered to earlier are the ones that got generated by jspm.
As per @guybedford 's advice i added the registry entry in the package.json and changed the dependency.
This is just a test of how i can locally change the naming of the dependency as guy suggested.
Anyway i changed the 2.0.x to 2.0.4 , and added a semver to jquery.
The package.json now looks like this
But this doesn't seem to have changed anything.
jquery.hammer is requiring hammerjs , which cannot be resolved right now eventho it is pointing to hammer@^2.0.4
from registry.
ok, I guess then @guybedford should take a look at this.
from registry.
Another general question.
Are we always supposed to use the exact version for a dependency ? like jquery@^2.1.1
Is it not a good idea to use wildcards like jquery@^2.1.*
or jquery@^2.*
Normally in bower for example i would use ~2.1 just to allow a broader range.
(sry for all the questions guys)
from registry.
no, the latest version in the specified semver range gets used.
from registry.
^2.1.1
means semver compatible with 2.1.1
so it will allow all versions >=2.1.1<3.0.0-
.
Altering the package.json of a package in jspm_packages
doesn't affect how jspm interprets the package as it statically compiles sources reading the package.json as dependencies are downloaded.
Rather you need to have the overridden package.json properties available to jspm at download time. This is through the override option or registry package overrides. To use the override option when installing to ensure this gets applied:
jspm install github:hammerjs/jquery.hammer.js@^2.0.0 -o "{ registry: "jspm", dependencies: { "hammerjs": "hammer@^2.0.4", "jquery": "jquery@^2.1.2" } }"
If that works, then when you can publish the override here and the install should work out without the above being necessary.
from registry.
aha, so that is what you meant by overriding it locally :)
ok will test it thx
from registry.
It works, i had to change the surrounding quotes of the -o option to single quotes
jspm install github:hammerjs/jquery.hammer.js@^2.0.0 -o '{ registry: "jspm", dependencies: { "hammerjs": "hammer@^2.0.4", "jquery": "jquery@^2.1.2" } }'
But that installed it correctly and the dependencies are now resolving.
The config.js now looks like this.
Now just so i am following things... how will you publish it override over there ? does that mean adding an override to the repository like i did with the flowtype package ?
from registry.
@Aaike yes exactly if you send a PR in exactly the same way, it will then work for all installs for everyone by default.
from registry.
from registry.
Related Issues (20)
- Difference between Jenkins and local build HOT 7
- Slow/flaky npm.jspm.io registry HOT 7
- intro.js overrides? HOT 1
- npm Debug package override not applying HOT 3
- some fetch errors while making ts bundle HOT 1
- Latest d3 breaks jspm install HOT 3
- registry CI failure caused by transitive dependency update
- GitLab endpoint? HOT 1
- I'm confused by the module format documentation in the wiki HOT 2
- Is there a way in my package.json to tell JSPM not to install a specific dependency? HOT 14
- Mapping a dependency to `@empty` changes the import path
- Bootstrap install fails HOT 5
- `jspm install` not outputting anything in Windows bash
- React Router Dom 404
- new HOT 1
- Question: how much can I use dev.jspm.io? HOT 2
- kasperlewau.github.io/registry is not found HOT 1
- Licensing information. Can this project make it explicit?
- @shopify/app-bridge-utils is missing all new versions for the last 9 months HOT 2
- Self-hosting JSPM? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from registry.