You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

219 lines
9.2 KiB

  1. # Contributing
  2. 👍🎉 First off, thanks for taking the time to contribute! 🎉👍
  3. When contributing to this project, please first discuss the changes you wish to make via an issue before making changes.
  4. Please note the [Code of Conduct](CODE_OF_CONDUCT.md) document, please follow it in all your interactions with this project.
  5. ## Your First Code Contribution
  6. Unsure where to begin contributing? You can start by looking through the [`help-wanted`](https://github.com/gitkraken/vscode-gitlens/labels/help-wanted) issues.
  7. ### Getting the code
  8. ```
  9. git clone https://github.com/gitkraken/vscode-gitlens.git
  10. ```
  11. Prerequisites
  12. - [Git](https://git-scm.com/), `>= 2.7.2`
  13. - [NodeJS](https://nodejs.org/), `>= 16.14.2`
  14. - [yarn](https://yarnpkg.com/), `>= 1.22.19`
  15. ### Dependencies
  16. From a terminal, where you have cloned the repository, execute the following command to install the required dependencies:
  17. ```
  18. yarn
  19. ```
  20. ### Build
  21. From a terminal, where you have cloned the repository, execute the following command to re-build the project from scratch:
  22. ```
  23. yarn run rebuild
  24. ```
  25. 👉 **NOTE!** This will run a complete rebuild of the project.
  26. Or to just run a quick build, use:
  27. ```
  28. yarn run build
  29. ```
  30. ### Watch
  31. During development you can use a watcher to make builds on changes quick and easy. From a terminal, where you have cloned the repository, execute the following command:
  32. ```
  33. yarn run watch
  34. ```
  35. Or use the provided `watch` task in VS Code, execute the following from the command palette (be sure there is no `>` at the start):
  36. ```
  37. task watch
  38. ```
  39. This will first do an initial full build and then watch for file changes, compiling those changes incrementally, enabling a fast, iterative coding experience.
  40. 👉 **Tip!** You can press <kbd>CMD+SHIFT+B</kbd> (<kbd>CTRL+SHIFT+B</kbd> on Windows, Linux) to start the watch task.
  41. 👉 **Tip!** You don't need to stop and restart the development version of Code after each change. You can just execute `Reload Window` from the command palette.
  42. ### Formatting
  43. This project uses [prettier](https://prettier.io/) for code formatting. You can run prettier across the code by calling `yarn run pretty` from a terminal.
  44. To format the code as you make changes you can install the [Prettier - Code formatter](https://marketplace.visualstudio.com/items/esbenp.prettier-vscode) extension.
  45. Add the following to your User Settings to run prettier:
  46. ```
  47. "editor.formatOnSave": true,
  48. ```
  49. ### Linting
  50. This project uses [ESLint](https://eslint.org/) for code linting. You can run ESLint across the code by calling `yarn run lint` from a terminal. Warnings from ESLint show up in the `Errors and Warnings` quick box and you can navigate to them from inside VS Code.
  51. To lint the code as you make changes you can install the [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension.
  52. ### Bundling
  53. To generate a production bundle (without packaging) run the following from a terminal:
  54. ```
  55. yarn run bundle
  56. ```
  57. To generate a VSIX (installation package) run the following from a terminal:
  58. ```
  59. yarn run package
  60. ```
  61. ### Debugging
  62. #### Using VS Code (desktop)
  63. 1. Open the `vscode-gitlens` folder
  64. 2. Ensure the required [dependencies](#dependencies) are installed
  65. 3. Choose the `Watch & Run` launch configuration from the launch dropdown in the Run and Debug viewlet and press `F5`.
  66. _Note: If you see a pop-up with a message similar to "The task cannot be tracked. Make sure to have a problem matcher defined.", you will need to install the [TypeScript + Webpack Problem Matchers](https://marketplace.visualstudio.com/items?itemName=amodio.tsl-problem-matcher) extension._
  67. #### Using VS Code (desktop webworker)
  68. 1. Open the `vscode-gitlens` folder
  69. 2. Ensure the required [dependencies](#dependencies) are installed
  70. 3. Choose the `Watch & Run (web)` launch configuration from the launch dropdown in the Run and Debug viewlet and press `F5`.
  71. #### Using VS Code for the Web (locally)
  72. See https://code.visualstudio.com/api/extension-guides/web-extensions#test-your-web-extension-in-a-browser-using-vscodetestweb
  73. 1. Open the `vscode-gitlens` folder
  74. 2. Ensure the required [dependencies](#dependencies) are installed
  75. 3. Run the `build` or `watch` task from the command palette
  76. 4. Run the `Run (local web)` task from the command palette
  77. #### Using VS Code for the Web (vscode.dev)
  78. See https://code.visualstudio.com/api/extension-guides/web-extensions#test-your-web-extension-in-vscode.dev
  79. 1. Open the `vscode-gitlens` folder
  80. 2. Ensure the required [dependencies](#dependencies) are installed
  81. 3. Run the `build` or `watch` task from the command palette
  82. 4. Run the `Run (vscode.dev)` task from the command palette
  83. ## Submitting a Pull Request
  84. Please follow all the instructions in the [PR template](.github/PULL_REQUEST_TEMPLATE.md).
  85. ### Contributions to GitLens+ Licensed Files
  86. This repository contains both OSS-licensed and non-OSS-licensed files. All files in or under any directory named "plus" fall under LICENSE.plus. The remaining files fall under LICENSE, the MIT license.
  87. If a pull request is submitted which contains changes to files in or under any directory named "plus", then you agree that GitKraken and/or its licensors (as applicable) retain all right, title and interest in and to all such modifications and/or patches.
  88. ### Update the CHANGELOG
  89. The [Change Log](CHANGELOG.md) is updated manually and an entry should be added for each change. Changes are grouped in lists by `added`, `changed`, `removed`, or `fixed`.
  90. Entries should be written in future tense:
  91. - Be sure to give yourself much deserved credit by adding your name and user in the entry
  92. > Added
  93. >
  94. > - Adds awesome feature &mdash; closes [#\<issue\>](https://github.com/gitkraken/vscode-gitlens/issues/<issue>) thanks to [PR #\<pr\>](https://github.com/gitkraken/vscode-gitlens/issues/<pr>) by Your Name ([@\<your-github-username\>](https://github.com/<your-github-username>))
  95. >
  96. > Changed
  97. >
  98. > - Changes or improves an existing feature &mdash; closes [#\<issue\>](https://github.com/gitkraken/vscode-gitlens/issues/<issue>) thanks to [PR #\<pr\>](https://github.com/gitkraken/vscode-gitlens/issues/<pr>) by Your Name ([@\<your-github-username\>](https://github.com/<your-github-username>))
  99. >
  100. > Fixed
  101. >
  102. > - Fixes [#\<issue\>](https://github.com/gitkraken/vscode-gitlens/issues/<issue>) a bug or regression &mdash; thanks to [PR #\<pr\>](https://github.com/gitkraken/vscode-gitlens/issues/<pr>) by Your Name ([@\<your-github-username\>](https://github.com/<your-github-username>))
  103. ### Update the README
  104. If this is your first contribution to GitLens, please give yourself credit by adding yourself to the `Contributors` section of the [README](README.md#contributors-) in the following format:
  105. > - `Your Name ([@<your-github-username>](https://github.com/<your-github-username>)) &mdash; [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=<your-github-username>)`
  106. ## Publishing
  107. ### Stable Releases
  108. #### Versioning
  109. GitLens version changes are bucketed into two types:
  110. - `minor`: normal release (new features, enhancements and fixes)
  111. - `patch`: hotfix release (just fixes)
  112. <small>Note: `major` version bumps are only considered for more special circumstances.</small>
  113. #### Preparing
  114. Use the [prep-release](scripts/prep-release.js) script to prepare a new release. The script updates the [package.json](package.json) and [CHANGELOG.md](CHANGELOG.md) appropriately, commits the changes as `Bumps to v<major.minor.patch>`, and creates a `v<major.minor.patch>` tag which when pushed will trigger the CI to publish a release.
  115. 1. Ensure you are on a clean working tree
  116. 2. Run `yarn run prep-release` and enter the desired version when prompted.
  117. 3. Review the `Bumps to v<major.minor.patch>` commit
  118. 4. Run `git push --follow-tags` to push the commit and tag
  119. Pushing the `v<major.minor.patch>` tag will trigger the [Publish Stable workflow](.github/workflows/cd-stable.yml) to automatically package the extension, create a [GitHub release](https://github.com/gitkraken/vscode-gitlens/releases/latest), and deploy it to the [VS Marketplace](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens).
  120. If the action fails and retries are unsuccessful, the VSIX can be built locally with `yarn package` and uploaded manually to the marketplace. A GitHub release can also be [created manually](https://github.com/gitkraken/vscode-gitlens/releases/new) using `v<major.minor.patch>` as the title and the notes from the [CHANGELOG.md](CHANGELOG.md) with the VSIX attached.
  121. ### Pre-releases
  122. The [Publish Pre-release workflow](.github/workflows/cd-pre.yml) is automatically run every AM unless no new changes have been committed to `main`.
  123. ### Insiders (deprecated use pre-release instead)
  124. The Publish Insiders workflow is no longer available and was replaced with the pre-release edition.
  125. ## Updating GL Icons
  126. To add new icons to the GL Icons font follow the steps below:
  127. - Add new SVG icons to the `images/icons` folder
  128. - Update the `images/icons/mappings.json` file with entries for the new icons (append to the end of the file)
  129. - Optimize and build the icons by running the following from a terminal:
  130. ```
  131. yarn run icons:svgo
  132. yarn run build:icons
  133. ```
  134. Once you've finshed copy the new `glicons.woff2?<uuid>` URL from `src/webviews/apps/shared/glicons.scss` and search and replace the old references with the new one.