From 6f676dcb33e367fbedfde0f46c47f88afadfd4ee Mon Sep 17 00:00:00 2001 From: Juan Mrad Date: Wed, 27 May 2026 13:27:24 -0500 Subject: [PATCH] [Types] Rename published package to @roostorg/coop-types (#602) * types: Rename published package to @roostorg/coop-types * code review fixes * code review fixes --- .github/workflows/publish-types.yaml | 11 ++++++----- scripts/publish-packages.sh | 26 ++++++++++++++++---------- types/package-lock.json | 8 ++++---- types/package.json | 6 +++--- 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.github/workflows/publish-types.yaml b/.github/workflows/publish-types.yaml index a6aa451..ed2acc9 100644 --- a/.github/workflows/publish-types.yaml +++ b/.github/workflows/publish-types.yaml @@ -28,13 +28,14 @@ jobs: - name: Check and publish types run: | cd types + PKG_NAME=$(node -p "require('./package.json').name") VERSION=$(node -p "require('./package.json').version") - echo "Checking @roostorg/types@$VERSION..." - - if npm view "@roostorg/types@$VERSION" version >/dev/null 2>&1; then - echo "⚠️ Version $VERSION of @roostorg/types already exists on npm - skipping" + echo "Checking $PKG_NAME@$VERSION..." + + if npm view "$PKG_NAME@$VERSION" version >/dev/null 2>&1; then + echo "⚠️ Version $VERSION of $PKG_NAME already exists on npm - skipping" else - echo "✅ Publishing @roostorg/types@$VERSION..." + echo "✅ Publishing $PKG_NAME@$VERSION..." npm ci --ignore-scripts npm run build npm publish diff --git a/scripts/publish-packages.sh b/scripts/publish-packages.sh index e0b725c..f0a8329 100755 --- a/scripts/publish-packages.sh +++ b/scripts/publish-packages.sh @@ -45,21 +45,27 @@ check_version_exists() { # Function to publish package if version doesn't exist publish_if_needed() { local package_dir=$1 - local package_name=$2 - + cd "$package_dir" - - # Get current version from package.json - local version=$(node -p "require('./package.json').version") - + + # Derive name and version from package.json so the script stays in sync + # with whatever npm publish will actually publish (avoids drift if the + # package is renamed without updating this script). + # Declare and assign separately so `set -e` catches node -p failures + # (shellcheck SC2155: `local foo=$(...)` masks the subshell's exit status). + local package_name + package_name=$(node -p "require('./package.json').name") + local version + version=$(node -p "require('./package.json').version") + echo "📦 Checking $package_name@$version..." - + if check_version_exists "$package_name" "$version"; then echo "⏭️ Skipping $package_name@$version (already published)" cd .. return fi - + echo "📦 Publishing $package_name@$version..." npm install npm run build @@ -68,8 +74,8 @@ publish_if_needed() { } # Publish packages -publish_if_needed "types" "@roostorg/types" -publish_if_needed "migrator" "@roostorg/db-migrator" +publish_if_needed "types" +publish_if_needed "migrator" echo "✅ All packages published successfully!" echo "" diff --git a/types/package-lock.json b/types/package-lock.json index 563d2bd..8dea361 100644 --- a/types/package-lock.json +++ b/types/package-lock.json @@ -1,12 +1,12 @@ { - "name": "@roostorg/types", - "version": "2.1.0", + "name": "@roostorg/coop-types", + "version": "2.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "@roostorg/types", - "version": "2.1.0", + "name": "@roostorg/coop-types", + "version": "2.2.0", "license": "ISC", "dependencies": { "date-fns": "^2.29.3", diff --git a/types/package.json b/types/package.json index 0c23959..c8abb21 100644 --- a/types/package.json +++ b/types/package.json @@ -1,8 +1,8 @@ { - "name": "@roostorg/types", + "name": "@roostorg/coop-types", "type": "module", - "version": "2.1.0", - "description": "Shared types across Coop services", + "version": "2.2.0", + "description": "Shared TypeScript types for Coop: schema primitives, signal data maps, and integration contracts.", "module": "transpiled/index.js", "typings": "./transpiled/index.d.ts", "scripts": { -- 2.51.2