create-skateboard-app 1.2.1 → 1.4.0

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 +11 -0
  2. package/bin/cli.js +31 -3
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ 1.4.0
2
+
3
+ Inject database driver
4
+ Add pg dependency
5
+ Add mongodb dependency
6
+
7
+ 1.3.0
8
+
9
+ Add non-TTY fallback
10
+ Fix setRawMode crash
11
+
1
12
  1.2.1
2
13
 
3
14
  Fix dash-prefixed flag values
package/bin/cli.js CHANGED
@@ -168,16 +168,21 @@ async function downloadTemplate(projectName) {
168
168
 
169
169
  // Interactive prompt functions
170
170
  function ask(question, defaultValue = '') {
171
+ // When stdin is not a TTY (piped input, CI, agents), use default value
172
+ if (!process.stdin.isTTY) {
173
+ return Promise.resolve(defaultValue);
174
+ }
175
+
171
176
  const rl = createInterface({
172
177
  input: process.stdin,
173
178
  output: process.stdout
174
179
  });
175
180
 
176
181
  return new Promise((resolve) => {
177
- const prompt = defaultValue
182
+ const prompt = defaultValue
178
183
  ? `${colors.cyan}${question}${colors.reset} ${colors.yellow}(${defaultValue})${colors.reset}: `
179
184
  : `${colors.cyan}${question}${colors.reset}: `;
180
-
185
+
181
186
  rl.question(prompt, (answer) => {
182
187
  rl.close();
183
188
  resolve(answer.trim() || defaultValue);
@@ -186,9 +191,14 @@ function ask(question, defaultValue = '') {
186
191
  }
187
192
 
188
193
  function askChoice(question, choices, defaultChoice = 0) {
194
+ // When stdin is not a TTY (piped input, CI, agents), use default choice
195
+ if (!process.stdin.isTTY) {
196
+ return choices[defaultChoice];
197
+ }
198
+
189
199
  return new Promise((resolve) => {
190
200
  let currentChoice = defaultChoice;
191
-
201
+
192
202
  const displayMenu = () => {
193
203
  // Clear screen and show menu
194
204
  console.clear();
@@ -245,6 +255,10 @@ async function askYesNo(question, defaultYes = true) {
245
255
  async function collectProjectConfig(projectName, flags = {}) {
246
256
  const nonInteractive = flags.yes;
247
257
 
258
+ if (!nonInteractive && !process.stdin.isTTY) {
259
+ info('Non-interactive mode detected, using defaults. Use --flags to customize.');
260
+ }
261
+
248
262
  if (!nonInteractive) {
249
263
  log(`\n${colors.bold}Let's configure your Skateboard app!${colors.reset}\n`);
250
264
  }
@@ -500,6 +514,20 @@ async function main() {
500
514
  success(`Database configured: ${config.database.value}`);
501
515
  }
502
516
 
517
+ // Step 5b: Inject database driver into backend deps (sqlite uses node:sqlite, no driver needed)
518
+ const driverMap = {
519
+ postgresql: { pg: '^8.20.0' },
520
+ mongodb: { mongodb: '^6.19.0' }
521
+ };
522
+ const driver = driverMap[config.database.value];
523
+ if (driver) {
524
+ const backendPkgPath = join(projectName, 'backend', 'package.json');
525
+ const backendPkg = JSON.parse(readFileSync(backendPkgPath, 'utf8'));
526
+ backendPkg.dependencies = { ...backendPkg.dependencies, ...driver };
527
+ writeFileSync(backendPkgPath, JSON.stringify(backendPkg, null, 4));
528
+ success(`Added ${Object.keys(driver)[0]} driver`);
529
+ }
530
+
503
531
  // Create .env file from .env.example
504
532
  info('Creating .env file...');
505
533
  const backendDir = join(projectName, 'backend');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-skateboard-app",
3
- "version": "1.2.1",
3
+ "version": "1.4.0",
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",