@gmoonc/cli
v0.0.6
Published
CLI do Goalmoon Ctrl (gmoonc): instalador e configurador.
Readme
@gmoonc/cli
CLI do Goalmoon Ctrl (gmoonc): install and configure @gmoonc/app in React projects.
Installation
npm install @gmoonc/cliUsage
Run the default command to install and configure @gmoonc/app:
npx gmooncThe default command will:
- Detect your project: Verify
package.jsonexists and identify package manager (npm/pnpm/yarn) - Install dependencies: Add
@gmoonc/app@^0.0.2(which includes@gmoonc/uiand@gmoonc/core) andreact-router-dom@^6.0.0if needed - Find entrypoint: Look for
src/main.tsx,src/main.jsx,src/main.tsorsrc/main.js - Inject CSS: Add CSS imports to your entrypoint:
import "@gmoonc/ui/styles.css"; import "@gmoonc/app/styles.css"; - Integrate routes: Automatically detect and patch React Router:
- Data Router (createBrowserRouter): Adds
...createGmooncRoutes({ basePath })to router array - BrowserRouter: Adds
<GmooncRoutes basePath="..." />as first child of<Routes>
- Data Router (createBrowserRouter): Adds
Options
--yes/-y: Skip confirmations and install automatically--base <path>: Base path for dashboard routes (default:/app)--skip-router-patch: Skip automatic router integration (only install and inject CSS)--dry-run: Show what would be done without making changes
Examples
# Default setup with base path /app
npx gmoonc
# Custom base path
npx gmoonc --base /dashboard
# Skip router integration
npx gmoonc --skip-router-patch
# Dry run (see what would be done)
npx gmoonc --dry-run
# Skip confirmations
npx gmoonc --yesManual Integration
If automatic router integration is not possible, the CLI will print minimal instructions:
For Data Router (createBrowserRouter):
- Import
createGmooncRoutesfrom@gmoonc/app - Add
...createGmooncRoutes({ basePath: "/app" })to your router array
For BrowserRouter:
- Import
GmooncRoutesfrom@gmoonc/app - Add
<GmooncRoutes basePath="/app" />as the first child of<Routes>
Always ensure CSS imports are present in your entrypoint:
import "@gmoonc/ui/styles.css";import "@gmoonc/app/styles.css";
Requirements
- Node.js 18+
- Existing React project with
package.json - Entrypoint in
src/main.*(tsx, jsx, ts or js)
Security
- Existing files are automatically backed up before modification
- Backup format:
file.gmoonc.bak-YYYYMMDDTHHMMSS.ext - CSS imports are not duplicated if they already exist
Site
https://gmoonc.com
