Skip to content

Commit

Permalink
build: separate yarn and pnpm maintenance scripts (#1163)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcC399 authored Apr 1, 2024
1 parent b713f3c commit 488f829
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 57 deletions.
14 changes: 14 additions & 0 deletions scripts/check-package-manager-pnpm.sh
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions scripts/check-package-manager-yarn.sh
Original file line number Diff line number Diff line change
@@ -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
32 changes: 0 additions & 32 deletions scripts/check-package-managers-other.sh

This file was deleted.

31 changes: 31 additions & 0 deletions scripts/update-cypress-latest-pnpm.sh
Original file line number Diff line number Diff line change
@@ -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 ..
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 ..
6 changes: 4 additions & 2 deletions scripts/update-cypress-latest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 488f829

Please sign in to comment.