Command line interface for scaffolding web map applications.
The CLI is part of the project-seed repository and can be used locally during development.
For development and testing, you can run the CLI directly from the TypeScript source:
# Install dependencies first
cd cli
pnpm install
# Run using the convenience script
pnpm start
# Generate with specific project name and component library
pnpm start my-project-name --component-library chakra
# Generate with specific project name, component library, and map library
pnpm start my-project-name --component-library chakra --map-library mapbox-gl
# Show help
pnpm start --help
# Show version
pnpm start --version
For production use or when you want to run the compiled version:
# Build the CLI
cd cli
pnpm build
# Run the built version
node ./dist/index.js
# Generate with specific project name and component library
node ./dist/index.js my-project-name --component-library chakra
# Generate with specific project name, component library, and map library
node ./dist/index.js my-project-name --component-library chakra --map-library mapbox-gl
# Show help
node ./dist/index.js --help
# Show version
node ./dist/index.js --version
The CLI supports three component library variants:
none
- Plain React with minimal dependencieschakra
- Chakra UI with theme and provider (default)uswds
- USWDS design system with government styling
The CLI supports three map library variants:
none
- No map functionality (default)mapbox-gl
- Mapbox GL JS for interactive mapsmaplibre-gl
- MapLibre GL JS (open source alternative)
When run without arguments, the CLI will prompt for:
- Project name (with validation)
- Component library selection
- Map library selection
cd cli
pnpm install
pnpm dev
Runs tsup in watch mode, automatically rebuilding on file changes.
For testing and development purposes, you can generate all possible combinations of component libraries and map libraries:
pnpm generate-all
This generates all the projects in the cli/generated/
directory with descriptive names like project-seed-chakra-mapbox-gl
. Useful for testing template combinations and QA.
pnpm lint
pnpm type-check
Projects are generated in cli/generated/
directory. This directory is gitignored to prevent generated projects from being committed.
- Complete copy of the base template
- Component library specific files and dependencies
- Project name replaced in
package.json
- Template placeholders replaced in
README.md
.env
file with default Vite environment variables- All development dependencies and configuration files
The CLI uses a modular template system:
cli/templates/
├── base/ # Base template (core project files)
│ ├── app/
│ ├── public/
│ ├── package.json # Core dependencies only
│ └── ...
├── component-library/ # Component library variants
│ ├── none/
│ │ ├── main.tsx # Plain React
│ │ └── package.json # Empty dependencies
│ ├── chakra/
│ │ ├── main.tsx # Chakra UI provider
│ │ ├── styles/ # Theme files
│ │ └── package.json # Chakra UI dependencies
│ └── uswds/
│ ├── main.tsx # USWDS components
│ └── package.json # USWDS dependencies
└── map/ # Map library variants
├── mapbox-gl/
│ ├── app.tsx # Mapbox GL map component
│ └── package.json # Mapbox GL dependencies
└── maplibre-gl/
├── app.tsx # MapLibre GL map component
└── package.json # MapLibre GL dependencies
The generator:
- Copies all files from the base template
- Applies component library variant (main.tsx + package.json mixin)
- Applies map library variant (app.tsx + package.json mixin)
- Replaces project name in
package.json
- Processes
_README.md
template and renames it toREADME.md
- Creates
.env
file with default environment variables
To add a new component library variant:
- Create a new folder in
cli/templates/component-library/
- Add
main.tsx
with the component library setup - Add
package.json
with component library dependencies - Update the CLI choices in
cli/src/index.ts
- Test the new variant
To add a new map library variant:
- Create a new folder in
cli/templates/map/
- Add
app.tsx
with the map library setup - Add
package.json
with map library dependencies - Update the CLI choices in
cli/src/index.ts
- Test the new variant