JSPM

  • Created
  • Published
  • Downloads 10444529
  • Score
    100M100P100Q216434F
  • License ISC

Package Exports

  • npm-packlist

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (npm-packlist) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm-packlist

Get a list of the files to add from a folder into an npm package

These can be handed to tar like so to make an npm package tarball:

const pack = require('npm-packlist')
const tar = require('tar')
const packageDir = '/path/to/package'
const packageTarball = '/path/to/package.tgz'

pack({ path: packageDir })
  .then(files => tar.create({
    prefix: 'package/',
    cwd: packageDir,
    file: packageTarball,
    gzip: true,
    bundled: [
      'some',
      'deps',
      'that-are',
      'bundled-dependencies-in-node_modules',
      'this-is-optional-of-course'
    ]
  }, files))
  .then(_ => {
    // tarball has been created, continue with your day
  })

This uses the following rules:

  1. If a package.json file is found, and it has a files list, then ignore everything that isn't in files. Always include the readme, license, notice, changes, changelog, and history files, if they exist, and the package.json file itself.

  2. If there's no package.json file (or it has no files list), and there is a .npmignore file, then ignore all the files in the .npmignore file.

  3. If there's no package.json with a files list, and there's no .npmignore file, but there is a .gitignore file, then ignore all the files in the .gitignore file.

  4. Everything in the root node_modules is ignored, unless it's a bundled dependency. If it IS a bundled dependency, and it's a symbolic link, then the target of the link is included, not the symlink itself. (The bundled option determines which packages are to be considered bundled deps.)

  5. Unless they're explicitly included (by being in a files list, or a !negated rule in a relevant .npmignore or .gitignore), always ignore certain common cruft files:

    1. .npmignore and .gitignore files (their effect is in the package already, there's no need to include them in the package)
    2. editor junk like .*.swp, ._* and .*.orig files
    3. A /test/ or /tests/ folder at the root
    4. .npmrc files (these may contain private configs)
    5. The node_modules/.bin folder
    6. Waf and gyp cruft like /build/config.gypi and .lock-wscript
    7. Darwin's .DS_Store files because wtf are those even
    8. npm-debug.log files at the root of a project

    You can explicitly re-include any of these with a files list in package.json or a negated ignore file rule.

API

Same API as ignore-walk, just hard-coded file list and rule sets, and takes the bundled list of package names to include.