Skip to content

Commit 41451e1

Browse files
committed
chore(build): add script to cleanup all dev tags at once
1 parent 27bed25 commit 41451e1

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,9 @@ Or to downgrade `latest-rc` tag to a previous version.
252252

253253
## How to cleanup dev tags
254254

255-
Execute the npm script `npm run devops:cleanup-tag -- <dev-tag>`
256-
Ex: `npm run devops:cleanup-tag -- dev-101`
255+
Execute the npm script `npm run devops:cleanup:dev-tag -- <dev-tag> <otp>` to clean up a single dev tag.
256+
Ex: `npm run devops:cleanup:dev-tag -- dev-101 123456`
257257

258-
It will remove the dev tag from npm registry and deprecate all versions related to this dev tag.
258+
To clean up **all** dev tags at once: `npm run devops:cleanup:dev-tag:all -- <otp>`
259+
260+
Both will deprecate all versions related to the dev tag(s) and remove the dist-tag(s) from the npm registry.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"compile": "wireit",
7777
"dependencies:upgrade": "npx npm-check-updates -u ; npm update ; npm audit fix",
7878
"devops:cleanup:dev-tag": "./tooling/devops-cleanup.sh",
79+
"devops:cleanup:dev-tag:all": "./tooling/devops-cleanup-all.sh",
7980
"devops:move-tag": "./tooling/devops-movetag.sh",
8081
"lint": "wireit",
8182
"lint:dependencies": "wireit",

tooling/devops-cleanup-all.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
OTP=$1
4+
PACKAGE="sf-git-merge-driver"
5+
6+
DEV_TAGS=$(npm dist-tag ls "${PACKAGE}" | grep -oE '^dev-[0-9]+')
7+
8+
if [ -z "${DEV_TAGS}" ]; then
9+
echo "No dev tags found"
10+
exit 0
11+
fi
12+
13+
VERSIONS_JSON=$(npm view "${PACKAGE}" versions --json)
14+
15+
for DEV_TAG in ${DEV_TAGS}; do
16+
echo "Cleaning up ${DEV_TAG}..."
17+
echo "${VERSIONS_JSON}" | jq -r '.[]' | grep "\\-${DEV_TAG}\\." | xargs -I {} npm deprecate "${PACKAGE}@{}" "Deprecated dev version" --otp "${OTP}"
18+
npm dist-tag rm "${PACKAGE}" "${DEV_TAG}" --otp "${OTP}"
19+
done

0 commit comments

Comments
 (0)