Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Add command to increase project version and implement version increment logic, Closes #94 #387

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

nicodecleyre
Copy link
Contributor

🎯 Aim

This pull request increases the version of the package.json & package-solution.json file with either major, minor or patch

📷 Result

Untitled.video.-.Made.with.Clipchamp.14.mp4

✅ What was done

clarify what was done and what still needs to be finished ex. [Remove this line]

  • added button to increase version
  • created prompt that asks for 'major', 'minor' or 'patch' when clicking on the button
  • increasing the number with function in separate file
  • Change the increased number in package.json
  • Change the increased number in package-solution.json (with an extra '0' at the end for the revision so the format is X.X.X.0)

🔗 Related issue

Closes: #94

@Adam-it Adam-it self-assigned this Jan 3, 2025
Copy link
Member

@Adam-it Adam-it left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicodecleyre awesome work so far. I added some small fixup to your branch. I left also two comments that we could recheck before we merge.

Comment on lines +7 to +13
const wsFolder = workspace.workspaceFolders?.[0];
if (!wsFolder) {
throw new Error('Workspace folder not found');
}

const packageJsonPath = join(wsFolder.uri.fsPath, 'package.json');
const packageSolutionPath = join(wsFolder.uri.fsPath, 'config/package-solution.json');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will not work when the SPFx project was created by TeamsToolkit. We should also support that case.
In case TT created a project that uses SPFx project then the SPFx part is in a src subcatalog.
I took a screenshot of the result when we use SPFx Toolkit in a project created by TT.
image

We already have some parts in SPFx Toolkit that add this support and check. Like here

let launchFiles = await workspace.findFiles('.vscode/launch.json', '**/node_modules/**');
if (!launchFiles || launchFiles.length <= 0) {
launchFiles = await workspace.findFiles('src/.vscode/launch.json', '**/node_modules/**');
}

@@ -302,6 +306,7 @@ export class CommandPanel {
actionCommands.push(new ActionTreeItem('Upgrade project SPFx version', '', { name: 'arrow-up', custom: false }, undefined, Commands.upgradeProject));
actionCommands.push(new ActionTreeItem('Validate project correctness', '', { name: 'check-all', custom: false }, undefined, Commands.validateProject));
actionCommands.push(new ActionTreeItem('Rename project', '', { name: 'whole-word', custom: false }, undefined, Commands.renameProject));
actionCommands.push(new ActionTreeItem('Increase project version', '', { name: 'arrow-up', custom: false }, undefined, Commands.increaseVersion));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets pick a different icon. This one is already used in upgrade action which may be just confusing.
we may use any icon from this
https://microsoft.github.io/vscode-codicons/dist/codicon.html
what do you think about fold-up icon 🤔

@Adam-it Adam-it marked this pull request as draft January 3, 2025 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants