Commit e1590f48 by ioclubs

ugen-tool

parent c4ebe510
gitUrl=$1
name=$2
git clone --depth=1 -b master ${gitUrl} ${name}
...@@ -21,24 +21,27 @@ module.exports = async () => { ...@@ -21,24 +21,27 @@ module.exports = async () => {
} }
let gitUrl, branch; let gitUrl, branch;
console.log(config.tpl); console.log(config.cloud);
if (!config.tpl[tplName]) { if (!config.cloud[tplName]) {
console.log(chalk.red('\n × Template does not support!')) console.log(chalk.red('\n × Template does not support!'))
return return
} }
gitUrl = config.tpl[tplName].url gitUrl = config.cloud[tplName].url
branch = config.tpl[tplName].branch branch = config.cloud[tplName].branch
console.log('\n fetch repository'); console.log('\n fetch repository');
// git命令,远程拉取项目并自定义项目名 // // git命令,远程拉取项目并自定义项目名
let cmdStr = `git clone --depth=1 -b ${branch} ${gitUrl} ${projectName}` // let cmdStr = `git clone --depth=1 -b ${branch} ${gitUrl} ${projectName}`
//
await execSync(cmdStr) // await execSync(cmdStr)
//
const registry = 'http://company.u-gen.net:7001' // const registry = 'http://company.u-gen.net:7001'
console.log('\n npm install'); // console.log('\n npm install');
//
await execSync(`cd ${projectName} && npm install --registry=${registry}`); // await execSync(`cd ${projectName} && npm install --registry=${registry}`);
await execSync(`sh cloud-init.sh ${gitUrl} ${projectName}`);
console.log(chalk.green('\n √ Generation completed!')); console.log(chalk.green('\n √ Generation completed!'));
console.log("bye bye");
} }
{ {
"tpl": { "cloud": {
"app": { "app": {
"url": "http://company.u-gen.net:10080/twb/ugen-cloud-app.git", "url": "http://company.u-gen.net:10080/twb/ugen-cloud-app.git",
"branch": "master" "branch": "master"
......
...@@ -12,11 +12,11 @@ program ...@@ -12,11 +12,11 @@ program
program program
.usage('<command>') .usage('<command>')
program program
.command('init') .command('cloud')
.description('Generate a new project') .description('Generate a new cloud project')
.alias('i') .alias('i')
.action(async() => { .action(async() => {
await require('./init.js')() await require('./cloud.js')()
}) })
program.parse(process.argv) program.parse(process.argv)
{ {
"name": "@ioclubs/ugen-cloud", "name": "ugen-tool",
"version": "1.0.0", "version": "1.0.0",
"description": "ugen cloud", "description": "ugen tool",
"private": false, "private": false,
"main": "index.js", "main": "index.js",
"bin": { "bin": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment