From cc43a06a63b3e4dfeb0ed3741d98e3b0c8bce07f Mon Sep 17 00:00:00 2001 From: P9oS Date: Wed, 3 Feb 2021 02:21:36 +0500 Subject: [PATCH 1/7] Add build.ps1 --- Scripts/build.ps1 | 186 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 Scripts/build.ps1 diff --git a/Scripts/build.ps1 b/Scripts/build.ps1 new file mode 100644 index 00000000..8c3d8da7 --- /dev/null +++ b/Scripts/build.ps1 @@ -0,0 +1,186 @@ +function Get-VariablesFromFile($filename = "BUILD") { + $fullPath = Join-Path -Path $PWD -ChildPath $filename + if (-not(Test-Path -Path $fullPath -PathType Leaf)) { + Write-Output "BUILD file is missing" + Write-Output "Script should execute from ""Scripts"" directory" + exit + } + $content = Get-Content -Path $fullPath -Raw + $pattern = @" +(?^[A-Z]\w+)="(?.+)" +"@ + $dict = New-Object "System.Collections.Generic.Dictionary[String,String]" + $_matches = [System.Text.RegularExpressions.Regex]::Matches($content, $pattern, + [System.Text.RegularExpressions.RegexOptions]::Multiline) + foreach ($match in $_matches) { + $key = $match.Groups["key"].Value + $value = $match.Groups["value"].Value + $dict.Add($key, $value) + } + return $dict +} + +function Remove-RootProjectFromString([string]$str) { + $n = $str.IndexOf('/') + return $str.Substring($n) +} + +function Write-FormattedOutput { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True,Position=1,ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True)][Object] $Object, + [Parameter(Mandatory=$False)][ConsoleColor] $BackgroundColor, + [Parameter(Mandatory=$False)][ConsoleColor] $ForegroundColor + ) + + # save the current color + $bc = $host.UI.RawUI.BackgroundColor + $fc = $host.UI.RawUI.ForegroundColor + + # set the new color + if($BackgroundColor -ne $null) { + $host.UI.RawUI.BackgroundColor = $BackgroundColor + } + + if($ForegroundColor -ne $null) { + $host.UI.RawUI.ForegroundColor = $ForegroundColor + } + + Write-Output $Object + + # restore the original color + $host.UI.RawUI.BackgroundColor = $bc + $host.UI.RawUI.ForegroundColor = $fc +} + +$d = Get-VariablesFromFile -filename "BUILD" + +$project_root +$server_path +$client_path +$config_path +$build_path +$npm_util = $d["NPM_UTIL"] + +if ($d["PROJECT_ROOT"] -eq "auto") { + while (-not (Test-Path -Path (Join-Path -Path $PWD -ChildPath "SunEngine.md"))) { + Set-Location ..\ | Out-Null + } + $project_root = $PWD + +} +else { + $project_root = $d["PROJECT_ROOT"] +} + +$server_path = Join-Path -Path $PWD -ChildPath (Remove-RootProjectFromString($d["SERVER_PATH"])) +$client_path = Join-Path -Path $PWD -ChildPath (Remove-RootProjectFromString($d["CLIENT_PATH"])) +$config_path = Join-Path -Path $PWD -ChildPath (Remove-RootProjectFromString($d["CONFIG_PATH"])) +$build_path = Join-Path -Path $PWD -ChildPath (Remove-RootProjectFromString($d["BUILD_PATH"])) + +Write-FormattedOutput -Object "Building $($d["PROJECT_NAME"]) project." -ForegroundColor Green + +Write-FormattedOutput -Object "PROJECT_ROOT = $($project_root)." -ForegroundColor Green +Write-FormattedOutput -Object "SERVER_PATH = $($server_path)." -ForegroundColor Green +Write-FormattedOutput -Object "CLIENT_PATH = $($client_path)." -ForegroundColor Green +Write-FormattedOutput -Object "CONFIG_PATH = $($config_path)." -ForegroundColor Green +Write-FormattedOutput -Object "BUILD_PATH = $($build_path)." -ForegroundColor Green + +# check Config directory exists +if (Test-Path -Path (Join-Path -Path $project_root -ChildPath "Config.template")) { + Write-FormattedOutput -Object "Creating Config directory from Config.template" -ForegroundColor Green + $p = Join-Path -Path $project_root -ChildPath "Config.template" + Copy-Item -Source $p -Destination $config_path -Force +} + +Write-FormattedOutput -Object "Deleting old build" -ForegroundColor Green +Remove-Item -Path $build_path -Recurse +New-Item -Path $build_path -ItemType Directory | Out-Null + +# dotnet build +try { + $path1 = Join-Path -Path $server_path -ChildPath "SunEngine.Cli" + $path2 = Join-Path -Path $build_path -ChildPath "Server" + & dotnet publish --configuration Release $path1 --output $path2 | Out-Null + if ($LASTEXITCODE -ne 0) { + throw new [System.Exception] + } +} +catch [System.Management.Automation.CommandNotFoundException] { + Write-FormattedOutput -Object ".NET Core not install." -ForegroundColor Red + exit +} +catch { + Set-Location -Path (Join-Path -Path $project_root -ChildPath "Scripts") + Write-FormattedOutput -Object "Crush build .net applicaton" -ForegroundColor Red + exit +} + +Write-FormattedOutput -Object "Building Client" -ForegroundColor Green +Set-Location -Path $client_path | Out-Null +# install node_modules +try { + & $npm_util install | Out-Null + if ($LASTEXITCODE -ne 0) { + throw new [System.Exception] + } +} +catch [System.Management.Automation.CommandNotFoundException] { + Write-FormattedOutput -Object "npm util not found" -ForegroundColor Red + exit +} +catch { + Set-Location -Path (Join-Path -Path $project_root -ChildPath "Scripts") + Write-FormattedOutput -Object "Fail npm install" -ForegroundColor Red + exit +} + +# check Client/src/site exists +if (-not(Test-Path -Path (Join-Path -Path $client_path -ChildPath "src/site"))) { + Write-FormattedOutput -Object "Copying $($client_path)/src/site.template => $($client_path)/src/site" -ForegroundColor Green + $path1 = Join-Path -Path $client_path -ChildPath "src\site.template\*" + $path2 = Join-Path -Path $client_path -ChildPath "src\site" + New-Item -Path $path2 -ItemType Directory | Out-Null + Copy-Item -Path $path1 -Destination $path2 -Recurse +} +# quasar build +Write-FormattedOutput -Object "Quasar building" -ForegroundColor Blue +try { + & quasar build | Out-Null + if ($LASTEXITCODE -ne 0) { + throw new [System.Exception] + } +} +catch [System.Management.Automation.CommandNotFoundException] { + Write-FormattedOutput -Object "Quasar not install please install by command ""npm install -g @quasar/cli""" -ForegroundColor Red + exit +} +catch { + Set-Location -Path (Join-Path -Path $project_root -ChildPath "Scripts") + Write-FormattedOutput -Object "Quasar build was failed" -ForegroundColor Red + exit +} + +# copy dirs and files +Write-FormattedOutput -Object "Copying Client to wwwroot directory" -ForegroundColor Green +New-Item -Path (Join-Path -Path $build_path -ChildPath "wwwroot") -ItemType Directory | Out-Null +Copy-Item -Path (Join-Path -Path $client_path -ChildPath "dist\spa\") -Destination (Join-Path -Path $build_path -ChildPath "wwwroot") -Recurse + +Write-FormattedOutput -Object "Clearing dist directory" -ForegroundColor Green +Remove-Item -Path (Join-Path -Path $client_path -ChildPath "dist") -Recurse | Out-Null + +Write-FormattedOutput -Object "Copying Config to build directory" -ForegroundColor Green +New-Item -Path (Join-Path -Path $build_path -ChildPath "config") -ItemType Directory | Out-Null +Copy-Item -Path $config_path -Destination (Join-Path -Path $build_path -ChildPath "config\") -Recurse + +Write-FormattedOutput -Object "Copying Data to build directory" -ForegroundColor Green +New-Item -Path (Join-Path -Path $build_path -ChildPath "Resources") -ItemType Directory | Out-Null +Copy-Item -Path (Join-Path -Path $project_root -ChildPath "Resources\*") -Destination (Join-Path -Path $build_path -ChildPath "Resources\") -Recurse + +Write-FormattedOutput -Object "Copying SunEngine.md file" -ForegroundColor Green +Copy-Item -Path (Join-Path -Path $project_root -ChildPath "SunEngine.md") -Destination $build_path + +Set-Location -Path (Join-Path -Path $project_root -ChildPath "Scripts") +Write-FormattedOutput -Object "All Done!" -ForegroundColor Blue +[System.Media.SystemSounds]::Beep.Play() +[System.Windows.MessageBox]::Show("All Done!") From 3b00654bf0cf0d4069db4c4f62b2a5b64eab0ff9 Mon Sep 17 00:00:00 2001 From: P9oS Date: Wed, 3 Feb 2021 12:48:25 +0500 Subject: [PATCH 2/7] Fix build.ps1 --- Scripts/build.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Scripts/build.ps1 b/Scripts/build.ps1 index 8c3d8da7..34d92f07 100644 --- a/Scripts/build.ps1 +++ b/Scripts/build.ps1 @@ -164,7 +164,7 @@ catch { # copy dirs and files Write-FormattedOutput -Object "Copying Client to wwwroot directory" -ForegroundColor Green New-Item -Path (Join-Path -Path $build_path -ChildPath "wwwroot") -ItemType Directory | Out-Null -Copy-Item -Path (Join-Path -Path $client_path -ChildPath "dist\spa\") -Destination (Join-Path -Path $build_path -ChildPath "wwwroot") -Recurse +Copy-Item -Path (Join-Path -Path $client_path -ChildPath "dist\spa\*.*") -Destination (Join-Path -Path $build_path -ChildPath "wwwroot") -Recurse Write-FormattedOutput -Object "Clearing dist directory" -ForegroundColor Green Remove-Item -Path (Join-Path -Path $client_path -ChildPath "dist") -Recurse | Out-Null @@ -183,4 +183,5 @@ Copy-Item -Path (Join-Path -Path $project_root -ChildPath "SunEngine.md") -Desti Set-Location -Path (Join-Path -Path $project_root -ChildPath "Scripts") Write-FormattedOutput -Object "All Done!" -ForegroundColor Blue [System.Media.SystemSounds]::Beep.Play() -[System.Windows.MessageBox]::Show("All Done!") +Add-Type -AssemblyName System.Windows.Forms +[System.Windows.Forms.MessageBox]::Show("All Done!") From f7829465981cde511645e03e72dc850f19dde548 Mon Sep 17 00:00:00 2001 From: P9oS Date: Wed, 3 Feb 2021 20:44:46 +0500 Subject: [PATCH 3/7] Fix build.ps1 --- Scripts/build.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Scripts/build.ps1 b/Scripts/build.ps1 index 34d92f07..5a09e3cf 100644 --- a/Scripts/build.ps1 +++ b/Scripts/build.ps1 @@ -164,14 +164,14 @@ catch { # copy dirs and files Write-FormattedOutput -Object "Copying Client to wwwroot directory" -ForegroundColor Green New-Item -Path (Join-Path -Path $build_path -ChildPath "wwwroot") -ItemType Directory | Out-Null -Copy-Item -Path (Join-Path -Path $client_path -ChildPath "dist\spa\*.*") -Destination (Join-Path -Path $build_path -ChildPath "wwwroot") -Recurse +Copy-Item -Path (Join-Path -Path $client_path -ChildPath "dist\spa\*") -Destination (Join-Path -Path $build_path -ChildPath "wwwroot") -Recurse Write-FormattedOutput -Object "Clearing dist directory" -ForegroundColor Green Remove-Item -Path (Join-Path -Path $client_path -ChildPath "dist") -Recurse | Out-Null Write-FormattedOutput -Object "Copying Config to build directory" -ForegroundColor Green -New-Item -Path (Join-Path -Path $build_path -ChildPath "config") -ItemType Directory | Out-Null -Copy-Item -Path $config_path -Destination (Join-Path -Path $build_path -ChildPath "config\") -Recurse +New-Item -Path (Join-Path -Path $build_path -ChildPath "Сonfig") -ItemType Directory | Out-Null +Copy-Item -Path $config_path -Destination (Join-Path -Path $build_path -ChildPath "Сonfig\") -Recurse Write-FormattedOutput -Object "Copying Data to build directory" -ForegroundColor Green New-Item -Path (Join-Path -Path $build_path -ChildPath "Resources") -ItemType Directory | Out-Null From 26074b64bc6e5996461c1eba9357ef94a25d03a1 Mon Sep 17 00:00:00 2001 From: P9oS Date: 2021年2月11日 15:12:04 +0500 Subject: [PATCH 4/7] Delete part old migration --- Server/SunEngine.Migrations/Migrations/001-Initial.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Server/SunEngine.Migrations/Migrations/001-Initial.cs b/Server/SunEngine.Migrations/Migrations/001-Initial.cs index ecdde6cd..83281fbf 100644 --- a/Server/SunEngine.Migrations/Migrations/001-Initial.cs +++ b/Server/SunEngine.Migrations/Migrations/001-Initial.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Data; using FluentMigrator; @@ -235,10 +235,6 @@ public override void Up() Create.Table("ConfigurationItems".s()) .WithColumn("Name".s()).AsMaxString().PrimaryKey().NotNullable() .WithColumn("Value".s()).AsMaxString().NotNullable(); - - - IfDatabase("MySql5", "MySql", "MariaDB") - .Execute.Sql("ALTER TABLE `Materials` ADD FULLTEXT INDEX `TFS` (`Title`, `Text`);"); } @@ -247,4 +243,4 @@ public override void Down() throw new NotImplementedException(); } } -} \ No newline at end of file +} From fba2a05ba11b46b99b584afce77cf66fc5bdf43c Mon Sep 17 00:00:00 2001 From: P9oS Date: 2021年2月11日 22:36:44 +0500 Subject: [PATCH 5/7] add @quasar/cli in package.json --- Client/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Client/package.json b/Client/package.json index 3b1bb266..cf127399 100644 --- a/Client/package.json +++ b/Client/package.json @@ -6,7 +6,8 @@ "author": "Dmitrij Polianin", "private": true, "scripts": { - "dev run": "quasar dev" + "dev run": "quasar dev", + "build" : "quasar build" }, "dependencies": { "@quasar/extras": "^1.9.12", @@ -17,6 +18,7 @@ }, "devDependencies": { "@quasar/app": "^2.1.14", + "@quasar/cli": "^1.1.3", "babel-preset-proposals": "^0.3.0", "glob": "^7.1.6", "minimist": "^1.2.5", From 4d35d9a8868871e80696357a79757684d38dc865 Mon Sep 17 00:00:00 2001 From: P9oS Date: 2021年2月12日 02:18:22 +0500 Subject: [PATCH 6/7] minor fix package.json --- Client/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/package.json b/Client/package.json index cf127399..648d7470 100644 --- a/Client/package.json +++ b/Client/package.json @@ -6,7 +6,7 @@ "author": "Dmitrij Polianin", "private": true, "scripts": { - "dev run": "quasar dev", + "dev": "quasar dev", "build" : "quasar build" }, "dependencies": { From 2e3485823c40b17c8018cb2f073f662f14478670 Mon Sep 17 00:00:00 2001 From: P9oS Date: 2021年2月12日 02:56:02 +0500 Subject: [PATCH 7/7] Minor fixes css on comp: register, login --- Client/src/modules/auth/Login.vue | 19 ++++++++++++++++--- Client/src/modules/auth/Register.vue | 24 +++++++++++++++++++++--- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/Client/src/modules/auth/Login.vue b/Client/src/modules/auth/Login.vue index a588419f..c62fd7c5 100644 --- a/Client/src/modules/auth/Login.vue +++ b/Client/src/modules/auth/Login.vue @@ -3,6 +3,7 @@
@@ -35,7 +36,7 @@ @@ -110,4 +111,16 @@ export default { }; - + diff --git a/Client/src/modules/auth/Register.vue b/Client/src/modules/auth/Register.vue index 50a345ef..ea6e3210 100644 --- a/Client/src/modules/auth/Register.vue +++ b/Client/src/modules/auth/Register.vue @@ -2,6 +2,7 @@
@@ -73,12 +77,14 @@

AltStyle によって変換されたページ (->オリジナル) /