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

💡 [Feature]: Deploy project Automatically Update the Application after Deployed to App Catalogue #243

Open
6gal6ler6 opened this issue Jun 2, 2024 · 4 comments
Assignees
Labels
👨‍💻 CLI for Microsoft 365 Requires to first extend CLI for Microsoft 365 ⭐ enhancement New feature or request ✏️prototype 🤔 research needs researching before I start hacking
Milestone

Comments

@6gal6ler6
Copy link

🎯 Aim of the feature

First, I want to thank all people who have been contributing to this amazing tool.

Now, lets get into my improvement idea, for an already amazing feature:

When using the feature Deploy project, it would be great if this could also allow the user to update the Application.

I am not 100% sure if this is something that could be implemented.

Still, I think this will benefit developers by adding that as an option for them, so they don’t have to go to the SPO Site Catalogue to update the App every time the package is deployed.

📷 Images (if possible) with expected result

Feature:

image

🤔 Additional remarks or comments

No response

@6gal6ler6 6gal6ler6 added the ⭐ enhancement New feature or request label Jun 2, 2024
@Adam-it
Copy link
Contributor

Adam-it commented Jun 2, 2024

Thank you for opening up this issue and for the positive feed.
I will try to research this and propose an implementation solution and in which milestone: v3.X or v4. it may fit

@Adam-it Adam-it added 🤔 research needs researching before I start hacking ✏️prototype labels Jun 2, 2024
@6gal6ler6
Copy link
Author

@Adam-it

This might help:

I created this small function with PnP PowerShell that now I am Using in my App Deployment to update the app.

function Update-SharePointApp {
    param(
        [Parameter(Mandatory=$true)]
        [string]$SharePointSite,
        [Parameter(Mandatory=$true)]
        [string]$AppName
    )

    try {
        # Connect to SharePoint Online
        Write-Host "Connecting to SharePoint Online site: $SharePointSite"
        Connect-PnPOnline -Url $SharePointSite #ADD CONNECTION METHOD

        # Get the app
        Write-Host "Getting the app: $AppName"
        $App = Get-PnPApp -Scope Site | Where-Object {$_.Title -eq $AppName}

        # Update the app
        Write-Host "Updating the app..."
        Update-PnPApp -Identity $App.Id -Scope Site

        Write-Host "App updated successfully."
    }
    catch {
        Write-Host "An error occurred: $_"
    }
}



Update-SharePointApp -SharePointSite "<MY_COOL_SPO_SITE>";

@nicodecleyre
Copy link
Contributor

Hi @6gal6ler6, @Adam-it,

Should be able with using spo app upgrade in src\services\CliActions.ts (deploy action)

@Adam-it
Copy link
Contributor

Adam-it commented Jun 10, 2024

yes indeed what you @nicodecleyre suggest is the way to go 👏👏👏. First of all SPFx Toolkit uses CLI for M365 under the hood so we may use the spo app upgrade command.
@6gal6ler6 thank you very much for the additional comment and research you gave. Unfortunately, PnP PS is not an option for SPFx Toolkit as PowerShell may not be used in node.js app directly and we may not also assume user will have PowerShell 7 installed on his local workspace. So we need to be using node.js based approach like CLI for M365.

I am still thinking/prototyping this feature in my head 😜. I apologize it is taking sooo long but I am trying to organize the chaos in my mind to wrap my head around more work.
the biggest challenge here is that spo app upgrade requires to siteUrl to be passed. This by default will extend this action with an additional step one might no always want to do so we should for sure:

  1. allow it to be customized turn on/off in extension settings
  2. add support for the site Url to be picked rather than type by hand/keyboard.

@Adam-it Adam-it added this to the v3.X milestone Jun 10, 2024
@Adam-it Adam-it added the 👨‍💻 CLI for Microsoft 365 Requires to first extend CLI for Microsoft 365 label Jun 22, 2024
@Adam-it Adam-it self-assigned this Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👨‍💻 CLI for Microsoft 365 Requires to first extend CLI for Microsoft 365 ⭐ enhancement New feature or request ✏️prototype 🤔 research needs researching before I start hacking
Projects
None yet
Development

No branches or pull requests

3 participants