Giter VIP home page Giter VIP logo

Comments (12)

guybedford avatar guybedford commented on July 18, 2024

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.

Aaike avatar Aaike commented on July 18, 2024

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.

andreasgrimm avatar andreasgrimm commented on July 18, 2024

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.

Aaike avatar Aaike commented on July 18, 2024

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.

andreasgrimm avatar andreasgrimm commented on July 18, 2024

ok, I guess then @guybedford should take a look at this.

from registry.

Aaike avatar Aaike commented on July 18, 2024

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.

andreasgrimm avatar andreasgrimm commented on July 18, 2024

no, the latest version in the specified semver range gets used.

from registry.

guybedford avatar guybedford commented on July 18, 2024

^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.

Aaike avatar Aaike commented on July 18, 2024

aha, so that is what you meant by overriding it locally :)
ok will test it thx

from registry.

Aaike avatar Aaike commented on July 18, 2024

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.

guybedford avatar guybedford commented on July 18, 2024

@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.

Aaike avatar Aaike commented on July 18, 2024

#88

from registry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.