{"id":19151683,"url":"https://github.com/cypress-io/deploy-bits","last_synced_at":"2025-04-19T16:31:59.064Z","repository":{"id":57105216,"uuid":"108212343","full_name":"cypress-io/deploy-bits","owner":"cypress-io","description":"Reusable deployment utilities, mostly geared towards S3 static sites","archived":false,"fork":false,"pushed_at":"2020-09-17T20:30:58.000Z","size":216,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-09T21:29:50.780Z","etag":null,"topics":["deploy","deployment","github","release","utility","website"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cypress-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-25T03:00:14.000Z","updated_at":"2020-09-17T20:29:49.000Z","dependencies_parsed_at":"2022-08-21T03:00:26.296Z","dependency_job_id":null,"html_url":"https://github.com/cypress-io/deploy-bits","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypress-io%2Fdeploy-bits","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypress-io%2Fdeploy-bits/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypress-io%2Fdeploy-bits/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypress-io%2Fdeploy-bits/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cypress-io","download_url":"https://codeload.github.com/cypress-io/deploy-bits/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223440157,"owners_count":17145336,"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":["deploy","deployment","github","release","utility","website"],"created_at":"2024-11-09T08:15:27.582Z","updated_at":"2024-11-09T08:15:28.243Z","avatar_url":"https://github.com/cypress-io.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @cypress/deploy-bits\n\n\u003e Reusable deployment utilities\n\n[![NPM][npm-icon] ][npm-url]\n\n[![ci status][ci image]][ci url]\n[![semantic-release][semantic-image] ][semantic-url]\n[![js-standard-style][standard-image]][standard-url]\n\n## Install\n\nRequires [Node](https://nodejs.org/en/) version 6 or above.\n\n```sh\nnpm install --save @cypress/deploy-bits\n```\n\n## Use\n\n### Debugging\n\nTo debug functions from this module, run the program with `DEBUG=deploy-bits` environment\nvariable.\n\n### isCI\n\nReturns `true` if the code is running on a common continuous integration server.\nUses [is-ci](https://github.com/watson/is-ci).\n\n```js\nconst {isCI} = require('@cypress/deploy-bits')\nif (isCI) {\n  // we are on CI\n}\n```\n\n### warnIfNotCI\n\nPrints a console warning if the code is not running on CI. Often we prefer deploying\nfrom CI rather than running the deploy command locally.\n\n```js\nconst {warnIfNotCI} = require('@cypress/deploy-bits')\nwarnIfNotCI()\n```\n\n### getDeployEnvironment\n\nReturns target deployment environment `staging` or `production`\n\n```js\nconst {getDeployEnvironment} = require('@cypress/deploy-bits')\ngetDeployEnvironment()\n  .then(env =\u003e ...)\n```\n\nIf the user specified environment using CLI `--environment \u003cname\u003e` option, it will be used.\nOtherwise, user will be prompted to select one.\n\n```\n? Which environment are you deploying?\n❯ Staging\n  Production\n```\n\nYou can pass list of arguments for this function to parse (by default it uses `process.argv`)\n```js\ngetDeployEnvironment(['--environment', 'staging']) // yields \"staging\"\n```\nand you can even pass [minimist](https://github.com/substack/minimist) parsing options\n```js\nconst options = {\n  alias: {\n    environment: 'e'\n  }\n}\ngetDeployEnvironment(['-e', 'staging']) // yields \"staging\"\n```\n\n### getBranch\n\nResolves with current branch.\n\n```js\nconst {getBranch} = require('@cypress/deploy-bits')\ngetBranch()\n  .then(branch =\u003e ...)\n```\n\n### checkBranchEnvFolder\n\nChecks the branch to environment mapping. For some branches checks if the working\ndirectory is clean (no modified source files). Always returns input environment name.\nCurried.\n\n```js\nconst {checkBranchEnvFolder} = require('@cypress/deploy-bits')\n// synchronous method\ncheckBranchEnvFolder('master')('production')\n// returns \"production\"\n// will throw an error if there are modified files\n```\n\n### getS3Config\n\nReturns S3 config loaded from environment variable or local file. If cannot find either,\nthrows an error.\n\n```js\nconst {getS3Config} = require('@cypress/deploy-bits')\nconst config = getS3Config()\n```\n\nTypical config file in `support/.aws-credentials.json` contains\n\n```json\n{\n  \"bucket-production\": \"\u003cproduction S3 folder name\u003e\",\n  \"bucket-staging\": \"\u003cstaging S3 folder name\u003e\",\n  \"key\": \"AWS API key\",\n  \"secret\": \"AWS API secret\"\n}\n```\n\n### getS3Publisher\n\nReturns an instance of [gulp-awspublish](https://github.com/pgherveou/gulp-awspublish)\n\n```js\nconst {getS3Config, getS3Publisher} = require('@cypress/deploy-bits')\nconst config = getS3Config()\nconst publisher = getS3Publisher(config['bucket-production'], config.key, config.secret)\n```\n\n### publishToS3\n\nUploads (diffs) a local folder to AWS S3 folder.\n\n```js\nconst {getS3Config, getS3Publisher, publishToS3} = require('@cypress/deploy-bits')\nconst config = getS3Config()\nconst publisher = getS3Publisher(config['bucket-production'], config.key, config.secret)\npublishToS3('dist/public', publisher)\n// returns a promise\n```\n\nNote: if a local folder contains `build.json` it will be uploaded with \"no cache\" headers.\n\n### uploadToS3\n\nNormal local folder upload to S3 using above functions.\n\n```js\nconst {uploadToS3} = require('@cypress/deploy-bits')\nuploadToS3('dist/public', 'production')\n  .then(...)\n```\n\n### Small print\n\nSupport: if you find any problems with this module, email / tweet /\n[open issue](https://github.com/cypress-io/deploy-bits/issues) on Github\n\n## MIT License\n\nCopyright (c) 2017 Cypress.io\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\n[npm-icon]: https://nodei.co/npm/@cypress/deploy-bits.svg?downloads=true\n[npm-url]: https://npmjs.org/package/@cypress/deploy-bits\n[ci image]: https://github.com/cypress-io/deploy-bits/workflows/ci/badge.svg?branch=master\n[ci url]: https://github.com/cypress-io/deploy-bits/actions\n[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[semantic-url]: https://github.com/semantic-release/semantic-release\n[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg\n[standard-url]: http://standardjs.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcypress-io%2Fdeploy-bits","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcypress-io%2Fdeploy-bits","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcypress-io%2Fdeploy-bits/lists"}