One-way synchronization of directories with glob.
$ npm i -S syncy
const syncy = require('syncy');
syncy(['src/**', '!src/folder/**'], 'dest')
.then(() => {
console.log('Done!');
})
.catch(console.error);
syncy(glob, dest, [options])
Type: array|string
Default: null
Glob pattern. Files to copy.
Type: string
Default: null
Destination directory.
Type: object
Default: see options section
Module settings.
{
// Display log messages when copying and removing files
verbose: false,
// The base path to be removed from the path. Default: none
base: 'base_path'
// Remove all files from dest that are not found in src. Default: false
updateAndDelete: true,
// Never remove js files from destination. Default: false
ignoreInDest: '**/*.js'
}
const gulp = require('gulp');
const syncy = require('syncy');
gulp.task('sync', (done) => {
syncy(['node_modules/gulp/**'], 'dest')
.then(() => {
done();
})
.catch((err) => {
done(err);
});
});
const syncy = require('syncy');
module.exports = (grunt) => {
// Default task(s).
grunt.registerTask('default', function() {
const done = this.async();
syncy(['node_modules/grunt/**'], 'dest')
.then(() => {
done();
})
.catch((err) => {
done(err);
});
});
};
Tech specs:
- Intel Core i7-3610QM
- RAM 8GB
- SSD (555MB/S, 530MB/S)
- Windows 10
- Node.js v6.2.1
Files: AngularJS from release v1.5.6.
Note: UpdateAndDelete
option is enabled in the grunt-sync, because other plugins have this option initially.
Description of tests | syncy | gulp-directory-sync | grunt-sync |
---|---|---|---|
First run | 2,7s | 6,0s | 7,4s |
Re-run | 0,7s | 0,9s | 0,8s |
Changed single file | 0,7s | 0,9s | 0,8s |
Delete images from destination directories and run |
0,9s | 1,2s | 1,4s |
Delete images from the source directory and run |
1,1s | 0,7s | 1,3s |
See the Releases section of our GitHub project for changelogs for each release version.
This software is released under the terms of the MIT license.