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.6.2 to 0.7.0

.travis.yml

2

complexity.json

@@ -7,3 +7,3 @@ {

"cyclomatic": 3,
"halstead": 10,
"halstead": 12,
"maintainability": 90

@@ -10,0 +10,0 @@ }

@@ -1,2 +0,2 @@

/*global module:false*/
/* global module:false */
module.exports = function (grunt) {

@@ -37,3 +37,2 @@ require('time-grunt')(grunt);

grunt.loadTasks('tasks');
};
{
"name": "grunt-sync",
"description": "Task to synchronize two directories. Similar to grunt-copy but updates only files that have been changed.",
"version": "0.6.2",
"version": "0.7.0",
"homepage": "https://github.com/tomusdrw/grunt-sync.git",

@@ -18,8 +18,3 @@ "author": {

},
"licences": [
{
"type": "MIT",
"url": "http://opensource.org/licenses/MIT"
}
],
"license": "MIT",
"main": "Gruntfile.js",

@@ -32,19 +27,21 @@ "readmeFilename": "readme.md",

"lint": "semistandard",
"test": "mocha"
"test": "grunt simplemocha",
"grunt": "grunt"
},
"dependencies": {
"glob": "^7.0.5",
"lodash": "^4.14.2",
"md5-file": "^2.0.3",
"glob": "7.0.5",
"lodash": "4.17.4",
"md5-file": "2.0.3",
"promised-io": "0.3.5"
},
"devDependencies": {
"chai": "1.4.2",
"chai": "4.1.2",
"grunt": "0.4.x",
"grunt-complexity": "^0.1.51",
"grunt-contrib-jshint": "0.1.x",
"grunt-simple-mocha": "0.3.x",
"mocha": "~1.8.1",
"semistandard": "^6.1.2",
"time-grunt": "^0.4.0"
"grunt-cli": "1.2.0",
"grunt-complexity": "0.1.71",
"grunt-contrib-jshint": "0.1.1",
"grunt-simple-mocha": "0.4.1",
"mocha": "3.5.3",
"semistandard": "11.0.0",
"time-grunt": "1.4.0"
},

