From 52e34d36b2bc50b55a90c4b23c7cc73e646c399a Mon Sep 17 00:00:00 2001 From: AlisherAmonulloev Date: Wed, 25 Dec 2024 14:43:55 +0200 Subject: [PATCH] Update files --- .gitattributes | 2 + ASP.NET Core/Readme.md | 2 +- Angular/README.md | 2 +- README.md | 2 +- React/README.md | 4 +- Vue/README.md | 4 +- jQuery/package.json | 3 +- test-example.ps1 | 231 +++++++++++++++++++++++++++++++++++++++++ 8 files changed, 242 insertions(+), 8 deletions(-) create mode 100644 test-example.ps1 diff --git a/.gitattributes b/.gitattributes index 60ea83c..7e75064 100755 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,5 @@ +* text=auto eol=lf + VB/* linguist-vendored scripts linguist-vendored *.css linguist-detectable=false diff --git a/ASP.NET Core/Readme.md b/ASP.NET Core/Readme.md index d67d659..8c3a48f 100644 --- a/ASP.NET Core/Readme.md +++ b/ASP.NET Core/Readme.md @@ -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. diff --git a/Angular/README.md b/Angular/README.md index f981a7a..560f8f9 100644 --- a/Angular/README.md +++ b/Angular/README.md @@ -24,5 +24,5 @@ Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To u ## Further help -To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. +To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://v17.angular.io/cli) page. 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) diff --git a/README.md b/README.md index ec0348f..e5e0588 100755 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ This example demonstrates how to implement the following scenarios in DataGrid: ## More Examples -- [DataGrid - How to implement a custom editing form using dxForm and dxPopup](https://github.com/DevExpress-Examples/DataGrid-How-to-implement-a-custom-editing-form-using-dxForm-and-dxPopup) +- [DataGrid - How to implement a custom editing form using dxForm and dxPopup](https://github.com/DevExpress-Examples/devextreme-datagrid-custom-editing-form) ## Does this example address your development requirements/objectives? diff --git a/React/README.md b/React/README.md index 4152601..1066816 100644 --- a/React/README.md +++ b/React/README.md @@ -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.
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) diff --git a/Vue/README.md b/Vue/README.md index 6171589..9a4a656 100644 --- a/Vue/README.md +++ b/Vue/README.md @@ -10,7 +10,7 @@ This template should help get you started developing with Vue 3 in Vite. TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types. -If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps: +If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/vuejs/language-tools/discussions/471) that is more performant. You can enable it by the following steps: 1. Disable the built-in TypeScript Extension 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette @@ -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 diff --git a/jQuery/package.json b/jQuery/package.json index acdaf8c..c9a48ba 100644 --- a/jQuery/package.json +++ b/jQuery/package.json @@ -3,7 +3,8 @@ "version": "1.0.0", "scripts": { "start": "npm run lite", - "lite": "lite-server -c ./bs-config.json" + "lite": "lite-server -c ./bs-config.json", + "build": "npm run lint" }, "devDependencies": { "eslint": "^8.33.0", diff --git a/test-example.ps1 b/test-example.ps1 new file mode 100644 index 0000000..ec18171 --- /dev/null +++ b/test-example.ps1 @@ -0,0 +1,231 @@ +# For local testing, you can pass branchName and/or buildVersion. +# If both parameters are specified, only buildVersion will be used. +# Example usage: +# ./test-example.ps1 -branchName 23.1.3+ +# ./test-example.ps1 -buildVersion 23.1.13 +param ( + [string]$branchName = [Environment]::GetEnvironmentVariable("BRANCH_NAME", [EnvironmentVariableTarget]::Machine), + [string]$buildVersion = [Environment]::GetEnvironmentVariable("BUILD_VERSION", [EnvironmentVariableTarget]::Machine) +) + +# Repository's branch name, e.g. 24.1.3+ +$global:BRANCH_NAME = $branchName +# Masstest-specific parameter. Specifies the minor version (example: '21.1.5') !or daily build (example: '21.2.2005') +$global:BUILD_VERSION = $buildVersion + +$global:ERROR_CODE = 0 +$global:FAILED_PROJECTS = @() + +$global:ALL_VERSIONS = @( + "14.1", "14.2", + "15.1", "15.2", + "16.1", "16.2", + "17.1", "17.2", + "18.1", "18.2", + "19.1", "19.2", + "20.1", "20.2", + "21.1", "21.2", + "22.1", "22.2", + "23.1", "23.2", + "24.1", "24.2", + "25.1", "25.2" +) + +function Install-Packages { + param ( + [string]$folderName, + [string[]]$packages, + [string]$buildVersion + ) + Write-Output "`nInstalling packages in folder: $folderName" + + $packageList = $packages | ForEach-Object { "$_@$buildVersion" } + Write-Output "`nPackages to install: $($packageList -join ", ")" + # TODO: Uninstall DevExtreme packages to avoid potential peer-dependency issues + npm install @($packageList) --save --save-exact --no-fund + if (-not $?) { + Write-Error "`nERROR: Failed to install DevExtreme packages in $folderName" + throw "Installation failed in $folderName" + } +} + +function Build-Project { + param ( + [string]$folderName + ) + Write-Output "`nBuilding the project in folder: $folderName" + + npm run build + if (-not $?) { + Write-Error "`nERROR: Failed to build the project in $folderName" + throw "Build failed in $folderName" + } +} + +function Process-JavaScriptProjects { + param ( + [string]$buildVersion + ) + Write-Output "`n--== Starting JavaScript Projects Processing ==--" + + [hashtable[]]$folders = @( + @{ Name = "Angular"; Packages = @("devextreme", "devextreme-angular") }, + @{ Name = "React"; Packages = @("devextreme", "devextreme-react") }, + @{ Name = "Vue"; Packages = @("devextreme", "devextreme-vue") } + ) + + $jQueryEntry = @{ + Name = "jQuery"; + Packages = if ([version]$buildVersion -ge [version]23.1) { # `devextreme-dist` appeared in 23.1 + @("devextreme", "devextreme-dist") + } else { + @("devextreme") + } + } + + $folders = @($jQueryEntry) + $folders + + foreach ($folder in $folders) { + $folderName = $folder.Name + $packages = $folder.Packages + + if (-not (Test-Path $folderName)) { + Write-Output "`nDirectory $folderName does not exist. Skipping..." + continue + } + + Write-Output "`nProcessing folder: $folderName" + Push-Location $folderName + + try { + Install-Packages -folderName $folderName -packages $packages -buildVersion $buildVersion + Write-Output "`nInstalling remaining packages in $folderName" + npm install --save --save-exact --no-fund --loglevel=error + if (-not $?) { + throw "ERROR: Failed to install remaining packages in $folderName" + } + Build-Project -folderName $folderName + } catch { + Write-Error "`nAn error occurred: $_" + $global:LASTEXITCODE = 1 + $global:ERROR_CODE = 1 + $global:FAILED_PROJECTS += $folderName + } finally { + Pop-Location + } + } + + Write-Output "`n--== JavaScript Projects Processing Completed ==--" +} + +function Process-DotNetProjects { + param ( + [string]$RootDirectory = "." + ) + + Write-Output "`n--== Starting .NET project processing in directory: $RootDirectory ==--" + + $slnFiles = Get-ChildItem -Path $RootDirectory -Filter *.sln -Recurse -Depth 1 + + if ($slnFiles.Count -eq 0) { + Write-Output "`nNo solution files (.sln) found in the specified directory at level 1." + return + } + + foreach ($slnFile in $slnFiles) { + Write-Output "`nFound solution file: $($slnFile.FullName)" + + try { + Write-Output "`nBuilding solution: $($slnFile.FullName)" + dotnet build $slnFile.FullName -c Release + + if ($?) { + Write-Output "`nBuild succeeded for $($slnFile.FullName)." + } else { + throw "Build failed for $($slnFile.FullName)." + } + } catch { + Write-Error "`nERROR: $_" + $global:LASTEXITCODE = 1 + $global:ERROR_CODE = 1 + $global:FAILED_PROJECTS += "ASP.NET" + } + } + + Write-Output "`nCompleted .NET project processing." +} + +function Set-BuildVersion { + Write-Output "`n--== Starting Set-BuildVersion process. ==--" + + $BUILD_VERSION = $global:BUILD_VERSION + if ($BUILD_VERSION) { + Write-Output "BUILD_VERSION is already set: $BUILD_VERSION" + return + } + + $BUILD_VERSIONS_LIST = "BUILD_VERSIONS_LIST" + + $inputMajorMinor = $global:BRANCH_NAME -replace "\.\d+\+$", "" + Write-Output "Extracted major.minor version from branch name: $inputMajorMinor" + + $filteredList = $global:ALL_VERSIONS | Where-Object { + ($_ -replace "\." -as [double]) -ge ($inputMajorMinor -replace "\." -as [double]) + } + Write-Output "Filtered versions list: $filteredList" + + $currentValue = [Environment]::GetEnvironmentVariable($BUILD_VERSIONS_LIST, [EnvironmentVariableTarget]::Machine) + $currentList = if ($currentValue) { + $currentValue -split ";" + } else { + $filteredList + } + Write-Output "Current versions list: $currentList" + + if ($currentList.Count -gt 1) { + $inputMajorMinor = $currentList[0] + $updatedList = $currentList[1..($currentList.Count - 1)] + } else { + Write-Output "The list in the environment variable has only one item." + $inputMajorMinor = $currentList[0] + $updatedList = @() + } + + $global:BUILD_VERSION = $inputMajorMinor + Write-Output "BUILD_VERSION set to: $global:BUILD_VERSION" + + $newValue = $updatedList -join ";" + [Environment]::SetEnvironmentVariable($BUILD_VERSIONS_LIST, $newValue, [EnvironmentVariableTarget]::Machine) + + Write-Output "Environment variable '$BUILD_VERSIONS_LIST' updated." + Write-Output "New list: $updatedList" +} + +function Write-BuildInfo { + $BRANCH_NAME = if ($global:BRANCH_NAME -ne $null -and $global:BRANCH_NAME -ne "") { + $global:BRANCH_NAME + } else { + "(empty)" + } + + $BUILD_VERSION = if ($global:BUILD_VERSION -ne $null -and $global:BUILD_VERSION -ne "") { + $global:BUILD_VERSION + } else { + "(empty)" + } + + Write-Output "`nBranch Name: $BRANCH_NAME" + Write-Output "Build Version: $BUILD_VERSION" +} + +Write-BuildInfo +Set-BuildVersion +Process-JavaScriptProjects -buildVersion $global:BUILD_VERSION +Process-DotNetProjects + +Write-Output "`nFinished testing version: $global:BUILD_VERSION. Error code: $global:ERROR_CODE" +if ($global:ERROR_CODE -ne 0 -and $global:FAILED_PROJECTS.Count -gt 0) { + Write-Output "`FAILED PROJECTS: $(($global:FAILED_PROJECTS -join ", "))" +} + +exit $global:ERROR_CODE