create-sonicjs 2.0.0-alpha.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 SonicJS Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,291 @@
1
+ # create-sonicjs-app
2
+
3
+ > The easiest way to create a new SonicJS application
4
+
5
+ [![Version](https://img.shields.io/npm/v/create-sonicjs-app)](https://www.npmjs.com/package/create-sonicjs-app)
6
+ [![License](https://img.shields.io/npm/l/create-sonicjs-app)](./LICENSE)
7
+
8
+ ## Quick Start
9
+
10
+ ```bash
11
+ npx create-sonicjs-app my-app
12
+ ```
13
+
14
+ That's it! Follow the interactive prompts and you'll have a running SonicJS application in minutes.
15
+
16
+ ## What It Does
17
+
18
+ `create-sonicjs-app` sets up everything you need for a modern headless CMS on Cloudflare's edge:
19
+
20
+ - ✅ **Project scaffolding** - Complete project structure
21
+ - ✅ **Template selection** - Choose from pre-built templates
22
+ - ✅ **Cloudflare resources** - Optionally create D1 database and R2 bucket
23
+ - ✅ **Configuration** - Auto-configured wrangler.toml
24
+ - ✅ **Dependencies** - Installs all required packages
25
+ - ✅ **Git initialization** - Ready for version control
26
+ - ✅ **Example code** - Optional blog collection example
27
+
28
+ ## Usage
29
+
30
+ ### Interactive Mode (Recommended)
31
+
32
+ ```bash
33
+ npx create-sonicjs-app
34
+ ```
35
+
36
+ You'll be prompted for:
37
+ - Project name
38
+ - Template choice
39
+ - Database name
40
+ - R2 bucket name
41
+ - Whether to include examples
42
+ - Whether to create Cloudflare resources
43
+ - Whether to initialize git
44
+
45
+ ### With Project Name
46
+
47
+ ```bash
48
+ npx create-sonicjs-app my-blog
49
+ ```
50
+
51
+ ### Command Line Options
52
+
53
+ ```bash
54
+ npx create-sonicjs-app my-app --template=starter --skip-install
55
+ ```
56
+
57
+ **Available flags:**
58
+ - `--template=<name>` - Skip template selection (e.g., `--template=starter`)
59
+ - `--database=<name>` - Set database name without prompt
60
+ - `--bucket=<name>` - Set R2 bucket name without prompt
61
+ - `--include-example` - Include example blog collection (no prompt)
62
+ - `--skip-example` - Skip example blog collection (no prompt)
63
+ - `--skip-install` - Don't install dependencies
64
+ - `--skip-git` - Don't initialize git
65
+ - `--skip-cloudflare` - Don't prompt for Cloudflare resource creation
66
+
67
+ ## Templates
68
+
69
+ ### Starter (Default)
70
+ Perfect for blogs, documentation, and content sites.
71
+
72
+ Includes:
73
+ - Blog collection example
74
+ - Admin dashboard
75
+ - REST API
76
+ - Media management
77
+
78
+ **Coming Soon:**
79
+ - E-commerce template
80
+ - Documentation site template
81
+ - Portfolio template
82
+
83
+ ## Requirements
84
+
85
+ - **Node.js** 18 or higher
86
+ - **npm** 7 or higher (or yarn/pnpm)
87
+ - **wrangler** (optional, for Cloudflare resources)
88
+
89
+ ## What Gets Created
90
+
91
+ ```
92
+ my-app/
93
+ ├── src/
94
+ │ ├── index.ts # Application entry point
95
+ │ └── collections/ # Content type definitions
96
+ │ └── blog-posts.collection.ts
97
+ ├── wrangler.toml # Cloudflare Workers config
98
+ ├── package.json # Dependencies
99
+ ├── tsconfig.json # TypeScript config
100
+ ├── .gitignore
101
+ └── README.md
102
+ ```
103
+
104
+ ## After Creation
105
+
106
+ ### 1. Navigate to your project
107
+
108
+ ```bash
109
+ cd my-app
110
+ ```
111
+
112
+ ### 2. Create Cloudflare resources (if skipped)
113
+
114
+ ```bash
115
+ wrangler d1 create my-app-db
116
+ # Copy the database_id to wrangler.toml
117
+
118
+ wrangler r2 bucket create my-app-media
119
+ ```
120
+
121
+ ### 3. Run database migrations
122
+
123
+ ```bash
124
+ npm run db:migrate:local
125
+ ```
126
+
127
+ ### 4. Start development server
128
+
129
+ ```bash
130
+ npm run dev
131
+ ```
132
+
133
+ ### 5. Open admin interface
134
+
135
+ Visit http://localhost:8787/admin
136
+
137
+ Default credentials:
138
+ - Email: `admin@sonicjs.com`
139
+ - Password: `admin`
140
+
141
+ ## Package Managers
142
+
143
+ Works with all major package managers:
144
+
145
+ ```bash
146
+ # npm
147
+ npx create-sonicjs-app my-app
148
+
149
+ # yarn
150
+ yarn create sonicjs-app my-app
151
+
152
+ # pnpm
153
+ pnpm create sonicjs-app my-app
154
+ ```
155
+
156
+ The CLI automatically detects your package manager from lock files.
157
+
158
+ ## Environment Variables
159
+
160
+ After creation, you may want to set up environment variables:
161
+
162
+ ```bash
163
+ # .dev.vars (for local development)
164
+ ENVIRONMENT=development
165
+ ```
166
+
167
+ ## Cloudflare Resources
168
+
169
+ ### D1 Database
170
+
171
+ If you create resources during setup, a D1 database is automatically created and configured.
172
+
173
+ **Manual creation:**
174
+ ```bash
175
+ wrangler d1 create my-app-db
176
+ ```
177
+
178
+ ### R2 Bucket
179
+
180
+ For media storage, an R2 bucket is created.
181
+
182
+ **Manual creation:**
183
+ ```bash
184
+ wrangler r2 bucket create my-app-media
185
+ ```
186
+
187
+ ## Troubleshooting
188
+
189
+ ### "wrangler is not installed"
190
+
191
+ Install wrangler globally:
192
+ ```bash
193
+ npm install -g wrangler
194
+ ```
195
+
196
+ ### "Directory already exists"
197
+
198
+ Choose a different project name or remove the existing directory:
199
+ ```bash
200
+ rm -rf my-app
201
+ ```
202
+
203
+ ### Dependencies fail to install
204
+
205
+ Try manually:
206
+ ```bash
207
+ cd my-app
208
+ npm install
209
+ ```
210
+
211
+ ### Cloudflare resource creation fails
212
+
213
+ You can create resources manually after project creation. See the [After Creation](#after-creation) section.
214
+
215
+ ## Advanced Usage
216
+
217
+ ### Skip All Prompts (Non-Interactive Mode)
218
+
219
+ ```bash
220
+ npx create-sonicjs-app my-app \
221
+ --template=starter \
222
+ --database=my-app-db \
223
+ --bucket=my-app-media \
224
+ --include-example \
225
+ --skip-install \
226
+ --skip-git \
227
+ --skip-cloudflare
228
+ ```
229
+
230
+ ### Use in CI/CD
231
+
232
+ ```bash
233
+ npx create-sonicjs-app test-app \
234
+ --template=starter \
235
+ --database=test-db \
236
+ --bucket=test-bucket \
237
+ --skip-example \
238
+ --skip-install \
239
+ --skip-cloudflare \
240
+ --skip-git
241
+ ```
242
+
243
+ ## Features
244
+
245
+ - 🎨 **Beautiful CLI** - Colored output and progress indicators
246
+ - ⚡ **Fast** - Optimized for speed
247
+ - 🔒 **Type-safe** - Full TypeScript support
248
+ - 🌐 **Edge-first** - Built for Cloudflare Workers
249
+ - 📦 **Zero config** - Works out of the box
250
+ - 🔧 **Customizable** - Easy to extend
251
+
252
+ ## Examples
253
+
254
+ ### Create a blog
255
+
256
+ ```bash
257
+ npx create-sonicjs-app my-blog
258
+ # Select "Starter" template
259
+ # Include example collection: Yes
260
+ ```
261
+
262
+ ### Create without examples
263
+
264
+ ```bash
265
+ npx create-sonicjs-app my-app
266
+ # Include example collection: No
267
+ ```
268
+
269
+ ## Related
270
+
271
+ - [@sonicjs-cms/core](../core) - Core framework
272
+ - [SonicJS Documentation](https://docs.sonicjs.com)
273
+ - [Cloudflare Workers](https://workers.cloudflare.com)
274
+
275
+ ## Contributing
276
+
277
+ Contributions welcome! See [CONTRIBUTING.md](../../CONTRIBUTING.md).
278
+
279
+ ## License
280
+
281
+ MIT © SonicJS Team
282
+
283
+ ## Support
284
+
285
+ - **Issues**: [GitHub Issues](https://github.com/sonicjs/sonicjs/issues)
286
+ - **Discord**: [Join our community](https://discord.gg/sonicjs)
287
+ - **Docs**: [docs.sonicjs.com](https://docs.sonicjs.com)
288
+
289
+ ---
290
+
291
+ **Built with ❤️ for developers** | v2.0.0-alpha.1
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import '../src/cli.js'
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "create-sonicjs",
3
+ "version": "2.0.0-alpha.2",
4
+ "description": "Create a new SonicJS application with zero configuration",
5
+ "type": "module",
6
+ "bin": {
7
+ "create-sonicjs-app": "./bin/create-sonicjs-app.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "src",
12
+ "templates"
13
+ ],
14
+ "scripts": {
15
+ "build": "echo 'No build needed for CLI'",
16
+ "test": "node test-cli.js"
17
+ },
18
+ "keywords": [
19
+ "sonicjs",
20
+ "cms",
21
+ "create-app",
22
+ "scaffolding",
23
+ "cloudflare",
24
+ "workers",
25
+ "edge",
26
+ "headless-cms"
27
+ ],
28
+ "author": "SonicJS Team",
29
+ "license": "MIT",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/sonicjs/sonicjs.git",
33
+ "directory": "packages/create-app"
34
+ },
35
+ "bugs": {
36
+ "url": "https://github.com/sonicjs/sonicjs/issues"
37
+ },
38
+ "homepage": "https://sonicjs.com",
39
+ "dependencies": {
40
+ "prompts": "^2.4.2",
41
+ "kleur": "^4.1.5",
42
+ "ora": "^8.0.1",
43
+ "execa": "^9.5.2",
44
+ "fs-extra": "^11.2.0",
45
+ "validate-npm-package-name": "^6.0.0"
46
+ },
47
+ "engines": {
48
+ "node": ">=18.0.0"
49
+ }
50
+ }