Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ftp-deploy

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ftp-deploy - npm Package Compare versions

Comparing version 2.4.5 to 2.4.6

9

package.json
{
"name": "ftp-deploy",
"version": "2.4.5",
"version": "2.4.6",
"author": "Simon Hampton",

@@ -12,3 +12,2 @@ "description": "Ftp a folder from your local disk to an ftp destination",

"dependencies": {
"bluebird": "^3.7.2",
"minimatch": "9.0.0",

@@ -52,2 +51,6 @@ "promise-ftp": "^1.3.5",

"url": "https://github.com/keyle"
},
{
"name": "cyrdam",
"url": "https://github.com/cyrdam"
}

@@ -58,2 +61,2 @@ ],

}
}
}

@@ -6,3 +6,2 @@ "use strict";

const events = require("events");
const Promise = require("bluebird");
const fs = require("fs");

@@ -36,3 +35,3 @@

let keys = Object.keys(filemap);
return Promise.mapSeries(keys, (key) => {
return lib.mapSeries(keys, (key) => {
// console.log("Processing", key, filemap[key]);

@@ -56,3 +55,3 @@ return this.makeAndUpload(remoteDir, key, filemap[key]);

// console.log("newDirectory", newDirectory);
return Promise.mapSeries(fnames, (fname) => {
return lib.mapSeries(fnames, (fname) => {
let tmpFileName = upath.join(config.localRoot, relDir, fname);

@@ -59,0 +58,0 @@ let tmp = fs.readFileSync(tmpFileName);

"use strict";
// Mocha tests. https://mochajs.org/#working-with-promises
const path = require("path");
const path = require("upath");
const fs = require("fs");
const utils = require("util");
// var assert = require("assert");
const statP = utils.promisify(fs.stat);

@@ -14,3 +12,2 @@

const FtpDeploy = require("./ftp-deploy");
const { assert } = require("console");

@@ -71,3 +68,3 @@ const config = {

// Will reject if file does not exist
return statP(remoteDir + "/test-inside-root.txt");
return statP(path.join(remoteDir, "test-inside-root.txt"));
});

@@ -84,5 +81,5 @@ });

// Will reject if file does not exist
return statP(remoteDir + "/.testfile");
return statP(path.join(remoteDir, ".testfile"));
});
});
});
const fs = require("fs");
const path = require("path");
const path = require("upath");
const util = require("util");
const Promise = require("bluebird");

@@ -125,6 +124,6 @@ const read = require("read");

// delete sub-directories and then all files
return Promise.mapSeries(dirNames, (dirName) => {
return mapSeries(dirNames, (dirName) => {
// deletes everything in sub-directory, and then itself
return deleteDir(ftp, dirName).then(() => ftp.rmdir(dirName));
}).then(() => Promise.mapSeries(fnames, (fname) => ftp.delete(fname)));
}).then(() => mapSeries(fnames, (fname) => ftp.delete(fname)));
});

@@ -146,2 +145,29 @@ }

/**
* Applies the mapper function to each item in the array in series.
* @param {Array} array - The array to map over.
* @param {Function} mapper - The mapping function.
* @returns {Promise<Array>} A promise that resolves with the new array.
*/
function mapSeries(array, mapper) {
// Initialize a resolved Promise
let result = Promise.resolve();
// Empty array to store the results
const output = [];
array.forEach((item, index) => {
// Chain a new Promise to the result
result = result.then(() => {
// Apply the mapper function to the current item
return mapper(item, index, array)
.then(res => {
output.push(res);
});
});
});
// Return a Promise that resolves with the output array
return result.then(() => output);
}
module.exports = {

@@ -155,2 +181,3 @@ checkIncludes: checkIncludes,

deleteDir: deleteDir,
mapSeries: mapSeries,
};
"use strict";
const path = require("path");
const path = require("upath");
var assert = require("assert");

@@ -8,3 +8,3 @@

const lib = require("../src/lib");
const lib = require("./lib");

@@ -85,3 +85,3 @@ describe("canIncludePath", () => {

let exp2 = Object.assign(exp, {
"folderA/folderB/FolderC": ["test-inside-c.txt"],
[path.join("folderA/folderB/FolderC")]: ["test-inside-c.txt"],
});

@@ -108,4 +108,4 @@ assert.deepEqual(

folderA: ["test-inside-a.txt"],
"folderA/folderB": ["test-inside-b.txt"],
"folderA/folderB/emptyC/folderD": [
[path.join("folderA/folderB")]: ["test-inside-b.txt"],
[path.join("folderA/folderB/emptyC/folderD")]: [
"test-inside-d-1.txt",

@@ -112,0 +112,0 @@ "test-inside-d-2.txt",

const FtpSrv = require("ftp-srv");
const path = require("upath");
// Using non-standard port
const port = 2121;
const homeDir =
require("os").homedir() + "/code/projects/ftp-deploy/test/remote";
// console.log("serving", homeDir);
const homeDir = path.join(__dirname, "remote");

@@ -9,0 +8,0 @@ const options = {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc