An experimental TypeSpec syntax for Lexicon

yeah

+117
+1
packages/website/package.json
··· 1 1 { 2 2 "name": "website", 3 3 "type": "module", 4 + "private": true, 4 5 "version": "0.0.1", 5 6 "scripts": { 6 7 "dev": "astro dev",
+116
scripts/publish-all.sh
··· 1 + #!/bin/bash 2 + set -e 3 + 4 + # Usage: ./scripts/publish-all.sh <version> 5 + # Example: ./scripts/publish-all.sh 0.4.0 6 + 7 + if [ -z "$1" ]; then 8 + echo "Error: Version argument required" 9 + echo "Usage: ./scripts/publish-all.sh <version>" 10 + echo "Example: ./scripts/publish-all.sh 0.4.0" 11 + exit 1 12 + fi 13 + 14 + VERSION="$1" 15 + 16 + # Validate version format (basic semver check) 17 + if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then 18 + echo "Error: Invalid version format. Use semver format (e.g., 0.4.0 or 0.4.0-beta.1)" 19 + exit 1 20 + fi 21 + 22 + echo "📦 Publishing all packages at version $VERSION" 23 + echo "" 24 + 25 + # Get the root directory 26 + ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" 27 + cd "$ROOT_DIR" 28 + 29 + # Find all package.json files in packages/* 30 + ALL_PACKAGES=($(find packages -maxdepth 2 -name "package.json" -not -path "*/node_modules/*" | sort)) 31 + 32 + # Filter out private packages 33 + PACKAGES=() 34 + for pkg in "${ALL_PACKAGES[@]}"; do 35 + IS_PRIVATE=$(node -p "require('./$pkg').private || false") 36 + if [ "$IS_PRIVATE" != "true" ]; then 37 + PACKAGES+=("$pkg") 38 + fi 39 + done 40 + 41 + if [ ${#PACKAGES[@]} -eq 0 ]; then 42 + echo "Error: No publishable packages found in packages/" 43 + exit 1 44 + fi 45 + 46 + echo "Found ${#PACKAGES[@]} publishable packages:" 47 + for pkg in "${PACKAGES[@]}"; do 48 + PKG_NAME=$(node -p "require('./$pkg').name") 49 + echo " - $PKG_NAME" 50 + done 51 + echo "" 52 + 53 + # Update all package.json files with the new version 54 + echo "🔄 Updating versions in all packages..." 55 + for pkg in "${PACKAGES[@]}"; do 56 + PKG_DIR=$(dirname "$pkg") 57 + PKG_NAME=$(node -p "require('./$pkg').name") 58 + 59 + echo " Updating $PKG_NAME..." 60 + 61 + # Update version 62 + node -e " 63 + const fs = require('fs'); 64 + const path = '$pkg'; 65 + const pkg = require('./' + path); 66 + pkg.version = '$VERSION'; 67 + 68 + // Helper to preserve semver prefix (^, ~, etc.) and workspace: protocol 69 + function updateVersion(currentVersion, newVersion) { 70 + // Preserve workspace: protocol for monorepo 71 + if (currentVersion.startsWith('workspace:')) { 72 + return currentVersion; 73 + } 74 + // Preserve semver prefix 75 + const match = currentVersion.match(/^([~^>=<]*)(.*)$/); 76 + if (match) { 77 + return match[1] + newVersion; 78 + } 79 + return newVersion; 80 + } 81 + 82 + // Helper to update dependencies 83 + function updateDeps(deps) { 84 + if (!deps) return; 85 + for (const dep in deps) { 86 + if (dep.startsWith('@typelex/')) { 87 + deps[dep] = updateVersion(deps[dep], '$VERSION'); 88 + } 89 + } 90 + } 91 + 92 + updateDeps(pkg.dependencies); 93 + updateDeps(pkg.devDependencies); 94 + updateDeps(pkg.peerDependencies); 95 + 96 + fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n'); 97 + " 98 + done 99 + 100 + echo "" 101 + echo "✅ All versions updated to $VERSION" 102 + echo "" 103 + 104 + echo "" 105 + echo "✅ Dry run complete! Version updates have been applied." 106 + echo "" 107 + echo "📋 Updated packages:" 108 + for pkg in "${PACKAGES[@]}"; do 109 + PKG_NAME=$(node -p "require('./$pkg').name") 110 + echo " - $PKG_NAME@$VERSION" 111 + done 112 + echo "" 113 + echo "💡 Review the changes, then run with actual publishing enabled." 114 + echo "" 115 + echo "🚨 Publishing is currently disabled (dry-run mode)" 116 + echo " To enable publishing, edit scripts/publish-all.sh and uncomment the publish section"