node package manager
Stop wasting time. Easily manage code sharing in your team. Create a free org ยป

paprika

Paprika - Sprinkle JavaScript tasks on your .NET build

Paprika is a JavaScript library of tasks commonly performed while building .NET applications.

Tasks Included

At the moment there are a hand-full of tasks. Hopefully, this will fill out as more tasks are necessary!

ASP .NET Compiler Task

Pre-compile your ASP .NET applications using this task. Ideally, you should compile your Website project with a custom OutDir so MSBuild will generate a _PublishedWebsites directory.

var aspcompile = require('paprika').aspcompile;
aspcompile({
  virtualPath: '/myapp', // hard-coded into files generated by compilation
  physicalPath: 'build_temp/outdir/_PublishedWebsites/MyApp',
  targetPath: 'build_output/website',
  updatable: targetPathue, // false by default
  debug: true, // enables debug info and error stack information
  run_options: { stdout: false } // accepts same options as run task
});

MSBuild task

Execute MSBuild using this task by passing in the required parameters. You can also include a callback function as a second parameter

var msbuild = require('paprika').msbuild;
msbuild({
  file: '../MySolution.sln',
  version: 'net35',
  processor: 'x86',
  targets: ['Clean', 'Build'],
  properties: { Configuration: 'Release' },
  stdout: false, // prevent redirection to stdout
  stderr: false, // prevent redirection to stderr
  buildCommand: 'xbuild', // customize the location of MSBuild.exe (or xbuild)
  extraParameters: '/nologo /version' // add any additional parameters
}, function () { complete(); });

You can specify default values to prevent repeating yourself.

var msbuild = require('paprika').msbuild;
msbuild.setDefaults({
  properties: { Configuration: 'Release' },
  buildCommand: 'xbuild'
});

NUnit task

Execute NUnit tests and determine if they passed or failed.

nunit(['Project.Tests.dll'], {
	nunitDir: nunitDir, // path to nunit-console executable to use
	processor: 'x86', // can specify to use x86 or x64 bit version of runner
	subset: 'Project.Tests.UnitTests', // a namespace, fixture or test to run
	run_options: { stdout: false } // the options to pass to the Run task
}, function (err) { console.log(err ? 'Failed!' : 'Passed!'); });

Run task

The run task takes the effort out of calling out to other processes. It takes care of operating system specific idiosyncrasies (I'm looking at you node for Windows) and assumes you either want output redirected to the console (default) or not at all. Here is a simple example to get started:

run('pwd');

The run function requires one parameter: the filename (may include path) of the process to run. It has several optional parameters - here is the function signature along with some other examples:

// run(cmd [, args] [, options] [, callback])
var run = require('paprika').run;
run('node', '--version', {
  stdout: false, // by default, stdout is redirected to console
  stderr: false, // by default, stderr is redirected to console
  spawn_options: { cwd: '/' } // options to pass onto child_process.spawn
}, function () { complete(); });

run('mycmd', ['many', 'options']);

run('prevent_meltdown', function (code) {
  if (code !== 0) {
    runLikeHell();
  }
});

ZIP task

Run the zip command with the passed in command line arguments. This task determines what version of zip (www.info-zip.org) to use depending on the platform and architecture. The zip function accepts command line parameters as either a single string, or an array of strings.

var zip = require('paprika').zip;
zip('-r deploy_package ./package');
zip(['-r', 'deploy_package', './package']);