Skip to content

create-react-on-rails-app: Follow-ups from PR #2375 #2383

@justin808

Description

@justin808

Follow-up items from PR #2375 (create-react-on-rails-app CLI Phase 1).

Validation improvements

  • App name validation: Require names start with a letter (/^[a-zA-Z][a-zA-Z0-9_-]*$/) — names like 123app or -myapp will cause rails new to fail or behave poorly
  • Minimum Rails version check: validateRails only checks presence, not version — Rails 5 or 6 would produce an incompatible app. Add minimum version check (e.g., Rails 6.1+ or 7.0+)

Code quality

  • Unreachable else branch in buildGeneratorArgs: Since --ignore-warnings is always pushed, args.length > 0 is always true — simplify the ternary
  • process.exit(1) in createApp prevents composability: Consider having createApp throw or return a result instead, so the CLI entry point handles the exit and the function is testable
  • Add JSDoc on execLive/execLiveArgs: Document shell-injection contract — callers must ensure command is shell-safe
  • rm -rf in clean script is not cross-platform: Use node -e "require('fs').rmSync('./lib',{recursive:true,force:true})" or rimraf for Windows compatibility

Testing

  • Add validateAll success-case test: Current tests verify the failure path but don't assert allValid === true when all prerequisites pass
  • End-to-end test: Create an actual app with npx create-react-on-rails-app test-app and verify it boots (marked incomplete in PR test plan)

Documentation

  • Update proposal doc to match implementation: Listed dependencies (chalk ^5.0.0, ora, prompts) diverge from actual implementation (chalk ^4.1.2 for CJS, no ora/prompts)

Future phases (from PR description and issue #1637)

Build pipeline

  • Consider topological build: Root build script chains 4 sequential pnpm --filter ... run build calls — if packages are independent, pnpm -r run build would be simpler

Ref: PR #2375, Issue #1637

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Merge this week

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions