New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

split-command

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

split-command - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

27

index.js

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

var yargs = require('yargs');
var exec = require('child_process').exec;

@@ -43,11 +42,21 @@ var spawn = require('child_process').spawn;

module.exports = function (execCmd, installCmd) {
module.exports = function (projectPackageJson, execCmd, installCmd) {
if (!projectPackageJson || !projectPackageJson.splitCommands) {
console.info("Please check your SplitCommand congifuration");
return false;
}
var args, cmd, splitCmds;
args = process.argv;
if (!execCmd || !installCmd) {
var argv = yargs.argv;
var cmd = argv._[0];
var splitCmds = require('../../package.json').splitCommands;
if (args.length > 2) {
cmd = args[2];
splitCmds = projectPackageJson.splitCommands;
} else {
return false;
}
if (!splitCmds[cmd]) {
return;
return false;
}

@@ -64,8 +73,8 @@

console.error("can't read split command configuration in your package.json");
process.exit();
return false;
}
}
checkCmdExists(execCmd).then(function () {
forkRun(execCmd, argv._.slice(1));
return !!checkCmdExists(execCmd).then(function () {
forkRun(execCmd, args.slice(3));
}).catch(function () {

@@ -72,0 +81,0 @@ console.log('please run:\n ' + installCmd + '\nto install this command first');

{
"name": "split-command",
"version": "0.0.3",
"version": "0.0.4",
"description": "a framework for write separable command line application",

@@ -19,3 +19,2 @@ "scripts": {

"dependencies": {
"yargs": "^6.0.0",
"babel-plugin-transform-runtime": "^6.12.0",

@@ -22,0 +21,0 @@ "babel-runtime": "^6.11.6"

@@ -52,4 +52,5 @@ # SplitCommand

```javascript
var splitCommand = require('split-command');
splitCommand();
var projectPackageJSON = require('../package.json'); // configuration file of your project
require('split-command')(projectPackageJSON);
```

@@ -76,5 +77,6 @@

if (argv._[0] === 'coreCommand') {
console.log("coreCommand running....") // any awesome logic of your normal sub command
console.log("coreCommand running....") // any awesome logic of your normal sub command
}
splitCommand(); // let's split command do the rest
var projectPackageJSON = require('../package.json'); // configuration file of your project
var isSplitCommandMatched = splitCommand(projectPackageJSON); // let's split command do the rest
})()

@@ -94,3 +96,4 @@ ```

## Release History
* 161101(0.0.4): remove dependence of yargs
* 161027(0.0.3): first version
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