{"_id":"@aleclarson/bucket-runner","_rev":"2-8ba7fdc9d85c534fd7a9f400f1b87775","name":"@aleclarson/bucket-runner","dist-tags":{"latest":"4.0.2"},"versions":{"4.0.0":{"name":"@aleclarson/bucket-runner","version":"4.0.0","description":"Execute a command in parallel, distributing files and buffering output.","main":"index.js","bin":{"bucket-runner":"bin/cli.js"},"engines":{"node":">=12"},"repository":{"type":"git","url":"git+https://github.com/spotify/bucket-runner.git"},"nyc":{"all":true,"exclude":["coverage","fixtures","tests"]},"scripts":{"test":"yarn run lint && yarn run test:unit && yarn run test:integration","test:unit":"nyc tape tests/unit/*","test:integration":"nyc tests/integration/tests.sh","lint":"eslint bin/ lib/ tests/unit","lint:fix":"yarn run lint -- --fix","coverage:report":"nyc report --reporter=text-lcov | coveralls","coverage:html":"nyc report --reporter=html","prepublish":"in-publish && yarn run test || not-in-publish"},"keywords":["mocha","partition","bucket","tests","parallel","concurrent"],"author":{"name":"Drew Petersen","email":"drewp@spotify.com"},"license":"Apache-2.0","devDependencies":{"@spotify/web-scripts":"^8.1.1","coveralls":"^3.1.0","in-publish":"^2.0.0","istanbul":"^1.0.0-alpha.2","mocha":"^8.2.0","nyc":"^15.1.0","tape":"^5.0.1"},"dependencies":{"async":"^3.2.0","debug":"^4.2.0","glob":"^7.0.3","minimist":"^1.2.0","object-assign":"^4.0.1","set-blocking":"^2.0.0"},"gitHead":"a0cfe30e6f2540e78f225b7665fd1ad06f4eb9c2","bugs":{"url":"https://github.com/spotify/bucket-runner/issues"},"homepage":"https://github.com/spotify/bucket-runner#readme","_id":"@aleclarson/bucket-runner@4.0.0","_nodeVersion":"18.7.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-78oVT2dXS9MS5sb2peWZ2XV6SZ6TcOhrpU8qhdVoT17Q0M3e9E+1nbPfaRR85pkyJ6RKfdYX9uhwGHeMVEkOWQ==","shasum":"7f3e1112ac32517f20c9c7c105f2a7e99f3a358d","tarball":"https://registry.npmjs.org/@aleclarson/bucket-runner/-/bucket-runner-4.0.0.tgz","fileCount":26,"unpackedSize":49768,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICkUKRgTtgCt816aiVz40ixc0iHbZsqpAoHaoR2lSb3dAiAmPLdT53zvFlaPFyTtrKqJytrRqI0QtHxn+GPOkBm3Vg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi88Q3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoxGhAAo/zif/FAO88c/tPrzxBLlU9prEQ03E9SNTe9olpQoJ+6fspb\r\nwzCZlp4WP5mnzLX+TYB7Ssn0XxoESI51baKmmxCXjOJDK5DLJw5ZWU4ddMLa\r\nzureuzmAXucePCoAlqNvr3FEgf1jXbjqfYbIfa2eW+ImpzwhvEQLGDSmAlQ3\r\nRTZObgAqzYbNrTpjB+k2bSmen3WSpNg1mvoI9BK/UrtKstEa5qGbl1ukrAea\r\nMwQnUk+PAAniXp0l8txEPQ748M5uCTsyFG+wc/0JO8a96HL2EIIGRhmD+bl8\r\nCLZCt61wQiJQ8IsAcpXpM5coCPj7+VvlVDhnQterwyLx8o766n8O5AONLfrE\r\nf0roagUS4JsQEdLvbz3MoreF4WaqElMJAitrbiALL8IHehaoe/6+b3LbAhR+\r\nGN1wPttQ9CqnBwMDXnJJr5+2cddKDpG8nXHuFU0LMd0V7TwocQixHSa7VDl8\r\nNqcwL/VglTZqDff4FN5jflLLLuy+qmmu+Wpm3rtxTruKtauNBv5/Ru19C1ZJ\r\nJbIFKBMY49QtjCg/QkNv3Y425NSgPJT0VlEtTyjpCrZUAqdcOC1Kiq0nXcr4\r\nHclN1SfOmDDzEqyDtjLPth4jTlL5kfJyE8Fw4dND0hx51hw7jGUjnSivcq3a\r\nmrEG4lQYycIoqSUeFsMLEZqb4vln6lSVu3o=\r\n=Ly5a\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"aleclarson","email":"aleclarson@protonmail.com"},"directories":{},"maintainers":[{"name":"aleclarson","email":"aleclarson@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bucket-runner_4.0.0_1660142647436_0.7911655063320469"},"_hasShrinkwrap":false},"4.0.1":{"name":"@aleclarson/bucket-runner","version":"4.0.1","description":"Execute a command in parallel, distributing files and buffering output.","main":"index.js","bin":{"bucket-runner":"bin/cli.js"},"engines":{"node":">=12"},"repository":{"type":"git","url":"git+https://github.com/spotify/bucket-runner.git"},"nyc":{"all":true,"exclude":["coverage","fixtures","tests"]},"scripts":{"test":"yarn run lint && yarn run test:unit && yarn run test:integration","test:unit":"nyc tape tests/unit/*","test:integration":"nyc tests/integration/tests.sh","lint":"eslint bin/ lib/ tests/unit","lint:fix":"yarn run lint -- --fix","coverage:report":"nyc report --reporter=text-lcov | coveralls","coverage:html":"nyc report --reporter=html","prepublish":"in-publish && yarn run test || not-in-publish"},"keywords":["mocha","partition","bucket","tests","parallel","concurrent"],"author":{"name":"Drew Petersen","email":"drewp@spotify.com"},"license":"Apache-2.0","devDependencies":{"@spotify/web-scripts":"^8.1.1","coveralls":"^3.1.0","in-publish":"^2.0.0","istanbul":"^1.0.0-alpha.2","mocha":"^8.2.0","nyc":"^15.1.0","tape":"^5.0.1"},"dependencies":{"async":"^3.2.0","debug":"^4.2.0","glob":"^7.0.3","minimist":"^1.2.0","object-assign":"^4.0.1","set-blocking":"^2.0.0"},"gitHead":"1cf8438ba909b80ae9fbf01a1f3b4c4268f77a8a","bugs":{"url":"https://github.com/spotify/bucket-runner/issues"},"homepage":"https://github.com/spotify/bucket-runner#readme","_id":"@aleclarson/bucket-runner@4.0.1","_nodeVersion":"18.7.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-6kWfkVATLJQw7ZsW8Z5BfIBg70PJ85R2TctGXgENUG3SKO8ScFX95u0OR+p/Fla8VUDaSI0xzbWjHtmBxeiVtQ==","shasum":"13287129f0faef51076ed99eb2ec840b13033467","tarball":"https://registry.npmjs.org/@aleclarson/bucket-runner/-/bucket-runner-4.0.1.tgz","fileCount":12,"unpackedSize":33535,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDL8reN98cchAUiLvuJarfnBipBwwk8z8aIcjW49O6uqQIgCa96bkepswupbqwh8A2n2mspQ6/sri2NxY6po1mSnj8="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi88RxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqN3g//RsSOtmMVqD20cUi1bbyKdEO/+CWGdVI25VUNiBCx4NO/Bg0s\r\n71/nmOOAXQ6jGZCwyy71rqS0VseNtv9sKVrmDT9Lf9lZ7zEIoMB4UzmDeIrx\r\nt78jtl85WISht7UJqxod+Ja97CcMh9amdlnO56a0XWDVoB+2px2iXKt73Uyn\r\nzDDHS70BSliBqCtVgeRTxwR+p1iw5PvS1hKwEFGaR8AXKTKFAKd/pCaLITkL\r\nFr5VFPPLSxqS+oFLw3rxb6jUEYCEGtS+EBhVD/QuyPNmxTk+EsDcotTbCCWc\r\nP9RVrxrmNqYrAxWo9tLq5+r2Zxoio0vOqY8zOfUc9Vou5yOla6gGA8e+t8MB\r\nXX/aD/g41JaUR039JizDA5FRdXh9R3KpoZX3rVauU1YZsth3kV96vaXaRw4r\r\nXyKXlfZvwW+j16GYXb3V6d7rImMQhHijW1IBF6qmZLXgW0Sjh+osy61+GGcH\r\n+Ec9UTwbIKcnNCpa+DvdoxYWOgcV8vhjw0ssh9enBCW8x89Vz6mkGXaZ9uup\r\nHrs8hwvMhmnInRwr4kSolg58tphSHMjRGTgAbiXYGvbCdU5mF4OdTfz14MHo\r\n3tl+7rEjWLMOw2nxmcSUZSc+P1dYhbTvuSx8GVh/XoWC1ACMk7cn4WdAaiL6\r\n9TsiXYc8xqbY2HMfCtpYLPlczP7xDwx7Qi0=\r\n=Gybd\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"aleclarson","email":"aleclarson@protonmail.com"},"directories":{},"maintainers":[{"name":"aleclarson","email":"aleclarson@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bucket-runner_4.0.1_1660142704856_0.11577446307970307"},"_hasShrinkwrap":false},"4.0.2":{"name":"@aleclarson/bucket-runner","version":"4.0.2","description":"Execute a command in parallel, distributing files and buffering output.","main":"index.js","bin":{"bucket-runner":"bin/cli.js"},"engines":{"node":">=12"},"repository":{"type":"git","url":"git+https://github.com/spotify/bucket-runner.git"},"nyc":{"all":true,"exclude":["coverage","fixtures","tests"]},"scripts":{"test":"yarn run lint && yarn run test:unit && yarn run test:integration","test:unit":"nyc tape tests/unit/*","test:integration":"nyc tests/integration/tests.sh","lint":"eslint bin/ lib/ tests/unit","lint:fix":"yarn run lint -- --fix","coverage:report":"nyc report --reporter=text-lcov | coveralls","coverage:html":"nyc report --reporter=html","prepublish":"in-publish && yarn run test || not-in-publish"},"keywords":["mocha","partition","bucket","tests","parallel","concurrent"],"author":{"name":"Drew Petersen","email":"drewp@spotify.com"},"license":"Apache-2.0","devDependencies":{"@spotify/web-scripts":"^8.1.1","coveralls":"^3.1.0","in-publish":"^2.0.0","istanbul":"^1.0.0-alpha.2","mocha":"^8.2.0","nyc":"^15.1.0","tape":"^5.0.1"},"dependencies":{"async":"^3.2.0","debug":"^4.2.0","glob":"^7.0.3","minimist":"^1.2.0","object-assign":"^4.0.1","set-blocking":"^2.0.0"},"gitHead":"11ca81cf6dec5f442cac91e316a50e8149f24b39","bugs":{"url":"https://github.com/spotify/bucket-runner/issues"},"homepage":"https://github.com/spotify/bucket-runner#readme","_id":"@aleclarson/bucket-runner@4.0.2","_nodeVersion":"18.7.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-D6ibuhweAAHH2+LKlA+LugSDQJb/3yJJOamIZam6jEnTeOlcGZuHDl0Bay++auaEHR/iFzfiDBWYBZ57BgNYAA==","shasum":"a685bab6106778637799a6162221d60be268ec5a","tarball":"https://registry.npmjs.org/@aleclarson/bucket-runner/-/bucket-runner-4.0.2.tgz","fileCount":12,"unpackedSize":33557,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCZazVxKzNmpDarp2oUMMKsjp52E++5ed+bKUnx1wiv2gIhALyal1Zmt7bTYLjuhUgNisfnRqr9WAFVHOmdHdcFip2z"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi88qvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr7Uw/+K+oF1VI87DuQRheMHrRA1EYEdsaVyTVqyWVi1Lge8htkpHW+\r\nEOq83QfIz7TcrSw8CG6tcAuez8OoLlFdTAmfKtDeTbcpfRE5D9rqPP7XzYii\r\nOGTXp9mdJWoWGFixPJ2+7G1YDLqrm4I4ldj+lejmTMX2IU9iAHktrZVtGy+N\r\nQVSf8j4EbvYMcjfqal+iKZOogRIQg8WWruXHiY0agQlfd/bWdXMLedNNQLCJ\r\nMyWKM07kyMbt2fUCnXWwZEnjJUTgeacpx7fwRqNAuKT7r0m6STGFzf9RFqBR\r\n2ZFiBHMdGp87y0hoY54NE2/v0c8EbZQA5NboVMMKtDcP7dSbKkk4b6O74YhO\r\nGKCYPjTQSgjI+XnhZjeGiUFCMnizKRYfcXbGOix0S83EYVJMMZbxoJKaVwPC\r\nk7tVLMviQiRSiso845PVG2JfS6chRS5YdRgQ5/OmgTl6gZnVqxVTAuzOgZqv\r\nnPS98xXCEGOGjetn32jioALjWTpC0kPgsDNBxkECAOphSfwh2LkXpkwlknko\r\nyoWzLAZK2w5vvqudIdELmszUx/3fRQ7ufS5tTsWKSYIQnx0os8B79bFVnubX\r\nJcOl/IbZijMa06Wt/DmZxN3EnlZzuYwa6VLdbKxoYLg6z5MiP2D1meY6jQBb\r\nbE8yxwdNlhBc6+8pniwzmlGQeoU+C8dcpS8=\r\n=0l7C\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"aleclarson","email":"aleclarson@protonmail.com"},"directories":{},"maintainers":[{"name":"aleclarson","email":"aleclarson@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bucket-runner_4.0.2_1660144303506_0.44097393129064333"},"_hasShrinkwrap":false}},"time":{"created":"2022-08-10T14:44:07.355Z","4.0.0":"2022-08-10T14:44:07.601Z","modified":"2022-08-10T15:11:43.824Z","4.0.1":"2022-08-10T14:45:05.061Z","4.0.2":"2022-08-10T15:11:43.730Z"},"maintainers":[{"name":"aleclarson","email":"aleclarson@protonmail.com"}],"description":"Execute a command in parallel, distributing files and buffering output.","homepage":"https://github.com/spotify/bucket-runner#readme","keywords":["mocha","partition","bucket","tests","parallel","concurrent"],"repository":{"type":"git","url":"git+https://github.com/spotify/bucket-runner.git"},"author":{"name":"Drew Petersen","email":"drewp@spotify.com"},"bugs":{"url":"https://github.com/spotify/bucket-runner/issues"},"license":"Apache-2.0","readme":"@aleclarson/bucket-runner [![Build Status](https://travis-ci.org/spotify/bucket-runner.svg?branch=master)](https://travis-ci.org/spotify/bucket-runner) [![Coverage Status](https://coveralls.io/repos/github/spotify/bucket-runner/badge.svg?branch=master)](https://coveralls.io/github/spotify/bucket-runner?branch=master)\n=============\n\n> This is a fork of the original `bucket-runner` package, with a few changes based on preference. The partition size defaults to 1. Path validation is disabled by default. You can use `{}` (for xargs parity) instead of the `{files}` token.\n\nRun a command in parallel, distributing the input files to each process and buffer the output to prevent interleaving. Kind of like xargs but with control over output.\n\nA common example would be to easily run [mocha](https://mochajs.org/) tests in parallel without any code changes:\n\n```\n$ bucket-runner --partition-size 5 tests/* -- mocha\n```\n\nTypically mocha runs tests serially, but if your tests are in separate files you can run each file at the same time!\n\nOutput is buffered (and untouched), so it will still be linear and whole when tests finish.\n\nAn example using the fixtures in this repo:\n\n```sh\n# using mocha directly\n$ time node_modules/.bin/mocha fixtures/tests/**/*.js\n...\nreal  0m4.200s\nuser  0m0.163s\nsys   0m0.035s\n```\n\n```sh\n# using bucket-runner to execute mocha\n$ time bin/cli.js fixtures/tests/**/*.js --partition-size 1 -- node_modules/.bin/mocha\n...\nreal  0m1.403s\nuser  0m0.936s\nsys   0m0.198s\n```\n\nGetting Started\n---------------\n\nGlobal utility:\n\n```sh\n$ npm install -g bucket-runner\n$ bucket-runner --help\n```\n\nLocal utility:\n\n```sh\n$ npm install bucket-runner\n$ $(npm bin)/bucket-runner --help\n```\n\nCan also be `require`ed for [script usage](#api-usage):\n\n```sh\n$ npm install bucket-runner\n$ node\n> var runner = require('bucket-runner');\n```\n\n\nCLI Usage\n---------\n\n```sh\n$ bucket-runner [options] [files|globs...] -- [cmd] [{files}, {partition}]\n```\n\n`files|globs` can either be many files globbed through shell expansion, or a quoted glob. If quoted, the glob is passed into [glob](https://www.npmjs.com/package/glob) to expand into a list of files.\n\nIf the explicit token `{files}` is contained within the `[cmd]`, then the resolved globbed files will be placed at that point in the command string.\n\nExample:\n\n```sh\n$ ls tests\npage1.spec.js page2.spec.js page3.spec.js lib1.spec.js lib2.spec.js\n\n$ bucket-runner tests -- echo {files} are the files\npage1.spec.js page2.spec.js are the files\npage3.spec.js lib1.spec.js are the files\nlib2.spec.js are the files\n\n$ bucket-runner tests -- echo are the files\nare the files page1.spec.js page2.spec.js\nare the files page3.spec.js lib1.spec.js\nare the files lib2.spec.js\n```\n\nOptions\n-------\n\n### `--concurrency [count]` (default cpus * 4)\n\nThe number of simultaneous processes to use when executing.\n\n### `--partition-size [size]` (default: 1)\n\nUse `[size]` as the batch size for grouping files. Some examples:\n\n```sh\n# will use one echo command\n$ bucket-runner --partition-size 5 f1.js f2.js f3.js f4.js f5.js -- echo\nf1.js f2.js f3.js f4.js f5.js\n```\n\n```sh\n# will use five echo commands (the default behavior)\n$ bucket-runner --partition-size 1 f1.js f2.js f3.js f4.js f5.js -- echo\nf4.js\nf3.js\nf2.js\nf1.js\nf5.js\n```\n\n### `--partition-regex [regex]`\n\nUse `[regex]` to group the list of files into processes. The regex is matched using the absolute path to the file. If a capture group is specified, it can be accessed via a special command substitution token `{partition}` (including the `{}`). An example scenario: you want to create coverage reports, but your coverage framework needs a unique name for each process creating output:\n\n```\n$ ls tests\npage1.spec.js page2.spec.js page3.spec.js lib1.spec.js lib2.spec.js\n$ bucket-runner --partition-regex '(page|lib)\\d' tests/* -- istanbul cover _mocha --dir coverage/{partition} --\n```\n\nIn the above example the coverage destinations would be named `coverage/page` and `coverage/lib` since that was the result of the first-defined capture group in the regex.\n\nNOTE: If `--partition-regex` is used, `partition-size` is ignored as the regex will potentially create imbalanced partitions.\n\n### `--resolve-files`\n\nEnable file existence checking.\n\nBy default, bucket-runner runs your command without any path validation, so even directories are passed through. This option lets you only run the command for actual files.\n\n### `--continue-on-error`\n\nContinue processing commands, even if one of the parallel processes emits an error. Default is to halt and exit if an error is emitted.\n\n### `--stream-output`\n\nDo not buffer output, and instead stream directly to stdio.\n\nOne of bucket-runner's benefits is that it buffers output to ensure that output from multiple processes is not interwoven. This enables file redirection without having to use temporary files. But sometimes the output might be too large to buffer, or the speed hit too great.\n\n\nAPI Usage\n---------\n\n```js\nvar runner = require('bucket-runner');\n\nrunner(['file1.js', 'glob1/*/**.js'], '_mocha', {\n  concurrency: 2,\n  'partition-size': 2\n}, function (err) {\n  if (err) throw err;\n});\n```\n\nContributing\n------------\n\nIntegration and unit tests are executed using:\n\n```sh\n$ npm run test\n```\n\nThe integration tests use bash, and are untested on Windows. Contributing a Windows version of the test would be greatly appreciated!\n\nIf adding a new option, be sure to add descriptions to both this README and [bin/usage.txt](bin/usage.txt) for command-line help.\n\nThis project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to honor this code.\n\n[code-of-conduct]: https://github.com/spotify/code-of-conduct/blob/master/code-of-conduct.md\n\nReleasing\n---------\n\n```sh\n$ npm version [major|minor|patch]\n$ git push origin HEAD ---tags\n$ npm publish\n```\n\nLicense\n-------\n\n[Apache 2.0](LICENSE)\n","readmeFilename":"README.md"}