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.
- package/CHANGELOG.md +7 -0
- package/bin/cli.js +22 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
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('--')
|
|
66
|
+
} else if (arg.startsWith('--')) {
|
|
67
67
|
const key = arg.slice(2);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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 =
|
|
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
|
-
|
|
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