site/deploy.js

25 lines
627 B
JavaScript
Raw Normal View History

2021-10-31 16:20:14 +03:00
const { Client } = require('node-scp')
let remotePath = "/var/www/html"
let args = process.argv.slice(2);
async function deploy() {
try {
console.log("Starting scp upload")
const client = await Client({
host: 'npm.mipt.ru',
port: 22,
username: args[0],
password: args[1],
})
await client.emptyDir(remotePath)
await client.uploadDir('./public', remotePath)
client.close() // remember to close connection after you finish
} catch (e) {
console.log(e)
}
}
deploy().then(r => console.log("Deploy is finished"))