node package manager
Painless code sharing. npm Orgs help your team discover, share, and reuse code. Create a free org »

gulp-dotnet

DOTNET Core Gulp Plugin Dependency Status devDependency Status

GulpJS plugin for DOTNET CORE CLI ( ASP.NET Core ) that is cross-platform. This plugin does the following:

  • Build
  • Update
  • Start

and with Gulp you can setup watchers for recompiling on the fly and restarting the web server. Similar to gulp-dnx but this one has more logging opts, notifications and is cross platform.

Usage

build.js

var gulp = require('gulp');
var Dotnet = require('gulp-dotnet');
gulp.task('build:csharp', function(cb) {
  Dotnet.build({ cwd: './' }, cb);
});

watch.js

var gulp = require('gulp');
var runSequence = require('run-sequence');
var paths = './**/*.cs';
 
function changed(event) {
  gutil.log(`File ${event.path} was ${event.type}, running tasks...`);
};
 
gulp.task('watch', ['build'], function() {
  gulp.watch(paths, {interval: 500}, function(){
    runSequence('build:csharp', 'start:api');
  }).on('change', changed);
});

server.js

var gulp = require('gulp');
var Dotnet = require('gulp-dotnet');
 
var server;
gulp.task('start:api', function(cb) {
  if(!server) server = new Dotnet({ cwd: paths.api  });
  server.start('weblistener', cb);
});

Options

{
  // current working directory
  cwd: './',
  
  // how noisy?
  // options: 'debug', 'info', 'error', 'silent'
  logLevel: 'debug',
  
  // notify on errors
  notify: true
}
 

Credits

gulp-dotnet is a Swimlane open-source project; we believe in giving back to the open-source community by sharing some of the projects we build for our application. Swimlane is an automated cyber security operations and incident response platform that enables cyber security teams to leverage threat intelligence, speed up incident response and automate security operations.

License

MIT