tar-create-options.js 914 B

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