Node.js and NVM and Grunt in TeamCity.Node

In the previous posts I wrote about Jonnyzzz.Node plugin that provides support for Node.js, NPM, Grunt and Phantom.js in TeamCity. Today I'm here to introduce NVM support in the plugin. I'd also shed light on Grunt runner improvements.

NVM

In the latest builds of the plugin you'll find the build runner called Node.js NVM Installer. This build runner would install Node.js and Node Package Manager to your build agent machine with no pre-setup at all. As the implementation I use the amazing script from creatonix/nvm. The build runner fetches the latest version of the script from GitHub. Note, the script only works under Linux and MacOS.

The new runner provides very simple settings. All you need is to specify version of Node.js. After build runner is executed, you may simply use Node.js or Node.js NPM build runners or even call node or npm command from any of you scripts/runners.

You may use the Node.js NVM Installer more than once within the build configuration. So you may test/run your code under several Node.js version at once!

Grunt

There were many requests in feedback to let Grant build runner use system-wide grunt instead of NPM fetched local grunt. Starting from now you may select the preferred way you like Grunt runner to be executed!

It's handy to refer to TeamCity properties from build scripts. Grunt scripts are not an exception to the rule. Starting from now Grunt build runner would add --teamcity.properties.all=<file.json> parameter with path to a .json file that contains all TeamCity parameters serialized to JSON hash. So now you may easily integrate your builds with TeamCity! You may use the following code to parse parameters in Grunt.js:

Downloading TeamCity.Node

This plugin is provided under Apache 2.0 license. Sources (in Kotlin) are found on GitHub. You may download compiled build from TeamCity

comments powered by Disqus