From b1f299c6b1a664ec33bd2926e70db0bc09972826 Mon Sep 17 00:00:00 2001 From: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> Date: Mon, 1 Apr 2024 12:06:54 +0200 Subject: [PATCH] build: separate yarn and pnpm maintenance scripts --- scripts/check-package-manager-pnpm.sh | 14 ++++++++ scripts/check-package-manager-yarn.sh | 14 ++++++++ scripts/check-package-managers-other.sh | 32 ------------------- scripts/update-cypress-latest-pnpm.sh | 31 ++++++++++++++++++ ...other.sh => update-cypress-latest-yarn.sh} | 26 ++------------- scripts/update-cypress-latest.sh | 6 ++-- 6 files changed, 66 insertions(+), 57 deletions(-) create mode 100755 scripts/check-package-manager-pnpm.sh create mode 100755 scripts/check-package-manager-yarn.sh delete mode 100755 scripts/check-package-managers-other.sh create mode 100755 scripts/update-cypress-latest-pnpm.sh rename scripts/{update-cypress-latest-other.sh => update-cypress-latest-yarn.sh} (62%) diff --git a/scripts/check-package-manager-pnpm.sh b/scripts/check-package-manager-pnpm.sh new file mode 100755 index 000000000..cbb7ede3d --- /dev/null +++ b/scripts/check-package-manager-pnpm.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# This script checks that the prerequisite +# pnpm is installed + +if ! command -v pnpm &> /dev/null +then + echo "**pnpm not installed**" + echo "execute the following command:" + echo "npm install pnpm -g" + echo +exit 1 # failure +else + echo "pnpm is installed" +fi diff --git a/scripts/check-package-manager-yarn.sh b/scripts/check-package-manager-yarn.sh new file mode 100755 index 000000000..1661c579b --- /dev/null +++ b/scripts/check-package-manager-yarn.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# This script checks that the prerequisite +# yarn is installed + +if ! command -v yarn &> /dev/null +then + echo "**yarn not installed**" + echo "execute the following command:" + echo "npm install yarn -g" + echo +exit 1 # failure +else + echo "yarn is installed" +fi diff --git a/scripts/check-package-managers-other.sh b/scripts/check-package-managers-other.sh deleted file mode 100755 index 766af02a4..000000000 --- a/scripts/check-package-managers-other.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# This script checks that the prerequisites -# pnpm and yarn are installed - -pnpmInstalled=false -if ! command -v pnpm &> /dev/null -then - echo "**pnpm not installed**" - echo "execute the following command:" - echo "npm install pnpm -g" - echo -else -pnpmInstalled=true -fi - -yarnInstalled=false -if ! command -v yarn &> /dev/null -then - echo "**yarn not installed**" - echo "execute the following command:" - echo "npm install yarn -g" - echo -else -yarnInstalled=true -fi - -if $pnpmInstalled == true && $yarnInstalled == true -then - echo "pnpm and yarn are installed" -else -exit 1 # failure -fi diff --git a/scripts/update-cypress-latest-pnpm.sh b/scripts/update-cypress-latest-pnpm.sh new file mode 100755 index 000000000..5701ed8f8 --- /dev/null +++ b/scripts/update-cypress-latest-pnpm.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -e # fail on error +# +# Examples using the pnpm package manager are +# updated to Cypress latest version +# +# Make sure that pnpm is installed +./scripts/check-package-manager-pnpm.sh + +echo updating pnpm examples to Cypress latest version +cd examples + +# examples/basic-pnpm (pnpm) +echo +echo updating examples/basic-pnpm to cypress@latest +cd basic-pnpm +pnpm add cypress@latest --save-dev --save-exact +pnpm ls cypress +cd .. + +# examples/start-and-pnpm-workspaces +echo +echo updating pnpm workspaces example to Cypress latest version +echo +echo updating examples/start-and-pnpm-workspaces to cypress@latest +cd start-and-pnpm-workspaces +pnpm update cypress --latest --recursive +pnpm ls cypress --recursive +cd .. + +cd .. diff --git a/scripts/update-cypress-latest-other.sh b/scripts/update-cypress-latest-yarn.sh similarity index 62% rename from scripts/update-cypress-latest-other.sh rename to scripts/update-cypress-latest-yarn.sh index 8008fda3c..a4494bcb9 100755 --- a/scripts/update-cypress-latest-other.sh +++ b/scripts/update-cypress-latest-yarn.sh @@ -1,11 +1,11 @@ #!/bin/bash set -e # fail on error # -# Examples using yarn and pnpm package managers are +# Examples using the yarn package manager are # updated to Cypress latest version # -# Make sure that pnpm and yarn are installed -./scripts/check-package-managers-other.sh +# Make sure that yarn is installed +./scripts/check-package-manager-yarn.sh echo updating yarn examples to Cypress latest version cd examples @@ -53,24 +53,4 @@ yarn set version latest yarn add cypress --dev --exact cd .. -# examples/basic-pnpm (pnpm) -echo -echo updating pnpm example to Cypress latest version -echo -echo updating examples/basic-pnpm to cypress@latest -cd basic-pnpm -pnpm add cypress@latest --save-dev --save-exact -pnpm ls cypress -cd .. - -# examples/start-and-pnpm-workspaces -echo -echo updating pnpm workspaces example to Cypress latest version -echo -echo updating examples/start-and-pnpm-workspaces to cypress@latest -cd start-and-pnpm-workspaces -pnpm update cypress --latest --recursive -pnpm ls cypress --recursive -cd .. - cd .. diff --git a/scripts/update-cypress-latest.sh b/scripts/update-cypress-latest.sh index b63a9ff58..c291c0689 100755 --- a/scripts/update-cypress-latest.sh +++ b/scripts/update-cypress-latest.sh @@ -11,11 +11,13 @@ set -e # fail on error # # First check if the required package managers are installed ./scripts/check-package-manager-npm.sh -./scripts/check-package-managers-other.sh +./scripts/check-package-manager-yarn.sh +./scripts/check-package-manager-pnpm.sh # then proceed to updating the examples echo ./scripts/update-cypress-latest-npm.sh -./scripts/update-cypress-latest-other.sh +./scripts/update-cypress-latest-yarn.sh +./scripts/update-cypress-latest-pnpm.sh echo echo please manually edit run command in