Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
grunt-sync
Advanced tools
Task to synchronize two directories. Similar to grunt-copy but updates only files that have been changed.
A grunt task to keep directories in sync. It is very similar to grunt-contrib-copy but tries to copy only those files that has actually changed.
npm install grunt-sync --save
Within your grunt file:
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
}
}
});
grunt.loadNpmTasks('grunt-sync');
grunt.registerTask('default', 'sync');
sync: {
main: {
files: [
{src: ['path/**'], dest: 'dest/'}, // includes files in path and its subdirs
{cwd: 'path/', src: ['**/*.js', '**/*.css'], dest: 'dest/'}, // makes all src relative to cwd
],
verbose: true, // Default: false
pretend: true, // Don't do any disk operations - just write log. Default: false
failOnError: true, // Fail the task when copying is not possible. Default: false
ignoreInDest: "**/*.js", // Never remove js files from destination. Default: none
updateAndDelete: true // Remove all files from dest that are not found in src. Default: false
}
}
npm install grunt-sync --save
In the first phase the plugin compares modification times of files in src
and dest
. It only copies files with newer modification time. Second phase deletes files that exists in dest
but have not been found in src
.
Details:
src
.dest
and calculate difference between files in destination and source files.dest
but are not found src
excluding ignored files.failOnError
optionupdateAndDelete
.updateAndDelete
when source patterns matches only files.updateAndDelete
option to remove any files from destination.src
are deleted from dest
(unless you specify updateOnly
)In version 0.2 you have to explicitly specify that you want the plugin to remove files from destination. See updateAndDelete
option and run with pretend:true
first to make sure that it doesn't remove any crucial files. You can tune what files should be left untouched with ignoreInDest
property.
If you have updateOnly:true
in your 0.1 config you can remove this option. For those who used updateOnly:false
you have to include updateAndDelete:true
in 0.2 config to keep the same behavior.
grunt-contrib-watch
- update only changed files instead of scanning everything.updateAndDelete
in more elegant way (maybe use patterns from source?)FAQs
Task to synchronize two directories. Similar to grunt-copy but updates only files that have been changed.
The npm package grunt-sync receives a total of 23,652 weekly downloads. As such, grunt-sync popularity was classified as popular.
We found that grunt-sync demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.