Skip to content

[DEV#97] Update rolemodel rails generators#198

Open
mark-kraemer wants to merge 12 commits into
masterfrom
dev-97-update-rolemodel-rails-generators
Open

[DEV#97] Update rolemodel rails generators#198
mark-kraemer wants to merge 12 commits into
masterfrom
dev-97-update-rolemodel-rails-generators

Conversation

@mark-kraemer

@mark-kraemer mark-kraemer commented Jul 6, 2026

Copy link
Copy Markdown
Member

Why?

Our generator suite still defaulted new apps to Honeybadger for error tracking and to Yarn 1.22, both of which we've moved away from as a company. Running rolemodel:all on a fresh app also pulled in generators (React, SaaS/Devise, GoodJob, etc.) that most new apps don't actually need, making initial setup noisier than it should be and leaving more for the developer to manually undo. This PR brings the generators in line with our current standard stack and gives new apps a leaner, more accurate starting point.

What Changed

  • Replaced Honeybadger with Sentry for both Ruby and JS error reporting, including webpack source map upload and per-user error context
  • Added a new core_setup generator that runs only the generators appropriate for a brand-new app, separate from the full all generator
  • Switched projects from Yarn 1.22/global installs to Corepack-managed Yarn 4+, applied consistently everywhere yarn commands run
  • Added a Heroku deploy-app agent skill and matching GitHub Actions workflows to streamline setting up staging/production deploys
  • Pinned the Ruby version in the generated Gemfile so the Heroku buildpack installs the correct version
  • Updated the generated production database config to use DATABASE_URL so it works out of the box on Heroku
  • Made the Tailored Select input generator optional and prompted during Simple Form setup instead of always installed
  • Removed the outdated Honeybadger/GoodJob version reminder now that Sentry is the default
  • Updated README to document the new core setup workflow and Corepack-based Yarn setup

Pre-merge checklist

  • Update relevant READMEs
  • Run bin/bump_version or bin/bump_version --patch

@linear-code

linear-code Bot commented Jul 6, 2026

Copy link
Copy Markdown

DEV-97

@mark-kraemer mark-kraemer force-pushed the dev-97-update-rolemodel-rails-generators branch from f77ad19 to 26b8249 Compare July 6, 2026 17:02
@blacksmith-sh

This comment has been minimized.

end

def reference_deploy_app_skill
say 'Reference the deploy-app agent skill from rolemodel-rails', :green

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OutlawAndy - I know we discussed moving this, but it's kinda specific to a fresh build from the generator. We could make it more generic, but the generator just references this skill directly from the AGENTS.md file so that it can be used once and then dev doesn't need any other skill or setup

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should put it somewhere external, don't care where, and then pass to Claude/Copilot via download URL. It's not a skill anyone needs installed on their machine, but it also doesn't belong on the load path of every RoleModel project for ever.

@OutlawAndy OutlawAndy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mark-kraemer lets sync on this tomorrow

(pass `--js-runner` to include jasmine-playwright-runner)
- [SimpleForm](../simple_form) — SimpleForm with our configuration
- [Linters](../linters) — Rubocop and ESLint
- [UI Components](../ui_components) — flash, modals, navbar

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [UI Components](../ui_components) — flash, modals, navbar
- [UI Components](../ui_components) — flash, the modal pattern, & Turbo 8 support

Comment on lines +4 to +7
Sets up GitHub config, Heroku deployment, README, Webpack, Sentry, Slim,
Optics, testing (RSpec & friends), SimpleForm, linters, UI components,
editor config, and Lograge. The result is a new Rails app that is ready
to push straight to Heroku.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Sets up GitHub config, Heroku deployment, README, Webpack, Sentry, Slim,
Optics, testing (RSpec & friends), SimpleForm, linters, UI components,
editor config, and Lograge. The result is a new Rails app that is ready
to push straight to Heroku.
Sets up GitHub config, Heroku deployment, README, Webpack, Sentry, Slim,
Optics, testing (RSpec & friends), SimpleForm, linters, Turbo 8+ support,
and Lograge. The result is an app that is ready to push directly to Heroku.

Comment on lines +3 to +4
on:
workflow_dispatch:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support for deploying a specific commit or branch name

Suggested change
on:
workflow_dispatch:
on:
workflow_dispatch:
inputs:
sha:
description: 'Specific SHA or Branch name (optional)'
required: false
type: string

heroku_api_key: ${{ secrets.HEROKU_IT_SUPPORT_API_KEY }}
heroku_app_name: ${{ vars.HEROKU_APP_NAME }}
heroku_email: ${{ vars.HEROKU_IT_SUPPORT_EMAIL }}
healthcheck: '${{ vars.HEROKU_APP_URL }}/up'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
healthcheck: '${{ vars.HEROKU_APP_URL }}/up'
branch: ${{ inputs.sha || 'HEAD' }}
healthcheck: '${{ vars.HEROKU_APP_URL }}/up'

Comment on lines +4 to +7
workflow_dispatch:
push:
branches:
- main

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

support for deploying a specific commit or branch name

Suggested change
workflow_dispatch:
push:
branches:
- main
push: { branches: [ staging ] }
workflow_dispatch:
inputs:
sha:
description: 'Specific SHA or Branch name (optional)'
required: false
type: string

@honeybadger-io/js
esbuild
esbuild-loader
terser-webpack-plugin

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the latest version of webpack just removed this plugin.. there are several broken dependabot updates laying around our various repos..

Comment on lines -53 to -61
def honeybadger_setup
say 'Setting up Honeybadger for JS error reporting', :green

copy_file 'app/javascript/initializers/honeybadger.js'
append_to_file 'app/javascript/application.js', <<~JS
import './initializers/honeybadger'
JS
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could use class_options to coordinate overlapping concerns. Like if sentry do the webpack related sentry crap here??

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib is inserted into the load_path of consuming apps, so I don't think this should go here...

I don't know where to put it, but especially if its only relevant for new apps, I don't think it should permanently reside inside every RoleModel application..

What if we just put it in Google Drive and have a shell script that downloads and dumps it to standard out? Then you can tell Calude/etc. Run this for the context you need...

# Enable Corepack and pin the project to Yarn 4+ (instead of the classic
# Yarn 1.22). Idempotent, so any generator can call it before running a
# `yarn` command to guarantee the modern toolchain is in place.
def ensure_yarn

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not in love, but you've already worn me down by sheer line count. If you need me I'll be in the corner, crying.

Comment on lines +4 to +28
def invoke_core_setup(args = [])
generator = described_class.new([], args)
allow(generator).to receive(:generate) { |*invocation| invocations << invocation }
generator.invoke_all
end

it 'runs the core generators in order' do
invoke_core_setup

expect(invocations).to eq [
['rolemodel:github'],
['rolemodel:heroku'],
['rolemodel:readme'],
['rolemodel:webpack'],
['rolemodel:sentry'],
['rolemodel:slim'],
['rolemodel:optics:all'],
['rolemodel:testing:all'],
['rolemodel:simple_form'],
['rolemodel:linters:all'],
['rolemodel:ui_components:flash'],
['rolemodel:ui_components:modals'],
['rolemodel:lograge']
]
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad Claude, stop that!

Suggested change
def invoke_core_setup(args = [])
generator = described_class.new([], args)
allow(generator).to receive(:generate) { |*invocation| invocations << invocation }
generator.invoke_all
end
it 'runs the core generators in order' do
invoke_core_setup
expect(invocations).to eq [
['rolemodel:github'],
['rolemodel:heroku'],
['rolemodel:readme'],
['rolemodel:webpack'],
['rolemodel:sentry'],
['rolemodel:slim'],
['rolemodel:optics:all'],
['rolemodel:testing:all'],
['rolemodel:simple_form'],
['rolemodel:linters:all'],
['rolemodel:ui_components:flash'],
['rolemodel:ui_components:modals'],
['rolemodel:lograge']
]
end

Apply the reviewer's concrete suggestions and reduce cross-generator coupling:

- deploy workflows: support deploying a specific SHA/branch via workflow_dispatch
  input; staging pushes now trigger on the `staging` branch
- core_setup README/USAGE: tighten the UI Components / feature descriptions
- simple_form: replace the interactive tailored_select prompt with a
  --tailored_select class option that delegates to the tailored_select generator
- tailored_select: own the SimpleForm input template and install it only when
  SimpleForm is present in the app
- webpack: own the Sentry webpack wiring via a --sentry option; core_setup passes
  it. The wiring itself is a single shared GeneratorBase helper reused by the
  standalone sentry generator, so there's one source of truth
- webpack: drop terser-webpack-plugin and rely on webpack 5's built-in minimizer
  (the '...' placeholder), keeping CssMinimizerPlugin
- sentry: guard set_sentry_user so it's a no-op without an auth generator,
  removing the hard Devise dependency in fresh core_setup apps

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants