How mrzachnugent/react-native-reusables works
Main Components
• CLI Application:
– Located under apps/cli. This is a Node/TypeScript CLI tool that provides commands (like “init” and “add”) to help users either generate new projects or integrate components into an existing project.
• Documentation Site:
– Located in apps/docs. This appears to be an Astro-based documentation site (as signified by astro.config.mjs and MDX files) that explains how to use the library, provides code examples, and serves as the public face for user documentation.
• Application:
– Found in apps/showcase. This is a live demo/demo site that illustrates the look & feel and functionality of the UI components. It includes a web UI built with React/Next-like conventions (tsx files, layout components) and showcases usage of the library components.
• Core Reusables Package:
• Starter Templates:
– Located in packages/templates/starter-base. These provide boilerplate projects that customers can use as a starting point when building new apps with React Native Reusables.
• Monorepo Infrastructure:
– Files like pnpm-workspace.yaml, turbo.json, package.json at the root, and several configuration files highlight this is a monorepo. They manage project dependencies, build scripts, and shared libraries.
Relationships and Interactions
• The CLI tool (apps/cli) acts as an interface between the developer and the core library/templates. It uses commands (like “init” and “add”) to generate source files, copy over templates, and possibly configure projects.
• The core reusables package is the shared dependency for both the Docs and Showcase applications. Both these apps consume the reusables to demonstrate component usage and render interactive demos.
• The Documentation site (apps/docs) directly references documentation content and code samples from the reusables codebase and likely from the templates.
• The Showcase app (apps/showcase) collects UI component examples and live demos that use the core components and utilities from packages/reusables, thus acting as a real-world showcase of what’s available.
• Starter templates (packages/templates) provide entry points that are pre-configured to work with the reusables package and come with preset configurations (like tailwind.config.js, metro.config.js, etc.), demonstrating how to integrate the library.
• The monorepo structure (managed with pnpm and turbo) coordinates dependency management and build scripts across these different apps and packages.
Architectural Patterns and Technologies
• Monorepo/Multi-package architecture:
– The separation into apps (CLI, docs, showcase), shared packages (reusables), and templates indicates a modular design.
• CLI-driven automation:
– The CLI app encapsulates automation for setting up or extending projects by generating required code and configuration.
• Component Library and UI abstraction:
• Cross-platform considerations: