1const isPackageBin = require('./is-package-bin.js') 2 3const tarCreateOptions = manifest => ({ 4 cwd: manifest._resolved, 5 prefix: 'package/', 6 portable: true, 7 gzip: { 8 // forcing the level to 9 seems to avoid some 9 // platform specific optimizations that cause 10 // integrity mismatch errors due to differing 11 // end results after compression 12 level: 9, 13 }, 14 15 // ensure that package bins are always executable 16 // Note that npm-packlist is already filtering out 17 // anything that is not a regular file, ignored by 18 // .npmignore or package.json "files", etc. 19 filter: (path, stat) => { 20 if (isPackageBin(manifest, path)) { 21 stat.mode |= 0o111 22 } 23 return true 24 }, 25 26 // Provide a specific date in the 1980s for the benefit of zip, 27 // which is confounded by files dated at the Unix epoch 0. 28 mtime: new Date('1985-10-26T08:15:00.000Z'), 29}) 30 31module.exports = tarCreateOptions 32