|
| 1 | +# create-drupal-decoupled |
| 2 | + |
| 3 | +> A CLI tool that scaffolds Drupal integration for decoupled frontend projects. |
| 4 | +
|
| 5 | +## Features |
| 6 | + |
| 7 | +- Automatic detection of frontend frameworks (Next.js, React Router, Remix) |
| 8 | +- Scaffolds GraphQL integration with type-safe queries |
| 9 | +- Configures authentication and API connection |
| 10 | +- Updates project configuration files |
| 11 | +- Framework-specific template generation |
| 12 | + |
| 13 | +## Installation |
| 14 | + |
| 15 | +```bash |
| 16 | +# Using npm |
| 17 | +npx @octahedroid/create-drupal-decoupled |
| 18 | + |
| 19 | +# Using yarn |
| 20 | +yarn create @octahedroid/drupal-decoupled |
| 21 | + |
| 22 | +# Using pnpm |
| 23 | +pnpm create @octahedroid/drupal-decoupled |
| 24 | + |
| 25 | +# Using bun |
| 26 | +bunx @octahedroid/create-drupal-decoupled |
| 27 | +``` |
| 28 | + |
| 29 | +## Quick Start |
| 30 | + |
| 31 | +Navigate to your existing frontend project and run the scaffolding command: |
| 32 | + |
| 33 | +```bash |
| 34 | +# In your project directory |
| 35 | +npx @octahedroid/create-drupal-decoupled . --frontend next |
| 36 | + |
| 37 | +# Or specify a different directory |
| 38 | +npx @octahedroid/create-drupal-decoupled my-project --frontend react-router |
| 39 | +``` |
| 40 | + |
| 41 | +## Supported Frameworks |
| 42 | + |
| 43 | +- **Next.js** (`next`) - React framework with server-side rendering |
| 44 | +- **React Router** (`react-router`) - Modern React routing library |
| 45 | +- **Remix** (`remix`) - Full-stack React framework |
| 46 | + |
| 47 | +## Usage |
| 48 | + |
| 49 | +```bash |
| 50 | +create-drupal-decoupled [project-directory] [options] |
| 51 | +``` |
| 52 | + |
| 53 | +### Arguments |
| 54 | + |
| 55 | +- `project-directory` - Target directory for scaffolding (defaults to current directory) |
| 56 | + |
| 57 | +### Options |
| 58 | + |
| 59 | +- `-f, --frontend <framework>` - Frontend framework to use (required) |
| 60 | +- `-v, --version` - Display version number |
| 61 | +- `-h, --help` - Display help information |
| 62 | + |
| 63 | +### Examples |
| 64 | + |
| 65 | +```bash |
| 66 | +# Scaffold Next.js integration in current directory |
| 67 | +npx @octahedroid/create-drupal-decoupled . --frontend next |
| 68 | + |
| 69 | +# Scaffold React Router integration in specific directory |
| 70 | +npx @octahedroid/create-drupal-decoupled ./my-app --frontend react-router |
| 71 | + |
| 72 | +# Scaffold Remix integration |
| 73 | +npx @octahedroid/create-drupal-decoupled ./remix-app --frontend remix |
| 74 | +``` |
| 75 | + |
| 76 | +## What Gets Generated |
| 77 | + |
| 78 | +The CLI will add the following to your project: |
| 79 | + |
| 80 | +- GraphQL configuration and type definitions |
| 81 | +- Drupal client setup with authentication |
| 82 | +- Framework-specific integration files |
| 83 | +- Environment variable templates |
| 84 | +- Updated `.gitignore` with Drupal-specific entries |
| 85 | + |
| 86 | +## Requirements |
| 87 | + |
| 88 | +- Node.js >= 20.15.1 |
| 89 | +- Existing frontend project with supported framework |
| 90 | +- Package.json file in target directory |
| 91 | + |
| 92 | +## Development |
| 93 | + |
| 94 | +### Setup |
| 95 | + |
| 96 | +```bash |
| 97 | +# Install dependencies |
| 98 | +yarn install |
| 99 | + |
| 100 | +# Build the package |
| 101 | +yarn build |
| 102 | + |
| 103 | +# Development mode with file watching |
| 104 | +yarn dev |
| 105 | +``` |
| 106 | + |
| 107 | +### Local Testing |
| 108 | + |
| 109 | +```bash |
| 110 | +# Build the package |
| 111 | +yarn build |
| 112 | + |
| 113 | +# Test locally |
| 114 | +node dist/index.js . --frontend next |
| 115 | +``` |
0 commit comments