Azure-pipelines-tasks: Provide bower support

Created on 30 Jul 2015  ·  16Comments  ·  Source: microsoft/azure-pipelines-tasks

The new build system already support NPM, Gulp and Grunt. It would be nice to have also support for Bower like in Visual Studio ASP.NET 5 projects.

Most helpful comment

@chrisrpatterson Could you just tell me why NPM and NuGet package managers have dedicated tasks and Bower doesn't? Actually all of them can be run from build script.

All 16 comments

wouldn't you simply call bower from your grunt or gulp script?

Probably I could but default template for ASP.NET 5 doesn't use bower inside gulp but rather depends on built-in support for bower components restore in Visual Studio. So I think that it would be nice to have similar experience in TFS build.

For ASP.NET 5 you would want to run DNU Restore. Here is an article on build an ASP.NET 5 app with team build https://msdn.microsoft.com/Library/vs/alm/Build/azure/deploy-aspnet5. Currently it relies on some scripts but as it settles down and comes closer to release we will add more built in support.

You shouldn't be running bower install during build time. It is
recommended to check in bower components by the bower team:

“If you aren’t authoring a package that is intended to be consumed by
others (e.g., you’re building a web app), you should always check installed
packages into source control.”

This is strange for most people because you are not supposed to check nuget packages in.

That is interesting, the default project.json for ASP.NET 5 does run bower install in the post restore section. I would agree that seems odd as typically bower components are frontend javascript and HTML and not binaries so checking them in seems like the right thing to do.

@cwoolum - could you provide link to that recommendation? I can't find that on bower site.

I also want to know why that's the recommendations.

I do not think it is a good practice to store any packages in the repository. Only if you want to eliminate the dependency of the package source, so you can build even if it is offline.

can someone help me to execute bower install on the server? I tried lot of things already to no avail.

tried adding bower to devDependencies, (this make npm install takes forever to run), and I'm charged by the minute so I don't see why it doesn't use a cache or something or better download connection, but that's for another issue.

then using command line
command: node_modules/.bin/bower.cmd
parameters: install

error:
File not found: node_modules/.bin/bower.cmd

I already tried different config/scenarios but it takes like 5 minutes to queue a build and get the error, very frustrating to 'try/test'...

thanks

It looks like they have removed it. Maybe that's not the case anymore??

All I can find is a historical version of the page that had it
https://web.archive.org/web/20140625034714/http://bower.io/#installing-packages-and-dependencies

I think the reason that you wanted to be checking in the bower_components folder is because there isn't a lockfile for bower so you could inadvertently grab a different version of a package when you deploy vs. just developing on your local machine(dependencies, not direct references). This could cause your app to be broken after deploy even though it works fine in Dev.

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

@cwoolum interestingly that work (lock file) were done on Mar https://github.com/bower/bower/pull/1748 and is still waiting for merge.

We don't have any plans for an inbox bower task. Bower really feels like something that you should run from your build script.

@chrisrpatterson I'm ok with that, just in case someone needs this check out http://stackoverflow.com/questions/32348497/bower-install-on-visual-studio-online-build took me a while to get it working.

@chrisrpatterson Could you just tell me why NPM and NuGet package managers have dedicated tasks and Bower doesn't? Actually all of them can be run from build script.

Another option is to create an extension and offer it in the gallery. If the gallery would have existed when we started build.vnext, many of the 'inthebox' tasks would have been extensions.

https://www.visualstudio.com/integrate/extensions/develop/add-build-task

No reason anyone in the community couldn't offer it as an open source first class task

I know this is an ancient issue, but i found using the Shell Script task with following content worked for me:
bower install --allow-root. Dropping a note if anyone else stumbles into this in 2018 or later.

Was this page helpful?
0 / 5 - 0 ratings