Comparing version 3.2.3 to 3.3.0
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
The format is based on [Keep a Changelog](http://keepachangelog.com/) | ||
The format is based on [Keep a Changelog](http://keepachangelog.com/) | ||
and this project adheres to [Semantic Versioning](http://semver.org/). | ||
@@ -13,2 +13,6 @@ | ||
## 3.3.0 - 2017-05-10 | ||
### Added | ||
* Importing - Ignore directories option, true by default | ||
## 3.0.0 - 2017-04-28 | ||
@@ -15,0 +19,0 @@ ### Fixed |
@@ -18,2 +18,5 @@ var assert = require('assert') | ||
var indexSpeed = speed() | ||
var ignore = datIgnore(src, opts) | ||
var ignoreDirs = !(opts.ignoreDirs === false) | ||
opts = xtend({ | ||
@@ -25,3 +28,6 @@ watch: false, | ||
// overwrite opts.ignore (original opts.ignore parsed in dat-ignore) | ||
ignore: datIgnore(src, opts) | ||
ignore: function (name, st) { | ||
if (ignoreDirs && st && st.isDirectory()) return true | ||
return ignore(name, st) | ||
} | ||
}) | ||
@@ -28,0 +34,0 @@ debug('importFiles()', opts) |
{ | ||
"name": "dat-node", | ||
"version": "3.2.3", | ||
"version": "3.3.0", | ||
"description": "Build node applications with Dat archives on the file system.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -100,3 +100,3 @@ # dat-node | ||
We'll go through what these are for and a few of the common usages of each element. | ||
We'll go through what these are for and a few of the common usages of each element. | ||
@@ -321,2 +321,3 @@ ### Storage | ||
ignoreHidden: true, // ignore hidden files (if false, .dat will still be ignored) | ||
ignoreDirs: true, // do not import directories (hyperdrive does not need them and it pollutes metadata) | ||
useDatIgnore: true, // ignore entries in the `.datignore` file from import dir target. | ||
@@ -323,0 +324,0 @@ ignore: // (see below for default info) anymatch expression to ignore files |
@@ -85,2 +85,25 @@ var fs = require('fs') | ||
test('importing: ignore dirs option turned off', function (t) { | ||
Dat(fixtures, {temp: true}, function (err, dat) { | ||
t.error(err) | ||
dat.importFiles({ ignoreDirs: false }, function () { | ||
var stream = dat.archive.history() | ||
var hasFolder = false | ||
var hasRoot = false | ||
stream.on('data', function (data) { | ||
if (data.name === '/folder') hasFolder = true | ||
if (data.name === '/') hasRoot = true | ||
}) | ||
stream.on('end', function () { | ||
t.ok(hasFolder, 'folder in metadata') | ||
t.ok(hasRoot, 'root in metadata') | ||
dat.close(function () { | ||
rimraf.sync(path.join(fixtures, '.dat')) | ||
t.end() | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) | ||
test('importing: import with options but no callback', function (t) { | ||
@@ -87,0 +110,0 @@ Dat(fixtures, {temp: true}, function (err, dat) { |
@@ -66,5 +66,5 @@ var fs = require('fs') | ||
t.same(putFiles, 5, 'importer puts') | ||
t.same(archive.version, 5, 'archive version') | ||
t.same(archive.metadata.length, 6, 'entries in metadata') | ||
t.same(putFiles, 3, 'importer puts') | ||
t.same(archive.version, 3, 'archive version') | ||
t.same(archive.metadata.length, 4, 'entries in metadata') | ||
@@ -100,3 +100,3 @@ helpers.verifyFixtures(t, archive, function (err) { | ||
t.same(archive.version, 5, 'archive version still') | ||
t.same(archive.version, 3, 'archive version still') | ||
@@ -103,0 +103,0 @@ var st = stats.get() |
74745
1463
390