tree-sync
Advanced tools
Comparing version 2.0.0 to 2.1.0
24
index.js
@@ -35,8 +35,8 @@ 'use strict'; | ||
let input = FSTree.fromEntries(walkSync.entries(this._input, this._walkSyncOpts)); | ||
let output = FSTree.fromEntries(walkSync.entries(this._output, this._walkSyncOpts)); | ||
const input = FSTree.fromEntries(walkSync.entries(this._input, this._walkSyncOpts)); | ||
const output = FSTree.fromEntries(walkSync.entries(this._output, this._walkSyncOpts)); | ||
debug('walked %s %dms and %s %dms', this._input, input.size, this._output, output.size); | ||
let isFirstSync = !this._hasSynced; | ||
const isFirstSync = !this._hasSynced; | ||
let operations = output.calculatePatch(input).filter(operation => { | ||
@@ -50,3 +50,3 @@ if (operation[0] === 'change') { | ||
let inputOperations = this._lastInput.calculatePatch(input).filter(operation => { | ||
const inputOperations = this._lastInput.calculatePatch(input).filter(operation => { | ||
return operation[0] === 'change'; | ||
@@ -61,3 +61,3 @@ }); | ||
for (let patch of operations) { | ||
for (const patch of operations) { | ||
const operation = patch[0]; | ||
@@ -67,4 +67,4 @@ const pathname = patch[1]; | ||
const inputFullpath = this._input + '/' + pathname; | ||
const outputFullpath = this._output + '/' + pathname; | ||
const inputFullPath = this._input + '/' + pathname; | ||
const outputFullPath = this._output + '/' + pathname; | ||
@@ -74,4 +74,4 @@ switch(operation) { | ||
case 'change' : | ||
fs.writeFileSync(outputFullpath, fs.readFileSync(inputFullpath), { mode: entry.mode }); | ||
fs.utimesSync(outputFullpath, new Date(), entry.mtime / 1e3); | ||
fs.writeFileSync(outputFullPath, fs.readFileSync(inputFullPath), { mode: entry.mode }); | ||
fs.utimesSync(outputFullPath, new Date(), entry.mtime / 1e3); | ||
break; | ||
@@ -81,3 +81,3 @@ | ||
try { | ||
fs.mkdirSync(outputFullpath); | ||
fs.mkdirSync(outputFullPath); | ||
} catch(e) { | ||
@@ -91,3 +91,3 @@ if (e && e.code === 'EEXIST') { /* do nothing */ } | ||
try { | ||
fs.unlinkSync(outputFullpath); | ||
fs.unlinkSync(outputFullPath); | ||
} catch(e) { | ||
@@ -100,3 +100,3 @@ if (e && e.code === 'ENOENT') { /* do nothing */ } | ||
case 'rmdir': | ||
fs.rmdirSync(outputFullpath); | ||
fs.rmdirSync(outputFullPath); | ||
break; | ||
@@ -103,0 +103,0 @@ |
{ | ||
"name": "tree-sync", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "", | ||
@@ -28,5 +28,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"debug": "^2.2.0", | ||
"fs-tree-diff": "^0.5.6", | ||
"mkdirp": "^0.5.1", | ||
"debug": "^4.1.1", | ||
"fs-tree-diff": "^2.0.1", | ||
"mkdirp": "^0.5.5", | ||
"quick-temp": "^0.1.5", | ||
@@ -36,7 +36,11 @@ "walk-sync": "^0.3.3" | ||
"devDependencies": { | ||
"chai": "^3.4.1", | ||
"glob": "^7.0.0", | ||
"mocha": "^2.3.4", | ||
"mocha-eslint": "^5.0.0" | ||
"chai": "^4.2.0", | ||
"glob": "^7.1.6", | ||
"mocha": "^2.5.3", | ||
"mocha-eslint": "^6.0.0" | ||
}, | ||
"volta": { | ||
"node": "8.17.0", | ||
"yarn": "1.22.4" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# TreeSync [![Build Status](https://travis-ci.org/stefanpenner/tree-sync.svg?branch=master)](https://travis-ci.org/stefanpenner/tree-sync) [![Build status](https://ci.appveyor.com/api/projects/status/7136sbfmybx6q7w2?svg=true)](https://ci.appveyor.com/project/embercli/tree-sync) | ||
# TreeSync ![CI](https://github.com/stefanpenner/tree-sync/workflows/CI/badge.svg) | ||
@@ -9,3 +9,3 @@ A module for repeated efficient synchronizing two directories. | ||
var tree = new TreeSync('input', 'output'); | ||
const tree = new TreeSync('input', 'output'); | ||
tree.sync(); | ||
@@ -34,3 +34,3 @@ // output is now contains copies of everything that is in input | ||
var tree = new TreeSync('input', 'output', { | ||
const tree = new TreeSync('input', 'output', { | ||
ignore: ['**/b'] | ||
@@ -53,3 +53,3 @@ }); | ||
var tree = new TreeSync('input', 'output', { | ||
const tree = new TreeSync('input', 'output', { | ||
globs: ['foo', 'foo/bar.js'] | ||
@@ -62,2 +62,2 @@ }); | ||
// path is also included, or you'll get an error when tree-sync tries to copy the file over. | ||
``` | ||
``` |
60
7645
+ Added@types/symlink-or-copy@1.2.2(transitive)
+ Addeddebug@4.3.5(transitive)
+ Addedfs-tree-diff@2.0.1(transitive)
+ Addedms@2.1.2(transitive)
- Removedfs-tree-diff@0.5.9(transitive)
Updateddebug@^4.1.1
Updatedfs-tree-diff@^2.0.1
Updatedmkdirp@^0.5.5