Skip to content

Commit

Permalink
Merge 4bb01c9 into 82a00bf
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAboutJeff committed Aug 6, 2018
2 parents 82a00bf + 4bb01c9 commit 8426ac5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ Metalsmith.prototype.path = function(){
Metalsmith.prototype.build = unyield(function*(){
var clean = this.clean()
var dest = this.destination()
if (clean) yield rm(path.join(dest, '*'))
if (clean) yield rm(path.join(dest, '*'), { glob: { dot: true } })

var files = yield this.process()
yield this.write(files)
Expand Down
11 changes: 8 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,13 +639,18 @@ describe('Metalsmith', function(){

it('should remove an existing destination directory', function(done){
var m = Metalsmith(fixture('build'))
rm(fixture('build/build'))
var cmd =
'touch test/fixtures/build/build/empty.md' +
' && touch test/fixtures/build/build/.dotfile'
rm(fixture('build/build'), { glob: { dot: true } })
fs.mkdirSync(fixture('build/build'))
exec('touch test/fixtures/build/build/empty.md', function(err){
exec(cmd, function (err) {
if (err) return done(err)
m.build(function(err){
if (err) return done(err)
equal(fixture('build/build'), fixture('build/expected'))
equal(fixture('build/build'), fixture('build/expected'), {
filter: function () { return true }
})
done()
})
})
Expand Down

0 comments on commit 8426ac5

Please sign in to comment.