Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions .github/workflows/cli-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,20 @@ jobs:

- name: 📦 Publish xyd-js canary
run: |
cd packages/xyd-js
# Read the canary version of @xyd-js/cli from its local package.json
# (already versioned by changeset in the previous step)
CANARY_CLI_VERSION=$(node -p "require('./packages/xyd-cli/package.json').version")
echo "📦 @xyd-js/cli version: ${CANARY_CLI_VERSION}"

# Find the canary version of @xyd-js/cli that was just published
CANARY_CLI_VERSION=$(npm view @xyd-js/cli versions --json | node -e "
const versions = JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf8'));
const canary = versions.filter(v => v.includes('${{ steps.version.outputs.CANARY_VERSION }}'));
console.log(canary[canary.length - 1]);
")
cd packages/xyd-js

echo "📦 Installing @xyd-js/cli@${CANARY_CLI_VERSION}"
npm install @xyd-js/cli@${CANARY_CLI_VERSION} --save-exact
# Write dependency directly into package.json (avoids npm install resolving full dep tree)
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
pkg.dependencies['@xyd-js/cli'] = '${CANARY_CLI_VERSION}';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 4) + '\n');
"

# Set canary version on xyd-js package
npm version 0.0.0-${{ steps.version.outputs.CANARY_VERSION }} --no-git-tag-version
Expand Down
23 changes: 13 additions & 10 deletions scripts/canary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,23 @@ pnpm run build
echo "📦 Publishing @xyd-js/* packages..."
node ./release.js --prod --snapshot "${CANARY_VERSION}"

# Step 3: Find the published canary version of @xyd-js/cli
echo "🔍 Finding published @xyd-js/cli canary version..."
CANARY_CLI_VERSION=$(npm view @xyd-js/cli versions --json | node -e "
const versions = JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf8'));
const canary = versions.filter(v => v.includes('${CANARY_VERSION}'));
console.log(canary[canary.length - 1]);
")

echo " Found: @xyd-js/cli@${CANARY_CLI_VERSION}"
# Step 3: Read the canary version of @xyd-js/cli from local package.json
# (already versioned by changeset in the previous step)
CANARY_CLI_VERSION=$(node -p "require('./packages/xyd-cli/package.json').version")
echo " @xyd-js/cli version: ${CANARY_CLI_VERSION}"

# Step 4: Update xyd-js package and publish with canary tag
echo "📦 Publishing xyd-js canary..."
cd packages/xyd-js
npm install "@xyd-js/cli@${CANARY_CLI_VERSION}" --save-exact

# Write dependency directly (avoids npm install resolving full dep tree)
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
pkg.dependencies['@xyd-js/cli'] = '${CANARY_CLI_VERSION}';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 4) + '\n');
"

npm version "0.0.0-${CANARY_VERSION}" --no-git-tag-version
npm publish --tag canary
cd ../..
Expand Down
Loading