diff --git a/.github/assets/react-fabrio-logo.png b/.github/assets/react-fabrio-logo.png new file mode 100755 index 0000000..e7cf08e Binary files /dev/null and b/.github/assets/react-fabrio-logo.png differ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ee78c3..7bd9751 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,7 @@ name: CI on: push: pull_request: + workflow_dispatch: permissions: contents: read @@ -22,5 +23,120 @@ jobs: - run: pnpm react-doctor - run: pnpm format:check - run: pnpm typecheck - - run: pnpm test + - run: pnpm test:coverage + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage/lcov.info - run: pnpm build + - run: node scripts/check-docs.mjs + + e2e: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: pnpm/action-setup@v6 + - uses: actions/setup-node@v7 + with: + node-version: 24 + cache: pnpm + - run: pnpm install --frozen-lockfile + - run: pnpm exec playwright install --with-deps chromium firefox webkit + - run: pnpm test:e2e + - uses: actions/upload-artifact@v6 + if: failure() + with: + name: playwright-failures + path: | + test-results/ + playwright-report/ + retention-days: 7 + + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: pnpm/action-setup@v6 + - uses: actions/setup-node@v7 + with: + node-version: 24 + cache: pnpm + - run: pnpm install --frozen-lockfile + - run: node scripts/check-docs.mjs + - run: pnpm docs:build + - run: pnpm exec playwright install --with-deps chromium + - run: pnpm docs:test + - uses: actions/upload-pages-artifact@v4 + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + with: + path: apps/docs/dist/client + - uses: actions/upload-artifact@v6 + if: failure() + with: + name: docs-playwright-failures + path: apps/docs/test-results/ + retention-days: 7 + + publish: + name: Publish npm packages + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + needs: [validate, e2e, docs] + runs-on: ubuntu-latest + permissions: + contents: write + concurrency: + group: npm-release + cancel-in-progress: false + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + - uses: pnpm/action-setup@v6 + - uses: actions/setup-node@v7 + with: + node-version: 24 + cache: pnpm + registry-url: https://registry.npmjs.org + - run: pnpm install --frozen-lockfile + - name: Build library packages + run: pnpm build:packages + - name: Publish packages and create GitHub release + run: pnpm release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + deploy-docs: + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + needs: [validate, e2e, docs] + runs-on: ubuntu-latest + permissions: + contents: read + pages: write + id-token: write + concurrency: + group: github-pages + cancel-in-progress: false + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - uses: actions/configure-pages@v5 + - name: Deploy documentation + id: deployment + uses: actions/deploy-pages@v4 + - name: Check public documentation + env: + SITE_URL: ${{ steps.deployment.outputs.page_url }} + run: | + node --input-type=module <<'JS' + const base = process.env.SITE_URL.replace(/\/$/, ""); + for (const path of ["/", "/docs/agents/domain/", "/llms.txt", "/llms-full.txt", "/docs/content.md", "/api/search.json"]) { + const response = await fetch(`${base}${path}`); + if (!response.ok) throw new Error(`${path}: ${response.status}`); + const text = await response.text(); + if (text.length < 100) throw new Error(`Empty documentation: ${path}`); + if (!path.endsWith("/") && / + React Fabrio logo +

