Skip to content

Commit 3d2f525

Browse files
committed
fix: upload
1 parent 32c6c7e commit 3d2f525

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zhinjs/cli",
3-
"version": "0.2.33",
3+
"version": "0.2.34",
44
"description": "zhin 脚手架",
55
"bin": {
66
"zhin": "lib/index.js"

src/deploy.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ async function uploadFile(config: Config) {
6767
})
6868
console.log('登录远程服务器成功');
6969
// 为避免第一次时报错,尝试建一下文件夹
70-
await ssh.execCommand(`mkdir ${config.direct}`)
70+
await ssh.execCommand(`mkdir ${config.direct}`).catch(()=>{})
7171
// 给服务器上的项目做个备份,避免部署失败时,文件丢失
7272
await backupProject(config)
7373
// 上传网站的发布包至configs中配置的远程服务器的指定地址
@@ -117,10 +117,10 @@ const remoteStart = async (config: Config) => {
117117
};
118118
export default function registerDeployCommand(cli: CAC) {
119119
cli.command('deploy <remoteAddr>', '部署zhin到远程服务器')
120-
.option('-u,--uname', '登录用户名', {default: 'root'})
121-
.option('-p,--upass', '登录密码,不填则使用秘钥登录')
122-
.option('-k,--key','登录秘钥文件路径,默认:~/.ssh/{remoteArr}.pem')
123-
.option('-d,--direct', '部署到指定目录,默认:~/{projectName}')
120+
.option('-u,--uname [uname]', '登录用户名', {default: 'root'})
121+
.option('-p,--upass [upass]', '登录密码,不填则使用秘钥登录')
122+
.option('-k,--key [key]','登录秘钥文件路径,默认:~/.ssh/{remoteArr}.pem')
123+
.option('-d,--direct [direct]', '部署到指定目录,默认:~/{projectName}')
124124
.action(async (remoteArr, options) => {
125125
await startDeploy({
126126
host:remoteArr,

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export async function copyDir(src:string, dest:string,ignore:string) {
3636
export async function removeDir(dirPath){
3737
if(!fs.existsSync(dirPath)) return
3838
const fileStat=await fsp.stat(dirPath)
39-
if(fileStat.isFile()) return
39+
if(fileStat.isFile()) return fsp.unlink(dirPath)
4040
const files=await fsp.readdir(dirPath)
4141
for(const file of files){
4242
const subDir=path.join(dirPath,file)

0 commit comments

Comments
 (0)