Skip to content

Commit

Permalink
Merge pull request #8 from DevExpress-Examples/update-repo-for-automa…
Browse files Browse the repository at this point in the history
…tion

Update demo
  • Loading branch information
SavchenkoAlexander authored Dec 12, 2024
2 parents 751b199 + 4fb87bf commit 7b9fe99
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 48 deletions.
2 changes: 1 addition & 1 deletion ASP.NET Core/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Download the example and use Visual Studio 2019 to open the project.

## Client-side resources and bundling

This project uses [NPM](http://npmjs.com/) and [Gulp.js](https://gulpjs.com/) to install client-side libraries. The project restores NPM packages before the first build. Then, Gulp bundles required scripts and CSS files into the resulting package during the first and every next build.
This project uses [NPM](https://www.npmjs.com/) and [Gulp.js](https://gulpjs.com/) to install client-side libraries. The project restores NPM packages before the first build. Then, Gulp bundles required scripts and CSS files into the resulting package during the first and every next build.

The resulted bundles will be located in the `wwwroot` folder:
* `css/vendor.css` - a file with all CSS styles.
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<!-- default badges list -->
![](https://img.shields.io/endpoint?url=https://codecentral.devexpress.com/api/v1/VersionRange/800447205/23.1.3%2B)
[![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/T1233410)
[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183)
[![](https://img.shields.io/badge/💬_Leave_Feedback-feecdd?style=flat-square)](#does-this-example-address-your-development-requirementsobjectives)
Expand Down
4 changes: 2 additions & 2 deletions React/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ It correctly bundles React in production mode and optimizes the build for the be
The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
See the section about [deployment](https://create-react-app.dev/docs/deployment/) for more information.

## Further help

You can learn more about React in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
You can learn more about React in the [Create React App documentation](https://create-react-app.dev/docs/getting-started/).

To get more help on DevExtreme submit an issue on [GitHub](https://github.com/DevExpress/devextreme/issues) or [Support Center](https://www.devexpress.com/Support/Center/Question/Create)

Expand Down
2 changes: 1 addition & 1 deletion Vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has a

## Customize configuration

See [Vite Configuration Reference](https://vitejs.dev/config/).
See [Vite Configuration Reference](https://vite.dev/config/).

## Project Setup

Expand Down
95 changes: 52 additions & 43 deletions test-example.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
Write-Output "Branch name: $env:branchName"
$global:inputVersion = $env:branchName
$global:errorCode = 0

$BUILD_VERSIONS_LIST = "BUILD_VERSIONS_LIST"

$allVersions = @(
$global:allVersions = @(
"14.1", "14.2",
"15.1", "15.2",
"16.1", "16.2",
Expand All @@ -21,48 +18,55 @@ $allVersions = @(

function Process-JavaScriptProjects {
param (
[string]$Path = ".",
[hashtable[]]$Folders = @(
@{ Name = "jQuery"; Packages = @("devextreme-dist", "devextreme") },
@{ Name = "Angular"; Packages = @("devextreme-angular", "devextreme") },
@{ Name = "React"; Packages = @("devextreme-react", "devextreme") },
@{ Name = "Vue"; Packages = @("devextreme-vue", "devextreme") }
)
[string]$buildVersion
)
Write-Output "`n--== Processing JavaScript Projects ==--"

[hashtable[]]$folders = @(
@{ Name = "Angular"; Packages = @("devextreme-angular", "devextreme") },
@{ Name = "React"; Packages = @("devextreme-react", "devextreme") },
@{ Name = "Vue"; Packages = @("devextreme-vue", "devextreme") }
)
Write-Host "`n--== Processing JavaScript Projects ==--"

foreach ($folder in $Folders) {
$jQueryEntry = @{
Name = "jQuery";
Packages = if ([double]$buildVersion -ge 23.1) { # `devextreme-dist` appeared in 23.1
@("devextreme-dist", "devextreme")
} else {
@("devextreme")
}
}

$folders = @($jQueryEntry) + folders

foreach ($folder in $folders) {
if (-not (Test-Path $($folder.Name))) {
Write-Host "Directory $($folder.Name) does not exist. Skipping..."
Write-Output "`nDirectory $($folder.Name) does not exist. Skipping..."
continue
}

Write-Host "`n<-- Processing folder: $($folder.Name) -->"
Write-Output "`n<-- Processing folder: $($folder.Name) -->"

Set-Location $($folder.Name)

$packages = $folder.Packages | ForEach-Object { "$_@$global:buildVersion" }
$packages = $folder.Packages | ForEach-Object { "$_@$buildVersion" }

$packageList = $packages -join " "

$command = "npm install $packageList --force --save --no-fund"

Write-Output "Running: $command"
Invoke-Expression $command
Write-Output "`nInstalling DevExtreme packages"
npm install $packageList --save --save-exact --no-fund

Write-Host "Running 'npm install' in $($folder.Name)"
$installResult = & npm install --force --no-fund --loglevel=error -PassThru
Write-Output "`nInstalling the rest of the packages $($folder.Name)"
npm install --save --save-exact --no-fund --loglevel=error
if ($LASTEXITCODE -ne 0) {
Write-Error "ERROR: npm install failed in $($folder.Name)"
Write-Error "`nERROR: Failed to install packages: $($folder.Name)"
$global:errorCode = 1
}

Write-Host "`n<-- Updating packages... -->"

Write-Host "Running 'npm run build' in $($folder.Name)"
$buildResult = & npm run build
Write-Output "`nBuilding the project with 'npm run build' $($folder.Name)"
npm run build
if ($LASTEXITCODE -ne 0) {
Write-Error "ERROR: npm run build failed in $($folder.Name)"
Write-Error "`nERROR: Failed to build the project: $($folder.Name)"
$global:errorCode = 1
}

Expand All @@ -74,33 +78,35 @@ function Process-DotNetProjects {
param (
[string]$RootDirectory = "."
)
Write-Host "`nProcessing .NET Projects"
Write-Output "`nProcessing .NET projects"

$slnFiles = Get-ChildItem -Path $RootDirectory -Filter *.sln -Recurse -Depth 1

if ($slnFiles.Count -eq 0) {
Write-Host "No solution files (.sln) found in the specified directory at level 1."
Write-Output "`nNo solution files (.sln) found in the specified directory at level 1."
return
}

foreach ($slnFile in $slnFiles) {
Write-Host "Found solution file: $($slnFile.FullName)"
Write-Output "`nFound solution file: $($slnFile.FullName)"

dotnet build $slnFile.FullName -c Release

if ($LASTEXITCODE -eq 0) {
Write-Host "Build succeeded for $($slnFile.FullName)."
Write-Output "`nBuild succeeded for $($slnFile.FullName)."
} else {
Write-Error "Build failed for $($slnFile.FullName)."
Write-Error "`nBuild failed for $($slnFile.FullName)."
$global:errorCode = 1
}
}
}

function Set-BuildVersion {
$BUILD_VERSIONS_LIST = "BUILD_VERSIONS_LIST"

$inputMajorMinor = $global:inputVersion -replace "\.\d+\+$", ""

$filteredList = $allVersions | Where-Object {
$filteredList = $global:allVersions | Where-Object {
($_ -replace "\." -as [double]) -ge ($inputMajorMinor -replace "\." -as [double])
}

Expand All @@ -114,31 +120,34 @@ function Set-BuildVersion {

if ($currentList.Count -gt 1) {
$inputMajorMinor = $currentList[0]
Write-Output "Input version: '$inputMajorMinor'"
$global:buildVersion = $inputMajorMinor
$updatedList = $currentList[1..($currentList.Count - 1)]
} else {
Write-Output "The list in the environment variable has only one item. "
Write-Output "`nThe list in the environment variable has only one item."
$inputMajorMinor = $currentList
$global:buildVersion = $inputMajorMinor
Write-Output "Input version: '$inputMajorMinor'"
$updatedList = ""
}

$global:buildVersion = $inputMajorMinor
Write-Output "Input version: '$inputMajorMinor'"

$newValue = $updatedList -join ";"

[Environment]::SetEnvironmentVariable($BUILD_VERSIONS_LIST, $newValue, [EnvironmentVariableTarget]::Machine)

Write-Output "Environment variable '$BUILD_VERSIONS_LIST' has been updated."
Write-Output "`nEnvironment variable '$BUILD_VERSIONS_LIST' has been updated."
Write-Output "New List: $updatedList"
}

Write-Host "`nBranch Name: $global:branchName"
Write-Output "`nBranch Name: $global:branchName"

Set-BuildVersion
Process-JavaScriptProjects
if (-not $global:buildVersion) {
Write-Output "`nThe buildVersion is null or an empty string."
exit 1
}
Process-JavaScriptProjects -buildVersion $global:buildVersion
Process-DotNetProjects

Write-Host "Error code: $global:errorCode"
Write-Output "`nFinished testing. Error code: $global:errorCode"

exit $global:errorCode

0 comments on commit 7b9fe99

Please sign in to comment.