Skip to content

Add top-level setup script for unified dependency installation #2190

@justin808

Description

@justin808

Problem

Currently, setting up the development environment requires running multiple commands in different directories:

# Root directory
pnpm install
bundle install

# Dummy app
cd spec/dummy
pnpm install
bundle install

# Pro package (if working on Pro features)
cd react_on_rails_pro
pnpm install
bundle install

cd react_on_rails_pro/spec/dummy
pnpm install
bundle install

This is error-prone and easy to forget, especially for new contributors or when switching between branches with different dependency requirements.

Proposed Solution

Add a top-level bin/setup script (the Rails convention) that:

  1. Installs all dependencies across all directories
  2. Runs any necessary setup tasks (e.g., rake node_package)
  3. Provides clear output about what's being installed
  4. Handles errors gracefully with helpful messages

Example implementation

#!/bin/bash
set -e

echo "Setting up React on Rails development environment..."

# Root dependencies
echo "Installing root dependencies..."
pnpm install
bundle install

# Build node package
echo "Building node package..."
rake node_package

# Dummy app
echo "Setting up spec/dummy..."
cd spec/dummy
pnpm install
bundle install
cd ../..

# Pro package (if present)
if [ -d "react_on_rails_pro" ]; then
  echo "Setting up react_on_rails_pro..."
  cd react_on_rails_pro
  pnpm install
  bundle install
  
  if [ -d "spec/dummy" ]; then
    cd spec/dummy
    pnpm install
    bundle install
    cd ../..
  fi
  cd ..
fi

echo ""
echo "Setup complete! You can now run:"
echo "  rake          # Run all tests"
echo "  rake lint     # Run linters"

Acceptance Criteria

  • bin/setup script exists and is executable
  • Running bin/setup from the repo root installs all dependencies
  • Script handles missing directories gracefully (e.g., if Pro package isn't cloned)
  • Script provides clear progress output
  • Script fails fast with helpful error messages if something goes wrong
  • README.md updated to reference bin/setup in the development setup section

Related

This would also help with the CI setup steps, which currently duplicate this logic across multiple workflow files.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions