{"id":20294220,"url":"https://github.com/teambit/bit-with-azure-devops","last_synced_at":"2025-04-11T11:42:52.507Z","repository":{"id":80427366,"uuid":"209249281","full_name":"teambit/bit-with-azure-devops","owner":"teambit","description":"A Bit integration with Azure.","archived":false,"fork":false,"pushed_at":"2022-12-12T15:58:51.000Z","size":166,"stargazers_count":2,"open_issues_count":1,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-25T08:03:26.358Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://bit.dev","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/teambit.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-18T07:46:12.000Z","updated_at":"2020-07-13T08:50:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"072d3e12-007d-406a-aaee-addff9c9c336","html_url":"https://github.com/teambit/bit-with-azure-devops","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teambit%2Fbit-with-azure-devops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teambit%2Fbit-with-azure-devops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teambit%2Fbit-with-azure-devops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teambit%2Fbit-with-azure-devops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teambit","download_url":"https://codeload.github.com/teambit/bit-with-azure-devops/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248385983,"owners_count":21094985,"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":[],"created_at":"2024-11-14T15:28:18.732Z","updated_at":"2025-04-11T11:42:52.487Z","avatar_url":"https://github.com/teambit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bit with Azure DevOps\n\n[![Slack](https://badgen.now.sh/badge/chat/on%20Slack/cyan)](https://join.slack.com/t/bit-dev-community/shared_invite/enQtNzM2NzQ3MTQzMTg3LWI2YmFmZjQwMTkxNmFmNTVkYzU2MGI2YjgwMmJlZDdkNWVhOGIzZDFlYjg4MGRmOTM4ODAxNTIxMTMwNWVhMzg)\n\nHow to integrate Bit in your workflow with Azure DevOps.\n\n## npm install for [Bit components](https://github.com/teambit/bit) during CI (for projects that install components)\n\n- Create new Pipelines and link your GitHub project.\n- Clone your repo.\n- In the panel click \"Edit\" to open the yml file, then click on \"Variables\".\n- Click on \"New variable\", set Name to \"BIT_TOKEN\", and set Value need to be your bit token(bit config get user.token), then click on Save.\n- Create another variable and set Name to \"BIT_COLLECTION\", and the value to your bit collection that you want to export.\n- In your project root directory add an `.npmrc` file and put the following code inside:\n\n```\n@bit:registry=https://node.bit.dev\n//node.bit.dev/:_authToken=$BIT_TOKEN\nalways-auth=true\n```\ncreate also `.env.local` file in your project root directory to be able to install localy from the registry:\n```\nBIT_TOKEN=\u003ccopy the value you get from this: bit config get user.token\u003e\n```\n- Create an `npm-ci.sh` file in your project root directory with the following commands:\n```\nnpm install\n```\nthis will install all the dependencies from the pacakge.json.\n- Edit the `azure-pipelines.yml` file, with the following commands in script section:\n```\n- script: |\n    ./npm-ci.sh\n```\nMake sure the file has execution permissions by running `chmod +x ./npm-ci.sh`.\n- Now you can run the pipelines and the build should work.\nLearn more about [variables in Azure DevOps](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops\u0026tabs=yaml%2Cbatch)\n\n## bit import from private components during CI \nIf you project import a component from with `bit import ...`, and your package.json have a dependencies with a locale link to components folder like this, follow the following setups:\n```\n\"@bit/\u003cUSER-NAME\u003e.\u003cCOLLECTION-NAME\u003e.\u003cCOMPONENT-ID\u003e\": \"file:./components/\u003cCOMPONENT-ID\u003e\"\n```\n- Edit the `npm-ci.sh` and add this command: `npm install bit-bin -g`, now the file should look like this:\n```\nnpm install\nnpm install bit-bin -g\n```\n- Add this command in your package.json to import the components and build them:  \n```\n\"scripts\": {\n    ...\n    \"bit-build\": \"bit -v \u0026\u0026 bit import \u0026\u0026 bit build\"\n  },\n```\n- Edit the `azure-pipelines.yml`file to configure bit on the server and to run the `bit-build` command before building the project:\n```\n- script: |\n    ./npm-ci.sh\n    \n    bit config set analytics_reporting false\n    bit config set anonymous_reporting false\n    bit config set user.token $(BIT_TOKEN)\n    bit config \n \n    npm run bit-build\n    npm run build\n\n  displayName: 'npm install \u0026 build'\n```\n\n## bit export to private collection during CI\n- Create a private collection in [bit.dev](bit.dev).\n- Import the [compiler you need](https://bit.dev/bit/envs).\n- Track, Tag and export components to your collection, [Alert component for example](src/components/Alert.js).\n- Modify the `azure-pipelines.yml` file, and add the bit tag and bit export commands after the build:\n```\n- script: |\n    ./npm-ci.sh\n    \n    bit config set analytics_reporting false\n    bit config set anonymous_reporting false\n    bit config set user.token $(BIT_TOKEN)\n    bit config \n \n    npm run bit-build\n    npm run build\n    \n    bit status\n    bit tag -a\n    bit export $(BIT_COLLECTION)\n\n  displayName: 'npm install \u0026 bit config \u0026 npm build \u0026 bit export components if needed'\n```\n\n## git commit back after exported new version components during CI\n- First you need to allow azure to do this changes, follow this setups in [azure](https://docs.microsoft.com/en-us/azure/devops/pipelines/scripts/git-commands?view=azure-devops\u0026tabs=yaml).\n- Create a `git-ci.sh` file in the root of your project, and add the following commands:\n```\ngit config --global user.email \"you@example.com\"\ngit config --global user.name \"Your Name\"\ngit checkout master\ngit add .\ngit commit -m \"This is a commit message from azure pipelines [skip ci]\"\ngit push -u origin master\n```\nMake sure the file has execution permissions by running `chmod +x ./git-ci.sh`. \n- Edit the `azure-pipelines.yml` file and add just one line to run this file:\n```\n- script: |\n    ./npm-ci.sh\n    \n    bit config set analytics_reporting false\n    bit config set anonymous_reporting false\n    bit config set user.token $(BIT_TOKEN)\n    bit config \n \n    npm run bit-build\n    npm run build\n    \n    bit status\n    bit tag -a\n    bit export $(BIT_COLLECTION)\n\n    ./git-ci.sh\n\n  displayName: 'npm install \u0026 bit config \u0026 npm build \u0026 bit export components if needed \u0026 git commit back'\n```\n- Now you can change your components, and commit the changes, and every thing should work in the CI.\n- After this, the workspace need be update with all the changes the CI do with new version of components, to do this just run the following command to get all the updates:\n```\ngit pull\nbit import\n```\n### Get help\n\nGet [help on Slack here](https://join.slack.com/t/bit-dev-community/shared_invite/enQtNzM2NzQ3MTQzMTg3LWI2YmFmZjQwMTkxNmFmNTVkYzU2MGI2YjgwMmJlZDdkNWVhOGIzZDFlYjg4MGRmOTM4ODAxNTIxMTMwNWVhMzg).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteambit%2Fbit-with-azure-devops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteambit%2Fbit-with-azure-devops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteambit%2Fbit-with-azure-devops/lists"}