create-skateboard-app 1.0.1 → 1.0.3
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/.claude/settings.local.json +11 -0
- package/CHANGELOG.md +15 -8
- package/bin/cli.js +91 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
|
|
2
|
+
1.0.3
|
|
3
|
+
|
|
4
|
+
Add database selection
|
|
5
|
+
Auto-install dependencies
|
|
6
|
+
Include Stripe setup
|
|
7
|
+
Fix config formatting
|
|
8
|
+
|
|
9
|
+
1.0.2
|
|
10
|
+
|
|
11
|
+
Clarify prompt labels
|
|
12
|
+
|
|
2
13
|
1.0.1
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
Fix
|
|
7
|
-
Simplify setup by removing backend URL, pages, and company name prompts
|
|
8
|
-
Change npm run dev to npm run start in instructions
|
|
9
|
-
Clarify that users need to manually cd into project directory
|
|
10
|
-
Bump version to 1.0.1
|
|
14
|
+
|
|
15
|
+
Improve download speed
|
|
16
|
+
Simplify setup flow
|
|
17
|
+
Fix folder duplication
|
|
11
18
|
|
|
12
19
|
1.0.0
|
package/bin/cli.js
CHANGED
|
@@ -187,7 +187,7 @@ async function collectProjectConfig(projectName) {
|
|
|
187
187
|
log(`\n${colors.bold}Let's configure your Skateboard app!${colors.reset}\n`);
|
|
188
188
|
|
|
189
189
|
// App name
|
|
190
|
-
const appName = await ask('App name', projectName.split('-').map(word =>
|
|
190
|
+
const appName = await ask('App display name', projectName.split('-').map(word =>
|
|
191
191
|
word.charAt(0).toUpperCase() + word.slice(1)
|
|
192
192
|
).join(' '));
|
|
193
193
|
|
|
@@ -222,6 +222,23 @@ async function collectProjectConfig(projectName) {
|
|
|
222
222
|
|
|
223
223
|
const selectedIcon = await askChoice('Choose an app icon:', iconChoices);
|
|
224
224
|
|
|
225
|
+
// Database selection
|
|
226
|
+
const databaseChoices = [
|
|
227
|
+
{ label: '🗃️ SQLite (default)', value: 'sqlite', connectionString: `./databases/${appName.replace(/\s+/g, '')}.db` },
|
|
228
|
+
{ label: '🐘 PostgreSQL', value: 'postgresql', connectionString: 'postgresql://user:password@localhost:5432/dbname' },
|
|
229
|
+
{ label: '🍃 MongoDB', value: 'mongodb', connectionString: 'mongodb://localhost:27017/dbname' }
|
|
230
|
+
];
|
|
231
|
+
|
|
232
|
+
const selectedDatabase = await askChoice('Choose your database:', databaseChoices, 0);
|
|
233
|
+
|
|
234
|
+
// Get connection string for non-SQLite databases
|
|
235
|
+
let connectionString = '';
|
|
236
|
+
if (selectedDatabase.value === 'postgresql') {
|
|
237
|
+
connectionString = await ask('PostgreSQL connection string (optional)', '');
|
|
238
|
+
} else if (selectedDatabase.value === 'mongodb') {
|
|
239
|
+
connectionString = await ask('MongoDB connection string (optional)', '');
|
|
240
|
+
}
|
|
241
|
+
|
|
225
242
|
// Default values for removed questions
|
|
226
243
|
const backendURL = 'https://api.example.com';
|
|
227
244
|
const devBackendURL = 'http://localhost:8000';
|
|
@@ -232,7 +249,7 @@ async function collectProjectConfig(projectName) {
|
|
|
232
249
|
];
|
|
233
250
|
|
|
234
251
|
// Installation preferences
|
|
235
|
-
const installDeps =
|
|
252
|
+
const installDeps = true; // Always install dependencies
|
|
236
253
|
const initGit = await askYesNo('Initialize git repository?', true);
|
|
237
254
|
|
|
238
255
|
return {
|
|
@@ -241,6 +258,8 @@ async function collectProjectConfig(projectName) {
|
|
|
241
258
|
tagline,
|
|
242
259
|
appColor: selectedColor.value,
|
|
243
260
|
appIcon: selectedIcon.value,
|
|
261
|
+
database: selectedDatabase,
|
|
262
|
+
connectionString,
|
|
244
263
|
backendURL,
|
|
245
264
|
devBackendURL,
|
|
246
265
|
pages,
|
|
@@ -294,7 +313,7 @@ async function main() {
|
|
|
294
313
|
// If no project name provided, ask for it
|
|
295
314
|
if (!projectName) {
|
|
296
315
|
log(`\n${colors.bold}🛹 Welcome to Skateboard App Creator!${colors.reset}\n`);
|
|
297
|
-
projectName = await ask('
|
|
316
|
+
projectName = await ask('Project directory name', 'my-skateboard-app');
|
|
298
317
|
}
|
|
299
318
|
|
|
300
319
|
// Validate project name
|
|
@@ -344,7 +363,51 @@ async function main() {
|
|
|
344
363
|
success('App configuration updated');
|
|
345
364
|
}
|
|
346
365
|
|
|
347
|
-
// Step 5:
|
|
366
|
+
// Step 5: Configure database settings
|
|
367
|
+
info('Configuring database...');
|
|
368
|
+
const backendConfigPath = join(projectName, 'backend', 'config.json');
|
|
369
|
+
if (existsSync(backendConfigPath)) {
|
|
370
|
+
const backendConfig = JSON.parse(readFileSync(backendConfigPath, 'utf8'));
|
|
371
|
+
// Handle both array and single object formats defensively
|
|
372
|
+
const configArray = Array.isArray(backendConfig) ? backendConfig : [backendConfig];
|
|
373
|
+
|
|
374
|
+
configArray.forEach(configObj => {
|
|
375
|
+
configObj.dbType = config.database.value;
|
|
376
|
+
if (config.database.value === 'sqlite') {
|
|
377
|
+
configObj.connectionString = config.database.connectionString;
|
|
378
|
+
} else if (config.database.value === 'postgresql') {
|
|
379
|
+
// Always use environment variable placeholder in config.json
|
|
380
|
+
configObj.connectionString = '${POSTGRES_URL}';
|
|
381
|
+
} else if (config.database.value === 'mongodb') {
|
|
382
|
+
// Always use environment variable placeholder in config.json
|
|
383
|
+
configObj.connectionString = '${MONGODB_URL}';
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
// Write back the original format (array or single object)
|
|
388
|
+
const finalConfig = Array.isArray(backendConfig) ? configArray : configArray[0];
|
|
389
|
+
writeFileSync(backendConfigPath, JSON.stringify(finalConfig, null, 2));
|
|
390
|
+
success(`Database configured: ${config.database.value}`);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// Create .env file if connection string provided
|
|
394
|
+
if (config.connectionString && (config.database.value === 'postgresql' || config.database.value === 'mongodb')) {
|
|
395
|
+
info('Creating .env file...');
|
|
396
|
+
const backendDir = join(projectName, 'backend');
|
|
397
|
+
const envPath = join(backendDir, '.env');
|
|
398
|
+
|
|
399
|
+
// Ensure backend directory exists
|
|
400
|
+
if (!existsSync(backendDir)) {
|
|
401
|
+
mkdirSync(backendDir, { recursive: true });
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
const envVar = config.database.value === 'postgresql' ? 'POSTGRES_URL' : 'MONGODB_URL';
|
|
405
|
+
const envContent = `${envVar}=${config.connectionString}\n`;
|
|
406
|
+
writeFileSync(envPath, envContent);
|
|
407
|
+
success('.env file created with database connection');
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// Step 6: Update app color in styles.css
|
|
348
411
|
info('Setting app color...');
|
|
349
412
|
const stylesPath = join(projectName, 'src', 'assets', 'styles.css');
|
|
350
413
|
if (existsSync(stylesPath)) {
|
|
@@ -358,14 +421,12 @@ async function main() {
|
|
|
358
421
|
success(`App color set to ${config.appColor}`);
|
|
359
422
|
}
|
|
360
423
|
|
|
361
|
-
// Step
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
success('Dependencies installed');
|
|
366
|
-
}
|
|
424
|
+
// Step 7: Install dependencies
|
|
425
|
+
info('Installing dependencies...');
|
|
426
|
+
execSync(`cd ${projectName} && npm install`, { stdio: 'inherit' });
|
|
427
|
+
success('Dependencies installed');
|
|
367
428
|
|
|
368
|
-
// Step
|
|
429
|
+
// Step 8: Initialize git (if requested)
|
|
369
430
|
if (config.initGit) {
|
|
370
431
|
info('Initializing git repository...');
|
|
371
432
|
execSync(`cd ${projectName} && git init`, { stdio: 'pipe' });
|
|
@@ -380,12 +441,28 @@ async function main() {
|
|
|
380
441
|
log(` 💬 Tagline: ${config.tagline}`);
|
|
381
442
|
log(` 🎨 Color: ${config.appColor}`);
|
|
382
443
|
log(` 🎯 Icon: ${config.appIcon}`);
|
|
444
|
+
log(` 🗃️ Database: ${config.database.value}`);
|
|
445
|
+
|
|
446
|
+
// Database-specific instructions (only if connection string not provided)
|
|
447
|
+
if (config.database.value === 'postgresql' && !config.connectionString) {
|
|
448
|
+
log(`\n${colors.yellow}📝 PostgreSQL Setup:${colors.reset}`);
|
|
449
|
+
log(` Update the ${colors.cyan}backend/.env${colors.reset} file with:`);
|
|
450
|
+
log(` ${colors.green}POSTGRES_URL=postgresql://username:password@localhost:5432/dbname${colors.reset}`);
|
|
451
|
+
} else if (config.database.value === 'mongodb' && !config.connectionString) {
|
|
452
|
+
log(`\n${colors.yellow}📝 MongoDB Setup:${colors.reset}`);
|
|
453
|
+
log(` Update the ${colors.cyan}backend/.env${colors.reset} file with:`);
|
|
454
|
+
log(` ${colors.green}MONGODB_URL=mongodb://localhost:27017/dbname${colors.reset}`);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// Stripe setup instructions
|
|
458
|
+
log(`\n${colors.yellow}💳 Stripe Setup:${colors.reset}`);
|
|
459
|
+
log(` Update the ${colors.cyan}backend/.env${colors.reset} file with:`);
|
|
460
|
+
log(` ${colors.green}STRIPE_KEY=sk_test_your_stripe_secret_key_here${colors.reset}`);
|
|
461
|
+
log(` ${colors.green}STRIPE_ENDPOINT_SECRET=whsec_your_webhook_endpoint_secret_here${colors.reset}`);
|
|
462
|
+
log(` Get your keys from: ${colors.blue}https://dashboard.stripe.com/apikeys${colors.reset}`);
|
|
383
463
|
|
|
384
464
|
log(`\n${colors.bold}Get started with:${colors.reset}`, 'yellow');
|
|
385
465
|
log(`\n ${colors.cyan}cd ${projectName}${colors.reset}`);
|
|
386
|
-
if (!config.installDeps) {
|
|
387
|
-
log(` ${colors.cyan}npm install${colors.reset}`);
|
|
388
|
-
}
|
|
389
466
|
log(` ${colors.cyan}npm run start${colors.reset}`);
|
|
390
467
|
log(`\n${colors.yellow}Happy coding! 🛹${colors.reset}\n`);
|
|
391
468
|
|