{"id":13483527,"url":"https://github.com/npm/npm-packlist","last_synced_at":"2025-05-14T14:07:37.083Z","repository":{"id":21657530,"uuid":"92569773","full_name":"npm/npm-packlist","owner":"npm","description":"Walk through a folder and figure out what goes in an npm package","archived":false,"fork":false,"pushed_at":"2025-04-09T18:01:33.000Z","size":723,"stargazers_count":111,"open_issues_count":6,"forks_count":35,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-05-05T10:08:11.733Z","etag":null,"topics":["npm-cli"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/npm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-05-27T04:06:12.000Z","updated_at":"2025-04-09T18:01:35.000Z","dependencies_parsed_at":"2024-04-20T22:55:43.440Z","dependency_job_id":"916b29a3-7796-4d60-80ed-25fdf3eb0062","html_url":"https://github.com/npm/npm-packlist","commit_stats":{"total_commits":285,"total_committers":26,"mean_commits":"10.961538461538462","dds":0.5754385964912281,"last_synced_commit":"b50e3c4dd38212d223334e8901357e3d6557622b"},"previous_names":[],"tags_count":64,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fnpm-packlist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fnpm-packlist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fnpm-packlist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fnpm-packlist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/npm","download_url":"https://codeload.github.com/npm/npm-packlist/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253181418,"owners_count":21866991,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["npm-cli"],"created_at":"2024-07-31T17:01:12.385Z","updated_at":"2025-05-14T14:07:37.062Z","avatar_url":"https://github.com/npm.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# npm-packlist\n\nGet a list of the files to add from a folder into an npm package.\n\nThese can be handed to [tar](http://npm.im/tar) like so to make an npm\npackage tarball:\n\n```js\nconst Arborist = require('@npmcli/arborist')\nconst packlist = require('npm-packlist')\nconst tar = require('tar')\nconst packageDir = '/path/to/package'\nconst packageTarball = '/path/to/package.tgz'\n\nconst arborist = new Arborist({ path: packageDir })\narborist.loadActual().then((tree) =\u003e {\n  packlist(tree)\n    .then(files =\u003e tar.create({\n      prefix: 'package/',\n      cwd: packageDir,\n      file: packageTarball,\n      gzip: true\n    }, files))\n    .then(_ =\u003e {\n      // tarball has been created, continue with your day\n    })\n  })\n```\n\nThis uses the following rules:\n\n1. If a `package.json` file is found, and it has a `files` list,\n   then ignore everything that isn't in `files`.  Always include the root\n   readme, license, licence and copying files, if they exist, as well\n   as the package.json file itself. Non-root readme, license, licence and\n   copying files are included by default, but can be excluded using the \n   `files` list e.g. `\"!readme\"`.\n2. If there's no `package.json` file (or it has no `files` list), and\n   there is a `.npmignore` file, then ignore all the files in the\n   `.npmignore` file.\n3. If there's no `package.json` with a `files` list, and there's no\n   `.npmignore` file, but there is a `.gitignore` file, then ignore\n   all the files in the `.gitignore` file.\n4. Everything in the root `node_modules` is ignored, unless it's a\n   bundled dependency.  If it IS a bundled dependency, and it's a\n   symbolic link, then the target of the link is included, not the\n   symlink itself.\n4. Unless they're explicitly included (by being in a `files` list, or\n   a `!negated` rule in a relevant `.npmignore` or `.gitignore`),\n   always ignore certain common cruft files:\n\n    1. .npmignore and .gitignore files (their effect is in the package\n       already, there's no need to include them in the package)\n    2. editor junk like `.*.swp`, `._*` and `.*.orig` files\n    3. `.npmrc` files (these may contain private configs)\n    4. The `node_modules/.bin` folder\n    5. Waf and gyp cruft like `/build/config.gypi` and `.lock-wscript`\n    6. Darwin's `.DS_Store` files because wtf are those even\n    7. `npm-debug.log` files at the root of a project\n\n    You can explicitly re-include any of these with a `files` list in\n    `package.json` or a negated ignore file rule.\n\nOnly the `package.json` file in the very root of the project is ever\ninspected for a `files` list.  Below the top level of the root package,\n`package.json` is treated as just another file, and no package-specific\nsemantics are applied.\n\n### Interaction between `package.json` and `.npmignore` rules\n\nIn previous versions of this library, the `files` list in `package.json`\nwas used as an initial filter to drive further tree walking. That is no\nlonger the case as of version 6.0.0.\n\nIf you have a `package.json` file with a `files` array within, any top\nlevel `.npmignore` and `.gitignore` files *will be ignored*.\n\nIf a _directory_ is listed in `files`, then any rules in nested `.npmignore` files within that directory will be honored.\n\nFor example, with this package.json:\n\n```json\n{\n  \"files\": [ \"dir\" ]\n}\n```\n\na `.npmignore` file at `dir/.npmignore` (and any subsequent\nsub-directories) will be honored.  However, a `.npmignore` at the root\nlevel will be skipped.\n\nAdditionally, with this package.json:\n\n```\n{\n  \"files\": [\"dir/subdir\"]\n}\n```\n\na `.npmignore` file at `dir/.npmignore` will be honored, as well as `dir/subdir/.npmignore`.\n\nAny specific file matched by an exact filename in the package.json `files` list will be included, and cannot be excluded, by any `.npmignore` files.\n\n## API\n\nSame API as [ignore-walk](http://npm.im/ignore-walk), except providing a `tree` is required and there are hard-coded file list and rule sets.\n\nThe `Walker` class requires an [arborist](https://github.com/npm/cli/tree/latest/workspaces/arborist) tree, and if any bundled dependencies are found will include them as well as their own dependencies in the resulting file set.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpm%2Fnpm-packlist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnpm%2Fnpm-packlist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpm%2Fnpm-packlist/lists"}