installed bower how to use it - bower

I have installed bower through Solutions Package Manager in VS 2017. I obviously want to use it.
I'm confused because that only created cmd files (node, bower & git) in a new .bin folder. No components folder or json or anything else.
Shall I run bower init somewhere (where? a command line). When I'm trying to do it it asks me for a 'name' . Name of what I should give? Will that be a bower json file or components folder name or something else? What other questions will it ask?
All bower manuals I find say to do the install and then do bower install of a package (from a command line I guess?)
And where do I perform 'bower search'?
https://bower.io/
On the other hand when I tried to run this command (before I installed Bower package from solutions manager) in nuget console:
npm install -g bower
I got an error:
npm : npm WARN deprecated bower#1.8.0: ..psst! While Bower is maintained, we recommend Yarn and Webpack for *new* front-end projects! Yarn's advantage is security and reliability, and Webpack's is support for both CommonJS and AMD
projects. Currently there's no migration path but we hope you'll help us figure out one.
At line:1 char:1
+ npm install -g bower
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (npm WARN deprec...figure out one.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

Related

Bower - Change directory name when package is installed

When I install the following package from this git url, it creates a directory /flyLabel.js
bower install https://github.com/space150/flyLabel.js.git
The fact the directory has a dot in its name is causing issues elsewhere when I am trying to include it.
Question
Is there a way to change the name of the directory Bower is going to create when it installs the package?

Trying to install bower in mac but getting semver-utils#1.1.1 issue

I typed sudo npm install -g bower getting this issue again and again
/usr/local/bin/bower -> /usr/local/lib/node_modules/bower/bin/bower
bower#1.7.2 /usr/local/lib/node_modules/bower
└── semver-utils#1.1.1
This doesn't look like an error at all. semver-utils is a library required by bower after 1.7.1.
Maybe run bower in the command line and show us the error you're getting.

Is the Bower command missing from project?

I have a deploy.cmd script that I built using these steps. It is being used to package a project up for deployment to Azure. In it there is this line:
IF EXIST "%DEPLOYMENT_TARGET%\bower.json" (
pushd "%DEPLOYMENT_TARGET%"
call :ExecuteCmd .\node_modules\.bin\bower install
IF !ERRORLEVEL! NEQ 0 goto error
popd
When I test the script locally, it fails because there is no bower command in the .bin directory. I have installed bower using -g and have used it to install project packages. But I can't figure out how it's supposed to make it into this folder.
It'll make it to that folder if you run npm install bower without -g. -g is meant to install tools globally to be available anywhere on your commandline, while not adding -g will install it locally in the node_modules folder

Managing bower dependencies with ionic

After starting with a new ionic app, I can see at bower.json that comes with ionic is in devdependencies. Why is it a devdependency and not a normal dependency?
"devDependencies": {
"ionic": "driftyco/ionic-bower#1.0.0-rc.0"
},
Thanks, I feel confused right now
having devDependencies gives you the opportunity to simplify the steps that drive you from the source files (a git clone of the project) to the production ready app
when you don't need to make changes and (develop) the application, you could just run
bower install --production
or
npm install --production
they work the same
bower install options
-F, --force-latest: Force latest version on conflict
-p, --production: Do not install project devDependencies
-S, --save: Save installed packages into the project’s bower.json dependencies
-D, --save-dev: Save installed packages into the project’s bower.json devDependencies
-E, --save-exact: Configure installed packages with an exact version rather than semver
bower documentation
npm install options
By default, npm install will install all modules listed as
dependencies. With the --production flag (or when the NODE_ENV
environment variable is set to production), npm will not install
modules listed in devDependencies.
npm documentation
This way you take less time to ship the app and don't waste bandwidth downloading stuff you won't need.
Given that, to me, the choice of listing ionic as devDependecy is a poor one: it implies that I could take advantage of this choice to get ready the app for execution this way:
git clone my-project
git cd my-project
npm install --production # ionic not installed here
ionic state restore
ionic build ios
Now, if you ignore the content of /lib folder in your sources, this should not work, and if it works because the ionic-cli does some more checks to save your ass, I think this is unclear.
From what I understand, dependencies are required to run, and devDependencies are only for development, like minification, unit tests, etc.
Both will install when you do npm install but only dependencies will install when you do npm install $package, unless you add the --dev option

Bower - Get only files needed (not entire Repo)

I am trying to use Bower to install jquery.
The frustrating problem I have been running into is that bower downloads the entire repro. I was hoping to tell bower to install a certain version of jquery and have only those files downloaded.
I did try the suggestion here with no luck. The entire repo is still downloaded even after clearing the bower cache
I would rather have something else manage which files to download than me manually specifying the file names in bower.json
bower.json in the repo : https://github.com/jquery/jquery/blob/master/bower.json
Thank you
I think you didn't unterstand the meening of bower:
Bower is handling you dependencys, so if you do a:
bower install jquery
it should download all files.
Now to you question:
you have following options:
declare wich file you want to download:
bower install http://code.jquery.com/jquery-2.1.0.min.js
but remember:
this file cant be updated easily
search for a js only package:
expample with bootstrap:
bower install bootstrap-css-only
but remember:
these packages sometimes are not up to date
use bower-installer (recommended):
install the bower-installer:
npm install bower-installer --global
and now follow the tutorial:
bower-installer github
sorry for my bad english :-)

Resources