Comments (5)
NicE!
Sounds good!
I have not had time to test yet. But I must do so soon. I come back with my observations. But I trust it will work well!
Thanks @mkloubert !
from vscode-deploy-reloaded.
I released a new version 0.65.0, which is now able to define logic for "upload events" in SFTP and FTP targets.
For that, you can define scripts, which can use the underlying raw connection to do anything you want.
In your case (if you use SFTP):
First setup your target:
{
"deploy.reloaded": {
"targets": [
{
"type": "sftp",
"name": "My SFTP folder",
"uploaded": "./uploadedToSFTP.js",
"uploadedOptions": 23979
}
]
}
}
Create a file, called uploadedToSFTP.js
, inside your .vscode
folder or .vscode-deploy-reloaded
subfolder inside your home directory:
// s. https://nodejs.org/api/path.html
const Path = require('path');
// s. https://code.visualstudio.com/docs/extensionAPI/vscode-api
const vscode = require('vscode');
// script entry
// for 'args', s. https://mkloubert.github.io/vscode-deploy-reloaded/interfaces/_plugins_sftp_.sftpuploadedmoduleexecutorarguments.html
exports.execute = async function(args) {
if (args.context.error) {
return; // rethrow error
}
// s. https://github.com/jyu213/ssh2-sftp-client
const CONN = args.context.connection;
const DIR = Path.dirname( args.context.file );
if ('/' !== DIR) { // only if not root
await setMode(CONN, DIR, '755'); // mode for directory
}
await setMode(CONN, args.context.file, '644'); // mode for file
};
// execute 'chmod' for a file
function setMode(conn, path, mode) {
mode = parseInt(mode, 8);
return new Promise((resolve, reject) => {
try {
conn.sftp.chmod(path, mode, (err) => {
if (err) {
reject(err);
}
else {
resolve();
}
});
} catch (e) {
reject(e);
}
});
}
For FTP targets, this is quite similar.
You only need to replace the part
conn.sftp.chmod(path, mode, (err) => {
});
with code of the API, that is provided by ftp or jsftp modules.
This depends on what you have defined in the engine
setting of the underlying target.
from vscode-deploy-reloaded.
Btw.: If you want to execute a command on a SFTP server, you can try this:
function executeCommand(conn, commandToExecute) {
return new Promise((resolve, reject) => {
try {
conn.client.exec(commandToExecute, (err, stream) => {
if (err) {
reject( err );
return;
}
let output = Buffer.alloc(0);
stream.once('error', (streamErr) => {
reject( streamErr );
});
stream.once('end', () => {
resolve( output );
});
stream.on('data', (chunk) => {
if (chunk) {
output = Buffer.concat([ output, chunk ]);
}
});
});
} catch (e) {
reject(e);
}
});
}
from vscode-deploy-reloaded.
I have reimplemented command feature from vs-deploy in version 0.66.1 for SFTP and FTP targets.
from vscode-deploy-reloaded.
Hey @mkloubert !
Any exemples or Wiki doscs for this exemple?
from vscode-deploy-reloaded.
Related Issues (20)
- Symbolink links in packages are not followed under Windows HOT 1
- Deploy Based on SVN Status HOT 1
- Best way to deploy different folders to different targets HOT 3
- SFTP destination file is given current timestamp, not timestamp of source file
- Exclude filters not being honoured
- Empty folders and dot files are not deployed
- Ability to pull all files with sub folders on selection
- Disable popups
- Typo on wiki-page
- Be more verbose when action start or connecting
- I tried setting up this extension and now I can't reach my live domain anymore
- How to select files without parent folder
- Clean/delete from remote directory before deploy HOT 1
- Since VsCode Version : 1.53.0 Deploy crash on save #173
- sftp: Cannot parse privateKey: Unsupported key format HOT 2
- After renaming a file from CamelCase to lowercase, it's still deployed with CamelCase name (SFTP)
- Add support for active-transfer FTP servers
- How to get proper file permissions on the destination server?
- 'Cannot parse privateKey: Unsupported key format'
- Deploy reloaded no longer working after vscode update to 1.59.0 HOT 26
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-deploy-reloaded.