Created
July 8, 2019 06:29
-
-
Save dashawk/6a1a8b97d72495a4b5cd2dce7a8fb4b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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