Huge News!Announcing our $40M Series B led by Abstract Ventures.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.0.7 to 0.0.8

2

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.0.7",
"version": "0.0.8",
"homepage": "https://github.com/tomusdrw/grunt-sync.git",

@@ -6,0 +6,0 @@ "author": {

@@ -7,4 +7,5 @@ {

"cwd": "bin/from"
}]
}],
"verbose": true
}
}
}

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

var tryCopy = function(src, dest) {
try {
grunt.file.copy(src, dest);
} catch (e) {
grunt.log.warn('Cannot copy to ' + dest.red);
}
};
var tryMkdir = function(dest) {
try {
grunt.file.mkdir(dest);
} catch (e) {
grunt.log.warn('Cannot create directory ' + dest.red);
}
};
var overwriteDest = function(options, src, dest) {
grunt[options.logMethod].writeln('Overwriting ' + dest.cyan + 'because type differs.');
grunt.file['delete'](dest);
grunt.file.copy(src, dest);
try {
grunt.file['delete'](dest);
grunt.file.copy(src, dest);
} catch(e) {
grunt.log.warn('Cannot overwrite ' + dest.red);
}
};
var updateIfNeeded = function(options, src, dest, srcStat, destStat) {

@@ -18,3 +39,3 @@ // we can now compare modification dates of files

// and just update destination
grunt.file.copy(src, dest);
tryCopy(src, dest);
}

@@ -42,6 +63,6 @@ };

grunt[options.logMethod].writeln('Creating ' + dest.cyan);
grunt.file.mkdir(dest);
tryMkdir(dest);
} else {
grunt[options.logMethod].writeln('Copying ' + src.cyan + ' -> ' + dest.cyan);
grunt.file.copy(src, dest);
tryCopy(src, dest);
}

@@ -48,0 +69,0 @@ });

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