77cli
Advanced tools
Comparing version 0.0.6 to 0.0.7
46
index.js
@@ -13,11 +13,12 @@ #!/usr/bin/env node | ||
program | ||
.version(packages.version) | ||
.option('-pmr, --push-merge-request <source>', 'push and merge request') | ||
.option('-h5, --genarate-h5-url <json>', 'create h5 page link, input /getTokenByCode response json string') | ||
.option('-gql, --gql', 'open gql tool') | ||
.option('-h5, --genarate-h5-url <json>', 'input getTokenByCode json string, for example: \'{ "Txx": "xx", ... }\'') | ||
.option('-gql, --gql [str]', 'get GraphQL online tool\n\n') | ||
.option('-p, --product', '-p, product env, default hotfix') | ||
.option('-e, --env <env>', '-e <env>, -e 1 = temp1, -e hotfix = nx-hotfix-k8s, -p -e 1 = cn-northwest-1') | ||
.option('-p, --product', '-p, product env, default development env') | ||
.option('-e, --env <env>', '-e <env>, -e 1 = temp1, -e hotfix = nx-hotfix-k8s, -p -e 1 = cn-northwest-1\n\n') | ||
.option('-o, --open', 'auto open browser') | ||
.option('-d, --debug', 'console options') | ||
.version(packages.version) | ||
.parse(process.argv); | ||
@@ -42,3 +43,3 @@ | ||
// 打开h5调试页面 | ||
if (options.genarateH5Url) { | ||
else if (options.genarateH5Url) { | ||
const clusterId = options.product ? `cn-northwest-${options.env || 1}` : `nx-${isNaN(Number(options.env)) ? (options.env || 'hotfix') : ('temp' + options.env)}-k8s` | ||
@@ -51,3 +52,8 @@ const host = options.product ? `app.77hub.com` : `${clusterId}.e7link.com`; | ||
if (tenantId) { | ||
opn(`https://${host}/${clusterId}/weapp?globalApiPrefix=___XX${clusterId}&isALlScreen=false&isFollowServiceNumber=true&safeBottomGap=0&tenantId=${tenantId}&refreshToken=${refreshToken}&token=${accessToken}`) | ||
const url = `https://${host}/${clusterId}/weapp?globalApiPrefix=___XX${clusterId}&isALlScreen=false&isFollowServiceNumber=true&safeBottomGap=0&tenantId=${tenantId}&refreshToken=${refreshToken}&token=${accessToken}` | ||
if (options.open) { | ||
opn(url) | ||
} else { | ||
console.log(url) | ||
} | ||
} else { | ||
@@ -59,5 +65,27 @@ console.log('miss token: -t \'{json}\'') | ||
// 打开gql调试页面 | ||
if (options.gql) { | ||
else if (options.gql) { | ||
const clusterId = options.product ? `cn-northwest-${options.env || 1}` : `nx-${isNaN(Number(options.env)) ? (options.env || 'hotfix') : ('temp' + options.env)}-k8s` | ||
opn(`http://graphql.${clusterId}.e7link.com/graphiql/index.html`) | ||
const url = `http://graphql.${clusterId}.e7link.com/graphiql/index.html${typeof options.gql === 'string' ? '?query=' + encodeURI(options.gql) : ''}` | ||
if (options.open) { | ||
opn(url) | ||
} else { | ||
console.log(url) | ||
} | ||
} | ||
// 打开web应用页面 | ||
else if (options.open) { | ||
const clusterId = options.product ? `cn-northwest-${options.env || 1}` : `nx-${isNaN(Number(options.env)) ? (options.env || 'hotfix') : ('temp' + options.env)}-k8s` | ||
const url = 'https://' + (options.product ? `app.77hub.com` : `${clusterId}.e7link.com`); | ||
if (options.open) { | ||
opn(url) | ||
} else { | ||
console.log(url) | ||
} | ||
// 无有效参数,则自动展示帮助 | ||
} else { | ||
child_process.exec(Object.keys(packages.bin)[0] + ' -h', (err, stdout) => { | ||
console.log(stdout) | ||
}) | ||
} |
@@ -17,3 +17,3 @@ { | ||
"name": "77cli", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"_from": "77cli", | ||
@@ -20,0 +20,0 @@ "_id": "77cli@0.0.5", |
4301
72