Skip to content

Commit cbc7183

Browse files
committed
Updated upgrade script to skip confirmation for shad add in bash
1 parent f0843d5 commit cbc7183

2 files changed

Lines changed: 24 additions & 16 deletions

File tree

scripts/upgrade.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,14 @@ $templateShadComponents = (Get-ChildItem -Path app/components/ui).name
112112
$diffComponents = $shadComponents | Where-Object {$templateShadComponents -NotContains $_}
113113

114114
invoke-npmCommand -command "exec --" -pnpmCommand "dlx" -argslist "nuxi prepare"
115-
116-
invoke-npmCommand -command "exec --" -pnpmCommand "dlx" -argslist "shadcn-vue@latest add $diffComponents"
115+
if ($diffComponents.Length -gt 0) {
116+
write-output "Choose no (N) to overriding components if prompted below"
117+
invoke-npmCommand -command "exec --" -pnpmCommand "dlx" -argslist "shadcn-vue@latest add $diffComponents"
118+
}
117119

118120
write-output "-----------------------------"
119121
write-output "Upgrade complete!"
120122
write-output "The next step is to convert your Tailwind CSS variables saved in 'tailwind.txt'"
121123
write-output "Follow step 9 in the upgrade guide"
122124
write-output "https://github.com/RDFLib/prez-ui/blob/feature/tailwind4/docs/upgrade.md#9-update-tailwindcss"
123-
write-output "(Note: You may need to remove the prez-ui folder as it may not have been deleted properly)"
125+
write-output "(Note: You may need to remove the prez-ui folder as it may not have been deleted properly)"

scripts/upgrade.sh

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ fi
77
MAC_OS=$([ $(uname -s) == Darwin ] && echo true || echo false)
88
USE_PNPM=$([ -f pnpm-lock.yaml ] && echo true || echo false)
99

10+
if $USE_PNPM; then
11+
MANAGER="pnpm"
12+
else
13+
MANAGER="npm"
14+
fi
15+
1016
if $MAC_OS; then
1117
SED_FLAGS=( -i '' )
1218
else
@@ -15,21 +21,21 @@ fi
1521

1622
# 1. Uninstall old packages
1723
REMOVE_PACKAGES=(@nuxtjs/tailwindcss radix-vue tailwindcss-animate prez-ui)
18-
if $USE_PNPM; then
19-
pnpm remove "${REMOVE_PACKAGES[@]}"
20-
else
21-
npm uninstall "${REMOVE_PACKAGES[@]}"
22-
fi
24+
25+
for package in "${REMOVE_PACKAGES[@]}"; do
26+
if $MANAGER list --depth=0 | grep $package; then
27+
if $USE_PNPM; then
28+
pnpm remove $package
29+
else
30+
npm uninstall $package
31+
fi
32+
fi
33+
done
2334

2435
# 2. Update packages
2536
UPDATE_PACKAGES=(tailwind-merge nuxt shadcn-nuxt)
26-
2737
PREZ_PACKAGES=(prez-lib prez-components)
28-
if $USE_PNPM; then
29-
MANAGER="pnpm"
30-
else
31-
MANAGER="npm"
32-
fi
38+
3339
for package in "${PREZ_PACKAGES[@]}"; do
3440
if $MANAGER list --depth=0 | grep $package; then
3541
UPDATE_PACKAGES+=($package)
@@ -117,9 +123,9 @@ else
117123
fi
118124

119125
if $USE_PNPM; then
120-
pnpm dlx shadcn-vue@latest add "${DIFF_COMPONENTS[@]}"
126+
yes n | pnpm dlx shadcn-vue@latest add "${DIFF_COMPONENTS[@]}"
121127
else
122-
npx shadcn-vue@latest add "${DIFF_COMPONENTS[@]}"
128+
yes n | npx shadcn-vue@latest add "${DIFF_COMPONENTS[@]}"
123129
fi
124130

125131
echo "-----------------------------"

0 commit comments

Comments
 (0)