From 0840eb01c3132ba742381865da2dc28ee41e5bd3 Mon Sep 17 00:00:00 2001 From: "luk.lu" Date: Fri, 25 Oct 2019 10:15:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20-n,=20--gitname=20?= =?UTF-8?q?=E5=92=8C=20-e,=20--gitemail=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++++-- deploy.js | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 907ca29..febdbb0 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,14 @@ * 如果是 git * -r, --repo: 远程仓库,例如 'https://github.com/ORG/ORG.github.io' * -b, --branch: 分支,默认为 master + * -n, --gitname + * -e, --gitemail * 如果是 web * -H, --host: 远程主机 * -P, --port: 远程端口,默认为 22 - * -D, --dir: 远程目录,例如 /home/USER/FOLDER + * -D, --dir: 远程路径,例如 /home/USER/FOLDER * -d, --dist: 远程文件夹,例如 www。默认为 dist。 -* -l, --local: 本地文件夹,例如 ../../project/public。默认为 ./dist +* -l, --local: 本地路径,例如 ../../project/public。默认为 ./dist * -u, --user: 用户名 * -p, --password: 密码 * -k, --key: 密钥文件 diff --git a/deploy.js b/deploy.js index deeff71..82e1ee3 100644 --- a/deploy.js +++ b/deploy.js @@ -29,13 +29,15 @@ try { commander .version('1.0', '-v, --version') // 默认是 -V。如果要 -v,就要加 '-v --version' .option('-t, --type ', `Deploy to server type, web or git. Default to ${Config.deploy.type}`) + .option('-l, --local ', `Local path to copy from. Default to ${Config.deploy.local}`) .option('-H, --host ', `Host IP or domain name of the target server. Default to ${Config.deploy.host}`) .option('-P, --port ', `Ssh port number of the target server. Default to ${Config.deploy.port}`) - .option('-D, --dir ', `Directory to deploy on the target server. Default to ${Config.deploy.dir}`) - .option('-d, --dist ', `Folder to deploy on the target server. Default to ${Config.deploy.dist}`) + .option('-D, --dir ', `Destination path to deploy on the target server. Default to ${Config.deploy.dir}`) + .option('-d, --dist ', `Destination folder to deploy on the target server. Default to ${Config.deploy.dist}`) .option('-r, --repo ', `git repo address. Default to ${Config.deploy.repo}`) .option('-b, --branch ', `Local folder to copy from. Default to ${Config.deploy.local}`) + .option('-n, --gitname ', `git user name. Default to ${Config.deploy.gitname}`) + .option('-e, --gitemail ', `git user email. Default to ${Config.deploy.gitemail}`) .option('-u, --user ', `User id to login the target server. Default to ${Config.deploy.user}`) .option('-k, --key ', `User private key file to login the target server. Default to ${Config.deploy.key}`) .option('-p, --password ', `User password to login the target server. You may have to enclose it in "". Default to "${Config.deploy.password}"`) @@ -51,6 +53,8 @@ const connection = { dist: commander.dist || Config.deploy.dist || 'dist', // 新系统将发布在这个文件夹里。建议为dist,和npm run build产生的目录一致,这样既可以远程自动部署,也可以直接登录服务器手动部署。 repo: commander.repo || Config.deploy.repo, branch: commander.branch || Config.deploy.branch || 'master', + gitname: commander.gitname || Config.deploy.gitname, + gitemail: commander.gitemail || Config.deploy.gitemail, local: commander.local || Config.deploy.local || './dist', username: commander.user || Config.deploy.user, privateKey: fs.existsSync(privateKeyFile) ? privateKeyFile : undefined,