Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js and TeamCity

I have the following question:

In our company we start a new web project, with a lot of .js .css files. Our company is a Java company, meaning all the development is done in: Java/Maven/Team City for build process.

Since the company is already using TeamCity, we want to use it also for the web build, we are trying to introduce Node.js and GruntJs in our build process. I was wondering if someone has experience of setting/configuration Node.js like a runner in TeamCity?

In the end we want to "commit" an change and then a build, this build will be done with the Node.js runner. I found the following plugin for TeamCity.

Any help will be appreciated

like image 888
Boba Fett likes JS Avatar asked Mar 08 '13 10:03

Boba Fett likes JS


1 Answers

I'm using GruntJS and TeamCity in Web Project which contains couple of sites such as API, User and Admin portals, and Unit/Smock/Integration Tests. After couple of prototyping I finally decide to put all logic within ONE GruntJS file to build each part of project separately.

To do so, I added one new project to source repository just for deployment. Within that project then I have my base Gruntfile.js which is just entry point to sub-Grunt build processes for each part of project. I can pass parameter to base by Grunt-CLI to choose my target for build, like: grunt --target=api (Note: I also pass Version/Revision and other stuff too but for simplicity I don't go more in deep in this answer)

Then I created one shell script which run grunt with all possible parameters in sequence. And finally just created one step in build configuration in TeamCity to just run that shell script!

By doing this way I gain lots of benefits such as:

  1. Put all deployment logic within source control for better maintainability.
  2. Each developer have access to it and can build even on local machine
  3. TeamCity integration become so simple and also you can easily move it to other CI platforms!

If you want to have each project on separated repositories, then you can setup one Deployment repository with base GruntJS and create submodules to other repositories.

like image 197
Qorbani Avatar answered Oct 11 '22 23:10

Qorbani