UNPKG

releaseme

Version:

A tool inspired by SBT Release for releasing node applications.

27 lines (22 loc) 542 B
const shell = require('shelljs'); const escape = require('any-shell-escape'); const exec = (command) => { return new Promise((resolve, reject) => { shell.exec(command, (code, stdout, stderr) => { if (code !== 0) return reject(new Error(stderr)); return resolve(stdout); }); }); }; const run = (cmd) => { const command = escape(['npm', 'run', cmd]); return exec(command); }; const publish = () => { const command = escape(['npm', 'publish']); return exec(command); }; module.exports = { run, publish };