diff --git a/.github/workflows/nodejs.yml b/.github/workflows/ci.yml similarity index 94% rename from .github/workflows/nodejs.yml rename to .github/workflows/ci.yml index 17fe8be..bab007b 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,10 @@ -name: Node CI +name: CI on: [push, pull_request] +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest @@ -33,7 +36,7 @@ jobs: cache: 'pnpm' - name: Install dependencies - run: pnpm install + run: pnpm install --frozen-lockfile - name: Build run: pnpm build diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml deleted file mode 100644 index f6ec097..0000000 --- a/.github/workflows/npmpublish.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Publish - -on: - release: - types: [published] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [20.x] - - steps: - - uses: actions/checkout@v4 - - - name: Install pnpm - uses: pnpm/action-setup@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install - - - name: Build - run: pnpm build - - - name: Pack the package - run: | - cd imagekit-astro - pnpm pack - - - name: Setup test-app with packed package - run: | - cd test-app - pnpm remove @imagekit/astro || true - pnpm add ../imagekit-astro/imagekit-astro-*.tgz - - - name: Install Playwright - run: | - cd test-app - npx playwright install --with-deps - - - name: Run E2E tests - run: | - cd test-app - pnpm test:e2e - env: - CI: true - - publish: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - version: 9 - - - uses: actions/setup-node@v4 - with: - node-version: 20 - registry-url: https://registry.npmjs.org/ - cache: 'pnpm' - - - name: Install and Build - run: | - pnpm install - pnpm build - - - name: NPM Publish - run: | - cd imagekit-astro - npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN - # print the NPM user name for validation - npm whoami - VERSION=$(node -p "require('./package.json').version") - # Only publish stable versions to the latest tag - if [[ "$VERSION" =~ ^[^-]+$ ]]; then - NPM_TAG="latest" - else - NPM_TAG="beta" - fi - echo "Publishing $VERSION with $NPM_TAG tag." - npm publish --tag $NPM_TAG --access public - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} - CI: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..7314db0 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,52 @@ +name: Publish + +on: + release: + types: [published] + +permissions: + contents: read + id-token: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + cache: 'pnpm' + + - name: Install + run: pnpm install --frozen-lockfile + + - name: Build SDK + run: pnpm --filter @imagekit/astro build + + - name: Stage README and LICENSE into package + run: | + cp README.md imagekit-astro/README.md + cp LICENSE imagekit-astro/LICENSE + + - name: NPM Publish + working-directory: imagekit-astro + run: | + npm whoami + VERSION=$(node -p "require('./package.json').version") + # Stable versions go to "latest", pre-release versions go to "beta" + if [[ "$VERSION" =~ ^[^-]+$ ]]; then + NPM_TAG="latest" + else + NPM_TAG="beta" + fi + echo "Publishing $VERSION with $NPM_TAG tag." + npm publish --tag $NPM_TAG --access public --provenance + env: + NODE_AUTH_TOKEN: ${{ secrets.npm_token }} + CI: true diff --git a/README.md b/README.md index 1975bfa..8c08b2f 100644 --- a/README.md +++ b/README.md @@ -1,499 +1,123 @@ -# @imagekit/astro +[ImageKit.io](https://imagekit.io) -Astro SDK for [ImageKit.io](https://imagekit.io) — optimized image & video delivery with real-time transformations, responsive images, and automatic format optimization. +# ImageKit.io Astro SDK [![npm version](https://img.shields.io/npm/v/@imagekit/astro)](https://www.npmjs.com/package/@imagekit/astro) -[![license](https://img.shields.io/npm/l/@imagekit/astro)](./LICENSE) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Twitter Follow](https://img.shields.io/twitter/follow/imagekitio?label=Follow&style=social)](https://twitter.com/ImagekitIo) -## Quick Start +## Introduction -### 1. Install +ImageKit Astro SDK plugs ImageKit.io into Astro's built-in image pipeline. It allows you to: -```bash -npm install @imagekit/astro -# or -pnpm add @imagekit/astro -# or -yarn add @imagekit/astro -``` - -### 2. Configure - -Add your ImageKit URL endpoint to your `.env` file: - -```env -# Preferred when endpoint may be used in client-side code -PUBLIC_IMAGEKIT_URL_ENDPOINT=https://ik.imagekit.io/your_imagekit_id - -# Server-only fallback -IMAGEKIT_URL_ENDPOINT=https://ik.imagekit.io/your_imagekit_id -``` +- Render images with Astro's `` and `` components, served from ImageKit with automatic optimization, responsive `srcset`, and lazy loading. +- Apply real-time transformations (resize, crop, focus, quality, format) using URL parameters. +- Apply AI-powered transformations such as background removal, generative fill, and smart cropping via the `transformation` prop. +- Render optimized `