How does jQuery install with Bower? - javascript

bower install jquery works fine. Although I don't see jquery in http://bower.io/search/?q=owner:jquery.
Also https://github.com/jquery/jquery doesn't have a bower.json yet I can install, howcome ?

If you look closely to the last line when you install jQuery using bower you can see that bower used the following repository:
https://github.com/components/jquery
d:\temp>bower install jquery
bower not-cached git://github.com/jquery/jquery.git#*
bower resolve git://github.com/jquery/jquery.git#*
bower download https://github.com/jquery/jquery/archive/2.1.4.tar.gz
bower extract jquery#* archive.tar.gz
bower resolved git://github.com/jquery/jquery.git#2.1.4
bower install jquery#2.1.4
jquery#2.1.4 bower_components\jquery
You can find the packet on the bowerwebsite here:
http://bower.io/search/?q=owner:components%20property-book-client

Related

Bower Install of arcgis-js-api failing (unable to find suitable version for dojo)

I get the following error when trying to run the following command: bower install arcgis-js-api
I've tried installing into a new directory and also after creating a base bower.json file. Searching the web has found some people with the issue, but no posted solutions on how to resolve.
{
"name": "arcgis-js-api-sample-app",
"version": "1.0.0",
"license": "Apache-2.0",
"dependencies": {
"esri": "arcgis-js-api#3.15.0"
},
"resolutions": {
"dojo": "v1.10.4/esri-3.14.0"
}
}
Error Message:
bower install arcgis-js-api ECONFLICT Unable to find suitable version for dojo
Full Trace:
$ bower install arcgis-js-api
bower arcgis-js-api#* cached https://github.com/Esri/arcgis-js-api.git#4.3.1
bower arcgis-js-api#* validate 4.3.1 against https://github.com/Esri/arcgis-js-api.git#*
bower dojo#v1.12.1/esri-3.20.0 cached https://github.com/Esri/dojo.git#v1.12.1/esri-3.20.0
bower dojo#v1.12.1/esri-3.20.0 validate v1.12.1/esri-3.20.0 against https://github.com/Esri/dojo.git#v1.12.1/esri-3.20.0
bower util#v1.12.1/esri-3.20.0 cached https://github.com/Esri/dojo-util.git#v1.12.1/esri-3.20.0
bower util#v1.12.1/esri-3.20.0 validate v1.12.1/esri-3.20.0 against https://github.com/Esri/dojo-util.git#v1.12.1/esri-3.20.0
bower dojox#v1.12.1/esri-3.20.0 cached https://github.com/Esri/dojox.git#v1.12.1/esri-3.20.0
bower dojox#v1.12.1/esri-3.20.0 validate v1.12.1/esri-3.20.0 against https://github.com/Esri/dojox.git#v1.12.1/esri-3.20.0
bower dgrid#v1.1.0/esri-3.20.0 cached https://github.com/Esri/dgrid.git#v1.1.0/esri-3.20.0
bower dgrid#v1.1.0/esri-3.20.0 validate v1.1.0/esri-3.20.0 against https://github.com/Esri/dgrid.git#v1.1.0/esri-3.20.0
bower dijit#v1.12.1/esri-3.20.0 cached https://github.com/Esri/dijit.git#v1.12.1/esri-3.20.0
bower dijit#v1.12.1/esri-3.20.0 validate v1.12.1/esri-3.20.0 against https://github.com/Esri/dijit.git#v1.12.1/esri-3.20.0
bower dstore#1.1.1 cached https://github.com/SitePen/dstore.git#1.1.1
bower dstore#1.1.1 validate 1.1.1 against https://github.com/SitePen/dstore.git#1.1.1
bower moment#2.17.1 cached https://github.com/moment/moment.git#2.17.1
bower moment#2.17.1 validate 2.17.1 against https://github.com/moment/moment.git#2.17.1
bower dojo#>=1.8.9 cached https://github.com/dojo/dojo.git#1.12.2
bower dojo#>=1.8.9 validate 1.12.2 against https://github.com/dojo/dojo.git#>=1.8.9
bower dijit#1.12.1 cached https://github.com/dojo/dijit.git#1.12.1
bower dijit#1.12.1 validate 1.12.1 against https://github.com/dojo/dijit.git#1.12.1
bower dojox#1.12.1 cached https://github.com/dojo/dojox.git#1.12.1
bower dojox#1.12.1 validate 1.12.1 against https://github.com/dojo/dojox.git#1.12.1
bower dojo-themes#1.12.1 cached https://github.com/dojo/themes.git#1.12.1
bower dojo-themes#1.12.1 validate 1.12.1 against https://github.com/dojo/themes.git#1.12.1
bower dojo#>=1.8.1 cached https://github.com/dojo/dojo.git#1.12.2
bower dojo#>=1.8.1 validate 1.12.2 against https://github.com/dojo/dojo.git#>=1.8.1
bower dojo#1.12.1 cached https://github.com/dojo/dojo.git#1.12.1
bower dojo#1.12.1 validate 1.12.1 against https://github.com/dojo/dojo.git#1.12.1
bower ECONFLICT Unable to find suitable version for dojo
I found a solution. This seems to be a problem on windows machines when using the gitBash interfaces. gitBash isn't allowing for user interaction to respond to prompts for selecting specific versions of the dependencies and just shows the error message.
I switched to using the gitCMD prompt instead of gitBash. Once switching to gitCMD and running the same bower install arcgis-js-api command, the questions on selecting the dependencies showed up and I was able to successfully select them and finish the install.
I hope this helps anyone else using bower on windows.
I haven't been able to reproduce this issue. If I do just bower install arcgis-js-api I'm given the option to choose my resolutions. If I use the bower.json you posted, I get a warning, but no error.
Please note that, esri#3.15.0 depends on
dojo#v1.10.4/esri-3.14.0 which resolved to dojo#v1.10.4/esri-3.14.0
dstore#1.1.0 depends on dojo#>=1.8.1 which resolved to dojo#1.12.2
Resort to using dojo#v1.10.4/esri-3.14.0 which resolved to dojo#v1.10.4/esri-3.14.0
Code incompatibilities may occur.
That's fine, it's just Bower giving a warning to play it safe.
Have you tried bower cache clean?