-See [CONTRIBUTING.md](CONTRIBUTING.md) for setup, commands, current architecture, and package validation. +[![CI](https://github.com/Imunal/react-fabrio/actions/workflows/ci.yml/badge.svg)](https://github.com/Imunal/react-fabrio/actions/workflows/ci.yml) +[![codecov](https://codecov.io/gh/Imunal/react-fabrio/branch/main/graph/badge.svg)](https://codecov.io/gh/Imunal/react-fabrio) + +React Fabrio is a React library for building product personalization editors for print and engraving. Configure it for apparel, drinkware, accessories, gifts and other products with customizable decoration areas. + +Customers can edit text, images and vector artwork, then preview their design. Fabrio exports PNG files for printing and SVG files for engraving. Use the included editor or build your own interface with the React components. + +The packages are still in development and have not been published. Run the playground from this repository to try them. + +## Get started + +You need Node.js 24.11+ and pnpm 12.14.x. + +```sh +pnpm install +pnpm dev +``` + +Open the URL printed in the terminal to try the playground. + +## Project structure + +```text +apps/ + playground/ Demo application + docs/ Documentation site and Markdown sources +packages/ + core/ Product definitions, design documents, validation and history + fabric/ Canvas editing and PNG/SVG output + react/ Providers, hooks and editor lifecycle + ui/ Default editor, controls and styles + three/ Optional 3D mug preview +tests/ Library tests and integration examples +e2e/ Browser tests for editor workflows +scripts/ Repository tools +``` + +Products define their sides, decoration areas and editing rules through configuration. Designs store geometry in millimeters, independently of the canvas or screen size. Editing, previews and production use the same design document. + +The default UI can be replaced with custom React controls. The 3D preview is optional. Your application handles uploads, storage, pricing and checkout. See [architecture](apps/docs/content/architecture.md) for package boundaries. + +## Documentation + +- [Quick Start](apps/docs/content/quick-start.md) +- [React integration](apps/docs/content/integration.md) +- [Full documentation](apps/docs/content/index.md) +- [Contributing](CONTRIBUTING.md) ## License -MIT. See [LICENSE](LICENSE). +[MIT](LICENSE) diff --git a/apps/docs/content/agents/domain.md b/apps/docs/content/agents/domain.md new file mode 100644 index 0000000..ad22ee1 --- /dev/null +++ b/apps/docs/content/agents/domain.md @@ -0,0 +1,19 @@ +--- +title: "Domain orientation" +description: "Domain vocabulary and task-specific reading paths." +--- + +This repository has one domain context. Before exploring code, read the root [glossary](../../../../GLOSSARY.md) and [architecture](../architecture.md). For document, output or preview work, also read the [design document](../design-document.md), [production](../production.md) or [previews](../previews.md) reference. + +Use the glossary's vocabulary in code, tests, issues and documentation. Record domain terms there; keep implementation details in reference documents. + +| Task | Read before changing | +| ------------------------------------- | ---------------------------------------------------------------------------- | +| Configuration, permissions, templates | [Configuration](../configuration.md), [product status](../product.md) | +| Persistence, migration, history | [Design document](../design-document.md), [architecture](../architecture.md) | +| React integration, callbacks | [Integration](../integration.md), [API](../api.md) | +| UI, keyboard access, localization | [Editor UX](../editor-ux.md) | +| Uploads, text, SVG import | [Assets and fonts](../assets-and-fonts.md) | +| Previews or production | [Previews](../previews.md), [production](../production.md) | + +Update the authoritative reference when its contract changes. Check the actual exported types before copying an API example. Explicitly distinguish available behavior from planned behavior. If a proposal changes a documented architectural choice, identify that choice and explain the trade-off before replacing it. diff --git a/apps/docs/content/agents/issue-tracker.md b/apps/docs/content/agents/issue-tracker.md new file mode 100644 index 0000000..3d3c68c --- /dev/null +++ b/apps/docs/content/agents/issue-tracker.md @@ -0,0 +1,37 @@ +--- +title: "Issue tracker: GitHub" +description: "Read and manage GitHub Issues for React Fabrio." +--- + +Issues and specs live in GitHub Issues for `Imunal/react-fabrio`. +Use the `gh` CLI from this repo. + +## Conventions + +- Create: `gh issue create --title "..." --body-file `. +- Read: `gh issue view --json number,title,body,labels,comments`. +- List: `gh issue list --state open --json number,title,body,labels`. +- Comment: `gh issue comment --body-file `. +- Apply labels: `gh issue edit --add-label "