Conversation
Summary of ChangesHello @axeldelafosse, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the developer experience by introducing an automated script for patch releases, simplifying the versioning and tagging process. Concurrently, it refines the application's self-update mechanism to immediately apply new versions, providing a more direct and efficient update experience. These changes are supported by updated documentation and adjusted test cases. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Superseded by clean PR #10, which contains only the release:patch and README changes (this PR had older unrelated commit). |
There was a problem hiding this comment.
Code Review
This pull request introduces a new release:patch script for easier version bumping and tag pushing. It also refactors the update mechanism to allow for direct application of updates, alongside the existing staging mechanism for auto-updates. The documentation and tests have been updated to reflect these changes. Overall, the changes improve the release process and provide more flexible update handling.
| const checkAndApply = async ( | ||
| assetName: string, | ||
| silent: boolean | ||
| ): Promise<void> => { | ||
| const currentVersion = getCurrentVersion(); | ||
| const release = await fetchLatestRelease(); | ||
| const version = release.tag_name.replace(VERSION_PREFIX_RE, ""); | ||
|
|
||
| if (!isNewerVersion(version, currentVersion)) { | ||
| if (!silent) { | ||
| console.log(`[loop] already up to date (v${currentVersion})`); | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| const asset = release.assets.find((a) => a.name === assetName); | ||
| if (!asset) { | ||
| throw new Error(`No release asset for ${assetName}`); | ||
| } | ||
|
|
||
| if (!silent) { | ||
| console.log(`[loop] downloading v${version}...`); | ||
| } | ||
|
|
||
| const checksumAsset = release.assets.find( | ||
| (a) => a.name === `${assetName}.sha256` | ||
| ); | ||
| const binary = await downloadBinary( | ||
| asset.browser_download_url, | ||
| checksumAsset?.browser_download_url | ||
| ); | ||
| applyBinary(binary); | ||
|
|
||
| if (!silent) { | ||
| console.log(`[loop] v${version} applied`); | ||
| } | ||
| }; |
There was a problem hiding this comment.
The checkAndApply function duplicates a significant amount of logic already present in checkAndStage. To reduce redundancy and improve maintainability, consider extracting the common logic (fetching release, version comparison, asset finding, and initial logging) into a shared helper function. This suggestion refactors checkAndApply to use such a helper, which is included in the suggestion.
const getUpdateInfo = async (assetName: string, silent: boolean) => {
const currentVersion = getCurrentVersion();
const release = await fetchLatestRelease();
const version = release.tag_name.replace(VERSION_PREFIX_RE, "");
if (!isNewerVersion(version, currentVersion)) {
if (!silent) {
console.log(`[loop] already up to date (v${currentVersion})`);
}
return null;
}
const asset = release.assets.find((a) => a.name === assetName);
if (!asset) {
throw new Error(`No release asset for ${assetName}`);
}
if (!silent) {
console.log(`[loop] downloading v${version}...`);
}
const checksumAsset = release.assets.find(
(a) => a.name === `${assetName}.sha256`
);
return { version, asset, checksumAsset };
};
const checkAndApply = async (
assetName: string,
silent: boolean
): Promise<void> => {
const updateInfo = await getUpdateInfo(assetName, silent);
if (!updateInfo) {
return;
}
const { version, asset, checksumAsset } = updateInfo;
const binary = await downloadBinary(
asset.browser_download_url,
checksumAsset?.browser_download_url
);
applyBinary(binary);
if (!silent) {
console.log(`[loop] v${version} applied`);
}
};
Summary
release:patchscript topackage.json:npm version patch && git push --follow-tagsREADME.mdto document patch release using the new script:bun run release:patchWhy
Files Changed
package.jsonREADME.mdTesting