Repository navigation
feat: restructure exports and integrate live-preview for enhanced Vis… #138
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to npm | |
| on: | |
| push: | |
| branches: [main, dev] | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| publish: | |
| if: github.ref_name == 'main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Use Node.js 24.x | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24.x | |
| registry-url: 'https://registry.npmjs.org/' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Sync versions from root package.json | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "Publishing version: $VERSION" | |
| for pkgdir in packages/*/; do | |
| pkg="${pkgdir}package.json" | |
| jq --arg v "$VERSION" ' | |
| .version = $v | | |
| if .dependencies then | |
| .dependencies |= with_entries(if .key | startswith("@localess/") then .value = $v else . end) | |
| else . end | | |
| if .peerDependencies then | |
| .peerDependencies |= with_entries(if .key | startswith("@localess/") then .value = $v else . end) | |
| else . end | |
| ' "$pkg" > tmp.json && mv tmp.json "$pkg" | |
| done | |
| shell: bash | |
| - name: Build all packages | |
| run: npm run build | |
| - name: Publish all packages to npm | |
| run: | | |
| for pkgdir in packages/*/; do | |
| if ! grep -q '"private"\s*:\s*true' "${pkgdir}package.json"; then | |
| npm publish --access public --provenance --ignore-scripts --workspace "$pkgdir" | |
| fi | |
| done | |
| shell: bash | |
| publish-snapshot: | |
| if: github.ref_name == 'dev' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Use Node.js 24.x | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24.x | |
| registry-url: 'https://registry.npmjs.org/' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Set snapshot version from root package.json | |
| run: | | |
| DATE=$(date +"%Y%m%d%H%M%S") | |
| VERSION="$(node -p "require('./package.json').version")-dev.${DATE}" | |
| echo "Publishing snapshot version: $VERSION" | |
| for pkgdir in packages/*/; do | |
| pkg="${pkgdir}package.json" | |
| jq --arg v "$VERSION" ' | |
| .version = $v | | |
| if .dependencies then | |
| .dependencies |= with_entries(if .key | startswith("@localess/") then .value = $v else . end) | |
| else . end | | |
| if .peerDependencies then | |
| .peerDependencies |= with_entries(if .key | startswith("@localess/") then .value = $v else . end) | |
| else . end | |
| ' "$pkg" > tmp.json && mv tmp.json "$pkg" | |
| done | |
| shell: bash | |
| - name: Build all packages | |
| run: npm run build | |
| - name: Publish all packages to npm with tag 'dev' | |
| run: | | |
| for pkgdir in packages/*/; do | |
| if ! grep -q '"private"\s*:\s*true' "${pkgdir}package.json"; then | |
| echo "Navigating to $pkgdir to publish..." | |
| # Step into the package directory | |
| cd "$pkgdir" | |
| # Publish locally from inside the package directory | |
| npm publish --tag dev --access public --provenance --ignore-scripts | |
| # Step back out to the root for the next iteration | |
| cd - > /dev/null | |
| fi | |
| done | |
| shell: bash |