Skip to content

Instantly share code, notes, and snippets.

@giuleon
Last active October 16, 2017 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giuleon/abf2d03c4ca1cccad54311f114b74b2b to your computer and use it in GitHub Desktop.
Save giuleon/abf2d03c4ca1cccad54311f114b74b2b to your computer and use it in GitHub Desktop.
Automated deployment of your SharePoint Framework solution to Office 365 CDN
#################
# Configuration #
#################
$cdnSite = "https://giuleon.sharepoint.com/" # => CDN SharePoint site
$cdnLib = "cdn/SPFx-deploy" # => Document library and eventual folders
#######
# End #
#######
Write-Host ************************************************************************************** -ForegroundColor Yellow
Write-Host * Reading the cdnBasePath from write-manifests.json and collectiong the bundle files * -ForegroundColor Yellow
Write-Host ************************************************************************************** -ForegroundColor Yellow
$cdnConfig = Get-Content -Raw -Path .\config\copy-assets.json | ConvertFrom-Json
$bundlePath = Convert-Path $cdnConfig.deployCdnPath
$files = Get-ChildItem $bundlePath\*.*
Write-Host **************************************** -ForegroundColor Yellow
Write-Host Uploading the bundle on Office 365 CDN * -ForegroundColor Yellow
Write-Host **************************************** -ForegroundColor Yellow
Connect-PnPOnline $cdnSite -Credentials giuleon
foreach ($file in $files) {
$fullPath = $file.DirectoryName + "\" + $file.Name
Add-PnPFile -Path $fullPath -Folder $cdnLib
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment