From 181f3e93b3303e7d9637aea8058686991eb8a201 Mon Sep 17 00:00:00 2001 From: Louis Varin Date: Mon, 29 Sep 2025 22:00:03 -0400 Subject: [PATCH] chore: remove unused publish scripts TICKET: DX-1510 --- modules/bitgo/scripts/publish.sh | 78 ---------------------------- modules/statics/scripts/publish.sh | 79 ----------------------------- modules/unspents/README.md | 9 ---- modules/unspents/scripts/publish.sh | 79 ----------------------------- 4 files changed, 245 deletions(-) delete mode 100755 modules/bitgo/scripts/publish.sh delete mode 100755 modules/statics/scripts/publish.sh delete mode 100755 modules/unspents/scripts/publish.sh diff --git a/modules/bitgo/scripts/publish.sh b/modules/bitgo/scripts/publish.sh deleted file mode 100755 index 3e08d5f697..0000000000 --- a/modules/bitgo/scripts/publish.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env bash - -# Due to the strange behavior in npm@3 of running prepublish scripts during npm install, -# this script is designed as a replacement for `npm publish` for correctly preparing, -# building, publishing, and verifying this package. - -usage() { - echo "usage: $0 [ref-name]" - echo - echo "Builds, publishes, and verifies a release from the given ref name (branch, tag, or commit hash)" - echo - echo "If ref-name is not given, HEAD is used as the release ref" - exit 0 -} - -error() { - echo "error: $1" - exit "${2:-1}" -} - -confirm() { - echo -n "$1 [yN]: " - read -r confirm - [[ "$confirm" != "y" && "$confirm" != "Y" ]] && error "user aborted" -} - -package_json() { - node -e "console.log(require('./package.json').$1)" -} - -# check preconditions -# make sure we can read the package.json -[[ -f package.json ]] || error "could not locate package.json in directory $(pwd). Publish must be run from the package root." -git rev-parse --verify "${1:-HEAD}" >/dev/null 2>&1 || error "ref $1 does not exist" -REF_NAME="$(git rev-parse --abbrev-ref "${1:-HEAD}")" - -# warn if release is not rel/something -[[ "$REF_NAME" =~ rel/.* || "$REF_NAME" =~ [0-9]+\.[0-9]+\.[0-9] ]] || \ -confirm "Ref $REF_NAME does not look like a release branch or version tag. Are you sure you want to publish this ref?" - -# make sure the working directory is clean -[[ -z "$(git status --porcelain)" ]] || error "working directory not clean" - -git checkout -q "$REF_NAME" -PACKAGE_NAME="$(package_json 'name')" -PACKAGE_VERSION="$(package_json 'version')" - -# install -npm install - -# build -echo "executing dry run publish of $PACKAGE_NAME@$PACKAGE_VERSION from ref $REF_NAME..." -npm publish --dry-run -confirm "Does everything look ok?" - -echo -echo "publishing package with the following details to npm:" -echo "package: $PACKAGE_NAME" -echo "version: $PACKAGE_VERSION" -echo "ref: $REF_NAME" -echo "commit: $(git rev-parse HEAD)" -echo "date: $(date)" -echo -confirm "confirm publish" - -echo -n "enter OTP: " -read -r otp -npm publish --otp="$otp" -git checkout -q - - -# verify package -echo "verifying correct publish of $PACKAGE_NAME@$PACKAGE_VERSION" -cd "$(mktemp -d)" || error "cd failed. Verify package manually." -npm init -y >/dev/null 2>&1 || error "npm init failed. Verify package manually." -npm install "$PACKAGE_NAME@$PACKAGE_VERSION" >/dev/null 2>&1 || error "npm install failed! Publish may not have occurred or there was an installation blocker!!!" -node -e "require('${PACKAGE_NAME}')" || error "node require failed! unpublish!!!" -cd "$OLDPWD" || error "cd to OLDPWD failed. Verify package manually." -echo "correct publish of $PACKAGE_NAME@$PACKAGE_VERSION has been verified!" diff --git a/modules/statics/scripts/publish.sh b/modules/statics/scripts/publish.sh deleted file mode 100755 index 03966d9d94..0000000000 --- a/modules/statics/scripts/publish.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env bash - -# Due to the strange behavior in npm@3 of running prepublish scripts during npm install, -# this script is designed as a replacement for `npm publish` for correctly preparing, -# building, publishing, and verifying this package. - -usage() { - echo "usage: $0 [ref-name]" - echo - echo "Builds, publishes, and verifies a release from the given ref name" - echo - echo "If ref-name is not given, HEAD is used as the release ref" - exit 0 -} - -error() { - echo "error: $1" - exit "${2:-1}" -} - -confirm() { - echo -n "$1 [yN]: " - read -r confirm - [[ "$confirm" != "y" && "$confirm" != "Y" ]] && error "user aborted" -} - -package_json() { - node -e "console.log(require('./package.json').$1)" -} - -# check preconditions -# make sure we can read the package.json -[[ -f package.json ]] || error "could not locate package.json in directory $(pwd). Publish must be run from the package root." -git rev-parse --verify "${1:-HEAD}" >/dev/null 2>&1 || error "ref $1 does not exist" -REF_NAME="$(git rev-parse --abbrev-ref "${1:-HEAD}")" - -# warn if release is not rel/something -[[ "$REF_NAME" =~ rel/.* || "$REF_NAME" =~ [0-9]+\.[0-9]+\.[0-9]+ ]] || \ -confirm "Ref $REF_NAME does not look like a release branch or version tag. Are you sure you want to publish this ref?" - -# make sure the working directory is clean -[[ -z "$(git status --porcelain)" ]] || error "working directory not clean" - -git checkout -q "$REF_NAME" -PACKAGE_NAME="$(package_json 'name')" -PACKAGE_VERSION="$(package_json 'version')" - -# install -npm install - -# build -npm run build -echo "executing dry run publish of $PACKAGE_NAME@$PACKAGE_VERSION from ref $REF_NAME..." -npm publish --dry-run -confirm "Does everything look ok?" - -echo -echo "publishing package with the following details to npm:" -echo "package: $PACKAGE_NAME" -echo "version: $PACKAGE_VERSION" -echo "ref: $REF_NAME" -echo "commit: $(git rev-parse HEAD)" -echo "date: $(date)" -echo -confirm "confirm publish" - -echo -n "enter OTP: " -read -r otp -npm publish --otp="$otp" -git checkout -q - - -# verify package -echo "verifying correct publish of $PACKAGE_NAME@$PACKAGE_VERSION" -cd "$(mktemp -d)" || error "cd to temp directory failed. Verify package manually." -npm init -y >/dev/null 2>&1 || error "npm init failed. Verify package manually." -npm install "$PACKAGE_NAME@$PACKAGE_VERSION" >/dev/null 2>&1 || error "npm install failed! May need to unpublish!!!" -node -e "require('${PACKAGE_NAME}')" || error "node require failed! unpublish!!!" -cd "$OLDPWD" || error "cd to old pwd failed. Publish is probably alright, but verify package manually" -echo "correct publish of $PACKAGE_NAME@$PACKAGE_VERSION has been verified!" diff --git a/modules/unspents/README.md b/modules/unspents/README.md index 438ce15a2c..d222fd2585 100644 --- a/modules/unspents/README.md +++ b/modules/unspents/README.md @@ -47,15 +47,6 @@ Dimensions.fromUnspents({ unspents }) .getVSize(); ``` -## Publishing new versions - -Publishing new versions should be done by running the publish script in `scripts/publish.sh`. - -It can be invoked with the name of the branch to release, and will default to the currently checked out branch if not given. - -It will perform validation of all prepublish conditions, run a dry-run publish, then, if successful, a real publish. After that is complete, -the newly installed package will be downloaded and `require()`'d to ensure the package was published correctly. - ## Continuous Integration `@bitgo/unspents` uses github actions for continuous integration, which is configured by the `.github/workflows/ci.yml` file in the project root. All changes to the CI process should be done by modifying the `.github/workflows/ci.yml` file. diff --git a/modules/unspents/scripts/publish.sh b/modules/unspents/scripts/publish.sh deleted file mode 100755 index 03966d9d94..0000000000 --- a/modules/unspents/scripts/publish.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env bash - -# Due to the strange behavior in npm@3 of running prepublish scripts during npm install, -# this script is designed as a replacement for `npm publish` for correctly preparing, -# building, publishing, and verifying this package. - -usage() { - echo "usage: $0 [ref-name]" - echo - echo "Builds, publishes, and verifies a release from the given ref name" - echo - echo "If ref-name is not given, HEAD is used as the release ref" - exit 0 -} - -error() { - echo "error: $1" - exit "${2:-1}" -} - -confirm() { - echo -n "$1 [yN]: " - read -r confirm - [[ "$confirm" != "y" && "$confirm" != "Y" ]] && error "user aborted" -} - -package_json() { - node -e "console.log(require('./package.json').$1)" -} - -# check preconditions -# make sure we can read the package.json -[[ -f package.json ]] || error "could not locate package.json in directory $(pwd). Publish must be run from the package root." -git rev-parse --verify "${1:-HEAD}" >/dev/null 2>&1 || error "ref $1 does not exist" -REF_NAME="$(git rev-parse --abbrev-ref "${1:-HEAD}")" - -# warn if release is not rel/something -[[ "$REF_NAME" =~ rel/.* || "$REF_NAME" =~ [0-9]+\.[0-9]+\.[0-9]+ ]] || \ -confirm "Ref $REF_NAME does not look like a release branch or version tag. Are you sure you want to publish this ref?" - -# make sure the working directory is clean -[[ -z "$(git status --porcelain)" ]] || error "working directory not clean" - -git checkout -q "$REF_NAME" -PACKAGE_NAME="$(package_json 'name')" -PACKAGE_VERSION="$(package_json 'version')" - -# install -npm install - -# build -npm run build -echo "executing dry run publish of $PACKAGE_NAME@$PACKAGE_VERSION from ref $REF_NAME..." -npm publish --dry-run -confirm "Does everything look ok?" - -echo -echo "publishing package with the following details to npm:" -echo "package: $PACKAGE_NAME" -echo "version: $PACKAGE_VERSION" -echo "ref: $REF_NAME" -echo "commit: $(git rev-parse HEAD)" -echo "date: $(date)" -echo -confirm "confirm publish" - -echo -n "enter OTP: " -read -r otp -npm publish --otp="$otp" -git checkout -q - - -# verify package -echo "verifying correct publish of $PACKAGE_NAME@$PACKAGE_VERSION" -cd "$(mktemp -d)" || error "cd to temp directory failed. Verify package manually." -npm init -y >/dev/null 2>&1 || error "npm init failed. Verify package manually." -npm install "$PACKAGE_NAME@$PACKAGE_VERSION" >/dev/null 2>&1 || error "npm install failed! May need to unpublish!!!" -node -e "require('${PACKAGE_NAME}')" || error "node require failed! unpublish!!!" -cd "$OLDPWD" || error "cd to old pwd failed. Publish is probably alright, but verify package manually" -echo "correct publish of $PACKAGE_NAME@$PACKAGE_VERSION has been verified!"