Developer Guide
Essential information for maintaining, developing, and contributing to the `npui` monorepo.
Running the Web App
To start the development server for the `npui` documentation website, navigate to the monorepo root and run the following command:
1pnpm dev
This will typically start the Next.js development server on `http://localhost:3000`.
Publishing the CLI to npm
When you've made changes to the `@npui/cli` package and are ready to publish a new version to npm, follow these steps:
- **Update Version:** Increment the `version` in `packages/cli/package.json` according to Semantic Versioning.
- **Build the CLI:** Ensure the latest changes are compiled. Run this from the monorepo root:
1pnpm --filter=@npui/cli build
- **Login to npm:** If you haven't already, log in to your npm account in your terminal:
1npm login
- **Publish:** From the monorepo root, execute the publish command:
1pnpm publish -r --filter=@npui/cli --access public
This command tells `pnpm` to recursively publish packages, specifically filtering for the `@npui/cli` package, and setting its access to public.
Testing the CLI
To test the functionality of the `npui` CLI locally without publishing it, you can use `npx` from the monorepo root. This allows you to simulate how a user would interact with the CLI.
To test the `add` command, which copies a component from the `npui` source to a target directory (e.g., `src/components/ui/`), run:
1npx @npui/cli add button
This command will attempt to copy the `button` component's files. Check your `src/components/ui/button` directory to verify the files were copied correctly.
Note: For this local testing, the CLI assumes it's run from the monorepo root to access source component files. In a real published scenario, the CLI would fetch from a remote source.
Explore on GitHub
For more in-depth developer documentation, including monorepo structure and advanced maintenance tasks, refer to the `DEVELOPER.md` file in the repository.