component-wrapper

Small module that spawns component.js as a child process

npm install component-wrapper
8 downloads in the last month

Component Wrapper

Small wrapper that calls the component.js executable using child_process.spawn.

Install

npm install component-wrapper

API

var component = require('component-wrapper');
component([args], [options]);

// Calls spawn once or multiple times depending on the length of the args array

require('child_process').spawn('/node_modules/component/bin/component', [args], [options]);

Example

component();

// This defaults to [ ['install'], ['build'] ] so this calls.

require('child_process').spawn('/node_modules/component/bin/component', [ 'install' ], null);
require('child_process').spawn('/node_modules/component/bin/component', [ 'build' ], null);

Command arguments

component([ [ '--help' ] ]);

// Calls spawn once:

require('child_process').spawn('/node_modules/component/bin/component', [ [ '--help' ] ], null);

Command arguments + options

component([ [ '--help' ], [ 'search', 'font-awesome' ] ], { cwd: __dirname });

// Calls spawn twice:

require('child_process').spawn('/node_modules/component/bin/component', [ [ '--help' ] ], { cwd: '/some/directory' });
require('child_process').spawn('/node_modules/component/bin/component', [ [ 'search', 'font-awesome' ] ], { cwd: '/some/directory' });
npm loves you