Why would i install bower with NPM? - angularjs

I'm failing to understand something,
I've started learning AngularJS, and there is a option to install it trough bower.
Then i went and read what is this bower thingy, and it said that this is a package manager.
But the installation of bower (in the tutorial at least) is trough NPM, which is node's package manager.
So... Why would a package manager that is installed with node will be used to install AngularJS? unless i want to use both of them - what's the point?

npm is much more well suited for server side javascript package management. Bower is written specifically to serve the brower's javascript package management needs. For example, npm allows for nested js and nested versions, bower makes the entire dependency tree into flat siblings. That said bower is powered by nodejs, so it makes sense that npm would be the method for getting access to bower. The idea is that you use both.

Related

How should I include aws-appsync in AngularJS project

I am working on a AngularJS project that uses bower as package manager and gulp to inject the dependencies into the index.html file. I am not very familiar with both of these tools.
I now want to use AWS AppSync, but it is not available as a bower package.
Currently the AWS SDK is specified as a file dependency in bower.json as:
"aws-sdk": "./thirdparty/script/aws-sdk-2.69.0.min.js",
When I install aws-appsync with npm npm install aws-appsync the node_modules folder for aws-appsync contains multiple js files in the lib directory.
How can I include these with bower or is there another way to do this altogether?
I am currently unable to change much of the build and dependency management process so any suggestions working with the current tools would be much appreciated.
Thanks for reaching out!
The Bower team itself has recommended that people migrate to npm or yarn, and so aws-appsync has not been pushed to Bower.
It might be worth investigating whether you can install directly from github using something like...
bower install <github url>.git
... and install directly from the appsync-sdk github repo.
In the end I hacked together an interim solution until I can move the whole project over to npm and browserify.
I added the aws-appsync package using npm and required it in a new file. This file is then passed through a gulp task that uses the browserify plugin. The added file is then included into the rest of the build process as before.

What command do I upgrade my angular 1.x version to the last 1.x version?

First, I am unsure how checking the version of Angular because if I type the command, "Angular -v" it says "Angular: command not found". I think someone told me that it was version 1.5, but I want it to be 1.6 or whatever the latest angular 1 version is available to upgrade.
Lastly, what is the command to update the version to the latest version of Angular 1.x? Is it, "npm install [NAME OF ANGULAR 1.X PACKAGE]"?
You can use the npm update as per the npm documentation:
https://docs.npmjs.com/all
You can run an npm outdated first to see what is in need of updating and then run the npm update, but some combination in the command prompt of...
npm update
npm outdated
... should at least get you started.
As for your version of angular somewhere in your project you have to have the angular source code thaht will include the license version, or a link to a cdn or the like for it. Maybe search the project for something like "license AngularJS v".
The uninstall/reinstall works too, but you might need to do it for more than just the angular package. Even with the update method it is likely that you'll need to look into dependencies and other packages that will become outdated.

Install bower component (angular-qr-scanner) using Meteor

I'm trying to install Angular QR Scanner in my Meteor app. It seems the only way to install it is using Bower, however bower support for Meteor seems to be deprecated now for 1.3. I tried installing using npm install however I receive an error that qrcode.decode is not a function, despite importing both files needed.
Is there another way to install bower components using Meteor?
Ended up just importing the plain javascript implementation with html5-qrcode rather than using an angular directive.

Download persice i18n locale in Angularjs using Bower

I'm using Wiredep tool with Gulp, to inject into my index.html on the run everything that I install using Bower. I don't want to download all the files listed here.
Is there a way to download only precise locale?
I've tried
bower install angular-i18n/angular-locale_uk-ua.js
And I got
fatal: remote error:
Repository not found.
In order to do this angular/bower-angular-i18n repo should be forked.
If the concern is to lower bower_components footprint on server side, postinstall hook can be supplied in .bowerrc to delete extra files from the package after installation.

How to use existing libraries in reactjs/webpack like GSAP?

I want to use existing library like GSAP. I am using webpack, though I don't know what is the right way to do this. Should I be using bower to install my packages and injecting them into my index.html where there are the js and css injection points as if I had used grunt? Or should I be npm installing packages?
You have to use npm package installation and you have to use like
npm install --save GSAP
it will also update your package.json file.

Resources