Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generator specs (non-breaking, no changes to production code) #536

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dummy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
node-version: '16'
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1.2'
ruby-version: '3.1.6'
- name: Install dependencies
run: |
bundle install
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,23 @@ jobs:
- gemfiles/Gemfile-rails.7.0.x
- gemfiles/Gemfile-rails.7.1.x
- gemfiles/Gemfile-rails.7.2.x
- gemfiles/Gemfile-rails.8.0.x
# Uncomment the following line only to ensure compatibility with the
# upcomming Rails versions, maybe before a release.
#- gemfiles/Gemfile-rails-edge
exclude:
- ruby: '2.7'
gemfile: gemfiles/Gemfile-rails.7.2.x
- ruby: '2.7'
gemfile: gemfiles/Gemfile-rails.8.0.x
- ruby: '3.0'
gemfile: gemfiles/Gemfile-rails.7.2.x
- ruby: '3.0'
gemfile: gemfiles/Gemfile-rails.8.0.x
- ruby: '3.1'
gemfile: gemfiles/Gemfile-rails.6.0.x
- ruby: '3.1'
gemfile: gemfiles/Gemfile-rails.8.0.x
- ruby: '3.2'
gemfile: gemfiles/Gemfile-rails.6.0.x
- ruby: '3.3'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 22.x
Copy link

@coderabbitai coderabbitai bot Dec 27, 2024

Choose a reason for hiding this comment

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

💡 Codebase verification

Node.js 22.x is not recommended for this project

The project's package.json explicitly specifies Node.js engine requirements as ">= 14", and the codebase shows minimal TypeScript usage with conservative settings (target: es5). Using Node.js 22.x (which is currently in development) for linting could introduce unnecessary risks without providing any benefits.

  • .github/workflows/node.yml: Line 25 - Change node-version: 22.x to node-version: 20.x (latest LTS)
  • .github/workflows/node.yml: Line 38 - Remove Node.js 22.x from the test matrix

The project's dependencies and configuration suggest it's designed to work with a broad range of Node.js versions, and there's no technical requirement for Node.js 22.x features.

🔗 Analysis chain

Consider using stable Node.js version for linting

Node.js 22.x is currently in development and not yet released for production use. Consider using the latest LTS version (20.x) for the lint job to ensure stability.

Let's verify the Node.js version compatibility:

Also applies to: 38-38


Let me gather more information to verify the Node.js version requirements.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if any package.json files specify Node.js engine requirements
rg -l "engines" | xargs cat | jq '.engines.node'

# Check for any Node.js version-specific syntax or features in the codebase
rg --type js --type ts "(?:import|export)\s+type|^\s*#!" 

Length of output: 326


Script:

#!/bin/bash
# Check package.json content directly to see all engine requirements and dependencies
fd package.json --exec cat {} \;

# Check for any build or test scripts that might require specific Node.js features
fd package.json --exec jq '.scripts' {} \;

# Look for any TypeScript configuration that might need newer Node.js features
fd tsconfig.json --exec cat {} \;

Length of output: 7199

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@coderabbitai at the moment I'm writing, in late December 2024, Node 22 is LTS. Please double check

Copy link

Choose a reason for hiding this comment

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

@tagliala, thanks for pointing that out. Indeed, given it’s now December 2024, Node.js 22.x is considered LTS. There’s no issue keeping Node 22.x in this workflow, as you’re already targeting the proper LTS release. Let me know if you have further questions or if anything else needs to be changed!

cache: yarn

- name: Install dependencies
Expand All @@ -35,7 +35,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [14.x, 16.x, 18.x, 20.x]
node: [14.x, 16.x, 18.x, 20.x, 22.x]

runs-on: ${{ matrix.os }}

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,23 @@ jobs:
- gemfiles/Gemfile-rails.7.0.x
- gemfiles/Gemfile-rails.7.1.x
- gemfiles/Gemfile-rails.7.2.x
- gemfiles/Gemfile-rails.8.0.x
# Uncomment the following line only to ensure compatibility with the
# upcomming Rails versions, maybe before a release.
#- gemfiles/Gemfile-rails-edge
exclude:
- ruby: '2.7'
gemfile: gemfiles/Gemfile-rails.7.2.x
- ruby: '2.7'
gemfile: gemfiles/Gemfile-rails.8.0.x
- ruby: '3.0'
gemfile: gemfiles/Gemfile-rails.7.2.x
- ruby: '3.0'
gemfile: gemfiles/Gemfile-rails.8.0.x
- ruby: '3.1'
gemfile: gemfiles/Gemfile-rails.6.0.x
- ruby: '3.1'
gemfile: gemfiles/Gemfile-rails.8.0.x
- ruby: '3.2'
gemfile: gemfiles/Gemfile-rails.6.0.x
- ruby: '3.3'
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/Gemfile-rails.6.0.x
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ gemspec path: "../"
gem "rails", "~> 6.0.0"
gem "rake", ">= 11.1"
gem "rack-proxy", require: false
gem "rspec-rails", "~> 5.0.0"
gem "rspec-rails", "~> 5.0"
gem "byebug"
2 changes: 1 addition & 1 deletion gemfiles/Gemfile-rails.6.1.x
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ gemspec path: "../"
gem "rails", '~>6.1.0'
gem "rake", ">= 11.1"
gem "rack-proxy", require: false
gem "rspec-rails", "~> 6.0.0"
gem "rspec-rails", "~> 6.1"
gem "byebug"
2 changes: 1 addition & 1 deletion gemfiles/Gemfile-rails.7.0.x
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ gemspec path: "../"
gem "rails", '~>7.0.0'
gem "rake", ">= 11.1"
gem "rack-proxy", require: false
gem "rspec-rails", "~> 6.0.0"
gem "rspec-rails", "~> 7.0"
gem "byebug"
2 changes: 1 addition & 1 deletion gemfiles/Gemfile-rails.7.1.x
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ gemspec path: "../"
gem "rails", '~>7.1.0'
gem "rake", ">= 11.1"
gem "rack-proxy", require: false
gem "rspec-rails", "~> 6.0.0"
gem "rspec-rails", "~> 7.0"
gem "byebug"
2 changes: 1 addition & 1 deletion gemfiles/Gemfile-rails.7.2.x
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ gemspec path: "../"
gem "rails", '~>7.2.0'
gem "rake", ">= 11.1"
gem "rack-proxy", require: false
gem "rspec-rails", "~> 6.0.0"
gem "rspec-rails", "~> 7.0"
gem "byebug"
11 changes: 11 additions & 0 deletions gemfiles/Gemfile-rails.8.0.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
source "https://rubygems.org"

git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gemspec path: "../"

gem "rails", '~>8.0.0'
gem "rake", ">= 11.1"
gem "rack-proxy", require: false
gem "rspec-rails", "~> 7.0"
gem "byebug"
11 changes: 10 additions & 1 deletion spec/generator_specs/generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,17 @@
bundle install
))
else
# TODO: remove when Ruby < 3.1 support will be dropped
# Ref: https://github.com/shakacode/shakapacker/issues/534
bundler_update_command =
if RUBY_VERSION.start_with?("3.1")
"gem update bundler"
else
"gem install bundler --version '< 2.6'"
end

sh_in_dir({}, BASE_RAILS_APP_PATH, %(
gem update bundler
#{bundler_update_command}
bundle add shakapacker --path "#{GEM_ROOT}"
))
end
Expand Down
Loading