Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package json gets ignored when installing package via a custom endpoint #143

Closed
subesokun opened this issue Sep 23, 2014 · 17 comments
Closed

Comments

@subesokun
Copy link

I've just updated my jspm-git fork so that it works again with jspm 0.7.x ( https://github.com/subesokun/jspm-git/tree/feat-git-download )

I still have to problem that for some reason the package infos are getting ignored when downloading the packages via this endpoint. Not sure if the endpoint is broken or the package json doesn't get passed through correctly within the jspm-cli

@guybedford
Copy link
Member

Yes this is a but that still needs fixing.

In the mean time, if you can provide a getPackageConfig hook that should work around the issue.

I will look into it as soon as I'm next on the project.

@guybedford
Copy link
Member

I just tried this out and even installed the git endpoint as well and it all seemed to be working fine for me!

If you can let me know what package.json info is being ignored I can try and run another test on this.

Note that there was one bug that I had to fix due to the endpoint not having a config hook (a145dc4).

Also, it may be useful to provide this as I had to manually do jspm config endpoints.git.baseurl which would be nice to include in the config setup.

@subesokun
Copy link
Author

Mh interesting. Maybe something was wrong with my package json. I'll verify it again and let you know about the result.

Oh right, the config hook is still missing. I'll add it as soon as I've time :)

@guybedford
Copy link
Member

Yeah it would be interesting to hear what this was. The config hook is entirely optional, no need to add it.

@subesokun
Copy link
Author

I've added now the config hook in my latest pull-request for jspm-git :) But I still have to find the old configuration I've used back then when I created the ticket.

@subesokun
Copy link
Author

I've tested it now again with some old package.json and my configuration gets still ignored:

// package.json
{
  "name": "my-pkg",
  "author": "",
  "description": "",
  "version": "0.1.0",
  "jspm": {
    "name": "my-pkg",
    "registry": "jspm",
    "directories": {
      "dist": "src/"
    },
    "dependencies": {
      "sub-pkg": "myend:sub-pkg@^0.1.0"
    }
}

I'm using the latest jspm-git version to install it from our local git source server. The strange thing is that if I install the pre-build package from our git build server then everything works fine and it fetches also the dependencies...

// package.json on build server
{
  "registry": "jspm",
  "name": "my-pkg",
  "version": "0.1.0",
  "main": "",
  "dependencies": {
    "sub-pkg": "myend:sub-pkg@^0.1.0"
  }
}

@guybedford
Copy link
Member

Could this perhaps be that the jspm property is not being read here?

Basically, the calculated package.json is taken to be the package.json with the jspm property copied down to the base level. Perhaps this operation isn't being applied - would that explain it?

@subesokun
Copy link
Author

yes that could be the reason. I didn't know that the endpoint has to search for the jspm property. I thought it would be sufficient to return the whole package.json and then jspm will search for the jspm property if it's available. If that isn't the case I'll add this logic into the jspm-git endpoint.

@guybedford
Copy link
Member

Ok great, no the endpoint doesn't have to do t, this is a bug. Just wanted
to be sure it would explain the behaviour first. I'll look into a fix
shortly.

On Monday, October 13, 2014, subesokun [email protected] wrote:

yes that could be the reason. I didn't know that the endpoint has to
search for the jspm property. I thought it would be sufficient to return
the whole package.json and then jspm will search for the jspm property if
it's available. If that isn't the case I'll add this logic into the
jspm-git endpoint.

Reply to this email directly or view it on GitHub
#143 (comment).

@guybedford
Copy link
Member

There have been a lot of changes to the endpoint API but it is finally stable now. Thanks for bearing with here.

The API methods are pretty well documented at https://github.com/jspm/jspm-cli/blob/master/lib/endpoint.js#L35 now.

The download hook should now have its package.json treated correctly as well.

Let me know how it goes, and if you need any help at all.

@subesokun
Copy link
Author

Thanks for the update. I'll test it and let you know about the result. The Endpoint API documentation looks great :)

@guybedford
Copy link
Member

Sorry it's only comments - will move it out to a wiki soon.

@subesokun
Copy link
Author

The package.json gets now correctly interpreted so I can close this issue 👍

@guybedford
Copy link
Member

Great!

@guybedford
Copy link
Member

Also I did set up a page for the endpoint API here - https://github.com/jspm/jspm-cli/wiki/Endpoint-API.

@subesokun
Copy link
Author

The wiki page looks also good :) I was wondering if it's possible to have a list of 3'rd party endpoints to make it easier for others to find them. I think I've created once a pull-request on jspm.io but not sure if something went wrong while creating it. https://github.com/subesokun/jspm.io/tree/patch-1
I've added there the section "Custom Endpoints For jspm"

@guybedford
Copy link
Member

Oh nice. Yeah I'd be happy to take that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants