Yeoman Angular generator - bower_components missing in app folder - yeoman

Im on windows and when I use Angular generator to scaffold my application bower_components is missing in app directory - instead its in the root directory
This is my app directory after fresh scaffolding:
So I have to manually put bower components in the app directory...
Any ideas why is this happening?
P.S in bower.json I have:
"appPath": "app"
But that option is not respected, when I run bower install it doesnt add bower_components into the app directory.

Made it work - edited .bowerrc
{
"directory": "app/bower_components"
}
and then bower install.
Now all dependencies are in app directory.

try edit your bower.json file, then run bower install
{
"name": "mi-portfolio",
"version": "0.0.0",
"directory": "bower_components/"
"dependencies":
{
"angular": "1.2.6",
"json3": "~3.2.6",
"es5-shim": "~2.1.0",
"jquery": "~1.10.2",
"bootstrap": "~3.0.3",
"angular-cookies": "1.2.6",
"angular-sanitize": "1.2.6"
},
"devDependencies":
{
"angular-mocks": "1.2.6",
"angular-scenario": "1.2.6"
}
}
look here bower code

Related

ASP.NET 5 Client Side Depdency Management - Bower

I'm trying out the new ASP.NET 5 with MVC 6, and I'm using bower to manage all my client-side dependencies. Everything is working fine.
But I have a question: When I add a dependency (let's say jQuery). It adds both the /dist and /src along with bower configuration files to the /lib folder of wwwroot. How do I make it include just the compiled source for usage? (So I can reference it in my pages via /lib/jquery/jquery.js?
I have recently been playing in this space and following is something that I have tried:
Deleted the .bowerrrc file to enable installing in the default bower_components folder under the project folder rather than under wwwroor\lib as anything under wwwroot tends to get published.
Added "main-bower-files": "2.9.0" to package.json. This package gets all the files mentioned in the main property of each installed package's bower.json files.
Created a gulp task using the above package
gulp.task('copyMainFiles', function () {
return gulp.src(mainBowerFiles(), { base: 'bower_components' })
.pipe(gulp.dest('wwwroot/lib'));
});
Added a postrestore step to your application's project.json file
"scripts": {
"postrestore": "gulp copyMainFiles",
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
}
Updated my application's bower.json to copy files which are not listed in main (like some packages do not have min files as main files..ex: jQuery). The following settings are read by main-bower-files:
"overrides": {
"jquery": {
"main": [ "dist/jquery.js", "dist/jquery.min.js" ]
},
"hammer.js": {
"main": [ "hammer.js", "hammer.min.js" ]
},
"bootstrap": {
"main": [
"./dist/js/bootstrap.js",
"./dist/js/bootstrap.min.js",
"./dist/css/bootstrap.css",
"./dist/css/bootstrap.min.css"
]
}
}
Finally had to update the jquery-validation package to use 1.14.0 instead of 1.11.1 as the previous version does not dist folder and indeed no bower.json...

Update bower dependencies, bower.json in Ember-CLI app [duplicate]

I listed (and/or installed) several dependencies with Bower inside the bower.json file and/or with
bower install https://github.com/username/project.git
That worked fine.
Now I can list all them with
bower list
and then I can pick the name of each dependency of my project and run
bower update dependency-name
Question: How can I bulk update all of them? Or do I have to write a shell script to loop through and update them?
You can update all by running bower update.
Use the -h flag on any command to see how you can use it. Eg bower update -h.
This process is a little slow but is secure because you can realize when your app gets broken.
lets say that you want to update bootstrap you just need to run bower install --save bootstrap and you bower.json file will be updated
Before
{
"name": "my-awesome-app",
"version": "0.0.0",
"dependencies": {
"bootstrap": "~3.0.0",
"requirejs": "~2.1.11",
"modernizr": "~2.8.2",
"jquery": "~2.1.1",
"underscore-amd": "~1.5.2",
"backbone-amd": "~1.1.0",
"require-handlebars-plugin": "~0.8.0"
}
}
After
{
"name": "my-awesome-app",
"version": "0.0.0",
"dependencies": {
"bootstrap": "~3.3.1",
"requirejs": "~2.1.11",
"modernizr": "~2.8.2",
"jquery": "~2.1.1",
"underscore-amd": "~1.5.2",
"backbone-amd": "~1.1.0",
"require-handlebars-plugin": "~0.8.0"
}
}
Used bower-update-all to update all bower dependencies in bower.json, as follows:
npm install -g bower-update-all
bower-update-all
If you want to force all dependencies to update you can use bower install --save --force. This is the same as bower install --save [dep1] [dep2] ...
The short version is bower i -S -f

Bower is not updating in Visual Studio 2015 CTP 6

I have just installed React using Bower inside Visual Studio 2015 CTP6.
In Dependencies -> Bower -> React (0.13.0)
I do have React package.(js files are also in bower_components/react folder on disk)
When I try to add script <script src="~/lib/ I do not have React in my list of scripts.
Intelligence not working and JavaScript is not loaded.
in this sample I added a simple rule to copy all the .js files:
{
"name": "WebApplication",
"private": true,
"dependencies": {
"bootstrap": "3.0.0",
"jquery": "1.10.2",
"jquery-validation": "1.11.1",
"jquery-validation-unobtrusive": "3.2.2",
"hammer.js": "2.0.4",
"bootstrap-touch-carousel": "0.8.0",
"react": "~0.13.1"
},
"exportsOverride": {
"bootstrap": {
"js": "dist/js/*.*",
"css": "dist/css/*.*",
"fonts": "dist/fonts/*.*"
},
"bootstrap-touch-carousel": {
"js": "dist/js/*.*",
"css": "dist/css/*.*"
},
"hammer": {
"": "hammer.{js,min.js}"
},
"react": {
"": "*.js"
}
}
}
the result is that when you run install bower task you'll find inside the wwwroot/lib a directory named react with just the ,js files.
I think you have configure the exportsOverride section in the bower.json

bower install fails silently on any package

I can install Bower and it seems just fine via npm. I create a bower.json file using bower init, and add dependencies. Then when I use bower install, literally nothing happens in the terminal. I can use bower update to install packages, but bower install does not work and I cannot get any error to produce, even with --verbose. I've included bower.json below:
{
"name": "testing",
"version": "0.0.0",
"authors": [
"AJ"
],
"main": "index.html",
"license": "private",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"polymer": "Polymer/polymer#~0.3.0",
"core-menu": "Polymer/core-menu",
"core-ajax": "Polymer/core-ajax"
}
}
edit: using 1.3.3, but I've reproduced this using 1.3.2 as well
Try removing the bower_components directory and running bower install again.
Edit:
This is also related to a circular dependency in Polymer see: https://github.com/bower/bower/issues/1324#issuecomment-44436595

install package with bower components is not correctly

I have this code in my webstorm IDE in the Terminal dialog:
bower install angular-ui-router
When I look now in my app/bower_components folder I can see the new created folder with angular-ui-router package.
But what I would have expected is also an entry in the bower.json file:
{
"name": "app",
"version": "0.0.0",
"dependencies": {
"angular": "1.2.6",
"json3": "~3.2.6",
"es5-shim": "~2.1.0",
"jquery": "~1.10.2",
"bootstrap": "~3.0.3",
"angular-resource": "1.2.6",
"angular-sanitize": "1.2.6",
"angular-route": "1.2.6",
"angular-bootstrap": "~0.10.0"
},
"devDependencies": {
"angular-mocks": "1.2.6",
"angular-scenario": "1.2.6"
}
}
I does not see the angular-ui-router anywhere!
Why is that?
You need to use the --save flag to get it in your bower.json:
bower install --save angular-ui-router

Resources