2

can you define the working directory for bower? or tell it where I want the install to run at? ie: like the composer working directory flag?

--working-dir (-d) If specified, use the given directory as working directory.

veilig
  • 5,085
  • 10
  • 48
  • 86
  • Is the `directory` config not what you are looking for, or are you wanting a global configuration? – Kelly J Andrews Feb 01 '14 at 04:20
  • The directory config is not what I want - I'm looking for something to assist in automated deployment script. but I need to define where bower should be run from. the --config.cwd flag seems to work, and will create a bower_components directory w/ the required files - but ignores the 'directory' config in my .bowerrc file in that directory? – veilig Feb 01 '14 at 20:07

3 Answers3

3

EDIT: Bower now supports config.cwd http://github.com/bower/spec/blob/master/config.md#cwd

bower install jquery --config.cwd=~/my-sub-project

It seems to be an option in bower canary but not currently supported in stable bower yet according to bower contributor [stazor][1]

With bower-canary you have the ability to specify --config.cwd and --config.directory.

When released it will work like this

bower install jquery --config.cwd=client

https://github.com/bower/bower/issues/212

Cristian Diaconescu
  • 34,633
  • 32
  • 143
  • 233
actual_kangaroo
  • 5,971
  • 2
  • 31
  • 45
0

Working directory for bower is in file

.bowerrc

in the following format

{
  "directory": "resources/assets/bower"
}
Yevgeniy Afanasyev
  • 37,872
  • 26
  • 173
  • 191
-3

Bower uses the current working directory. Just cd into the directory you want. No need for an option.

Sindre Sorhus
  • 62,972
  • 39
  • 168
  • 232
  • so what if I'm issuing a remote command and need to define where bower should run at? – veilig Feb 01 '14 at 20:08
  • Cd mydir && Bower install – Kelly J Andrews Feb 01 '14 at 20:13
  • 1
    that doesn't appear to be an option for me. I'm having problems issues consecutive calls, otherwise I would have already done that. http://phpseclib.sourceforge.net/ssh/examples.html#chdir – veilig Feb 01 '14 at 20:27
  • That's a problem with the lib you're using, not Bower. Bower does like every CLI tool and uses `$PWD`. – Sindre Sorhus Feb 01 '14 at 23:26
  • 1
    It appears as if that is the intent of the library. I also highly doubt it uses `$PWD`, more likely some degree of `getcwd` from `libc` which is what most command line tools use. It isn't uncommon for a tool to accept a directory to switch to as a convenience alternative to wrapping commands in `pushd` and `popd` statements – Steve Buzonas Feb 06 '15 at 15:57