Skip to content

chore: add script to deprecate a version across all packages #259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions scripts/deprecate-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

version_to_deprecate="$1"
shift

message="$1"
shift

if [ -z "$version_to_deprecate" -o -z "$message" -o -n "$*" ]; then
echo "Usage: $0 <version-or-range-to-deprecate> <message>"
echo "Example: $0 1.2.3 'This version is deprecated. Please upgrade to version 2.3.4 or newer.'"
exit 1
fi

echo "Deprecating version $version_to_deprecate with message: $message"

# `readarray` is convenient to avoid piping into the loop,
# ensuring that npm can authenticate interactively if needed
readarray -t packages < <(npm -ws pkg get name | jq -r '.[]')

for package in "${packages[@]}"; do
echo "Deprecating $package@$version_to_deprecate"
npm deprecate "$package@$version_to_deprecate" "$message"
done
Loading