Shared configurations and utilities for React on Rails demo applications.
- 🎨 Linting: RuboCop for Ruby, ESLint for JavaScript/TypeScript
- 💅 Formatting: Prettier for consistent code style
- 🪝 Git Hooks: Lefthook for pre-commit and pre-push checks
- 🧪 Testing: Shared test utilities for Playwright
- 🚀 Deployment: Rake tasks for Control Plane deployment
- 🔧 CI/CD: GitHub Actions workflow templates
- Add to your
Gemfile
:
gem 'react_on_rails_demo_common', github: 'shakacode/react_on_rails_demo_common'
- Add to your
package.json
:
"devDependencies": {
"@shakacode/react-on-rails-demo-common": "github:shakacode/react_on_rails_demo_common"
}
- Run the installation generator:
bundle install
npm install
rails generate react_on_rails_demo_common:install
.rubocop.yml
- Ruby linting rules.eslintrc.js
- JavaScript/TypeScript linting rules.prettierrc.js
- Code formatting ruleslefthook.yml
- Git hooks configuration.commitlintrc.js
- Commit message linting
lint
- Run ESLintlint:fix
- Auto-fix ESLint issuesformat
- Format code with Prettierformat:check
- Check formatting without changing files
demo_common:all
- Run all linters and testsdemo_common:setup
- Set up development environmentdemo_common:deploy[environment]
- Deploy to Control Planedemo_common:rebuild
- Clean and rebuild everything
- Pre-commit: RuboCop, ESLint, Prettier
- Pre-push: Full test suite, bundle audit
- Commit-msg: Conventional commit format
You can override any configuration by editing the generated files:
# .rubocop.yml
inherit_from:
- node_modules/@shakacode/react-on-rails-demo-common/config/rubocop.yml
# Your overrides
Style/StringLiterals:
EnforcedStyle: single_quotes
// .eslintrc.js
const baseConfig = require('@shakacode/react-on-rails-demo-common/configs/eslint.config.js');
module.exports = {
...baseConfig,
rules: {
...baseConfig.rules,
// Your overrides
'no-console': 'off',
},
};
# Run everything
bundle exec rake demo_common:all
# Run individually
bundle exec rubocop
npm run lint
npm run format:check
# Skip pre-commit hooks
git commit --no-verify
# Skip specific hooks
LEFTHOOK_EXCLUDE=rubocop,eslint git commit
import { waitForReactOnRails, getReactProps } from '@shakacode/react-on-rails-demo-common/playwright/helpers';
await waitForReactOnRails(page);
const props = await getReactProps(page, 'HelloWorld');
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
MIT