Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

FlowType (how to exactly configure packages) #85

Closed
Aaike opened this issue Dec 17, 2014 · 6 comments
Closed

FlowType (how to exactly configure packages) #85

Aaike opened this issue Dec 17, 2014 · 6 comments

Comments

@Aaike
Copy link
Contributor

Aaike commented Dec 17, 2014

I would like to submit a PR for FlowType but have a little question first.
The github repo currently does not have a package.json , only a bower.json.
i forked the repo and added a package.json.

This works but when it is installed the package is registered in the configuration as FlowType.JS
and i can import it as require("FlowType.JS")

Is there any way to change the name from FlowType.JS to just FlowType ?

@andreasgrimm
Copy link
Collaborator

I guess it's due to a missing alias in the registry.json file .. so the repo name gets used as an alias per default.
But as you'd commit the config.js file into your application repo anyways, you could just change the name in your config file as you see fit.

A missing package.json file in the github repo shouldn't be a problem, e.g. see https://github.com/angular/bower-material which doesn't have one either .. and the repo entry works just fine.

I'd suggest to submit a PR with an appropriate alias name. Speaking of which, what about all lower case flowtype? It'd fit much better because all existing alias entries are lower case as well.

@Aaike
Copy link
Contributor Author

Aaike commented Dec 17, 2014

well the bower-material package works just fine because there is already an override for it in this registry. but there isn't one yet for flowtype, that's why i want to submit the PR :)

I do like the all lowercase naming , but i just went with what the author named it and removed the .JS
I will submit is as flowtype

but how do i do that ?
you mentioned submitting a pr with an alias name.
does that mean i should put the contents of the package.json i created into a file :

package-overrides/github/simplefocus/flowtype@1.1.0.json ?

would that allow the flowtype package to be installed and required as flowtype ?
(it's my first time submitting something to this repo)

edit: and then add an entry in the registry file like this ?

"flowtype": "github:simplefocus/flowtype"

@andreasgrimm
Copy link
Collaborator

@Aaike the PR should include a modified registry.json (with the alias <-> endpoint mapping added, e.g. "flowtype": "github:simplefocus/FlowType.JS",) and a new file package-overrides/github/simplefocus/FlowType.JS@1.1.0.json. my apologies if I wasn't specific enough.

note: the endpoint name as well as the file for the override must match the exact user/org name and repo name. In this case you have to append the .JS in both cases.
Only in the alias is where we can choose a different (and hopefully simpler to use) name.

yes, put the contents into the override file. Actually you don't need all of the properties you specified in your file. Maybe take a look at https://github.com/jspm/registry/blob/master/package-overrides/github/angular/bower-material%400.6.0.json

Be sure to change the name to lowercase in your override as well ...

"shim": {
        "flowtype": {
            "deps": ["jquery"]
        }
    }

... as it relates to the alias we specified in registry.json.

yes, that allows the flowtype package to be installed and required as flowtype.

So all in all the override file content could look something like this:

{
  "main": "flowtype",
  "shim": {
    "flowtype": {
      "deps": [
        "jquery"
      ]
    }
  },
  "registry": "jspm",
  "dependencies": {
    "jquery": "jquery@^2.1.2"
  }
}

I hope this helps.
It would be helpful to know if you think that the docs over at https://github.com/jspm/registry/wiki/Configuring-Packages-for-jspm could be improved in some way :)

@andreasgrimm andreasgrimm changed the title FlowType FlowType (how to exactly configure packages) Dec 17, 2014
@Aaike
Copy link
Contributor Author

Aaike commented Dec 18, 2014

The docs are pretty clear :) i was just confused i guess about how to change the alias
thx for the explanation , i submitted a PR, i hope it is correct now :)

@Aaike Aaike closed this as completed Dec 18, 2014
@Aaike
Copy link
Contributor Author

Aaike commented Dec 18, 2014

damn.. i just copied your configuration , which had jquery 2.1.2 in it , but now that is failing , because github:components/jquery is at 2.1.1

but jquery itself is at 2.1.2...
ah well ... the component version will get updated pretty soon i guess :)

@guybedford
Copy link
Member

@Aaike it may well be possible to send a PR to that repo to speed things up if you need, otherwise feel free to alter the override back to 2.1.1 in the mean time.

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

No branches or pull requests

3 participants