{"name":"@balena/dockerignore","version":"0.0.6-changelog-resinci-yml-2ed05765fd08977ade902af73b29788709b7f68f","description":"dockerignore is a file filter library compatible with Docker and the node-ignore API","main":"./ignore.js","scripts":{"prepublishOnly:":"npm run build","build":"babel -o ignore.js index.js","test":"npm run build && nyc ava ./test/ignore.js","test-ci":"npm run build && nyc ava ./test/ignore.js --verbose && npm run cov-report","test-no-cov":"npm run build && ava ./test/ignore.js","cov-report":"nyc report --reporter=text-lcov > coverage.lcov && codecov"},"repository":{"type":"git","url":"git+ssh://git@github.com/balena-io-modules/dockerignore.git"},"keywords":["ignore",".dockerignore","dockerignore","rules","manager","filter","regexp","regex","fnmatch","glob","asterisks","regular-expression"],"license":"MIT","bugs":{"url":"https://github.com/balena-io-modules/dockerignore/issues"},"devDependencies":{"async-sema":"^2.1.0","ava":"0.25.0","babel-cli":"^6.26.0","babel-preset-es2015":"^6.24.1","chai":"~1.7.2","codecov":"3.0.2","cuid":"2.1.1","mkdirp":"^0.5.1","nyc":"11.8.0","pre-suf":"^1.0.4","raw-body":"^2.3.3","rimraf":"^2.6.2","tmp":"0.0.33"},"readme":"<table><thead>\n  <tr>\n    <th>Linux</th>\n    <th>OS X</th>\n    <th>Windows</th>\n    <th>Coverage</th>\n  </tr>\n</thead><tbody><tr>\n  <td colspan=\"2\" align=\"center\">\n    <a href=\"https://circleci.com/gh/zeit/dockerignore\">\n    <img\n      src=\"https://circleci.com/gh/zeit/dockerignore.svg?style=svg\"\n      alt=\"Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://ci.appveyor.com/project/zeit/dockerignore\">\n    <img\n      src=\"https://ci.appveyor.com/api/projects/status/github/zeit/dockerignore?branch=master&svg=true\"\n      alt=\"Windows Build Status\" /></a>\n  </td>\n  <td align=\"center\">\n    <a href=\"https://codecov.io/gh/zeit/dockerignore\">\n    <img\n      src=\"https://codecov.io/gh/zeit/dockerignore/branch/master/graph/badge.svg\"\n      alt=\"Coverage Status\" /></a>\n  </td>\n</tr></tbody></table>\n\n# dockerignore\n\n`dockerignore` is a manager, filter and parser which is implemented in pure JavaScript according to the .dockerignore [spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) and is used in production on [now-cli](https://github.com/zeit/now-cli/)\n\nThe `.dockerignore` spec has a few subtle differences from `.gitignore`. If you'd like a great `.gitignore` file parser, check out [ignore](https://github.com/kaelzhang/node-ignore). This package is a fork of `ignore` and follows the exact same API.\n\n#### What's different from `ignore`?\n- There are many direct differences between the `.gitignore` and `.dockerignore` specifications\n  - `*` in `.gitignore` matches everything, whereas in `.dockerignore` it only matches things in the current directory (like glob). This difference is important when whitelisting after a `*` rule\n  - `abc` in `.gitignore` matches all `abc` files and directories, however deeply nested, however `.dockerignore` specifically matches on `./abc` but does not match nested files/directories like `./somedir/abc`\n  - With `.gitignore`, when a parent directory is ignored, subdirectories cannot be re-added (using `!`) since `git` simply avoids walking through the subtree as an optimization, wheras with `.dockerignore` a subdirectory can be re-added even if a parent directory has been ignored\n  - For a complete list of differences, check out the [.gitignore spec](https://git-scm.com/docs/gitignore) and the [.dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file)\n- Under the hood, we rewrote the entire matching logic to be much simpler\n  - instead of complex Regex rule to replace patterns with regex, we scan through patterns\n  - this is also modeled directly from [docker's implementation](https://github.com/docker/docker-ce/blob/7d44629ea2c739e7803acc77b84ee8dd2a8c4746/components/engine/pkg/fileutils/fileutils.go)\n\n#### What's the same as `ignore`?\n- The entire API (In fact we even reuse the same `index.d.ts` file for TypeScript definitions)\n\n##### Tested on\n\n- Linux + Node: `9.0` (but we use `babel` and it *should* work on older version of Node. Accepting PRs if that isn't the case)\n- Windows + Node testing *coming soon*\n\n## Install\n\n```bash\nyarn add @zeit/dockerignore // or npm install --save @zeit/dockerignore\n```\n\n\n## Usage\n\n```js\nconst ignore = require('@zeit/dockerignore')\nconst ig = ignore().add(['.abc/*', '!.abc/d/'])\n```\n\n### Filter the given paths\n\n```js\nconst paths = [\n  '.abc/a.js',    // filtered out\n  '.abc/d/e.js'   // included\n]\n\nig.filter(paths)        // ['.abc/d/e.js']\nig.ignores('.abc/a.js') // true\n```\n\n### As the filter function\n\n```js\npaths.filter(ig.createFilter()); // ['.abc/d/e.js']\n```\n\n### Win32 paths will be handled\n\n```js\nig.filter(['.abc\\\\a.js', '.abc\\\\d\\\\e.js'])\n// if the code above runs on windows, the result will be\n// ['.abc\\\\d\\\\e.js']\n```\n\n## Features\n\n- Exactly according to the [dockerignore spec](https://docs.docker.com/engine/reference/builder/#dockerignore-file) \n- All test cases are verified on Circle CI by doing an actual `docker build` with the test case files and `.dockerignore` rules to ensure our tests match what happens with the real [docker](https://www.docker.com/) CLI\n- 0 external dependencies which keeps this package very small!\n\n## dockerignore vs ignore\n\nRead our [blog post](https://zeit.co/blog/dockerignore) about the differences between `dockerignore` and `ignore` and why we built this package.\n\n## Methods\n\n### .add(pattern)\n### .add(patterns)\n\n- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance\n- **patterns** `Array.<pattern>` Array of ignore patterns.\n\nAdds a rule or several rules to the current manager.\n\nReturns `this`\n\nNotice that a line starting with `'#'`(hash) is treated as a comment. Put a backslash (`'\\'`) in front of the first hash for patterns that begin with a hash, if you want to ignore a file with a hash at the beginning of the filename.\n\n```js\nignore().add('#abc').ignores('#abc')    // false\nignore().add('\\#abc').ignores('#abc')   // true\n```\n\n`pattern` could either be a line of ignore pattern or a string of multiple ignore patterns, which means we could just `ignore().add()` the content of a ignore file:\n\n```js\nignore()\n.add(fs.readFileSync(filenameOfGitignore).toString())\n.filter(filenames)\n```\n\n`pattern` could also be an `ignore` instance, so that we could easily inherit the rules of another `Ignore` instance.\n\n### .ignores(pathname)\n\nReturns `Boolean` whether `pathname` should be ignored.\n\n```js\nig.ignores('.abc/a.js')    // true\n```\n\n### .filter(paths)\n\nFilters the given array of pathnames, and returns the filtered array.\n\n- **paths** `Array.<path>` The array of `pathname`s to be filtered.\n\n### .createFilter()\n\nCreates a filter function which could filter an array of paths with `Array.prototype.filter`.\n\nReturns `function(path)` the filter function.\n\n## Contributing\n\nContributions are always welcome and we are fully [commited to Open Source](https://zeit.co/blog/oss).\n\n1. Fork this repository to your own GitHub account and then clone it to your local device.\n2. Install the dependencies: `yarn` or `npm install`\n3. Add a test case (if applicable) and ensure it currently fails\n4. Add code to pass the test\n5. Make a pull request (additional tests will run on CI to ensure that your test case agrees with an actual `docker build`)\n\n## Authors\n  - Pranay Prakash ([@pranaygp](https://twitter.com/pranaygp)) – [▲ZEIT](https://zeit.co)\n  \n  Most of the initial work on this project was done by Kael Zhang ([@kaelzhang](https://github.com/kaelzhang)) and the [collaborators](https://github.com/kaelzhang/node-ignore#collaborators) on [node-ignore](https://github.com/kaelzhang/node-ignore)\n","readmeFilename":"README.md","gitHead":"2ed05765fd08977ade902af73b29788709b7f68f","homepage":"https://github.com/balena-io-modules/dockerignore#readme","_id":"@balena/dockerignore@0.0.6-changelog-resinci-yml-2ed05765fd08977ade902af73b29788709b7f68f","_nodeVersion":"10.4.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-Gfhgcy0fZWImBya2qhkP5Ilp3bA0Lv1hnxvUz+omCMzLn1otk30j0Gf+k9OFeVMuhKVz9CDxxnV+luSGUkhsSg==","shasum":"a92c6ac77767b58bd66f580cbb66319130134c9f","tarball":"http://registry-npm.ywwl.com/@balena/dockerignore/download/@balena/dockerignore-0.0.6-changelog-resinci-yml-2ed05765fd08977ade902af73b29788709b7f68f.tgz","fileCount":5,"unpackedSize":20677,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeouUBCRA9TVsSAnZWagAAarwQAJjIp9OXhcBxzv5TJgeM\nsZs1QAQmhEn34ZPVUr8p6mgSoY02kAHYGR/QIUYrrBdSOHcbn4iyBICDAzde\nMV0RxIphuaQHdXznpL6pcL9g1/azKCJ3nGwg4+4RhUB/1f8QOM0mCJxe4iy2\nfKTDicGqOrZg3osmSy5sQRMRyKkiEifEj+pLa4/Jv7Kj4SkHKFSjwGCr/Lku\naCi6np1+nQ0SLDHerLgRiEzjffpx10jxkdbTqI9VHfjjz/e7eosQOowwtYXp\ntidvUlFqRZBV/j1njKw0gIIl4LNHjFbM/RlOz6srnLUwAuEDstReCj2ePmtV\npatbDdFx6JRf4lmkVzPROLZwbKpM7Bw83GsT/L8fI2P0IO0PLQIw8U4I4qjK\nGdrbArMgTXO3ruPXv2hJlIUNkTnIndf2srNK9HIXQkQtaiJj6X9OGNRK5kFl\nY+7igJFGgpuX4Nl16yC76wXcaYHWDqkoy0fn5p/JkrH/gIEOzNXgKdJ4e9fm\nfKM9BW8Ig45U+5tliLUULRuU3kEzZdSmV+5PyrZdRFPdvIMJuTH1wikA9YeM\nobzP+uOqYGGHyxuV5DVj1EA+K+eHx6IwZtoTBMy1nFOvRbCXsBwaiZEH4uvx\nvBYBvBB/79bYSh0QfRZUbaa/g/Y4UkyMV4HjQ9eao9PkkWgIgGR8jGAp3X3Y\ns4uJ\r\n=7jGh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC/jtRbJCkGOx24t+2DDybMTvzIgRYexqu3Iw/Im311gAIhAKZBq6nWwGg3MwJLvxQQNDQdcbY7oqQeSvZysAm28w97"}],"size":8056,"noattachment":false,"key":"/@balena/dockerignore/-/@balena/dockerignore-0.0.6-changelog-resinci-yml-2ed05765fd08977ade902af73b29788709b7f68f.tgz"},"maintainers":[{"email":"accounts+npm@balena.io","name":"balena.io"},{"email":"tomast@balena.io","name":"kaisoz"},{"email":"nazrhom@gmail.com","name":"nazrhom"},{"email":"petrosagg@gmail.com","name":"petrosagg"}],"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dockerignore_0.0.6-changelog-resinci-yml-2ed05765fd08977ade902af73b29788709b7f68f_1587733760896_0.8019279003588409"},"_hasShrinkwrap":false,"publish_time":1587733761040,"_cnpm_publish_time":1587733761040,"dist-tags":{"latest":"1.0.2"}}