@iboying/easy-deploy
v0.4.0
Published
A simple deploy tool for based on ssh and node.js
Downloads
7
Readme
Overview
easy-deploy.js is a front-end deployment tool based on rsync and node.js.
Prerequisites
- rsync
- ssh authorized
Installation
npm install @iboying/easy-deploy --dev
Usage
Create a file deploy.js and include the follow code within it:
const EasyDeploy = require('@iboying/easy-deploy');
const firstServer = new EasyDeploy({
username: 'web',
host: 'Your remote server ip address',
localPath: 'dist/',
port: 1234,
remotePath: '/home/first/project/dist',
});
const secondServer = new EasyDeploy({
username: 'web',
host: 'Your remote server ip address',
localPath: 'dist/',
remotePath: '/home/second/project/dist',
});
async function deploy() {
try {
await EasyDeploy.shell('npm run lint');
await EasyDeploy.shell('npm run test');
await EasyDeploy.shell('npm run build');
await firstServer.sync();
await secondServer.sync();
console.log('Deploy success');
} catch (err) {
console.log('Deploy failed');
}
}
deploy();
Then, run node deploy.js
to deploy project.
Apis
EasyDeploy.shell('npm run test')
exec local shell command.instance.remote('pwd')
exec remote server shell command.instance.sync('-ravz')
sync localPath content with remote server, the arguments is rsync flags and the default flags is-avI
, such as add delete logic: '-ravz --delete'
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request