diff --git a/packages/client/package.json b/packages/client/package.json index 16aca2f01..c5532491c 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -28,7 +28,7 @@ "repository": { "type": "git", "url": "https://github.com/scaleway/scaleway-sdk-js", - "directory": "packages/clients" + "directory": "packages/client" }, "engines": { "node": ">=18.0" diff --git a/packages/client/src/scw/constants.ts b/packages/client/src/scw/constants.ts index b9788cbf3..8e1d9f4ab 100644 --- a/packages/client/src/scw/constants.ts +++ b/packages/client/src/scw/constants.ts @@ -1,3 +1,5 @@ -export const version = 'v2.71.0' +import pkg from '../../package.json' + +export const { version } = pkg export const userAgent = `scaleway-sdk-js/${version}` diff --git a/packages/clients/package.json b/packages/clients/package.json index c44a1f01f..cb36f04a1 100644 --- a/packages/clients/package.json +++ b/packages/clients/package.json @@ -12,7 +12,6 @@ "module": "dist/index.js", "types": "dist/index.d.ts", "scripts": { - "version": "./scripts/update-constants-file.sh", "typecheck": "tsc --noEmit", "type:generate": "tsc --declaration -p tsconfig.build.json", "build": "vite build --config ../../vite.config.ts && pnpm run type:generate && tsc-alias -p tsconfig.build.json", diff --git a/packages/clients/scripts/update-constants-file.sh b/packages/clients/scripts/update-constants-file.sh deleted file mode 100755 index ee04aac95..000000000 --- a/packages/clients/scripts/update-constants-file.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -set -e - -echo "Updating version in constants.ts" - -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -PACKAGE_PATH="${SCRIPT_DIR}/../package.json" -CONSTANTS_PATH="${SCRIPT_DIR}/../src/scw/constants.ts" - -# Search for the new version -NEW_VERSION=$(node -e "console.log(require('${PACKAGE_PATH}').version);") -[ -z "${NEW_VERSION}" ] && echo "New version cannot be found, abording" && exit 1 -echo "Found version: ${NEW_VERSION}" - -# Replace the old version with the new one -OLD_LINE_EXP="\(^export const version.*$\)" -NEW_LINE="export const version = 'v${NEW_VERSION}'" -NEW_FILE=$( cat "${CONSTANTS_PATH}" | sed -e "s/${OLD_LINE_EXP}/${NEW_LINE}/" ) -if [[ "$NEW_FILE" != *"$NEW_LINE"* ]]; then - echo "New file content doesn't contain expected version:" - echo "${NEW_FILE}" - exit 2 -fi - -# Copy content to file -echo "${NEW_FILE}" > "${CONSTANTS_PATH}" -echo "Updated version in constants file" - -# Add change to commit -git add "${CONSTANTS_PATH}" diff --git a/packages/clients/src/scw/constants.ts b/packages/clients/src/scw/constants.ts index b9788cbf3..8e1d9f4ab 100644 --- a/packages/clients/src/scw/constants.ts +++ b/packages/clients/src/scw/constants.ts @@ -1,3 +1,5 @@ -export const version = 'v2.71.0' +import pkg from '../../package.json' + +export const { version } = pkg export const userAgent = `scaleway-sdk-js/${version}`