How do I install bower packages using Cake (

Home / Uncategorized / How do I install bower packages using Cake (

I am working on migrating a Powershell build script to Cake script and previously I would have run the following on a collection of directories where the bower.json files were found:foreach ($directory in (Get-CommonPath $bowerDirs)) {
Push-Location $directory
&bower install
But since there doesn’t seem to be a cake alias for bower I’m struggling to work out how I should do this (&bower install) using Cake.

You are correct, there currently is not an addin for Bower within Cake. There are though a few things that you can do.

The first, would be to create an addin for this task. There is a blog series by Jamie Philips on how you can start doing this, and this can be found in our resources section here.

The second option would be to make use of the Cake.Npm addin. Within my package.json file, I typically make the install command do a bower install while the init command does the npm install. This has the effect of doing both an npm and bower install while emitting only one command in the Cake.Npm addin.

The final one, which I think would make sense for you right now would be to use one of the Process Aliases, which are documented here. For example, you should be able to do something like this:var exitCodeWithArgument = StartProcess("bower", new ProcessSettings{ Arguments = "install" });

// This should output 0 as valid arguments supplied
Information("Exit code: {0}", exitCodeWithArgument);
Read more

Leave a Reply

Your email address will not be published. Required fields are marked *