From c7b0b00d054b19ab19d77ff826e113a4a68ec40a Mon Sep 17 00:00:00 2001 From: realmarv Date: Mon, 7 Aug 2023 13:47:06 +0330 Subject: [PATCH] scripts/styleCheck: refactor --- scripts/styleCheck.fsx | 13 +++++++++++++ src/FileConventions/Config.fs | 6 +++--- src/FileConventions/Helpers.fs | 13 ------------- src/FileConventions/Library.fs | 12 ++++++------ 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/scripts/styleCheck.fsx b/scripts/styleCheck.fsx index 7b6f7e378..e3f87c3c3 100644 --- a/scripts/styleCheck.fsx +++ b/scripts/styleCheck.fsx @@ -166,6 +166,19 @@ let CheckStyleOfXamlFiles(rootDir: DirectoryInfo) : bool = let rootDir = Path.Combine(__SOURCE_DIRECTORY__, "..") |> DirectoryInfo +// We need this step so we can change the files using `npx prettier --write` in the prettier calls. +// Otherwise we get permission denied error in the CI. +Process + .Execute( + { + Command = "chmod" + Arguments = "777 --recursive ." + }, + Echo.Off + ) + .UnwrapDefault() +|> ignore + let processSuccessStates = [| CheckStyleOfFSharpFiles rootDir diff --git a/src/FileConventions/Config.fs b/src/FileConventions/Config.fs index 50d1801c9..58f739e52 100644 --- a/src/FileConventions/Config.fs +++ b/src/FileConventions/Config.fs @@ -1,5 +1,5 @@ module Config -let fantomlessToolVersion = "4.7.997-prerelease" -let prettierVersion = "2.8.3" -let pluginXmlVersion = "v2.2.0" +let FantomlessToolVersion = "4.7.997-prerelease" +let PrettierVersion = "2.8.3" +let PluginXmlVersion = "v2.2.0" diff --git a/src/FileConventions/Helpers.fs b/src/FileConventions/Helpers.fs index 17a4f3f95..63b7a5f7a 100644 --- a/src/FileConventions/Helpers.fs +++ b/src/FileConventions/Helpers.fs @@ -212,19 +212,6 @@ let InstallPrettierPluginXml(version: string) = let RunPrettier(arguments: string) = - // We need this step so we can change the files using `npx prettier --write` in the next step. - // Otherwise we get permission denied error in the CI. - Process - .Execute( - { - Command = "chmod" - Arguments = "777 --recursive ." - }, - Echo.Off - ) - .UnwrapDefault() - |> ignore - Process.Execute( { Command = "npx" diff --git a/src/FileConventions/Library.fs b/src/FileConventions/Library.fs index ffad450c7..1ea9e5d47 100644 --- a/src/FileConventions/Library.fs +++ b/src/FileConventions/Library.fs @@ -387,7 +387,7 @@ let NonVerboseFlags(fileInfo: FileInfo) = let StyleFSharpFiles(rootDir: DirectoryInfo) = - InstallFantomlessTool fantomlessToolVersion + InstallFantomlessTool FantomlessToolVersion Process .Execute( @@ -413,15 +413,15 @@ let StyleCSharpFiles(rootDir: DirectoryInfo) = |> ignore let StyleXamlFiles() = - InstallPrettier prettierVersion - InstallPrettierPluginXml pluginXmlVersion + InstallPrettier PrettierVersion + InstallPrettierPluginXml PluginXmlVersion Process .Execute( { Command = "npm" Arguments = - $"install --save-dev prettier@{prettierVersion} @prettier/plugin-xml@{pluginXmlVersion}" + $"install --save-dev prettier@{PrettierVersion} @prettier/plugin-xml@{PluginXmlVersion}" }, Echo.Off ) @@ -450,7 +450,7 @@ let StyleXamlFiles() = |> ignore let StyleTypeScriptFiles() = - InstallPrettier prettierVersion + InstallPrettier PrettierVersion let pattern = $"{Directory.GetCurrentDirectory()}{Path.DirectorySeparatorChar}**{Path.DirectorySeparatorChar}*.ts" @@ -458,7 +458,7 @@ let StyleTypeScriptFiles() = RunPrettier $"--quote-props=consistent --write {pattern}" let StyleYmlFiles() = - InstallPrettier prettierVersion + InstallPrettier PrettierVersion let pattern = $"{Directory.GetCurrentDirectory()}{Path.DirectorySeparatorChar}**{Path.DirectorySeparatorChar}*.yml"