48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
/* eslint-disable */
|
|
const {
|
|
copyFile,
|
|
zipFile,
|
|
} = require('./file');
|
|
const chalk = require('chalk');
|
|
const path = require('path');
|
|
|
|
const root = process.cwd();
|
|
const node_ssh = require('node-ssh');
|
|
|
|
const ssh = new node_ssh();
|
|
|
|
const deploy = async() => {
|
|
await copyFile();
|
|
await zipFile();
|
|
// await ssh.connect({
|
|
// host : '---',
|
|
// username: '----',
|
|
// password: '----',
|
|
// port : --,
|
|
// });
|
|
//
|
|
// await ssh.putFile(`${root}/server/server.zip`, '/usr/local/smart-library/server-pkg/server.zip').then(() => {
|
|
// console.log('The File thing is done');
|
|
// }, (error) => {
|
|
// console.log('Something\'s wrong');
|
|
// console.log(error);
|
|
// });
|
|
//
|
|
//
|
|
// await ssh.exec('sh', ['./deploy.sh'], {
|
|
// cwd: '/usr/local/smart-library/server-pkg',
|
|
// onStdout(chunk) {
|
|
// console.log(chalk.green(chunk.toString('utf8')));
|
|
// },
|
|
// onStderr(chunk) {
|
|
// console.log(chalk.red(chunk.toString('utf8')));
|
|
// },
|
|
// });
|
|
// console.log('success');
|
|
process.exit(0);
|
|
};
|
|
deploy().catch((e) => {
|
|
console.log(e);
|
|
process.exit(0);
|
|
});
|