New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ntr

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ntr

Node task runner.

latest
Source
npmnpm
Version
0.0.2
Version published
Weekly downloads
31
93.75%
Maintainers
1
Weekly downloads
 
Created
Source

Node Task Runner

Install

npm install ntr

Example

Make like build system in node.js.


var path = require('path');

var ntr = require('ntr');

var cfiles = ['file_a.c','file_b.c'];

ntr()
  .env({gcc : '/usr/bin/gcc',cflags : '-Wall '})
  .add('somelib.a',cfiles,compileLib)
  .add('main.hex',['somelib.a','arduino.a'],compileLib)
  .add(cfiles,compileFile)
  .done(function(err){
    if(err)
      console.log(err);    
    console.log('done')
  });

function toO(f){
  return path.basename(f,path.extname(f)) + '.o';
}

function exec(cmd,callback){
  console.log(cmd);
  callback();
  // execute cmd string on OS when done run callback;
}

function compileLib(next){
  // this.deps => ['file_a.c','file_b.c']
  // this.name = 'somelib.a'
  // this.env = {gcc : '/usr/bin/gcc',cflags : '-Wall '}

  var cmd = [this.env.gcc,this.env.cflags,'-o',this.name].concat(this.deps.map(toO).join(' ')).join(' ');
  // cmd => /usr/bin/gcc -Wall -o somelib.a file_a.o file_b.o
  exec(cmd,next);
}

function compileFile(next){
  // this.deps => [];
  // this.name = 'file_a.c'
  var cmd = [this.env.gcc,this.env.cflags,'-o', toO(this.name),this.name ].join(' ');
  // cmd => /usr/bin/gcc -Wall -o file_a.o this.name
  exec(cmd,next);
}

Keywords

task

FAQs

Package last updated on 05 May 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts