core icon indicating copy to clipboard operation
core copied to clipboard

create-dotcms-app cli library added in the core-web/libs

Open AfaqJaved opened this issue 1 month ago โ€ข 1 comments

๐Ÿš€ Pull Request: Add create-dotcms-app Scaffolding CLI

๐Ÿ“Œ Overview

This pull request introduces a new CLI tool named create-dotcms-app, designed to scaffold front-end applications for DotCMS headless implementations.
It streamlines the setup process by allowing developers to quickly generate starter projects in popular frameworks such as Next.js, Angular, Vue and more.

This CLI improves developer onboarding, reduces manual setup steps, and ensures consistency across DotCMS headless integrations.

Closes: #34054


๐Ÿ”ง Key Features Added

โœ… 1. Interactive CLI Wizard

  • Prompts users for:
    • Preferred front-end framework
    • Project name
    • Output directory
  • Supports non-interactive mode using flags.

โœ… 2. Framework Templates

  • Includes scaffolding for:
    • Next.js
    • Vue
    • Angular
    • (More can be added in the future)

โœ… 3. DotCMS Integration

  • Automatically configures:
    • DotCMS demo site identifier retrieval
    • UVE (Universal Visual Editor) configuration
    • Token generation for API usage
  • Provides clean helpers via the new DotCMSApi class.

โœ… 4. Error-Handled API Utilities

  • Robust error handling using ts-results (Ok, Err).
  • Safe network requests with Axios.
  • Custom error classes for improved DX.

โœ… 5. NX Project Integration

  • Added build, lint, and testing targets.
  • Prettier formatting working
  • Standardized project structure under NX workspace.

๐Ÿ—‚ New Files & Major Changes

๐Ÿ“ Newly Added

  • core-web/libs/create-app/*

๐Ÿ“ Updated

  • project.json (updated with build, test, and format targets)
  • package.json (added required dependencies)
  • Added README explaining usage.

๐Ÿ“ฆ Dependencies Introduced

Package Purpose
axios Network requests to DotCMS APIs
chalk Colored terminal output for better UX
commander CLI argument parsing & command handling
execa Run shell commands (Docker, git, etc.)
fs-extra File system helpers (copy, ensureDir, etc.)
inquirer Interactive CLI prompts
log-symbols Pretty success/error/warning icons
ora Terminal spinners for loading states
ts-results Functional-style result-based error handling

๐Ÿงช Testing

  • No testing performed right now although using jest for testing

๐Ÿ“š Documentation

A fully detailed README is included covering:

  • Installation
  • Usage
  • CLI flags
  • Framework support
  • Environment setup
  • Error handling

๐Ÿงฉ Motivation

This PR aims to:

  • Simplify the developer onboarding experience.
  • Provide a modern scaffolding tool similar to create-next-app or npm init vue.
  • Improve adoption of DotCMS as a headless CMS.
  • Reduce setup errors and improve usability.

โœ”๏ธ Checklist

  • [x] Code compiles without errors
  • [x] Documentation updated
  • [x] Linting & formatting applied
  • [x] Ready for review

๐Ÿ™ Request for Review

Please review the implementation, templates, and overall CLI flow.
Feedback on DX, naming, and template structure is especially appreciated.


AfaqJaved avatar Dec 08 '25 11:12 AfaqJaved

Legal Risk

The following dependencies were released under a license that has been flagged by your organization for consideration.

Recommendation

While merging is not directly blocked, it's best to pause and consider what it means to use this license before continuing. If you are unsure, reach out to your security team or Semgrep admin to address this issue.

GPL-2.0