-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(remote-sync): Enable remote syncing based on an API response (#1506
) * feat(remote-sync): Enable remote syncing based on an API response * feat(remote-sync): Added option for passing SSH key --------- Co-authored-by: Tyler Gauntlett <[email protected]>
- Loading branch information
1 parent
01fb40a
commit 11cfaa7
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { execSync } = require('child_process'); | ||
|
||
function ApiRsyncPlugin(source, destination) { | ||
this.source = source; | ||
this.destination = destination; | ||
} | ||
|
||
/* eslint-disable no-console */ | ||
ApiRsyncPlugin.prototype.apply = function rsync(compiler) { | ||
compiler.plugin('done', () => { | ||
console.log(''); | ||
console.log(`🔄 🔄 🔄 Rsync starting for ${this.source} 🔄 🔄 🔄`); | ||
execSync( | ||
`rsync -avz -e "ssh -p 8022 -o ConnectTimeout=3 ${process.env.DEVPOD_RSYNC_OPTIONS}" ${this.source} ${this.destination}`, | ||
{ | ||
stdio: [0, 1, 2], | ||
}, | ||
); | ||
}); | ||
}; | ||
|
||
module.exports = ApiRsyncPlugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters