@@ -74,14 +74,100 @@ for package_name in "${PUBLISH_ORDER[@]}"; do
7474 fi
7575done
7676
77- # Then publish iconify collections (which depend on iconify-core)
77+ # Publish iconify collections with workspace dependency resolution
7878if [ -d " packages/collections" ]; then
79- echo " Processing collections subdirectories..."
79+ echo " ========================================="
80+ echo " Publishing Iconify Collections..."
81+ echo " ========================================="
82+
83+ # Get the current version of iconify-core
84+ if command -v bun > /dev/null 2>&1 ; then
85+ ICONIFY_CORE_VERSION=$( bun --eval " console.log(require('./packages/iconify-core/package.json').version)" )
86+ elif command -v node > /dev/null 2>&1 ; then
87+ ICONIFY_CORE_VERSION=$( node -p " require('./packages/iconify-core/package.json').version" )
88+ else
89+ echo " Error: Neither bun nor node found to read iconify-core version"
90+ exit 1
91+ fi
92+
93+ if [ -z " $ICONIFY_CORE_VERSION " ]; then
94+ echo " Error: Could not determine iconify-core version"
95+ exit 1
96+ fi
97+
98+ echo " Using @stacksjs/iconify-core version: $ICONIFY_CORE_VERSION "
99+ echo " "
100+
101+ # Counter for published packages
102+ published_count=0
103+
80104 for collection_dir in packages/collections/* / ; do
81105 if [ -d " $collection_dir " ]; then
82- publish_package " $collection_dir "
106+ package_name=$( basename " $collection_dir " )
107+ package_json=" $collection_dir /package.json"
108+
109+ if [ ! -f " $package_json " ]; then
110+ continue
111+ fi
112+
113+ # Check if package is private
114+ if command -v bun > /dev/null 2>&1 ; then
115+ is_private=$( bun --eval " try { const pkg = JSON.parse(require('fs').readFileSync('$package_json ', 'utf8')); console.log(pkg.private === true ? 'true' : 'false'); } catch(e) { console.log('false'); }" )
116+ else
117+ is_private=" false"
118+ fi
119+
120+ if [ " $is_private " = " true" ]; then
121+ continue
122+ fi
123+
124+ echo " ----------------------------------------"
125+ echo " Processing $package_name ..."
126+ echo " Package $package_name private status: $is_private "
127+
128+ # Create a backup of package.json
129+ cp " $package_json " " $package_json .backup"
130+
131+ # Replace workspace:* with actual version
132+ if command -v jq > /dev/null 2>&1 ; then
133+ jq " .dependencies.\" @stacksjs/iconify-core\" = \" ^$ICONIFY_CORE_VERSION \" " " $package_json .backup" > " $package_json .tmp"
134+ mv " $package_json .tmp" " $package_json "
135+ else
136+ # Fallback to bun/node for JSON manipulation
137+ if command -v bun > /dev/null 2>&1 ; then
138+ bun --eval " const fs = require('fs'); const pkg = JSON.parse(fs.readFileSync('$package_json .backup', 'utf8')); pkg.dependencies['@stacksjs/iconify-core'] = '^$ICONIFY_CORE_VERSION '; fs.writeFileSync('$package_json ', JSON.stringify(pkg, null, 2));"
139+ else
140+ node -e " const fs = require('fs'); const pkg = JSON.parse(fs.readFileSync('$package_json .backup', 'utf8')); pkg.dependencies['@stacksjs/iconify-core'] = '^$ICONIFY_CORE_VERSION '; fs.writeFileSync('$package_json ', JSON.stringify(pkg, null, 2));"
141+ fi
142+ fi
143+
144+ echo " Publishing $package_name ..."
145+ cd " $collection_dir "
146+ if bun publish --access public; then
147+ echo " ✅ Published $package_name "
148+ published_count=$(( published_count + 1 ))
149+ else
150+ echo " ❌ Failed to publish $package_name "
151+ # Restore original package.json on failure
152+ mv " $package_json .backup" " $package_json "
153+ cd - > /dev/null
154+ echo " ----------------------------------------"
155+ continue
156+ fi
157+ cd - > /dev/null
158+
159+ # Restore original package.json after successful publish
160+ mv " $package_json .backup" " $package_json "
161+
162+ echo " ----------------------------------------"
83163 fi
84164 done
165+
166+ echo " "
167+ echo " ========================================="
168+ echo " Collections Summary: Published $published_count packages"
169+ echo " ========================================="
170+ echo " "
85171fi
86172
87173echo " All packages published successfully!"
0 commit comments