[DEV#97] Update rolemodel rails generators#198
Conversation
f77ad19 to
26b8249
Compare
This comment has been minimized.
This comment has been minimized.
| end | ||
|
|
||
| def reference_deploy_app_skill | ||
| say 'Reference the deploy-app agent skill from rolemodel-rails', :green |
There was a problem hiding this comment.
@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
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
@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 |
There was a problem hiding this comment.
| - [UI Components](../ui_components) — flash, modals, navbar | |
| - [UI Components](../ui_components) — flash, the modal pattern, & Turbo 8 support |
| 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. |
There was a problem hiding this comment.
| 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. |
| on: | ||
| workflow_dispatch: |
There was a problem hiding this comment.
Support for deploying a specific commit or branch name
| 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' |
There was a problem hiding this comment.
| healthcheck: '${{ vars.HEROKU_APP_URL }}/up' | |
| branch: ${{ inputs.sha || 'HEAD' }} | |
| healthcheck: '${{ vars.HEROKU_APP_URL }}/up' |
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - main |
There was a problem hiding this comment.
support for deploying a specific commit or branch name
| 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 |
There was a problem hiding this comment.
I feel like the latest version of webpack just removed this plugin.. there are several broken dependabot updates laying around our various repos..
| 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 | ||
|
|
There was a problem hiding this comment.
I wonder if we could use class_options to coordinate overlapping concerns. Like if sentry do the webpack related sentry crap here??
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
bad Claude, stop that!
| 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>
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:allon 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
core_setupgenerator that runs only the generators appropriate for a brand-new app, separate from the fullallgeneratoryarncommands runDATABASE_URLso it works out of the box on HerokuPre-merge checklist
bin/bump_versionorbin/bump_version --patch