diff --git a/.npmrc b/.npmrc index 08844f3..4f45d02 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -registry=http://101.132.121.111:6842 +#registry=http://101.132.121.111:6842 diff --git a/deploy.js b/deploy.js index 624e62b..0017a48 100644 --- a/deploy.js +++ b/deploy.js @@ -8,13 +8,15 @@ commander .version('1.0', '-v, --version') // 默认是 -V。如果要 -v,就要加 '-v --version' .option('-H, --host ', 'domain name or ip address of the target server') .option('-P, --port ', 'ssh port number of the target server') -.option('-r, --root ', 'root directory to deploy on the target server') +.option('-r, --root ', 'root path to deploy on the target server') +.option('-d, --dist ', 'dist folder to deploy on the target server') .option('-u, --user ', 'user id to login the target server') .option('-k, --key ', 'user key file to login the target server') .option('-p, --password ', 'user password to login the target server. You may have to enclose the password in ""') .parse(process.argv) const root=commander.root||'/home/tic/tic.node/console' // 本地的项目目录。似乎该目录必须已经存在于服务器上 +const dist=commander.dist||'dist' // 新系统将发布在这个目录里。建议和npm run build产生的目录一致,这样既可以远程自动部署,也可以直接登录服务器手动部署。 const privateKeyFile=commander.key||`${process.env.HOME}/.ssh/id_rsa` const connection = { @@ -47,16 +49,15 @@ const necessaryPath = (path) => { }; ssh.connect(connection).then(async () => { - const proj = 'dist' // 新系统将发布在这个目录里。建议和npm run build产生的目录一致,这样既可以远程自动部署,也可以直接登录服务器手动部署。 - await ssh.execCommand(`mv ${proj} ${proj}-backup-${new Date().toISOString()}`, { root }); // 把服务器上老系统改名成另一个目录 - await ssh.execCommand(`mkdir ${proj}`, { root }); // 新建发布目录 + await ssh.execCommand(`mv ${dist} ${dist}-backup-${new Date().toISOString()}`, { root }); // 把服务器上老系统改名成另一个目录 + await ssh.execCommand(`mkdir ${dist}`, { root }); // 新建发布目录 const toCreate = necessaryPath('./dist'); // 读取本地项目的发布目录下的子目录,去服务器上建立。 for (const name of toCreate) { - await ssh.execCommand(`mkdir ${proj}/${name.join('/')}`, { root }); + await ssh.execCommand(`mkdir ${dist}/${name.join('/')}`, { root }); } let err; - await ssh.putDirectory('./dist', `${root}/${proj}`, { + await ssh.putDirectory('./dist', `${root}/${dist}`, { concurrency: 10, recursive: true, validate: itemPath => { diff --git a/public/favicon.ico b/public/favicon.ico index c7b9a43..af1af2a 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/public/index.html b/public/index.html index 709892f..6692f1a 100644 --- a/public/index.html +++ b/public/index.html @@ -5,7 +5,7 @@ - console + TIC Console