Skip to content
This repository has been archived by the owner on Apr 16, 2019. It is now read-only.

please add bower support so grunt-requirejs can work well #236

Closed
davidmaxwaterman opened this issue May 13, 2013 · 13 comments
Closed

please add bower support so grunt-requirejs can work well #236

davidmaxwaterman opened this issue May 13, 2013 · 13 comments

Comments

@davidmaxwaterman
Copy link
Contributor

I'm using bowerjs[1] to install jqModi at build time using this line in bower.json 👍

{
...
"dependencies": {
"appframework": "01org/appframework",
...
}
}

This works, but install the whole of the git repo, out of which I have to pick the 'correct' file to use in my code.

  1. please register appframework with bower

Furthermore, I intend to use grunt-requirejs[2] to automatically obtain the above 'correct' file from bower, but this requires more information than bower has :

$ bower list --map
...
"appframework": {
"source": {}
},
...

IINM, it should look more like this one :

...
"peg-0.7.0.min": {
"source": {
"main": "app/lib/peg-0.7.0.min/index.js"
}
},
...

  1. please ensure that it gives the location of the real index file so that grunt-require can configure requirejs with the correct paths.

Thanks!
[1] https://github.com/bower/bower
[2] https://github.com/asciidisco/grunt-requirejs

@imaffett
Copy link
Contributor

Hi David,

I will flag this as a "feature" with hopes someone in the community does it, but it will not be an internal dev task.

thanks,
Ian

@imaffett
Copy link
Contributor

Hey David,

Someone just submitted a composer package file. I did my college attempt at Bower, but kept getting server validation errors on the json file. If you have one that registers, feel free to submit a pull request.

thanks,
Ian

@davidmaxwaterman
Copy link
Contributor Author

bower authors say to wait until the next-gen of bower where registering has changed...

@gavD
Copy link
Contributor

gavD commented Jul 23, 2013

This seems to work Ok for me if I run:

bower install jqMobi

I'm brand new to Bower, however, but it HAS installed the app framework to bower_components/jqMobi

Thanks,

  • Gav

@davidmaxwaterman
Copy link
Contributor Author

Yes, that works. I think what I was getting at with the request is that the output of 'bower list -p jqMobi' would output a 'main' property. This enables grunt-requirejs to know the path to the actual library so that it doesn't have to be hard-wired in by hand....that's my take on it anyway. Eg :

[tmp]$ bower install stapes
bower stapes#*              not-cached git://github.com/hay/stapes.git#*
bower stapes#*                 resolve git://github.com/hay/stapes.git#*
bower stapes#*                download http://github.com/hay/stapes/archive/v0.8.0.tar.gz
bower stapes#*                 extract archive.tar.gz
bower stapes#*              deprecated Package stapes is using the deprecated component.json file
bower stapes#*                mismatch Version declared in the json (0.7.1) is different than the resolved one (0.8.0)
bower stapes#*                resolved git://github.com/hay/stapes.git#0.8.0
bower stapes#~0.8.0            install stapes#0.8.0

stapes#0.8.0 bower_components/stapes
[tmp]$ bower list -j
{
  "endpoint": {
    "name": "tmp",
    "source": "/home/davidmaxwaterman/tmp",
    "target": "*"
  },
  "canonicalDir": "/home/davidmaxwaterman/tmp",
  "pkgMeta": {
    "name": "tmp"
  },
  "dependencies": {
    "stapes": {
      "endpoint": {
        "name": "stapes",
        "source": "git://github.com/hay/stapes.git",
        "target": "~0.8.0"
      },
      "canonicalDir": "/home/davidmaxwaterman/tmp/bower_components/stapes",
      "pkgMeta": {
        "name": "stapes",
        "version": "0.8.0",
        "main": "./stapes.js",
        "homepage": "https://github.com/hay/stapes",
        "_release": "0.8.0",
        "_resolution": {
          "type": "version",
          "tag": "v0.8.0",
          "commit": "65e13a77e438782f963353e5686830ea17572c23"
        },
        "_source": "git://github.com/hay/stapes.git",
        "_target": "~0.8.0"
      },
      "dependencies": {},
      "extraneous": true
    }
  },
  "versions": []
}

@gavD
Copy link
Contributor

gavD commented Jul 23, 2013

Ah I see.

Does that need jqMobi to have a package.json (or rather, bower.json as package.json is soon to be deprecated)? Something like : https://github.com/hay/stapes/blob/master/package.json

I'm familiar with Composer but Bower is brand new to me! I expect that what I would need to do is fork the repo, add a correct bower.json, and then submit a PR back to AppFramework nee JQMobi. Does that sound about right?

@imaffett
Copy link
Contributor

Just for conversations sake - the name "jqMobi" is gone...kaput...no longer used. Anything done should be "appframework" - I won't accept a PR with "jqmobi" in it.

@gavD
Copy link
Contributor

gavD commented Jul 23, 2013

Understood @imaffett. The current package in Bower is named jqmobi though, so might be worth contacting them to get it changed or at least aliased

This was referenced Jul 23, 2013
@gavD
Copy link
Contributor

gavD commented Jul 23, 2013

OK, I have added one of my own little libraries to Bower as a test, and added a bower.json and it all worked as @davidmaxwaterman is looking for:

gavin@gavin-laptop:/var/www/tmp  $ bower list -p scrapper.js
{
  "scrapper.js": "/var/www/tmp/bower_components/scrapper.js/src/scrapper.js"
}

I've submitted PR #314 which is a very similar thing for the Intel App Framework - hopefully this'll get it up and running with the require.js autoloader in a zero-config stylee :-)

Thanks,

  • Gav

@imaffett
Copy link
Contributor

Going to NYC for devcon5, so I will get this included Friday and add the semver. Thanks!

@davidmaxwaterman
Copy link
Contributor Author

I think it is the 'main' property that is important and that still seems to be missing. I'm not totally familiar with the mechanism so I would ask on the #bower channel on freenode IRC to be sure.
I suspect my example above isn't a good one - sorry about that. Please confirm on #bower to make sure.

@gavD
Copy link
Contributor

gavD commented Jul 24, 2013

@davidmaxwaterman I'm not sure what you're expecting... My PR includes bower.json which states "main": "appframework.min.js", - see https://github.com/01org/appframework/pull/314/files

This will not take effect until the PR is merged, however.

@davidmaxwaterman
Copy link
Contributor Author

OK, I was having trouble getting it installed...needed to test using #master or #commitid specifically, else I don't get the correct version (get the latest tag - ie 2.0)...so, it's mostly looking fine, apart from the URL which should be git://, not git@.

dpesch pushed a commit to 11com7/appframework2 that referenced this issue Dec 20, 2013
Add Bower configuration so that bower-require can autoload the App framework

See intel#236 for a discussion of this.

Please note that tags will have to be created following [semver](http://semver.org/) so 2.0.0 should be created (rather than 2.0).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants