--local default to './dist'
This commit is contained in:
parent
4e17830a03
commit
223261b739
13
README.md
13
README.md
@ -2,13 +2,14 @@
|
|||||||
## 参数
|
## 参数
|
||||||
* -t, --type: web(默认) 或 git
|
* -t, --type: web(默认) 或 git
|
||||||
* 如果是 git
|
* 如果是 git
|
||||||
* -r, --repo: 'https://github.com/ORG/ORG.github.io'
|
* -r, --repo: 远程仓库,例如 'https://github.com/ORG/ORG.github.io'
|
||||||
* -b, --branch
|
* -b, --branch: 分支,默认为 master
|
||||||
* 如果是 web
|
* 如果是 web
|
||||||
* -H, --host: 远程主机
|
* -H, --host: 远程主机
|
||||||
* -P, --port: 端口
|
* -P, --port: 远程端口,默认为 22
|
||||||
* -D, --dir: 例如 /home/USER/FOLDER
|
* -D, --dir: 远程目录,例如 /home/USER/FOLDER
|
||||||
* -d, --dist: 默认为 dist。例如 www
|
* -d, --dist: 远程文件夹,例如 www。默认为 dist。
|
||||||
* -l, --local: 本地文件夹,例如 ../../project/public。默认为 dist
|
* -l, --local: 本地文件夹,例如 ../../project/public。默认为 ./dist
|
||||||
|
* -u, --user: 用户名
|
||||||
* -p, --password: 密码
|
* -p, --password: 密码
|
||||||
* -k, --key: 密钥文件
|
* -k, --key: 密钥文件
|
||||||
|
@ -51,7 +51,7 @@ const connection = {
|
|||||||
dist: commander.dist || Config.deploy.dist || 'dist', // 新系统将发布在这个文件夹里。建议为dist,和npm run build产生的目录一致,这样既可以远程自动部署,也可以直接登录服务器手动部署。
|
dist: commander.dist || Config.deploy.dist || 'dist', // 新系统将发布在这个文件夹里。建议为dist,和npm run build产生的目录一致,这样既可以远程自动部署,也可以直接登录服务器手动部署。
|
||||||
repo: commander.repo || Config.deploy.repo,
|
repo: commander.repo || Config.deploy.repo,
|
||||||
branch: commander.branch || Config.deploy.branch || 'master',
|
branch: commander.branch || Config.deploy.branch || 'master',
|
||||||
local: commander.local || Config.deploy.local || 'dist',
|
local: commander.local || Config.deploy.local || './dist',
|
||||||
username: commander.user || Config.deploy.user,
|
username: commander.user || Config.deploy.user,
|
||||||
privateKey: fs.existsSync(privateKeyFile) ? privateKeyFile : undefined,
|
privateKey: fs.existsSync(privateKeyFile) ? privateKeyFile : undefined,
|
||||||
password: commander.password || Config.deploy.password,
|
password: commander.password || Config.deploy.password,
|
||||||
@ -100,7 +100,7 @@ function deployToWeb(){
|
|||||||
await ssh.execCommand(`mv ${connection.dist} ${connection.dist}-backup-${new Date().toISOString()}`, { cwd: connection.dir })
|
await ssh.execCommand(`mv ${connection.dist} ${connection.dist}-backup-${new Date().toISOString()}`, { cwd: connection.dir })
|
||||||
console.log(`[ mkdir ${connection.dist} ... ]`)
|
console.log(`[ mkdir ${connection.dist} ... ]`)
|
||||||
await ssh.execCommand(`mkdir ${connection.dist}`, { cwd: connection.dir })
|
await ssh.execCommand(`mkdir ${connection.dist}`, { cwd: connection.dir })
|
||||||
const toCreate = necessaryPath('./'+connection.local)
|
const toCreate = necessaryPath(path.join('./', connection.local))
|
||||||
for (const name of toCreate) {
|
for (const name of toCreate) {
|
||||||
console.log(`[ mkdir ${connection.dist}/${name.join('/')} ... ]`)
|
console.log(`[ mkdir ${connection.dist}/${name.join('/')} ... ]`)
|
||||||
await ssh.execCommand(`mkdir ${connection.dist}/${name.join('/')}`, { cwd: connection.dir })
|
await ssh.execCommand(`mkdir ${connection.dist}/${name.join('/')}`, { cwd: connection.dir })
|
||||||
@ -108,7 +108,7 @@ function deployToWeb(){
|
|||||||
|
|
||||||
let err
|
let err
|
||||||
console.log(`[ Upload to ${connection.dir}/${connection.dist} ... ]`)
|
console.log(`[ Upload to ${connection.dir}/${connection.dist} ... ]`)
|
||||||
await ssh.putDirectory('./'+connection.local, `${connection.dir}/${connection.dist}`, {
|
await ssh.putDirectory(path.join('./', connection.local), `${connection.dir}/${connection.dist}`, {
|
||||||
concurrency: 10,
|
concurrency: 10,
|
||||||
recursive: true,
|
recursive: true,
|
||||||
validate: itemPath => {
|
validate: itemPath => {
|
||||||
|
Loading…
Reference in New Issue
Block a user