easy-deploy.js is a front-end deployment tool based on rsync and node.js.
- rsync
- ssh authorized
npm install @iboying/easy-deploy --dev
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.
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'
- 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