New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

grunt-sync

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-sync - npm Package Compare versions

Comparing version 0.7.0 to 0.8.0

9

package.json
{
"name": "grunt-sync",
"description": "Task to synchronize two directories. Similar to grunt-copy but updates only files that have been changed.",
"version": "0.7.0",
"version": "0.8.0",
"homepage": "https://github.com/tomusdrw/grunt-sync.git",

@@ -22,3 +22,3 @@ "author": {

"engines": {
"node": ">=0.8.0"
"node": ">=4.0.0"
},

@@ -31,6 +31,5 @@ "scripts": {

"dependencies": {
"fs-extra": "6.0.1",
"glob": "7.0.5",
"lodash": "4.17.4",
"md5-file": "2.0.3",
"promised-io": "0.3.5"
"md5-file": "2.0.3"
},

@@ -37,0 +36,0 @@ "devDependencies": {

@@ -1,6 +0,4 @@

var fs = require('promised-io/fs');
var promise = require('promised-io/promise');
var fs = require('fs-extra');
var path = require('path');
var glob = require('glob');
var _ = require('lodash');

@@ -38,3 +36,3 @@ module.exports = function (grunt) {

promise.all(this.files.map(function (fileDef) {
Promise.all(this.files.map(function (fileDef) {
var isCompactForm = this.data.src && this.data.dest;

@@ -47,3 +45,3 @@ var cwd = fileDef.cwd ? fileDef.cwd : '.';

return promise.all(fileDef.src.map(function (src) {
return Promise.all(fileDef.src.map(function (src) {
var dest;

@@ -71,23 +69,21 @@ // when using expanded mapping dest is the destination file

var getDestPaths = function (dest, pattern) {
var defer = new promise.Deferred();
glob(pattern, {
cwd: dest,
dot: true
}, function (err, result) {
if (err) {
defer.reject(err);
return;
}
defer.resolve(result.map(function (filePath) {
return path.join(dest, filePath);
}));
return new Promise(function (resolve, reject) {
glob(pattern, {
cwd: dest,
dot: true
}, function (err, result) {
if (err) {
reject(err);
return;
}
resolve(result.map(function (filePath) {
return path.join(dest, filePath);
}));
});
});
return defer.promise;
};
var getIgnoredPaths = function (dest, ignore) {
var defer = new promise.Deferred();
if (!ignore) {
defer.resolve([]);
return defer.promise;
return Promise.resolve([]);
}

@@ -99,3 +95,3 @@

promise.all(ignore.map(function (pattern) {
return Promise.all(ignore.map(function (pattern) {
return getDestPaths(dest, pattern);

@@ -106,12 +102,8 @@ })).then(function (results) {

}, []);
defer.resolve(flat);
}, function (err) {
defer.reject(err);
return flat;
});
return defer.promise;
};
// Second pass
return promise.all(Object.keys(expandedPaths).map(function (dest) {
return Promise.all(Object.keys(expandedPaths).map(function (dest) {
var processedDestinations = convertPathsToSystemSpecific(expandedPaths[dest]);

@@ -125,3 +117,3 @@

return promise.all([destPaths, ignoredPaths, processedDestinations]);
return Promise.all([destPaths, ignoredPaths, processedDestinations]);
})).then(function (result) {

@@ -139,6 +131,6 @@ var files = result.map(function (destAndIgnored) {

// TODO Find some faster way to ensure uniqueness here
var paths = _.uniq(files[0]);
var ignoredPaths = _.uniq(files[1]);
var processedDestinations = _.uniq(files[2]);
// Ensure uniqueness
var paths = files[0].filter(filterOutDuplicates);
var ignoredPaths = files[1].filter(filterOutDuplicates);
var processedDestinations = files[2].filter(filterOutDuplicates);

@@ -157,3 +149,3 @@ // Calculate diff

// stat destination file
return promise.all([fs.stat(src), fs.stat(dest)]).then(function (result) {
return Promise.all([fs.stat(src), fs.stat(dest)]).then(function (result) {
var srcStat = result[0];

@@ -250,3 +242,3 @@ var destStat = result[1];

function removePaths (justPretend, logger, paths) {
return promise.all(paths.map(function (file) {
return Promise.all(paths.map(function (file) {
return fs.stat(file).then(function (stat) {

@@ -262,3 +254,3 @@ return {

// First we need to process files
return promise.all(paths.files.map(function (filePath) {
return Promise.all(paths.files.map(function (filePath) {
logger.writeln('Unlinking ' + filePath.cyan + ' because it was removed from src.');

@@ -301,2 +293,6 @@

function filterOutDuplicates (val, index, array) {
return array.indexOf(val) === index;
}
function fastArrayDiff (from, diff) {

@@ -303,0 +299,0 @@ diff.map(function (v) {

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