@@ -51,0 +48,0 @@ "keywords": [

@@ -7,2 +7,7 @@ # Grunt-sync

## Deprecation notice
This package is not actively developed any more.
## Usage

@@ -18,18 +23,16 @@

grunt.initConfig({
sync: {
main: {
files: [{
cwd: 'src',
src: [
'**', /* Include everything */
'!**/*.txt' /* but exclude txt files */
],
dest: 'bin',
}],
pretend: true, // Don't do any IO. Before you run the task with `updateAndDelete` PLEASE MAKE SURE it doesn't remove too much.
verbose: true // Display log messages when copying files
}
}
sync: {
main: {
files: [{
cwd: 'src',
src: [
'**', /* Include everything */
'!**/*.txt' /* but exclude txt files */
],
dest: 'bin',
}],
pretend: true, // Don't do any IO. Before you run the task with `updateAndDelete` PLEASE MAKE SURE it doesn't remove too much.
verbose: true // Display log messages when copying files
}
}
});

@@ -72,7 +75,10 @@

1. [1] Overwrite destination if modification time is newer or destination is directory not file.
1. [2nd phase] Get a list of the files in `dest` and calculate difference between destination and source.
1. [2] Delete all files (and directories) that have been found in `dest` but are not found `src` excluding ignored files.
1. [2nd phase]* Get a list of the files in `dest` and calculate difference between destination and source.
1. [2]* Delete all files (and directories) that have been found in `dest` but are not found `src` excluding ignored files.
*second phase only occurs if updateAndDelete is set to true (whitch is set to false by default)
## Changelog
* 0.7.0 - Pass down grunt-copy options
* 0.6.2 - Bumped major versions of important dependencies
* 0.5.0 - Synchronous removal of directories (to avoid race conditions)

@@ -79,0 +85,0 @@ * 0.4.0 - Adding better patterns support for `ignoreInDest`

@@ -5,7 +5,5 @@ var fs = require('promised-io/fs');

var glob = require('glob');
var util = require('util');
var _ = require('lodash');
module.exports = function (grunt) {
grunt.registerMultiTask('sync', 'Synchronize content of two directories.', function () {

@@ -20,2 +18,13 @@ var done = this.async();

var expandedPaths = {};
var options = this.options({
encoding: grunt.file.defaultEncoding,
// processContent/processContentExclude deprecated renamed to process/noProcess
processContent: false,
processContentExclude: []
});
var copyOptions = {
encoding: options.encoding,
process: options.process || options.processContent,
noProcess: options.noProcess || options.processContentExclude
};

@@ -54,5 +63,4 @@ var getExpandedPaths = function (origDest) {

// Process pair
return processPair(justPretend, failOnError, logger, comparatorFactory, path.join(cwd, src), dest);
return processPair(justPretend, failOnError, logger, comparatorFactory, path.join(cwd, src), dest, copyOptions);
}));
}, this)).then(function () {

@@ -87,3 +95,3 @@ if (updateOnly) {

if (!util.isArray(ignore)) {
if (!Array.isArray(ignore)) {
ignore = [ignore];

@@ -144,4 +152,3 @@ }

function processPair (justPretend, failOnError, logger, comparatorFactory, src, dest) {
function processPair (justPretend, failOnError, logger, comparatorFactory, src, dest, copyOptions) {
// stat destination file

@@ -170,3 +177,3 @@ return promise.all([fs.stat(src), fs.stat(dest)]).then(function (result) {

doOrPretend(function () {
tryCopy(src, dest);
tryCopy(src, dest, copyOptions);
});

@@ -191,5 +198,5 @@ }

function tryCopy (src, dest) {
function tryCopy (src, dest, copyOptions) {
try {
grunt.file.copy(src, dest);
grunt.file.copy(src, dest, copyOptions);
} catch (e) {

@@ -211,3 +218,3 @@ warnOrFail('Cannot copy to ' + dest.red);

grunt.file['delete'](dest);
grunt.file.copy(src, dest);
grunt.file.copy(src, dest, copyOptions);
} catch (e) {

@@ -219,3 +226,2 @@ warnOrFail('Cannot overwrite ' + dest.red);

function overwriteOrUpdate (isSrcDirectory, typeDiffers, haventChangedFn) {
// If types differ we have to overwrite destination.

@@ -226,3 +232,3 @@ if (typeDiffers) {

doOrPretend(function () {
overwriteDest(src, dest);
overwriteDest(src, dest, copyOptions);
});

@@ -240,3 +246,3 @@ return;

// and just update destination
tryCopy(src, dest);
tryCopy(src, dest, copyOptions);
});

@@ -247,3 +253,2 @@ }

function removePaths (justPretend, logger, paths) {
return promise.all(paths.map(function (file) {

@@ -319,25 +324,23 @@ return fs.stat(file).then(function (stat) {

if (!paths.map) {
return convertPathToSystemSpecific (paths);
return convertPathToSystemSpecific(paths);
}
return paths.map(function (filePath) {
return convertPathToSystemSpecific (filePath);
return convertPathToSystemSpecific(filePath);
});
}
function addDirectoriesPaths (arr, dest) {
var f = dest.split(path.sep);
var i, p;
p = f[0];
function addDirectoriesPaths (destinations, dest) {
var parts = dest.split(path.sep);
var partialPath = parts[0];
for (i = 1; i < f.length - 1; ++i) {
p += path.sep + f[i];
if (arr.indexOf(p) === -1) {
arr.push(p);
parts.slice(1).forEach(function (part) {
partialPath += path.sep + part;
if (destinations.indexOf(partialPath) === -1) {
destinations.push(partialPath);
}
}
});
}
function getComparatorFactory(compareUsing, logger) {
function getComparatorFactory (compareUsing, logger) {
var md5;

@@ -356,4 +359,4 @@

function createMTimeComparator(src, srcStat, dest, destStat) {
return function() {
function createMTimeComparator (src, srcStat, dest, destStat) {
return function () {
return srcStat.mtime.getTime() <= destStat.mtime.getTime();

@@ -363,9 +366,8 @@ };

function createMd5Comparator(src, srcStat, dest, destStat) {
return function() {
return md5(src) == md5(dest);
function createMd5Comparator (src, srcStat, dest, destStat) {
return function () {
return md5(src) === md5(dest);
};
}
}
};
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