Skip to content

Commit

Permalink
Fix zip nondeterminism
Browse files Browse the repository at this point in the history
  • Loading branch information
mappum committed Feb 19, 2018
1 parent ec76822 commit 9adfd98
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tasks/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,18 @@ function zipFolder (inDir, outDir, version) {
return reject(err)
}
files
.filter(file => !fs.lstatSync(file).isDirectory())
.forEach(file => {
zip.file(path.relative(inDir, file), fs.readFileSync(file), {date: new Date('1987-08-16')}) // make the zip deterministic by changing all file times
// make the zip deterministic by changing all file times
if (fs.lstatSync(file).isDirectory()) {
zip.file(path.relative(inDir, file), null, {
dir: true,
date: new Date('1993-06-16')
})
} else {
zip.file(path.relative(inDir, file), fs.readFileSync(file), {
date: new Date('1987-08-16')
})
}
})
resolve()
})
Expand Down

0 comments on commit 9adfd98

Please sign in to comment.