Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cml-cli

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cml-cli - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

145

index.js

@@ -9,2 +9,3 @@ 'use strict';

var spawn = require('child_process').spawn;
var moment = require('moment');

@@ -20,7 +21,7 @@ require('autocmdr/lib/help')(program);

function run_task(task_name, cwd) {
console.log(chalk.grey('Starting task: ') + chalk.bold.white(task_name));
console.log(chalk.grey('Working directory: ') + chalk.bold.white(cwd));
return spawnSync('gulp', [task_name], {
cwd: cwd
});
console.log(chalk.grey('Starting task: ') + chalk.bold.white(task_name));
console.log(chalk.grey('Working directory: ') + chalk.bold.white(cwd));
return spawnSync('gulp', [task_name], {
cwd: cwd
});
}

@@ -30,90 +31,88 @@

console.log(chalk.grey('Starting task: ') + chalk.bold.white(task_name));
console.log(chalk.grey('Working directory: ') + chalk.bold.white(cwd));
console.log(chalk.grey('Starting task: ') + chalk.bold.white(task_name));
console.log(chalk.grey('Working directory: ') + chalk.bold.white(cwd));
var task_process = spawn('gulp', [task_name], {
cwd: cwd
});
return spawn('gulp', [task_name], {
cwd: cwd
});
}
var command_close_handler = function(code, signal) {
task_process.stdout.unref();
task_process.stderr.unref();
task_process.stdin.unref();
};
/**
* Handles synchronous task output
* @param {[Object]} task Task result object
* @return
*/
function handle_task_sync(task) {
if (task.error) {
console.error(chalk.bold.red(task.stderr));
console.dir(JSON.stringify(task.error));
return;
}
console.log(chalk.green(task.stdout.toString()));
}
// subprocess exit
var command_exit_handler = function(code, signal) {
task_process.stdout.unref();
task_process.stderr.unref();
task_process.stdin.unref();
};
function handle_task(task_process) {
var command_close_handler = function(code, signal) {
task_process.stdout.unref();
task_process.stderr.unref();
task_process.stdin.unref();
};
// subprocess error
var command_error_handler = function(err) {
task_process.stdout.unref();
task_process.stderr.unref();
task_process.stdin.unref();
task_process.kill('SIGTERM');
};
// subprocess exit
var command_exit_handler = function(code, signal) {
task_process.stdout.unref();
task_process.stderr.unref();
task_process.stdin.unref();
};
var command_buffer_handler = function(data) {
console.log(chalk.grey.underline(moment().format('H:m:i')) + ': ' + chalk.white.bold(data.toString()));
};
// subprocess error
var command_error_handler = function(err) {
task_process.stdout.unref();
task_process.stderr.unref();
task_process.stdin.unref();
task_process.kill('SIGTERM');
};
/*=============================================
= Čtení stdout a stderr =
=============================================*/
var command_buffer_handler = function(data) {
console.log(chalk.grey.underline(moment().format('H:m:i')) + ': ' + chalk.white.bold(data.toString()));
};
task_process.stdout.setEncoding('utf8');
task_process.stderr.setEncoding('utf8');
task_process.stdin.setEncoding('utf8');
task_process.stdout.on('data', command_buffer_handler);
task_process.stderr.on('data', command_buffer_handler);
task_process.stdin.on('data', command_buffer_handler);
task_process.on('close', command_close_handler);
task_process.on('exit', command_exit_handler);
task_process.on('error', command_error_handler);
task_process.stdout.setEncoding('utf8');
task_process.stderr.setEncoding('utf8');
task_process.stdin.setEncoding('utf8');
task_process.stdout.on('data', command_buffer_handler);
task_process.stderr.on('data', command_buffer_handler);
task_process.stdin.on('data', command_buffer_handler);
task_process.on('close', command_close_handler);
task_process.on('exit', command_exit_handler);
task_process.on('error', command_error_handler);
}
/**
* Handles task output
* @param {[Object]} task Task result object
* @return
*/
function handle_task(task) {
if (task.error) {
console.error(chalk.bold.red(task.stderr));
console.dir(JSON.stringify(task.error));
return;
}
console.log(chalk.green(task.stdout.toString()));
}
program
.version(pkg.version)
.option('-b, --build', 'create production build')
.option('-d, --development', 'start development')
.option('-D, --docs', 'generate project docs')
.option('-l, --lint', 'lint markup, styles and script sources')
.option('-t, --test', 'run tests')
.option('-g, --generate', 'generate view, page or pattern')
.parse(process.argv);
.version(pkg.version)
.option('-b, --build', 'create production build')
.option('-d, --development', 'start development')
.option('-D, --docs', 'generate project docs')
.option('-l, --lint', 'lint markup, styles and script sources')
.option('-t, --test', 'run tests')
.option('-g, --generate', 'generate view, page or pattern')
.parse(process.argv);
if (program.build) {
handle_task(spawn_task('build', path.join(__dirname, '../../')));
handle_task(spawn_task('build', path.join(__dirname, '../../')));
} else if (program.development) {
handle_task(run_task('development', path.join(__dirname, '../../')));
handle_task(run_task('development', path.join(__dirname, '../../')));
} else if (program.docs) {
handle_task(run_task('docs', path.join(__dirname, '../../')));
handle_task(run_task('docs', path.join(__dirname, '../../')));
} else if (program.lint) {
handle_task(run_task('lint', path.join(__dirname, '../../')));
handle_task(run_task('lint', path.join(__dirname, '../../')));
} else if (program.test) {
handle_task(run_task('test', path.join(__dirname, '../../')));
handle_task(run_task('test', path.join(__dirname, '../../')));
} else if (program.generate) {
console.log(chalk.underline.cyan.bold('Not yet implemented :('));
console.log(chalk.underline.cyan.bold('Not yet implemented :('));
} else {
console.error('No command specified. See \'cml-cli --help\':');
program.outputHelp();
console.error('No command specified. See \'cml-cli --help\':');
program.outputHelp();
}
process.exit(1);
{
"name": "cml-cli",
"version": "0.0.3",
"description": "Simple wrapper for build scripts to stabilize API and to scaffold views and common patterns of cml-frontend boilerplate. Not for standalone usage.",
"private": false,
"bin": {
"cml-cli": "./bin/cml-cli"
},
"scripts": {},
"author": {
"name": "Viktor Bezdek",
"email": "viktor.bezdek@gmail.com",
"url": "https://github.com/viktorbezdek"
},
"repository": {
"type": "git",
"url": "https://github.com/viktorbezdek/cml-cli"
},
"license": "MIT",
"bugs": "https://github.com/viktorbezdek/cml-cli/issues",
"dependencies": {
"autocmdr": "~0.0.4",
"chalk": "^1.0.0",
"commander": "~2.0.0",
"moment": "^2.10.2"
},
"devDependencies": {}
"name": "cml-cli",
"version": "0.0.4",
"description": "Simple wrapper for build scripts to stabilize API and to scaffold views and common patterns of cml-frontend boilerplate. Not for standalone usage.",
"private": false,
"bin": {
"cml-cli": "./bin/cml-cli"
},
"scripts": {},
"author": {
"name": "Viktor Bezdek",
"email": "viktor.bezdek@gmail.com",
"url": "https://github.com/viktorbezdek"
},
"repository": {
"type": "git",
"url": "https://github.com/viktorbezdek/cml-cli"
},
"license": "MIT",
"bugs": "https://github.com/viktorbezdek/cml-cli/issues",
"dependencies": {
"autocmdr": "~0.0.4",
"chalk": "^1.0.0",
"commander": "~2.0.0",
"moment": "^2.10.2"
},
"devDependencies": {}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc