@dotcms/create-app 1.2.5 → 1.2.6-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -174
- package/index.js +1522 -0
- package/package.json +22 -25
- package/src/api/index.d.ts +0 -26
- package/src/api/index.js +0 -80
- package/src/api/index.js.map +0 -1
- package/src/asks.d.ts +0 -47
- package/src/asks.js +0 -222
- package/src/asks.js.map +0 -1
- package/src/constants/index.d.ts +0 -22
- package/src/constants/index.js +0 -151
- package/src/constants/index.js.map +0 -1
- package/src/errors/index.d.ts +0 -18
- package/src/errors/index.js +0 -40
- package/src/errors/index.js.map +0 -1
- package/src/git/index.d.ts +0 -8
- package/src/git/index.js +0 -64
- package/src/git/index.js.map +0 -1
- package/src/index.d.ts +0 -2
- package/src/index.js +0 -419
- package/src/index.js.map +0 -1
- package/src/types/index.d.ts +0 -69
- package/src/types/index.js +0 -3
- package/src/types/index.js.map +0 -1
- package/src/utils/index.d.ts +0 -78
- package/src/utils/index.js +0 -461
- package/src/utils/index.js.map +0 -1
- package/src/utils/validation.d.ts +0 -47
- package/src/utils/validation.js +0 -295
- package/src/utils/validation.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,238 +1,174 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @dotcms/create-app
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
> This CLI is currently in **beta**. Features and APIs may change as we continue improving the tool.
|
|
3
|
+
CLI to scaffold a dotCMS frontend project or start a local dotCMS Docker stack.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
## Status
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
- Universal Visual Editor pre-configured
|
|
10
|
-
- Generating site ID and authentication token (just copy paste them in frontend .env and enjoy)
|
|
11
|
-
- Comprehensive validation and helpful error messages
|
|
7
|
+
Beta. Behavior and flags may change.
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
## Requirements
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
- Node.js + npm
|
|
12
|
+
- Git
|
|
13
|
+
- Docker (for `--local` or `--starter`)
|
|
14
|
+
- Internet access (downloads templates and docker-compose)
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
It automates the tedious work of:
|
|
20
|
-
|
|
21
|
-
- Setting up a framework with best practices
|
|
22
|
-
- Connecting to dotCMS REST & GraphQL APIs
|
|
23
|
-
- Providing content-fetching helpers
|
|
24
|
-
- Adding example components & pages
|
|
25
|
-
- Creating environment variable templates
|
|
26
|
-
- Optionally setting up local dotCMS instance using Docker
|
|
27
|
-
- Validating your environment (Docker, ports, URLs)
|
|
28
|
-
|
|
29
|
-
This tool lets you focus on **building**, not configuring.
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## 🎯 Why this project exists
|
|
34
|
-
|
|
35
|
-
dotCMS is a hybrid headless CMS with powerful APIs — but initializing a frontend manually takes time.
|
|
36
|
-
|
|
37
|
-
This CLI solves that by offering:
|
|
38
|
-
|
|
39
|
-
- **Frictionless onboarding**
|
|
40
|
-
- **Standardized project setup**
|
|
41
|
-
- **Fast prototyping & demos**
|
|
42
|
-
- **DevRel-friendly scaffolding for workshops & tutorials**
|
|
43
|
-
- **Production-ready integration patterns**
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## 🛠️ Installation
|
|
48
|
-
|
|
49
|
-
Run using npx (recommended):
|
|
16
|
+
## Quick Start
|
|
50
17
|
|
|
51
18
|
```sh
|
|
52
|
-
npx @dotcms/create-app
|
|
19
|
+
npx @dotcms/create-app my-app
|
|
53
20
|
```
|
|
54
21
|
|
|
55
|
-
|
|
22
|
+
Global install:
|
|
56
23
|
|
|
57
24
|
```sh
|
|
58
25
|
npm install -g @dotcms/create-app
|
|
26
|
+
create-dotcms-app my-app
|
|
59
27
|
```
|
|
60
28
|
|
|
61
|
-
##
|
|
29
|
+
## CLI
|
|
62
30
|
|
|
63
31
|
```sh
|
|
64
|
-
|
|
32
|
+
create-dotcms-app [projectName] [options]
|
|
65
33
|
```
|
|
66
34
|
|
|
67
|
-
|
|
35
|
+
| Option | Description |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `-f, --framework <framework>` | Framework: `nextjs`, `astro`, `angular`, `angular-ssr` |
|
|
38
|
+
| `-d, --directory <path>` | Parent or target directory |
|
|
39
|
+
| `--local` | Use local dotCMS with Docker |
|
|
40
|
+
| `--starter <url>` | Custom starter ZIP URL (local-only; sets `CUSTOM_STARTER_URL`) |
|
|
41
|
+
| `--url <url>` | dotCMS URL for cloud mode |
|
|
42
|
+
| `-u, --username <username>` | dotCMS username for cloud mode |
|
|
43
|
+
| `-p, --password <password>` | dotCMS password for cloud mode |
|
|
44
|
+
| `-V, --version` | Show CLI version |
|
|
68
45
|
|
|
69
|
-
|
|
70
|
-
- Ask which frontend framework you want (Next.js, Angular, Astro, etc.)
|
|
71
|
-
- Ask if you're using dotCMS Cloud or Local Docker dotCMS
|
|
72
|
-
- **For local Docker setup:**
|
|
73
|
-
- Check if Docker is installed and running
|
|
74
|
-
- Verify required ports are available (8082, 8443, 9200, 9600)
|
|
75
|
-
- Provide specific error messages and solutions if issues are found
|
|
76
|
-
- Automatically scaffold your project
|
|
77
|
-
- Configure UVE (Edit Mode Anywhere)
|
|
78
|
-
- Start dotCMS (if using Docker)
|
|
79
|
-
- Print required environment variables for your frontend
|
|
46
|
+
Framework aliases:
|
|
80
47
|
|
|
81
|
-
|
|
48
|
+
- `next`, `next.js` -> `nextjs`
|
|
49
|
+
- `ng` -> `angular`
|
|
50
|
+
- `angular-server` -> `angular-ssr`
|
|
82
51
|
|
|
83
|
-
|
|
52
|
+
## Behavior by Mode
|
|
84
53
|
|
|
85
|
-
|
|
86
|
-
Host (site) : http://localhost:8082
|
|
87
|
-
Site ID : 59bb8831-6706-4589-9ca0-ff74016e02b2
|
|
88
|
-
API Token : YOUR_API_TOKEN
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## CLI Syntax
|
|
54
|
+
### 1) Cloud mode (existing dotCMS instance)
|
|
92
55
|
|
|
93
|
-
|
|
94
|
-
create-dotcms-app <project-name> [options]
|
|
95
|
-
```
|
|
56
|
+
Used when you do not pass `--local` or `--starter` and choose cloud in prompts.
|
|
96
57
|
|
|
97
|
-
|
|
98
|
-
|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
99
|
-
| `-f, --framework <name>` | Skip prompts and directly choose a framework. Supported: `nextjs`, `angular`, `angular-ssr`, `astro`. Case-insensitive. Aliases: `next`, `ng`, `next.js`, `angular-server` |
|
|
100
|
-
| `-d, --directory` | Project Directory |
|
|
101
|
-
| `--local` | Use local dotCMS instance using docker |
|
|
102
|
-
| `-u, --username` | dotCMS instance username (skip in case of local) |
|
|
103
|
-
| `-p, --password` | dotCMS instance password (skip in case of local) |
|
|
104
|
-
| `--url` | dotCMS instance URL (skip in case of local). Must include protocol (http:// or https://) |
|
|
105
|
-
| `-V, --version` | Show CLI version |
|
|
58
|
+
Flow:
|
|
106
59
|
|
|
107
|
-
|
|
60
|
+
1. Validates URL, project name, and flags.
|
|
61
|
+
2. Checks dotCMS health at `/api/v1/appconfiguration`.
|
|
62
|
+
3. Authenticates (up to 3 attempts).
|
|
63
|
+
4. Reads `defaultSite` from `/api/v1/site/defaultSite`.
|
|
64
|
+
5. Configures UVE via `/api/v1/apps/dotema-config-v2/{siteId}`.
|
|
65
|
+
6. Scaffolds selected frontend and runs `npm install`.
|
|
66
|
+
7. Prints framework-specific env setup instructions.
|
|
108
67
|
|
|
109
|
-
|
|
68
|
+
### 2) Local mode (`--local`)
|
|
110
69
|
|
|
111
|
-
|
|
112
|
-
- `ng`, `Angular` → `angular`
|
|
113
|
-
- `angular-server` → `angular-ssr`
|
|
114
|
-
- `angular-server` → `angular-ssr`
|
|
70
|
+
Flow:
|
|
115
71
|
|
|
116
|
-
|
|
72
|
+
1. Validates Docker availability.
|
|
73
|
+
2. Validates required ports: `8082`, `8443`, `9200`, `9600`.
|
|
74
|
+
3. Downloads docker-compose from dotCMS main repo.
|
|
75
|
+
4. Runs `docker compose up -d`.
|
|
76
|
+
5. Waits for local health check.
|
|
77
|
+
6. Authenticates with default local credentials (`admin@dotcms.com` / `admin`).
|
|
78
|
+
7. Reads `defaultSite`, configures UVE, scaffolds frontend, runs `npm install`.
|
|
79
|
+
8. Prints framework-specific env setup instructions.
|
|
117
80
|
|
|
118
|
-
|
|
81
|
+
### 3) Starter-only local mode (`--starter <url>`)
|
|
119
82
|
|
|
120
|
-
|
|
121
|
-
❌ **Invalid:** `demo.dotcms.com`, `localhost:8082` (missing protocol)
|
|
83
|
+
`--starter` implies local mode.
|
|
122
84
|
|
|
123
|
-
|
|
85
|
+
Flow:
|
|
124
86
|
|
|
125
|
-
|
|
87
|
+
1. Same Docker and port checks as local mode.
|
|
88
|
+
2. Downloads docker-compose.
|
|
89
|
+
3. Rewrites `CUSTOM_STARTER_URL` in `docker-compose.yml`.
|
|
90
|
+
4. Also passes `CUSTOM_STARTER_URL` in compose environment at runtime.
|
|
91
|
+
5. Starts containers and waits for health check.
|
|
92
|
+
6. Skips frontend scaffold and dotCMS frontend settings flow (token, default site lookup, UVE setup).
|
|
126
93
|
|
|
127
|
-
|
|
94
|
+
Use this when your starter is not compatible with the default frontend sample flow.
|
|
128
95
|
|
|
129
|
-
|
|
130
|
-
- **Project names:** Validates against filesystem limitations, reserved names, special characters, and path traversal
|
|
131
|
-
- **Framework names:** Supports aliases and case-insensitive matching
|
|
132
|
-
- **URLs:** Ensures proper protocol and format
|
|
133
|
-
- **Conflicting parameters:** Warns when mixing `--local` with cloud parameters
|
|
96
|
+
## Examples
|
|
134
97
|
|
|
135
|
-
|
|
136
|
-
When using local Docker setup, the CLI performs pre-flight checks:
|
|
98
|
+
Interactive:
|
|
137
99
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
- Direct link to Docker Desktop download
|
|
100
|
+
```sh
|
|
101
|
+
npx @dotcms/create-app my-blog
|
|
102
|
+
```
|
|
142
103
|
|
|
143
|
-
|
|
144
|
-
- Checks all required ports before starting containers
|
|
145
|
-
- Lists which specific ports are busy
|
|
146
|
-
- Provides platform-specific commands to identify blocking processes
|
|
147
|
-
- Suggests `docker compose down` to stop existing containers
|
|
104
|
+
Local + specific framework:
|
|
148
105
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
- Displays container status and recent logs
|
|
106
|
+
```sh
|
|
107
|
+
npx @dotcms/create-app my-blog --local --framework nextjs
|
|
108
|
+
```
|
|
153
109
|
|
|
154
|
-
|
|
155
|
-
All error messages include:
|
|
156
|
-
- **Clear problem description** - What went wrong
|
|
157
|
-
- **Specific suggestions** - How to fix it
|
|
158
|
-
- **Alternative solutions** - Other ways to proceed
|
|
159
|
-
- **Platform-specific commands** - Commands tailored to your OS
|
|
110
|
+
Starter-only local:
|
|
160
111
|
|
|
161
|
-
### Debug Mode
|
|
162
|
-
Run with `DEBUG=1` to see detailed stack traces:
|
|
163
112
|
```sh
|
|
164
|
-
|
|
113
|
+
npx @dotcms/create-app my-blog --starter https://repo.example.com/path/starter.zip
|
|
165
114
|
```
|
|
166
115
|
|
|
167
|
-
|
|
116
|
+
Cloud with flags:
|
|
168
117
|
|
|
169
|
-
|
|
118
|
+
```sh
|
|
119
|
+
npx @dotcms/create-app my-blog \
|
|
120
|
+
--framework angular \
|
|
121
|
+
--url https://demo.dotcms.com \
|
|
122
|
+
--username admin@dotcms.com \
|
|
123
|
+
--password admin
|
|
124
|
+
```
|
|
170
125
|
|
|
171
|
-
|
|
126
|
+
Debug errors with stack traces:
|
|
172
127
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
- Download from: https://www.docker.com/products/docker-desktop
|
|
128
|
+
```sh
|
|
129
|
+
DEBUG=1 npx @dotcms/create-app my-blog --local
|
|
130
|
+
```
|
|
177
131
|
|
|
178
|
-
|
|
179
|
-
- Check what's using the ports:
|
|
180
|
-
- macOS/Linux: `lsof -i :8082`
|
|
181
|
-
- Windows: `netstat -ano | findstr ":8082"`
|
|
182
|
-
- Stop existing dotCMS containers: `docker compose down`
|
|
183
|
-
- Stop conflicting services or choose a different port mapping
|
|
132
|
+
## Validation Rules
|
|
184
133
|
|
|
185
|
-
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
-
|
|
134
|
+
- URLs must include protocol (`http://` or `https://`).
|
|
135
|
+
- Project names are validated for path traversal, invalid characters, reserved Windows names, and length.
|
|
136
|
+
- If local mode is selected (`--local` or `--starter`), cloud flags are ignored with a warning.
|
|
137
|
+
- Existing non-empty target directory requires confirmation before cleanup.
|
|
189
138
|
|
|
190
|
-
|
|
139
|
+
## Troubleshooting
|
|
191
140
|
|
|
192
|
-
|
|
193
|
-
- Avoid special characters: `< > : " | ? *`
|
|
194
|
-
- Don't use Windows reserved names: `CON`, `PRN`, `AUX`, `NUL`, etc.
|
|
195
|
-
- Maximum 255 characters
|
|
196
|
-
- No path traversal patterns (`..`)
|
|
141
|
+
Docker not available:
|
|
197
142
|
|
|
198
|
-
|
|
199
|
-
- Include protocol: `https://` or `http://`
|
|
200
|
-
- Verify hostname is correct
|
|
201
|
-
- For localhost, default port is 8082
|
|
143
|
+
- Install/start Docker Desktop, then retry.
|
|
202
144
|
|
|
203
|
-
|
|
145
|
+
Ports already in use:
|
|
204
146
|
|
|
205
|
-
|
|
147
|
+
- macOS/Linux: `lsof -i :8082`
|
|
148
|
+
- Windows: `netstat -ano | findstr ":8082"`
|
|
149
|
+
- Stop conflicting services or run `docker compose down`.
|
|
206
150
|
|
|
207
|
-
|
|
208
|
-
```sh
|
|
209
|
-
npx @dotcms/create-app my-blog
|
|
210
|
-
```
|
|
151
|
+
`zip END header not found` during starter load:
|
|
211
152
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
# Local Docker setup
|
|
215
|
-
npx @dotcms/create-app my-blog --framework nextjs --local
|
|
153
|
+
- Starter URL is reachable but not returning a valid ZIP payload.
|
|
154
|
+
- Verify artifact URL, repository permissions, and response content type/body.
|
|
216
155
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
--url https://demo.dotcms.com \
|
|
221
|
-
--username admin@dotcms.com \
|
|
222
|
-
--password mypassword
|
|
223
|
-
```
|
|
156
|
+
## Development (this repo)
|
|
157
|
+
|
|
158
|
+
Build:
|
|
224
159
|
|
|
225
|
-
### Debug Mode
|
|
226
160
|
```sh
|
|
227
|
-
|
|
161
|
+
yarn nx build sdk-create-app --skip-nx-cache
|
|
228
162
|
```
|
|
229
163
|
|
|
230
|
-
|
|
164
|
+
Lint:
|
|
231
165
|
|
|
232
|
-
|
|
166
|
+
```sh
|
|
167
|
+
yarn nx lint sdk-create-app
|
|
168
|
+
```
|
|
233
169
|
|
|
234
|
-
|
|
235
|
-
- The CLI validates all inputs to prevent injection attacks
|
|
236
|
-
- Project names are sanitized to prevent path traversal
|
|
237
|
-
- Shell commands are properly escaped for cross-platform safety
|
|
170
|
+
Dist output:
|
|
238
171
|
|
|
172
|
+
- `dist/libs/sdk/create-app/index.js`
|
|
173
|
+
- ESM Node CLI bundle with shebang in production build
|
|
174
|
+
- Publishable package includes JavaScript files and `README.md` only (no type declarations)
|