create-process
Advanced tools
Comparing version 0.0.3 to 0.0.4
15
index.js
const spawn = require('cross-spawn') | ||
function parseCommand (str) { | ||
const config = {} | ||
const strData = str.split(' ') | ||
config.cmd = strData.shift() | ||
config.args = strData | ||
config.opts = { cwd: process.cwd() } | ||
return config | ||
} | ||
function createProcess (config) { | ||
if (typeof config === 'string') { | ||
config = parseCommand(config) | ||
} | ||
const name = config.name | ||
@@ -26,3 +39,3 @@ const tag = `[${name}]` | ||
p.on('error', (err) => console.log(err)) | ||
p.on('close', (c) => console.log(`process '${name}' exited with code: ${c}`)) | ||
p.on('close', (c) => console.log(`process exited with code: ${c}`)) | ||
} | ||
@@ -29,0 +42,0 @@ |
{ | ||
"name": "create-process", | ||
"version": "0.0.3", | ||
"description": "Small utility function to help your create and manage node processes more easily", | ||
"version": "0.0.4", | ||
"description": "Small utility library to help your create and manage node processes more easily", | ||
"main": "index.js", | ||
"scripts": {}, | ||
"keywords": ["create", "process", "spawn"], | ||
"keywords": [ | ||
"create", | ||
"process", | ||
"manager", | ||
"spawn", | ||
"create-process" | ||
], | ||
"author": { | ||
@@ -13,2 +19,6 @@ "name": "Kevin Karsopawiro", | ||
}, | ||
"repository": { | ||
"type" : "git", | ||
"url" : "https://github.com/afterburn/create-process" | ||
}, | ||
"license": "MIT", | ||
@@ -15,0 +25,0 @@ "dependencies": { |
# create-process | ||
Small utility function to help your create and manage node processes more easily. | ||
![enter image description here](https://img.shields.io/npm/dt/create-process) | ||
Small utility library to help your create and manage node processes more easily. | ||
(work in progress) | ||
## Installation | ||
npm install --save create-process | ||
```shell | ||
npm install --save create-process | ||
``` | ||
## Usage | ||
```javascript | ||
const createProcess = require('createProcess') | ||
// Simple usage: | ||
const process = createProcess('npm run build') | ||
// Advanced usage: | ||
const process = createProcess({ | ||
name: 'webpack', | ||
cmd: 'npm', | ||
args: ['run', 'build'], | ||
opts: { | ||
cwd: path.join(__dirname, '..') | ||
} | ||
}) | ||
``` |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
2422
36
29
0