Comparing version 1.0.2 to 1.1.0
16
index.js
@@ -26,3 +26,3 @@ 'use strict'; | ||
var input = FSTree.fromEntries(walkSync.entries(this._input)) | ||
var input = FSTree.fromEntries(walkSync.entries(this._input)); | ||
var output = FSTree.fromEntries(walkSync.entries(this._output)); | ||
@@ -64,5 +64,15 @@ | ||
case 'mkdir' : | ||
return fs.mkdirSync(outputFullpath); | ||
try { | ||
return fs.mkdirSync(outputFullpath); | ||
} catch(e) { | ||
if (e && e.code === 'EXISTS') { /* do nothing */ } | ||
else { throw e; } | ||
} | ||
case 'unlink': | ||
return fs.unlinkSync(outputFullpath); | ||
try { | ||
return fs.unlinkSync(outputFullpath); | ||
} catch(e) { | ||
if (e && e.code === 'ENOENT') { /* do nothing */ } | ||
else { throw e; } | ||
} | ||
case 'rmdir': | ||
@@ -69,0 +79,0 @@ return fs.rmdir(outputFullpath); |
{ | ||
"name": "tree-sync", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -27,4 +27,6 @@ "main": "index.js", | ||
"chai": "^3.4.1", | ||
"mocha": "^2.3.4" | ||
"glob": "^7.0.0", | ||
"mocha": "^2.3.4", | ||
"mocha-eslint": "^1.0.0" | ||
} | ||
} |
@@ -32,6 +32,6 @@ var expect = require('chai').expect; | ||
expect(walkSync(tmp)).to.deep.equal([ | ||
'one/', | ||
'one/bar/', | ||
'one/bar/bar.txt', | ||
'one/foo.txt', | ||
'one/', | ||
'one/bar/', | ||
'one/bar/bar.txt', | ||
'one/foo.txt' | ||
]); | ||
@@ -41,2 +41,19 @@ }); | ||
describe('existing empty directory -> populated', function() { | ||
it('file content', function() { | ||
expect(walkSync(tmp)).to.deep.equal([]); | ||
fs.mkdirSync(tmp + '/one'); | ||
treeSync.sync(); | ||
expect(walkSync(tmp)).to.deep.equal([ | ||
'one/', | ||
'one/bar/', | ||
'one/bar/bar.txt', | ||
'one/foo.txt' | ||
]); | ||
}); | ||
}); | ||
describe('input(same) -> input(same)', function() { | ||
@@ -43,0 +60,0 @@ beforeEach(function() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
9208
9
249
0
4