{"name":"@balena/dockerignore","version":"0.0.6-changelog-resinci-yml-991d541b57ffbfdea225da2bde49a1a3af7ba69e","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":"991d541b57ffbfdea225da2bde49a1a3af7ba69e","homepage":"https://github.com/balena-io-modules/dockerignore#readme","_id":"@balena/dockerignore@0.0.6-changelog-resinci-yml-991d541b57ffbfdea225da2bde49a1a3af7ba69e","_nodeVersion":"10.4.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-0V9CsjWrPzkFXLaHiuNcbs1MLlH8lL1Po2avhODFWsFXGAjhpULSjfhnyH3sr+FE70EjHJzn/K1vFcvNYoCVVg==","shasum":"9a2fb77f8e8d1bc20c38094171944bdc2ebb789b","tarball":"http://registry-npm.ywwl.com/@balena/dockerignore/download/@balena/dockerignore-0.0.6-changelog-resinci-yml-991d541b57ffbfdea225da2bde49a1a3af7ba69e.tgz","fileCount":5,"unpackedSize":10794,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJemJyBCRA9TVsSAnZWagAAU/EP/1MGlkbDQC1deifdO5TF\nXi1zEUpuqEROrCEG1+/8Wf4yHj8CIpwPQde09tL9RQQFkdPTv6Ichl7GhEdm\nIo6pdLo/XSGkGKXXVRaEceNAOwFf0VUIK58ONz712/scnZnbV0CphMaggOsV\nQB3oUTp7oBlAZxw65AMkD7gIOLCH63HQ40E/7UPvxm1h/DR2aHxJh9Xx4qyQ\nQfcUZjefPi/BNb89Mf1N064TnzoxWuX6fQ/tsu7nEcC8nCxQCvfyc/Z0bXb6\nhi094tBIRMxUT5oPF5wMcIPDnAIvmQaelvzm4M+9cmhHh0J9CW5yQSC1Z1tN\n0srG0tqhVosHYma2wdMYMjLpKbGwUMoJPQqse0ca6nWd0bGLgpiJwrnBjYEY\nzVsdWIG9lZO7rD4NrL89zbWRDSlekw/TkJaMlFUcJJ82ob7sXAq9pw+ZJ0qR\nspz8FthgD+bt+nBjQcLxQodu4c1Txmh/+Xh1c5iTrK/pc70hRzwx/5haoWQA\neuhqiCTAbTO7p3BX1gaZFFG092CrDRhKpulotDUWaVKNS2Bg/lrr6HMoSYJ6\nlBN8n/ymc6Msqt7hAO60oW6mrElDaQmyoehFJ/QiMerJ9Kht9YdoRi9ieqDs\nT0Xfg9uEFZ6h53OO1/lNtfpuU1lKRj1DY6SZliGoyKSjpSALdEp+B47guHFZ\nUVrq\r\n=MLTq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGR5O9hsKTHciAHHT0j+c7Qr0DXZ7yyDJYoQAc1hKTDLAiBZOJS/32IXGvOn9UzEU6MrNrli501J2DkXcCeEm1DIkg=="}],"size":4729,"noattachment":false,"key":"/@balena/dockerignore/-/@balena/dockerignore-0.0.6-changelog-resinci-yml-991d541b57ffbfdea225da2bde49a1a3af7ba69e.tgz"},"maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"kaisoz","email":"tomast@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"petrosagg","email":"petrosagg@gmail.com"}],"_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-991d541b57ffbfdea225da2bde49a1a3af7ba69e_1587059840805_0.0009746643774608543"},"_hasShrinkwrap":false,"publish_time":1587059840977,"_cnpm_publish_time":1587059840977,"dist-tags":{"latest":"1.0.2"}}