|
1 | 1 | Want to contribute? Great! First, read this page (including the small print at |
2 | 2 | the end). |
3 | 3 |
|
| 4 | +## Setup |
| 5 | + |
| 6 | +### Prerequisites |
| 7 | + |
| 8 | +- [Node.js](https://nodejs.org/) (version 18 or higher recommended) |
| 9 | +- [pnpm](https://pnpm.io/) - This workspace uses pnpm for package management |
| 10 | + |
| 11 | +### Installation |
| 12 | + |
| 13 | +1. Clone the repository: |
| 14 | + ```bash |
| 15 | + git clone https://github.com/firebase/firebaseui-web.git |
| 16 | + cd firebaseui-web |
| 17 | + ``` |
| 18 | + |
| 19 | +2. Install dependencies: |
| 20 | + ```bash |
| 21 | + pnpm install |
| 22 | + ``` |
| 23 | + |
| 24 | +### Development Workflow |
| 25 | + |
| 26 | +This is a monorepo managed with pnpm, containing both `packages` and `examples` sub-directories. |
| 27 | + |
| 28 | +#### Building |
| 29 | + |
| 30 | +Build all packages: |
| 31 | +```bash |
| 32 | +pnpm build |
| 33 | +``` |
| 34 | + |
| 35 | +Build only the packages (excluding examples): |
| 36 | +```bash |
| 37 | +pnpm build:packages |
| 38 | +``` |
| 39 | + |
| 40 | +#### Testing |
| 41 | + |
| 42 | +Run all tests: |
| 43 | +```bash |
| 44 | +pnpm test |
| 45 | +``` |
| 46 | + |
| 47 | +Run tests in watch mode: |
| 48 | +```bash |
| 49 | +pnpm test:watch |
| 50 | +``` |
| 51 | + |
| 52 | +Run tests for a specific package: |
| 53 | +```bash |
| 54 | +pnpm --filter=<package-name> run test |
| 55 | +``` |
| 56 | + |
| 57 | +#### Linting and Formatting |
| 58 | + |
| 59 | +Check for linting errors: |
| 60 | +```bash |
| 61 | +pnpm lint:check |
| 62 | +``` |
| 63 | + |
| 64 | +Fix linting errors automatically: |
| 65 | +```bash |
| 66 | +pnpm lint:fix |
| 67 | +``` |
| 68 | + |
| 69 | +Check for formatting issues: |
| 70 | +```bash |
| 71 | +pnpm format:check |
| 72 | +``` |
| 73 | + |
| 74 | +Format code automatically: |
| 75 | +```bash |
| 76 | +pnpm format:write |
| 77 | +``` |
| 78 | + |
| 79 | +### Project Structure |
| 80 | + |
| 81 | +The project is organized as follows: |
| 82 | + |
| 83 | +- **`packages/`**: Framework-agnostic and framework-specific packages |
| 84 | + - `core`: Framework-agnostic core package providing `initializeUI` and authentication functions |
| 85 | + - `translations`: Translation utilities and locale mappings |
| 86 | + - `styles`: CSS utility classes and compiled styles |
| 87 | + - `react`: React components and hooks |
| 88 | + - `angular`: Angular components and DI functionality |
| 89 | + - `shadcn`: Shadcn UI components |
| 90 | + |
| 91 | +- **`examples/`**: Example applications demonstrating usage |
| 92 | + - `react`: React example |
| 93 | + - `nextjs`: Next.js example |
| 94 | + - `nextjs-ssr`: Next.js SSR example |
| 95 | + - `angular`: Angular example |
| 96 | + - `shadcn`: Shadcn example |
| 97 | + |
| 98 | +The dependency graph: |
| 99 | +``` |
| 100 | +core → translations |
| 101 | +react → core |
| 102 | +angular → core |
| 103 | +react → styles |
| 104 | +angular → styles |
| 105 | +shadcn → react |
| 106 | +``` |
| 107 | + |
| 108 | +### Additional Notes |
| 109 | + |
| 110 | +- All packages extend the same base `tsconfig.json` file |
| 111 | +- Vitest is the preferred testing framework |
| 112 | +- The workspace uses pnpm catalogs to ensure dependency version alignment |
| 113 | +- Linting is controlled by ESLint via a root flatconfig `eslint.config.ts` file |
| 114 | +- Formatting is controlled by Prettier integrated with ESLint via the `.prettierrc` file |
| 115 | + |
4 | 116 | ### Before you contribute |
5 | 117 |
|
6 | 118 | Before we can use your code, you must sign the [Google Individual Contributor |
|
0 commit comments