Use javascript file in a different project

I have a javascript (which uses files from it's own project) file that I need to use in a different project without copy the code.
How can I do it?
Thanks
Well... You could install Bower, upload your file to your own repository or gist on GitHub and then use bower to include them as a dependancy for your project.
Setting up (assuming you have Node.js already installed)
npm install -g bower
cd /path/to/project-A
bower init
bower install <link to your gist/repo> --save
cd /path/to/project-B
bower init
bower install <link to your gist/repo> --save
And then in the future, if you upload changes to your repo/gist (and the link has not changed...)
cd /path/to/project
bower update
EDIT: That or you have a remotely hosted version of this file that you directly link to, I guess...? Kinda sucks though, could wreck a live project from a dodgy edit that way

Get new version (v2) of stampit from bower

I want to get the v2 version of stampit just by typing the 'bower install'.
I also set in bower config like this
"stampit": "git://github.com/ericelliott/stampit#v2_0"
and it seems that it did not created a compiled / dist for this new script. What's the best solution for this or any other alternatives? did I missed something?
stampit is available via bower: https://github.com/stampit-org/stampit-bower
$ bower install stampit
It provides standard UMD package.
UPD:
Install any version like this:
bower install stampit=https://npmcdn.com/stampit#4.1.1/dist/stampit.min.js
or
bower install stampit=https://unpkg.com/stampit#4.1.1/dist/stampit.min.js

Generate bower file automatically?

In current project I have pretty big bower file. Many dependencies are out of dated and have hardcoded version like ~1.2. I have replaced it with "latest" and run bower install/update and everything went ok.
The problem is that I don't want to have such settings like "latest" on production server. What is the easiest way to grab current versions of bower components and put it to the bower file? aka generate bower file from existing dependencies.
Using bower init, you'll be able to regenerate from scratch your bower.json file with all the current dependencies
With bower install --save jquery#<version_number> you can install specific versions of bower components, e.g.
bower install --save jquery#1.10.2
the --save automatically adds the dependency to bower.json. Normally there is no need to edit bower.json manually.

Can I add a git repository to my bower.json? [duplicate]

I have a very small repo in which I do all dev work in the master branch and use tags as "stable" points in history.
I guess by default Bower seems to fetch the latest tagged version of a repo. I'm trying to get the most recent commit in the master branch.
I've tried running all these, in every conceivable order:
bower cache-clean mypackage
bower install mypackage --force-latest
bower install mypackage --force --force-latest
bower install mypackage --force
I've also tried adding latest to my bower.json file:
"dependencies": {
"mypackage": "latest"
}
And then running:
bower update mypackage
No matter what it seems to always get the latest tagged state.
How do I get the latest, most up-to-date, untagged state of the project?
Specify a git commit SHA instead of a version:
bower install '<git-url>#<git-commit-sha>'
Example:
bower install 'git://github.com/yeoman/stringify-object.git#d2895fb97d'
You can also specify a branch instead of a SHA, but that's generally not recommended unless it's in development and you control all the parts.
Yes, you can point to the git url, or use name/repo shorthand (for github repos):
bower.json
{
"name": "bower-test",
"dependencies": {
"dpm": "git#github.com:okfn/dpm.git",
"docker-nmpjs": "terinjokes/docker-npmjs"
}
}
More in the docs
As #roi noted in the comments, you can use the --save flag to automatically add dependencies to bower.json, e.g. bower install terinjokes/docker-npmjs --save
You can install a branch in Bower > 1.0.0:
bower install xxx#foo-branch
More details at https://github.com/bower/bower/issues/107#issuecomment-22352689.
If you are using a bower.json file you specify the latest version of a branch with a line in either the dependencies or devDependencies as appropriate for your project configuration:
"angular-bootstrap": "git#github.com:angular-ui/bootstrap.git#bootstrap3",
Then when you run bower install the latest version of that branch is installed. That would be branch bootstrap3 of angular-ui in this example.
bower install --save package-name#master
adds this:
"dependencies": {
"package-name": "master"
}
using bower.json:
"dependencies": {
"jquery.slimscroll": "latest",
"jQuery": "1.11",
"fullPage.js": "git#github.com:overbyte/fullPage.js.git#1d6bbac3d4c3b1d3d7d4096cdbcabd1c3914393f",
}
where
"[library name - in this case a forked version of fullpage.js]" : "[from git clone box in github][#commit number if required - without this you will get latest tagged version]"

Categories

Resources