Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Commit

Permalink
fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mkloubert committed Apr 13, 2018
1 parent e625c71 commit 2ff5913
Show file tree
Hide file tree
Showing 13 changed files with 334 additions and 129 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

[![Share via Facebook](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Facebook.png)](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&quote=vscode-deploy-reloaded) [![Share via Twitter](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Twitter.png)](https://twitter.com/intent/tweet?source=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&text=vscode-deploy-reloaded:%20https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&via=mjkloubert) [![Share via Google+](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Google+.png)](https://plus.google.com/share?url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded) [![Share via Pinterest](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Pinterest.png)](https://pinterest.com/pin/create/button/?url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&media=https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/demo1.gif&description=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20%27vs-deploy%27%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.) [![Share via Reddit](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Reddit.png)](https://www.reddit.com/submit?url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&title=vscode-deploy-reloaded) [![Share via LinkedIn](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/LinkedIn.png)](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&title=vscode-deploy-reloaded&summary=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20%27vs-deploy%27%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.&source=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded) [![Share via Wordpress](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Wordpress.png)](https://wordpress.com/press-this.php?u=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&quote=vscode-deploy-reloaded&s=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20%27vs-deploy%27%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.&i=https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/demo1.gif) [![Share via Email](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Email.png)](mailto:?subject=vscode-deploy-reloaded&body=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20'vs-deploy'%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.:%20https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded)

## 0.71.0 (April 13th, 2018; create directories recursively)

* fixed and improved creation of directories recursively in [sftp targets](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/target_sftp) and [ftp targets](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/target_ftp)
* fixed cancellation of operation, when using things like [azureblob](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/target_azureblob), [dropbox](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/target_dropbox), [ftp](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/target_ftp), [s3bucket](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/target_s3bucket), [sftp](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/target_sftp) and/or [slack](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/target_slack) targets
* improved displaying file paths in output when running a deploy operation
* added `supportsDeepDirectoryCreation` settings for [sftp](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/target_sftp) and [ftp](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/target_ftp) target, which indicate if a server supports creating directories recursively or not ... if so, you should set this to `(true)`, which can help increasing speed, when uploading files
* updated the following [npm](https://www.npmjs.com/) modules:
* [aws-sdk](https://www.npmjs.com/package/aws-sdk) `2.224.1`
* [uglify-js](https://www.npmjs.com/package/uglify-js) `3.3.21`
* [vscode-helpers](https://www.npmjs.com/package/vscode-helpers) `1.10.0`

## 0.70.0 (April 11th, 2018; auto deployment)

* added `pauseFilesFor` setting for [packages](https://github.com/mkloubert/vscode-deploy-reloaded/wiki#packages-), which can define a time, in milliseconds, to wait, before an auto operation can be done for a file again
Expand Down
64 changes: 32 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-deploy-reloaded",
"displayName": "Deploy (Reloaded)",
"description": "Deploys files of a workspace to a destination.",
"version": "0.70.0",
"version": "0.71.0",
"publisher": "mkloubert",
"engines": {
"vscode": "^1.22.0"
Expand Down Expand Up @@ -71764,7 +71764,7 @@
"@types/moment-timezone": "^0.5.4",
"@types/mssql": "^4.0.7",
"@types/mysql": "^2.15.4",
"@types/node": "^7.0.59",
"@types/node": "^7.0.60",
"@types/node-emoji": "^1.8.0",
"@types/nodemailer": "^4.6.0",
"@types/public-ip": "^2.3.0",
Expand Down Expand Up @@ -71798,7 +71798,7 @@
"readmeFilename": "README.md",
"dependencies": {
"@slack/client": "^3.16.0",
"aws-sdk": "^2.222.1",
"aws-sdk": "^2.224.1",
"azure-storage": "^2.8.1",
"coffeescript": "^2.2.4",
"compare-versions": "^3.1.0",
Expand Down Expand Up @@ -71838,8 +71838,8 @@
"sanitize-filename": "^1.6.1",
"ssh2-sftp-client": "^2.1.1",
"tmp": "0.0.33",
"uglify-js": "^3.3.20",
"uglify-js": "^3.3.21",
"uuid": "^3.2.1",
"vscode-helpers": "^1.8.0"
"vscode-helpers": "^1.10.0"
}
}
53 changes: 37 additions & 16 deletions src/clients/ftp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ export interface FTPConnectionOptions {
* The TCP port.
*/
readonly port?: number;
/**
* Server supports deep directory creation or not.
*/
readonly supportsDeepDirectoryCreation?: boolean;
/**
* Is invoked AFTER an upload process.
*/
Expand Down Expand Up @@ -269,7 +273,7 @@ export abstract class FTPClientBase extends deploy_clients.AsyncFileListBase {
try {
await this.cwd(dir);
}
catch (e) {
catch {
// no, try to create
await this.mkdir(dir);
}
Expand All @@ -280,6 +284,25 @@ export abstract class FTPClientBase extends deploy_clients.AsyncFileListBase {
return true;
}

/**
* Creates a parent directory if it does not exist.
*
* @param {string} dir The child of the directory to check.
*
* @return {Promise<boolean>} The promise that indicates if parent directory has been created or not.
*/
protected async createParentDirectoryIfNeeded(dir: string): Promise<boolean> {
dir = toFTPPath(dir);
const PARENT_DIR = toFTPPath(deploy_helpers.from( dir.split('/') )
.skipLast()
.joinToString('/'));
if (PARENT_DIR === dir) {
return false;
}

return this.createDirectoryIfNeeded(PARENT_DIR);
}

/**
* Changes the current directory.
*
Expand Down Expand Up @@ -974,17 +997,16 @@ class FtpClient extends FTPClientBase {

dir = toFTPPath(dir);

return new Promise<void>((resolve, reject) => {
return new Promise<void>(async (resolve, reject) => {
const COMPLETED = deploy_helpers.createCompletedAction(resolve, reject);

try {
if (!deploy_helpers.toBooleanSafe(ME.options.supportsDeepDirectoryCreation)) {
await ME.createParentDirectoryIfNeeded(dir);
}

ME.connection.mkdir(dir, true, (err) => {
if (err) {
COMPLETED(err);
}
else {
COMPLETED(null);
}
COMPLETED(err);
});
}
catch (e) {
Expand Down Expand Up @@ -1397,17 +1419,16 @@ class JsFTPClient extends FTPClientBase {

dir = toFTPPath(dir);

return new Promise<void>((resolve, reject) => {
return new Promise<void>(async (resolve, reject) => {
const COMPLETED = deploy_helpers.createCompletedAction(resolve, reject);

try {
ME.connection.raw('mkd', dir, (err) => {
if (err) {
COMPLETED(err);
}
else {
COMPLETED(null);
}
if (!deploy_helpers.toBooleanSafe(ME.options.supportsDeepDirectoryCreation)) {
await ME.createParentDirectoryIfNeeded(dir);
}

ME.connection.raw('mkd', [ dir ], (err) => {
COMPLETED(err);
});
}
catch (e) {
Expand Down
Loading

0 comments on commit 2ff5913

Please sign in to comment.