{"id":16350448,"url":"https://github.com/zspecza/traffic-control","last_synced_at":"2026-04-07T19:31:13.585Z","repository":{"id":57378796,"uuid":"60182524","full_name":"zspecza/traffic-control","owner":"zspecza","description":":vertical_traffic_light: Get a grip on staging","archived":false,"fork":false,"pushed_at":"2020-06-02T18:18:28.000Z","size":467,"stargazers_count":11,"open_issues_count":20,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-24T11:41:21.578Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zspecza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-01T14:09:25.000Z","updated_at":"2018-12-23T15:42:16.000Z","dependencies_parsed_at":"2022-09-02T21:20:54.541Z","dependency_job_id":null,"html_url":"https://github.com/zspecza/traffic-control","commit_stats":null,"previous_names":["declandewet/traffic-control"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/zspecza/traffic-control","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zspecza%2Ftraffic-control","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zspecza%2Ftraffic-control/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zspecza%2Ftraffic-control/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zspecza%2Ftraffic-control/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zspecza","download_url":"https://codeload.github.com/zspecza/traffic-control/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zspecza%2Ftraffic-control/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31526665,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-10-11T01:05:00.479Z","updated_at":"2026-04-07T19:31:13.564Z","avatar_url":"https://github.com/zspecza.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# traffic-control\n:vertical_traffic_light: Get a grip on staging\n\n## Concept\n\nThis adds a bar to the top of a website hosted on Netlify that uses the Github and Netlify APIs to visually communicate information about the staging environment and allow one-click production deploys. Here are some mockups of the concept:\n\n![When staging is far beyond production](/concept/staging-bar--ahead.png?raw=true)\n![When staging is in sync with production](/concept/staging-bar--synchronized.png?raw=true)\n![When staging has diverged behind production](/concept/staging-bar--diverged.png?raw=true)\n![When the user is unauthorized to view changes or deploy](/concept/staging-bar--unauthorized.png?raw=true)\n\n## Installation\n\nYou can grab the code from NPM:\n\n```sh\n$ npm i traffic-control -S\n```\n\nOr from NPM CDN:\n\n```html\n\u003cscript src=\"//npmcdn.com/traffic-control@0.1.1/dist/traffic-control.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nThe easiest way to get set up is by doing the following:\n\nFirst, load Netlify's OAuth helpers before your closing `\u003c/body\u003e` (`traffic-control` will load this automatically if not present, but doing this will make it much faster):\n\n```html\n\u003cscript src=\"https://app.netlify.com/authentication.js\"\u003e\u003c/script\u003e\n```\n\nAnd then load this script:\n\n```html\n\u003cscript src=\"//npmcdn.com/traffic-control@0.1.1/dist/traffic-control.min.js\"\u003e\u003c/script\u003e\n```\n\nThen, simply initiate the `trafficControl` function:\n\n```js\ntrafficControl({\n  repo: 'username/repo', // required. default is undefined.\n  productionBranch: 'master', // required. default is 'master'\n  stagingBranch: 'develop' // required. default is 'develop'\n})\n```\n\nA good place to put it is on your staging site via Netlify's script injection feature:\n\n![](https://infinit.io/_/3dSfWya.png)\n\nThe final step is to configure Github OAuth for your Netlify site. You can do that by following the instructions here: https://www.netlify.com/docs/authentication-providers\n\n## Goals\n\nEventually, I want to get rid of the dependency on Netlify and have this be its own Github integration. Keep eyes peeled!\n\n## Custom CSS\n\n`traffic-control`'s default styles are designed to have as little footprint as possible.\n\nUsing CSS, you can customize just about any element - simply use the ID `#traffic-control` as a namespace before every element.\n\n```css\n#traffic-control .tc-bar { /* custom styles */ }\n```\n\nYou can target specific states like so:\n\n```css\n#traffic-control.is-mounted {}\n#traffic-control.is-diverged {}\n#traffic-control.is-ahead {}\n#traffic-control.is-unauthorized {}\n/* ...etc... */\n```\n\n## Animations\n\n`traffic-control` ships with a tiny keyframe-based animation engine.\n\nIf an element does not have an `is-active` class, it should be hidden from view.\n\nWhen an element is about to be rendered, it will have an `is-entering` class.\nSimilarly, when an element is about to be hidden, it will have an `is-leaving` class.\n\nYou can animate enter/leave states using CSS `@keyframes`:\n\n```css\n#traffic-control .tc-bar.is-entering {\n  animation: slideIn .6s ease;\n}\n\n@keyframes slideIn {\n  from: {\n    transform: translateY(100%);\n  }\n  to: {\n    transform: translateY(0%);\n  }\n}\n```\n\nAnimations are intelligent enough to detect the `animationend` event before triggering any new logic.\n\n\u003e **Note**: animations are mandatory. Things will break if each element is not animated. This behavior is intentional and required to keep uniform behavior.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzspecza%2Ftraffic-control","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzspecza%2Ftraffic-control","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzspecza%2Ftraffic-control/lists"}