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

Added tour response for Upgrade and Validate actions, Closes #188 #323

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

nicodecleyre
Copy link
Contributor

🎯 Aim

Adding the tour options and both md & tour options as settings for the upgrade and validate actions

📷 Result

image

✅ What was done

  • Added Md, Tour, Both as upgrade options in the settings
  • Added Md, Tour, Both as validate options in the settings
  • Added tour logic to code for the upgrade option
  • Added tour logic to code for the validate option

🔗 Related issue

Closes: #188

@nicodecleyre nicodecleyre changed the title First commit Added tour response for Upgrade and Validate actions, Closes #188 Oct 13, 2024
@Adam-it
Copy link
Contributor

Adam-it commented Oct 13, 2024

Awesome. Thank you for another awesome contribution. I will review it ASAP

@Adam-it Adam-it self-assigned this Oct 13, 2024
Copy link
Contributor

@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 tested it and works really good. During my tests and review I noticed some small details we could sort out before we merge 👍
Please do give them a double check 🙏

src/services/actions/CliActions.ts Outdated Show resolved Hide resolved
src/services/actions/CliActions.ts Outdated Show resolved Hide resolved
src/services/actions/CliActions.ts Outdated Show resolved Hide resolved
src/services/actions/CliActions.ts Outdated Show resolved Hide resolved
src/services/actions/CliActions.ts Outdated Show resolved Hide resolved
@Adam-it Adam-it marked this pull request as draft October 14, 2024 23:46
@Adam-it
Copy link
Contributor

Adam-it commented Oct 14, 2024

@nicodecleyre I also did some merging to the dev branch. May I kindly ask you to rebase against latest dev

@Adam-it
Copy link
Contributor

Adam-it commented Oct 19, 2024

@nicodecleyre we just rebased dev branch with latest main.
May I kindly ask you to align your branch 🙏 Cheers

@nicodecleyre nicodecleyre force-pushed the Tour-response-for-Upgrade-and-Validate-#188 branch 3 times, most recently from aa49dd8 to 67811be Compare October 21, 2024 18:36
@nicodecleyre
Copy link
Contributor Author

@nicodecleyre we just rebased dev branch with latest main. May I kindly ask you to align your branch 🙏 Cheers

Still working on it, having a little trouble with the rebase 😆

@nicodecleyre nicodecleyre force-pushed the Tour-response-for-Upgrade-and-Validate-#188 branch from 67811be to f36347f Compare October 22, 2024 20:13
@nicodecleyre nicodecleyre marked this pull request as ready for review October 22, 2024 20:15
@Adam-it Adam-it changed the base branch from main to dev October 30, 2024 06:27
Copy link
Contributor

@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 I think we are in a much better state now. I played with it a lot and I think it is a nice feature. I noticed some two small improvements we could double check before we proceed but those are not that important I guess.

What is my main concern, and this is more a question if you experienced the same behavior, is:
when I had both for validation and upgrade I noticed that sometimes when clicked on the upgrade action even though the tour was generated and the json was present te codeTour extension did not start it but instead it asked which tour should it run and none was available? I was wondering if the tour extension triggered just before the tour json was present 🤔 Maybe we could add a bit of wait as I checked this is already awaited so I am not sure why this behavior and I would need a bit deeper dive on this myself
image

And then the strange part. When I had the validation tour created first and then I clicked on the upgrade action the extension kicked of the validation tour 😮 instead of asking which tour should be triggered?
image

I was wondering did you maybe researched if there was a way to pass down to codeTour which specific tour should start, so we could avoid the picker when we have both the validation and upgrade tours? I will try to research this myself as well.

Other than the above concerns/questions I think we are all good and getting closer to get this merged 👍👍I wanted to make this feature perfect before we proceed 🤩. I will try to recheck some of the stuff mentioned above myself next week

Comment on lines +486 to +494
if (projectUpgradeOutputMode === 'markdown') {
resultMd = await CliExecuter.execute('spfx project upgrade', 'md');
CliActions.handleMarkdownResult(resultMd, wsFolder, 'upgrade');
} else if (projectUpgradeOutputMode === 'code tour') {
await CliExecuter.execute('spfx project upgrade', 'tour');
CliActions.handleTourResult(wsFolder, 'upgrade');
} else {
resultMd = await CliExecuter.execute('spfx project upgrade', 'md');
await CliExecuter.execute('spfx project upgrade', 'tour');
Copy link
Contributor

Choose a reason for hiding this comment

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

I was wondering if we could just have if blocks in which we check for either the specific type/method, like markdown or tour and check for both. In this case we don't need to check explicitly for both and we will avoid code repetition. What do you think? I guess it should work

Suggested change
if (projectUpgradeOutputMode === 'markdown') {
resultMd = await CliExecuter.execute('spfx project upgrade', 'md');
CliActions.handleMarkdownResult(resultMd, wsFolder, 'upgrade');
} else if (projectUpgradeOutputMode === 'code tour') {
await CliExecuter.execute('spfx project upgrade', 'tour');
CliActions.handleTourResult(wsFolder, 'upgrade');
} else {
resultMd = await CliExecuter.execute('spfx project upgrade', 'md');
await CliExecuter.execute('spfx project upgrade', 'tour');
if (projectUpgradeOutputMode === 'markdown' || projectUpgradeOutputMode === 'both') {
resultMd = await CliExecuter.execute('spfx project upgrade', 'md');
CliActions.handleMarkdownResult(resultMd, wsFolder, 'upgrade');
}
if (projectUpgradeOutputMode === 'code tour' || projectUpgradeOutputMode === 'both') {
await CliExecuter.execute('spfx project upgrade', 'tour');
CliActions.handleTourResult(wsFolder, 'upgrade');
}```

if (fs.existsSync(tourFilePath)) {
await commands.executeCommand('codetour.startTour');
} else {
Notifications.error('Validation tour file not found. Cannot start Code Tour.');
Copy link
Contributor

Choose a reason for hiding this comment

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

the error may be misleading as it may not always be the validation tour but also it may be the upgrade tour

@Adam-it Adam-it marked this pull request as draft October 30, 2024 14:23
@nicodecleyre
Copy link
Contributor Author

Hi Adam, you're right, there seems to be a sort of hickup. It seems that the setup right now "still lives in the past". I did some testing and this are the results:

  • run validate: no code tour selectable
  • run validate: validate code tour selectable
  • run upgrade: validate code tour selectable
  • run validate: validate & upgrade code tour selectable.

So it seems that only the tour from the previous run is selectable. Timeout doesn't seem to solve the problem right away. Will have to dig deeper.

@Adam-it
Copy link
Contributor

Adam-it commented Nov 15, 2024

Hi Adam, you're right, there seems to be a sort of hickup. It seems that the setup right now "still lives in the past". I did some testing and this are the results:

  • run validate: no code tour selectable
  • run validate: validate code tour selectable
  • run upgrade: validate code tour selectable
  • run validate: validate & upgrade code tour selectable.

So it seems that only the tour from the previous run is selectable. Timeout doesn't seem to solve the problem right away. Will have to dig deeper.

I wonder if we could open a issue in the code tour extension repo to ask for some advice 🤔?

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.

💡 [Feature]: The Upgrade and Validate actions could return also code tour response
2 participants