Skip to content

Conversation

@AlisherAmonulloev
Copy link
Contributor

@AlisherAmonulloev AlisherAmonulloev commented Oct 28, 2025

Issue

When creating a new React app with explicit CLI parameters, the --empty false flag fails to create sample pages, even though it should include them.

Expected behavior:

npx devextreme-cli new react-app MyApp --empty false
# Should create src/pages/ with sample pages (home, tasks, profile)

Actual behavior:

npx devextreme-cli new react-app MyApp --empty false
# Does NOT create src/pages/ directory - pages are missing

Workaround that works:

npx devextreme-cli new react-app MyApp
# Interactive prompts work correctly and create pages

Root Cause

The minimist argument parser was treating --empty false as a string "false" instead of a boolean false. This caused the conditional check in application.react.js to fail:

if(!templateOptions.empty) {
    addSamplePages(appPath, templateOptions);
}

When templateOptions.empty = "false" (string):

  • !templateOptions.empty evaluates to false (non-empty strings are truthy)
  • Sample pages are NOT created ❌

When templateOptions.empty = false (boolean):

  • !templateOptions.empty evaluates to true
  • Sample pages ARE created ✅

Solution

Configure minimist to parse the --empty flag as a boolean type by adding it to the boolean array in the parser options:

const args = require('minimist')(process.argv.slice(2), {
    alias: { v: 'version' },
    boolean: ['empty']  // ← Added this line
});

This ensures --empty false, --empty true, and --empty are all parsed as proper boolean values, making the flag behavior consistent regardless of how it's specified.

Ticket ID: T1311643

@AlisherAmonulloev AlisherAmonulloev added the bug Something isn't working label Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants