diff --git a/wc-grid-examples-react.yml b/wc-grid-examples-react.yml index 7ed836e..cfa405a 100644 --- a/wc-grid-examples-react.yml +++ b/wc-grid-examples-react.yml @@ -132,6 +132,35 @@ stages: # (cd "$dir" && npx ig upgrade-packages --skip-install) # fi # done + + - task: PowerShell@2 + displayName: 'Replace references to IG trial packages with licensed ones' + inputs: + failOnStderr: true + showWarnings: true + workingDirectory: '$(Build.SourcesDirectory)' + targetType: 'inline' + script: | + $packageJson = Get-Content -Raw .\package.json | ConvertFrom-Json + $properties = $packageJson.dependencies.PSObject.Properties ` + | where-object { $_.Name.StartsWith("igniteui-react") -or $_.Name.StartsWith("igniteui-dockmanager") } + + foreach( $property in $properties ) + { + $oldName = $property.Name; + $newName = "@infragistics/" + $oldName + + # remember the current value of the old property + $value = $property.Value; + + # remove reference to the trial package reference + $packageJson.dependencies.psobject.Properties.Remove($oldName); + + # add reference to the licensed package reference + $packageJson.dependencies | Add-Member -NotePropertyName $newName -NotePropertyValue $value; + } + + ConvertTo-Json -InputObject $packageJson | Set-Content -Path .\package.json - task: Npm@1 displayName: 'npm install --legacy-peer-deps' @@ -141,6 +170,18 @@ stages: workingDir: '$(Build.SourcesDirectory)' customCommand: 'install --legacy-peer-deps' + - task: PowerShell@2 + displayName: 'Replace references to IG trial packages with licensed ones in TSX files' + inputs: + failOnStderr: true + showWarnings: true + workingDirectory: '$(Build.SourcesDirectory)' + targetType: 'inline' + script: | + Get-ChildItem -Include "*.tsx","*.ts" -Recurse | ` + ForEach { (Get-Content $_.PSPath | ForEach { ($_ -replace '([from|import])\s?[''"](igniteui-[react|dockmanager].*)[''"]', '$1 "@infragistics/$2"') }) | ` + Set-Content $_.PSPath } + - task: Npm@1 displayName: 'npm run build' inputs: