{"name":"travis-deploy-once","version":"1.0.0-node-0.10-support","description":"run a deployment script only once in the test matrix","main":"index.js","scripts":{"test":"standard && npm run build","build":"babel src.js > index.js","prepublish":"npm run build","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"repository":{"type":"git","url":"git+https://github.com/semantic-release/travis-deploy-once.git"},"keywords":["travis","deploy","after","success"],"author":{"name":"Stephan Bönnemann","email":"stephan@boennemann.me"},"license":"MIT","bugs":{"url":"https://github.com/semantic-release/travis-deploy-once/issues"},"homepage":"https://github.com/semantic-release/travis-deploy-once#readme","devDependencies":{"babel-cli":"^6.18.0","babel-plugin-transform-regenerator":"^6.16.1","babel-preset-es2015":"^6.18.0","semantic-release":"^6.3.1","standard":"^8.5.0"},"dependencies":{"babel-polyfill":"^6.16.0","bluebird":"^3.4.6","request":"^2.78.0","request-promise":"^4.1.1","travis-ci":"^2.1.1"},"babel":{"presets":["es2015"],"plugins":["transform-regenerator"]},"files":["index.js","src.js"],"gitHead":"c9443cde692efef8cf29ea1ad1766a8d83491fc5","_id":"travis-deploy-once@1.0.0-node-0.10-support","_shasum":"98ecce7d95b2f4ba5dcdeeebf54b9df87713d5e6","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.1.0","_npmUser":{"name":"boennemann","email":"stephan@boennemann.me"},"dist":{"shasum":"98ecce7d95b2f4ba5dcdeeebf54b9df87713d5e6","tarball":"http://registry-npm.ywwl.com/travis-deploy-once/download/travis-deploy-once-1.0.0-node-0.10-support.tgz","integrity":"sha512-M7EwZiAsGt/tkCsw384kYXoZeHJ0rTf5CfFVBVIjXssU9DJkWJDgeyhaOQO/3MmGnizoY6qq43lOU5lOq5/y+w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC9qdPr1o/dj1oFakHDyxE0erCDOvu0ZJD4OqwSo6sacAIhAJguYeM44WtxF8+dWeDTmFzz+uCKJ9zAv6S9yyZgEFyi"}],"size":3072,"noattachment":false,"key":"/travis-deploy-once/-/travis-deploy-once-1.0.0-node-0.10-support.tgz"},"maintainers":[{"name":"boennemann","email":"stephan@boennemann.me"},{"name":"semantic-release-bot","email":"semantic-release@boennemann.me"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/travis-deploy-once-1.0.0-node-0.10-support.tgz_1479398824360_0.22746784309856594"},"directories":{},"deprecated":"We recommend to use Travis Build Stages instead","readme":"# travis-deploy-once\n\nRun a deployment script only once in the [Travis](https://travis-ci.org/) test matrix.\n\n[![Travis](https://img.shields.io/travis/semantic-release/travis-deploy-once.svg)](https://travis-ci.org/semantic-release/travis-deploy-once)\n[![Codecov](https://img.shields.io/codecov/c/github/semantic-release/travis-deploy-once.svg)](https://codecov.io/gh/semantic-release/travis-deploy-once)\n[![Greenkeeper badge](https://badges.greenkeeper.io/semantic-release/travis-deploy-once.svg)](https://greenkeeper.io/)\n\n## :warning: Deprecation Notice :warning:\n\n**This library is deprecated and will not be maintained. We recommend to use [Build Stages](https://docs.travis-ci.com/user/build-stages) instead. It’s a clearer and more flexible way to orchestrate jobs within a build.**\n\n## Overview\n\nFor Travis builds running multiple jobs (to test with multiple [Node versions](https://docs.travis-ci.com/user/languages/javascript-with-nodejs/#Specifying-Node.js-versions) and/or [OSs](https://docs.travis-ci.com/user/multi-os)), `travis-deploy-once` run some code only once, after all other jobs have completed successfully.\n\n`travis-deploy-once` is usually used in the `after_success` step. But if you want your build to break in case the `travis-deploy-once` script returns an error, you can set it in the `script` or `before_script` step (see [Travis Build Lifecycle](https://docs.travis-ci.com/user/customizing-the-build/#The-Build-Lifecycle)).\n\nYour code will run only on the job identified as the build leader, which is determined as follow, by order of priority:\n- The job with the ID defined in the [-b](#-b---buildleaderid), [--buildLeaderId](#-b---buildleaderid) CLI options or the [buildLeaderId](#buildleaderid) API option or `BUILD_LEADER_ID` environment variable.\n- The job configured with the [latest Node version](https://docs.travis-ci.com/user/languages/javascript-with-nodejs/#Specifying-Node.js-versions) (`node_js: node`).\n- The job configured with the [lts Node version](https://docs.travis-ci.com/user/languages/javascript-with-nodejs/#Specifying-Node.js-versions) (`node_js: lts/*`).\n- The job with the highest node version\n- The job with the highest job number if none of the jobs specify a node version (see [#42](https://github.com/semantic-release/travis-deploy-once/pull/42))\n\n**Note**: If multiple jobs match, the one with the highest job ID (which corresponds to the last one defined in `.travis.yml`) will be identified as the build leader.\n\n## CLI\n\n```bash\nUsage: travis-deploy-once.js [script]\n```\n\n### CLI usage with script argument\n\nRun the `script` passed in the first argument only if the current job is the build leader and all other jobs are successful and return with the exit code of the script. Return with exit code `0` otherwise.\n\nIn `.travis.yml`:\n\n```yaml\nlanguage: node_js\nnode_js:\n  - 8\n  - 6\n  - 4\nos:\n  - osx\n  - linux\nafter_success:\n  - npm install -g travis-deploy-once\n  - travis-deploy-once \"deploy-script --script-arg script-arg-value\"\n```\n\nThe script `deploy-script` will be called only for the node 8 job running on `linux`. It will be passed the arguments `--script-arg script-arg-value`.\n\n### CLI usage without script argument\n\nReturn with exit code `0` if the current job is the build leader and all other jobs are successful. Return with exit code `1` otherwise.\n\nIn `.travis.yml`:\n\n```yaml\nlanguage: node_js\nnode_js:\n  - 8\n  - 6\n  - 4\nos:\n  - osx\n  - linux\nafter_success:\n  - npm install -g travis-deploy-once\n  - travis-deploy-once && deploy-script --script-arg script-arg-value\n```\n\nThe script `deploy-script` will be called only for the node 8 job running on `linux`. It will be passed the arguments `--script-arg script-arg-value`.\n\n### CLI options\n\n#### -t, --githubToken\n\nType: `String`\nDefault: `GH_TOKEN` or `GITHUB_TOKEN` environment variable\n\nGitHub OAuth token.\n\n#### -b, --buildLeaderId\n\nType: `Number`\nDefault: `BUILD_LEADER_ID` environment variable\n\nDefine which Travis job will run the script (build leader). If not defined the build leader will be the Travis job running on the highest Node version.\n\n#### -p, --pro\n\nType: `Boolean`\nDefault: `false`\n\n`true` to use [Travis Pro](https://travis-ci.com), `false` to use [Travis for Open Source](https://travis-ci.org).\n\n#### -u, --travis-url\n\nType: `String`\nDefault: `TRAVIS_URL` environment variable\n\n[Travis Enterprise](https://enterprise.travis-ci.com) URL. If defined, the [-p, --pro](#-p---pro) option will be ignored.\n\n**Note**: This is the URL of the API endpoint, for example `https://travis.example.com/api`.\n\n#### -h, --help\n\nType: `Boolean`\n\nShow help.\n\n#### -v, --version\n\nType: `Boolean`\n\nShow version number.\n\n## API\n\n### API usage\n\n```bash\nnpm install --save travis-deploy-once\n```\n\nIn the module `my-module`:\n\n```js\nconst deployOnce = require('travis-deploy-once');\n\ntry {\n  const result = await deployOnce({travisOpts: {pro: true}, githubToken: 'xxxxxx', buildLeaderId: 1});\n\n  if (result === true) deployMyThing();\n  if (result === false) console.log('Some job(s) failed');\n  if (result === null) console.log('Did not run as the build leader');\n} catch (err) {\n  // something went wrong, and err will tell you what\n}\n```\n\nIn `.travis.yml`:\n\n```yaml\nlanguage: node_js\nnode_js:\n  - 8\n  - 6\n  - 4\nos:\n  - osx\n  - linux\nafter_success:\n  - npm run my-module\n```\n\nThe script `my-module` with be called for each node version on both OSs and `deployMyThing` will be called only for the node 8 job running on `linux`.\n\n### Function `deployOnce([options])`\n\nReturns a `Promise` that resolves to:\n- `true` if the current Travis job is the build leader, the current `script` phase is successful and all other job have completed successfully. => Your code can safely run.\n- `false` if at least one Travis job failed. => Your code should not run.\n- `null` if the current Travis job is **not** the build leader. => Your code should not run, and will be executed on the build leader.\n\nThrows an `Error` if:\n- It doesn't run on Travis.\n- The Github authentication token is missing.\n- The Github authentication token is not authorized with Travis.\n\n#### options\n\nType: `Object`\n\n##### githubToken\n\nType: `String`\nDefault: `process.env.GH_TOKEN` or `process.env.GITHUB_TOKEN`\n\nGitHub OAuth token.\n\n##### buildLeaderId\n\nType: `Number`\nDefault: `process.env.BUILD_LEADER_ID`\n\nDefine which Travis job will run the script (build leader). If not defined the build leader will be the Travis job running on the highest Node version.\n\n##### travisOpts\n\nType: `Object`\n\n###### pro\n\nType: `Boolean`\nDefault: `false`\n\n`true` to use [Travis Pro](https://travis-ci.com), `false` to use [Travis for Open Source](https://travis-ci.org).\n\n###### enterprise\n\nType: `String`\nDefault: `process.env.TRAVIS_URL`\n\n[Travis Enterprise](https://enterprise.travis-ci.com) URL. If defined, the [pro](#pro) option will be ignored.\n\n**Note**: This is the URL of the API endpoint, for example `https://travis.example.com/api`.\n","publish_time":1479398826188,"_cnpm_publish_time":1479398826188,"dist-tags":{"latest":"5.0.11","next":"2.0.0","node-0.10-support":"1.0.0-node-0.10-support"}}