Skip to content

create-rnstack: Make component gallery and data-demo opt-in (prompt + --no-demo) #14

Description

@sanjaysah101

Overview

The current create-rnstack scaffold includes development-only reference screens and demo code by default:

  • Component gallery (src/app/gallery/*)
  • Data demo screen (src/app/data-demo.tsx)
  • Example API hook (use-example-posts)

These resources are useful while developing and validating the rnstack template, especially for testing UI components and API integration patterns.

However, most generated applications should start with production-focused code only. Currently, users need to manually remove demo files and clean up references after scaffolding.

This issue changes the behavior so demo/reference content becomes opt-in.


Problem

Demo content ships by default

A fresh scaffold currently contains:

src/app/
├── gallery/
│   └── ~35 component example screens
├── data-demo.tsx

packages/api-client/
└── hooks/
    └── use-example-posts.ts

Additional wiring exists:

  • Settings → Developer links to gallery screens
  • Home screen references demo content
  • API package exports demo hooks

Impact

1. Generated applications contain unnecessary code

Most production applications do not need:

  • 35 gallery routes
  • Example API screens
  • Placeholder data hooks
  • Developer-only navigation entries

Users immediately delete these files after generation.


2. Manual cleanup is error-prone

Removing the files manually requires updating multiple locations:

  • Route definitions
  • Navigation links
  • Exports
  • Imports
  • Screens

Missing one reference can leave:

  • Broken imports
  • Dead routes
  • Unused dependencies

Why opt-in instead of cleanup command

A cleanup script would introduce another maintenance problem.

Generated projects would contain:

demo code
+
script to remove demo code

The generated application still ships unnecessary files and tooling.

The goal of rnstack should be:

Generated code should be code users keep.

Users who want the gallery should explicitly enable it during initialization.


Proposed Behavior

Default behavior

Demo content should be excluded by default.

Example:

create-rnstack my-app

generates:

src/app/
├── normal application routes
└── no gallery/data-demo

Interactive Prompt

During interactive setup:

Include component gallery + demo screens? (y/N)

Default:

No

Selecting:

Yes

keeps the existing gallery and demo content.


CLI Flag

Add:

--no-demo

Example:

create-rnstack my-app --no-demo

Behavior:

  • Removes demo content
  • Removes related wiring
  • Works with non-interactive mode

Example:

create-rnstack my-app -y --no-demo

should generate a clean production project.


Conditional Removal

When demo content is disabled, the CLI should remove:

Component Gallery

src/app/gallery/**

Data Demo Screen

src/app/data-demo.tsx

Example API Hook

Remove:

packages/api-client/src/hooks/use-example-posts.ts

and remove its export from:

packages/api-client/src/index.ts

Cleanup Requirements

The scaffold process must also remove all references to deleted files.

Remove:

Navigation references

Example:

Settings
 └── Developer
      └── Component Gallery

should not exist when demo mode is disabled.


Home screen references

Remove:

  • Demo cards
  • Example links
  • Imports
  • Navigation actions

The generated home screen must build successfully without dangling references.


Implementation Approach

Implement this as a conditional strip set.

Similar to:

STRIP_PATHS

introduce:

DEMO_STRIP_PATHS

Example:

const DEMO_STRIP_PATHS = [
  "src/app/gallery",
  "src/app/data-demo.tsx",
  "packages/api-client/src/hooks/use-example-posts.ts",
];

Apply based on:

includeDemo === false

Acceptance Criteria

Default Generation

  • Fresh scaffold excludes gallery/demo content by default
  • No demo routes are generated
  • No demo hooks are generated
  • Application builds successfully

Opt-in Mode

When user selects:

Include component gallery + demo screens? Yes

or runs:

create-rnstack app --include-demo

the generated project includes:

  • Component gallery
  • Data demo screen
  • Example API hook

CLI Behavior

  • Interactive prompt defaults to No
  • --no-demo flag is supported
  • --no-demo works with -y
  • Non-interactive generation excludes demo content

Cleanup Validation

Generated projects without demos must not contain:

  • Broken imports
  • Dead routes
  • Missing exports
  • Developer menu links
  • Home screen references

Environment

Affected versions:

create-rnstack@0.1.1
template: sanjaysah101/rnstack#v0.1.1

Out of Scope

  • Removing development tools from the rnstack repository itself
  • Creating a separate demo package
  • Building a demo marketplace/gallery system

The goal is only to make generated applications production-ready by default.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions