create-skateboard-app 1.2.0 → 1.2.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/bin/cli.js +22 -12
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ 1.2.1
2
+
3
+ Fix dash-prefixed flag values
4
+ Fix connection-string validation
5
+ Fix quiet-mode error output
6
+ Fix resolve absolute path
7
+
1
8
  1.2.0
2
9
 
3
10
  Add non-interactive CLI flags
package/bin/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { execSync } from 'child_process';
4
4
  import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
5
- import { join } from 'path';
5
+ import { join, resolve } from 'path';
6
6
  import https from 'https';
7
7
  import { createWriteStream } from 'fs';
8
8
  import { createInterface } from 'readline';
@@ -63,16 +63,19 @@ function parseFlags(argv) {
63
63
  flags.help = true;
64
64
  } else if (arg === '--version' || arg === '-v') {
65
65
  flags.version = true;
66
- } else if (arg.startsWith('--') && i + 1 < args.length && !args[i + 1].startsWith('-')) {
66
+ } else if (arg.startsWith('--')) {
67
67
  const key = arg.slice(2);
68
- i++;
69
- const val = args[i];
70
- if (key === 'name') flags.name = val;
71
- else if (key === 'tagline') flags.tagline = val;
72
- else if (key === 'color') flags.color = val;
73
- else if (key === 'icon') flags.icon = val;
74
- else if (key === 'database') flags.database = val;
75
- else if (key === 'connection-string') flags.connectionString = val;
68
+ const knownValueFlags = ['name', 'tagline', 'color', 'icon', 'database', 'connection-string'];
69
+ if (knownValueFlags.includes(key) && i + 1 < args.length) {
70
+ i++;
71
+ const val = args[i];
72
+ if (key === 'name') flags.name = val;
73
+ else if (key === 'tagline') flags.tagline = val;
74
+ else if (key === 'color') flags.color = val;
75
+ else if (key === 'icon') flags.icon = val;
76
+ else if (key === 'database') flags.database = val;
77
+ else if (key === 'connection-string') flags.connectionString = val;
78
+ }
76
79
  } else if (!arg.startsWith('-') && !flags.positional) {
77
80
  flags.positional = arg;
78
81
  }
@@ -95,6 +98,9 @@ function validateFlags(flags) {
95
98
  console.error(`Error: Invalid database "${flags.database}". Must be one of: ${VALID_DATABASES.join(', ')}`);
96
99
  process.exit(1);
97
100
  }
101
+ if (flags.connectionString && (!flags.database || flags.database === 'sqlite')) {
102
+ console.error('Warning: --connection-string is ignored when database is sqlite. Use --database postgresql or --database mongodb.');
103
+ }
98
104
  }
99
105
 
100
106
  async function downloadTemplate(projectName) {
@@ -550,7 +556,7 @@ async function main() {
550
556
 
551
557
  // Success message
552
558
  if (quiet) {
553
- const absolutePath = join(process.cwd(), projectName);
559
+ const absolutePath = resolve(projectName);
554
560
  console.log(JSON.stringify({ success: true, path: absolutePath }));
555
561
  } else {
556
562
  log(`\n${colors.bold}${colors.green}🎉 Success! Created ${config.appName}${colors.reset}\n`);
@@ -580,7 +586,11 @@ async function main() {
580
586
  }
581
587
 
582
588
  } catch (err) {
583
- error(`Failed to create project: ${err.message}`);
589
+ if (quiet) {
590
+ console.log(JSON.stringify({ success: false, error: err.message }));
591
+ } else {
592
+ error(`Failed to create project: ${err.message}`);
593
+ }
584
594
  process.exit(1);
585
595
  }
586
596
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-skateboard-app",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Create a full-stack React app with authentication, Stripe payments, and database support in seconds",
5
5
  "main": "index.js",
6
6
  "type": "module",