Git branches support#148
Conversation
- added a utility function `get-current-git-branch` that gets the git branch of the current workspace. The branch can be string | null - we don't have a git branch if: either the project is not version controlled or the file is not a part of the current workspace folder, which was already taken in account - updated the global state object type to also include the branch name - now remaining is to include the branches on the server side
- added the branches table schema - updated the files schema to remove the project_id and replaced it by branch_id - generated and ran migrations scripts, adding necessary adjustments to safely put the branch table between projects and files, generate default branch main for each project link all files of a project to that main branch before safely deleting the project_id column from the files table
- generated the branches module with the basic functions in the branches.service: create, findOne and update - updated the files service to use the branchId instead of the projectId - updated the extension service upsertFiles method to take the branches in account: upsert the projects first, then the branches and finally the files - updated the vscode extension to use "N/A" when the branch is null (for a non-version controlled project), so the branch is always a string - updated the files impacted by that change in both the extension and in the extension.dto in the api
- updated the projects analytics methods to include the new relationship in consideration of the branches, with the proper joins between tables and calculations if necessary - updated all the files that were affected by the change of the endpoints schemas of projects analytics in the dashboard - used the nullish coalescing assignment to initialize `updatedBranches[projectPath]` while avoiding runtime errors - added tests files to the list of files to ignore during the api build in its `tsconfig.build.json` file
- added a default value for branchName for backward compatibility reasons (a user still have an old version of the extension that doesn't send the branches to the server) - renamed back projectName to name for the same reasons to prevent an old version of the dashboard requests to be refused by the server
- updated the general structure of the file sync data, which is also saved the global state of the extension and used as filesData in the extension, updated all affected functions to match that new shape - updated the `getFilesForDay` and `upsertFiles` methods of the extension.service to support that new data shape meanwhile keeping backward compatibility to avoid breaking the extension for consumers of old versions - updated the `findAll` method of the filesService to return an array instead of an object
- added a new trpc procedure `analytics.projects.getProjectBranchesOnPeriod` - added a dropdown menu to select branches on projects - that dropdown only shows up if the project is version controlled - created a zustand store to keep track of projects selected - the store automatically updates the url to add the branches selected as search params - the branches state of the store is reset between navigations
- pulled the selected branches from the store and added them to the queries in the dashboard for all trpc procedures where it can be passed
- added tests for the branchesService and updated the tests of the filesService
- updated and fixed all broken tests as well as added tests for new methods in the projects analytics and extension modules (router and service) - updated the `vitest.config.ts` file to generate the tests coverage report even if there are failing tests
- tested both the presence and absence of the branches parameter for the projects analytics service methods using it
- added the git branches tracking feature to the features section on the landing page
- bumped the extension version to `v0.0.70`
|
Important Review skippedToo many files! This PR contains 62 files, which is 12 over the limit of 50. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (62)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Commits
feat: git branches support
get-current-git-branchthat gets the git branch of the current workspace. The branch can be string | nullfeat: database migrations
project_idand replaced it bybranch_idproject_idcolumn from the files tablefeat: branches api
feat: analytics branches
updatedBranches[projectPath]while avoiding runtime errors in the extensionServicetsconfig.build.jsonfilechore: backward compatibility
fix: branching
getFilesForDayandupsertFilesmethods of the extension.service to support that new data shape meanwhile keeping backward compatibility to avoid breaking the extension for consumers of old versionsfindAllmethod of the filesService to return an array instead of an objectfeat: branching dashboard
analytics.projects.getProjectBranchesOnPeriodfeat: branching
test: branchesService
test: fix and update tests
vitest.config.tsfile to generate the tests coverage report even if there are failing teststest: projects analytics
feat: web app
chore: extension version
v0.0.70