diff options
author | Alexander <a.kiryukhin@vk.team> | 2024-10-10 17:35:30 +0300 |
---|---|---|
committer | Alexander <a.kiryukhin@vk.team> | 2024-10-10 17:35:30 +0300 |
commit | 79277335465f3a59460844bf322b5b1b07827a78 (patch) | |
tree | 2326523bd51ce7678c945b6eece8375beb903b53 /bin |
initial
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ovsx_package_last_published_version | 8 | ||||
-rwxr-xr-x | bin/ovsx_publish_all_packages | 19 | ||||
-rwxr-xr-x | bin/ovsx_publish_package_when_outdated | 20 | ||||
-rwxr-xr-x | bin/vsce_package_last_published_version | 9 | ||||
-rwxr-xr-x | bin/vsce_publish_all_packages | 14 | ||||
-rwxr-xr-x | bin/vsce_publish_package_when_outdated | 22 |
6 files changed, 92 insertions, 0 deletions
diff --git a/bin/ovsx_package_last_published_version b/bin/ovsx_package_last_published_version new file mode 100755 index 0000000..80c25c2 --- /dev/null +++ b/bin/ovsx_package_last_published_version @@ -0,0 +1,8 @@ +#!/usr/bin/env sh +set -e + +PUBLISHER=$1 +PACKAGE_NAME=$2 + +(npx ovsx get --metadata "${PUBLISHER}.${PACKAGE_NAME}" || echo '{"version":"not yet published"}') | + jq -r .version diff --git a/bin/ovsx_publish_all_packages b/bin/ovsx_publish_all_packages new file mode 100755 index 0000000..42701f9 --- /dev/null +++ b/bin/ovsx_publish_all_packages @@ -0,0 +1,19 @@ +#!/usr/bin/env sh + +# 2021-08-28: +# publishing an extension package with at least one unpublished extension fails +# most of the packaged extensions are not published in the Open VSX registry +# let's fail silently =( +# set -e + +PATH_TO_THIS_SCRIPT=$(realpath "$0") +BIN_DIR=$(dirname "${PATH_TO_THIS_SCRIPT}") +ROOT_DIR=$(dirname "${BIN_DIR}") + +for PACKAGE in "${ROOT_DIR}/extensions/"*; do + cd "${PACKAGE}" + + ovsx_publish_package_when_outdated + + cd "${ROOT_DIR}" +done diff --git a/bin/ovsx_publish_package_when_outdated b/bin/ovsx_publish_package_when_outdated new file mode 100755 index 0000000..68280ba --- /dev/null +++ b/bin/ovsx_publish_package_when_outdated @@ -0,0 +1,20 @@ +#!/usr/bin/env sh +set -e + +PACKAGE_LOCAL_VERSION=$(node --print "require('./package.json').version") +PUBLISHER=$(node --print "require('./package.json').publisher") +PACKAGE_NAME=$(node --print "require('./package.json').name") + +PACKAGE_LAST_PUBLISHED_VERSION=$(ovsx_package_last_published_version "${PUBLISHER}" "${PACKAGE_NAME}") + +echo "${PUBLISHER}.${PACKAGE_NAME}" +echo "Package local version: ${PACKAGE_LOCAL_VERSION}" +echo "Package last published version: ${PACKAGE_LAST_PUBLISHED_VERSION}" + +if [ "${PACKAGE_LAST_PUBLISHED_VERSION}" != "${PACKAGE_LOCAL_VERSION}" ]; then + echo "Package is outdated" + echo "Publishing..." + npx ovsx publish +else + echo "Package is up-to-date" +fi diff --git a/bin/vsce_package_last_published_version b/bin/vsce_package_last_published_version new file mode 100755 index 0000000..c371b7d --- /dev/null +++ b/bin/vsce_package_last_published_version @@ -0,0 +1,9 @@ +#!/usr/bin/env sh +set -e + +PUBLISHER=$1 +PACKAGE_NAME=$2 + +npx vsce show "${PUBLISHER}.${PACKAGE_NAME}" | + grep -E -o "Version:\s+(\S+)" | + sed -r "s/Version:\s+(\S+)/\1/" diff --git a/bin/vsce_publish_all_packages b/bin/vsce_publish_all_packages new file mode 100755 index 0000000..44ef557 --- /dev/null +++ b/bin/vsce_publish_all_packages @@ -0,0 +1,14 @@ +#!/usr/bin/env sh +set -e + +PATH_TO_THIS_SCRIPT=$(realpath "$0") +BIN_DIR=$(dirname "${PATH_TO_THIS_SCRIPT}") +ROOT_DIR=$(dirname "${BIN_DIR}") + +for PACKAGE in "${ROOT_DIR}/extensions/"*; do + cd "${PACKAGE}" + + vsce_publish_package_when_outdated + + cd "${ROOT_DIR}" +done diff --git a/bin/vsce_publish_package_when_outdated b/bin/vsce_publish_package_when_outdated new file mode 100755 index 0000000..4d428c9 --- /dev/null +++ b/bin/vsce_publish_package_when_outdated @@ -0,0 +1,22 @@ +#!/usr/bin/env sh +set -e + +PACKAGE_LOCAL_VERSION=$(node --print "require('./package.json').version") +PUBLISHER=$(node --print "require('./package.json').publisher") +PACKAGE_NAME=$(node --print "require('./package.json').name") + +PACKAGE_LAST_PUBLISHED_VERSION=$(vsce_package_last_published_version "${PUBLISHER}" "${PACKAGE_NAME}") + +echo "${PUBLISHER}.${PACKAGE_NAME}" +echo "Package local version: ${PACKAGE_LOCAL_VERSION}" +echo "Package last published version: ${PACKAGE_LAST_PUBLISHED_VERSION}" + +if [ "${PACKAGE_LAST_PUBLISHED_VERSION}" != "${PACKAGE_LOCAL_VERSION}" ]; then + echo "Package is outdated" + echo "Package contains" + npx vsce ls + echo "Publishing..." + npx vsce publish +else + echo "Package is up-to-date" +fi |