Skip to content

Instantly share code, notes, and snippets.

@dashawk
Created July 8, 2019 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dashawk/6a1a8b97d72495a4b5cd2dce7a8fb4b0 to your computer and use it in GitHub Desktop.
Save dashawk/6a1a8b97d72495a4b5cd2dce7a8fb4b0 to your computer and use it in GitHub Desktop.
var chalk = require('chalk')
const { exec } = require('child_process');
var version = require('../version')
var type = process.argv[2],
moduler = process.argv[3],
message = process.argv.slice(4, process.argv.length).join(' '),
commands = [
"git add .",
"git commit -m \"" + type + "@" + version.pro_version + "(" + moduler + "): " + message + "\"",
"git push origin $(git symbolic-ref --short -q HEAD)"
]
var exec_commands = (commands) => {
var command = commands.shift()
exec(command, (error, stdout, stderr) => {
console.log(chalk.gray("$ ") + chalk.yellow(command))
console.log("")
if (error) {
console.error(chalk.red(error));
process.exit(1)
return;
}
if(stdout) console.log(chalk.gray(stdout));
if(stderr) console.log(chalk.gray(stderr));
if(commands.length) exec_commands(commands)
});
}
exec_commands(commands)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment