Skip to content

Commit

Permalink
feat: use package_json from RubyGems
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Oct 20, 2023
1 parent 2057fd3 commit 718dc24
Show file tree
Hide file tree
Showing 13 changed files with 8 additions and 66 deletions.
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ source "http://rubygems.org"

gemspec

gem "package_json", github: "G-Rath/package_json", branch: "add-bun-support"

# This is an optional dev-dependency, required whenever sprockets is required
10 changes: 2 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
GIT
remote: https://github.com/G-Rath/package_json.git
revision: 72e742afb7ea8c19369fa9a4ce0d74ce098e2678
branch: add-bun-support
specs:
package_json (0.1.0)

PATH
remote: .
specs:
Expand Down Expand Up @@ -118,6 +111,7 @@ GEM
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
package_json (0.1.0)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
Expand Down Expand Up @@ -184,7 +178,7 @@ DEPENDENCIES
guard-minitest
jbuilder
listen (~> 3.0.0)
package_json!
package_json
pry-byebug
react-rails!
selenium-webdriver
Expand Down
18 changes: 1 addition & 17 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@ end

Bundler::GemHelper.install_tasks

def require_package_json_gem
require "bundler/inline"

gemfile { gem "package_json", github: "G-Rath/package_json", branch: "add-bun-support" }

puts "using package_json v#{PackageJson::VERSION}"
end
require "package_json"

def copy_react_asset(webpack_file, destination_file)
full_webpack_path = File.expand_path("../react-builds/build/#{webpack_file}", __FILE__)
Expand All @@ -28,15 +22,11 @@ namespace :react do

desc "Install the JavaScript dependencies"
task :install do
require_package_json_gem

PackageJson.read("react-builds").manager.install
end

desc "Build the JS bundles with Webpack"
task :build do
require_package_json_gem

PackageJson.read("react-builds").manager.run("build")
end

Expand All @@ -56,15 +46,11 @@ namespace :ujs do

desc "Install the JavaScript dependencies"
task :install do
require_package_json_gem

PackageJson.read.manager.install
end

desc "Build the JS bundles with Webpack"
task :build do
require_package_json_gem

PackageJson.read.manager.run("build")
end

Expand Down Expand Up @@ -96,8 +82,6 @@ task default: :test

task :test_setup do
Dir.chdir("./test/dummy") do
require_package_json_gem

PackageJson.read.manager.install
end
end
Expand Down
1 change: 0 additions & 1 deletion gemfiles/base.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

source "http://rubygems.org"

gem "package_json", github: "G-Rath/package_json", branch: "add-bun-support"
gem "rails", "~> 7.0.x"

gemspec path: "../"
8 changes: 0 additions & 8 deletions gemfiles/base.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
GIT
remote: https://github.com/G-Rath/package_json.git
revision: 72e742afb7ea8c19369fa9a4ce0d74ce098e2678
branch: add-bun-support
specs:
package_json (0.1.0)

PATH
remote: ..
specs:
Expand Down Expand Up @@ -269,7 +262,6 @@ DEPENDENCIES
guard-minitest
jbuilder
listen (~> 3.0.0)
package_json!
pry-byebug
rails (~> 7.0.x)
react-rails!
Expand Down
1 change: 0 additions & 1 deletion gemfiles/shakapacker.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

source "http://rubygems.org"

gem "package_json", github: "G-Rath/package_json", branch: "add-bun-support"
gem "rails", "~> 7.0.x"
gem "shakapacker", github: "G-Rath/shakapacker", branch: "use-package_json"

Expand Down
12 changes: 3 additions & 9 deletions gemfiles/shakapacker.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
GIT
remote: https://github.com/G-Rath/package_json.git
revision: 72e742afb7ea8c19369fa9a4ce0d74ce098e2678
branch: add-bun-support
specs:
package_json (0.1.0)

GIT
remote: https://github.com/G-Rath/shakapacker.git
revision: 8e9db60edd13429bdae9783d7f37bac70470870c
revision: 992f156694499f62f35ddd32bb6d53597a78c453
branch: use-package_json
specs:
shakapacker (7.0.3)
activesupport (>= 5.2)
package_json
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
Expand Down Expand Up @@ -194,6 +188,7 @@ GEM
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
package_json (0.1.0)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
Expand Down Expand Up @@ -283,7 +278,6 @@ DEPENDENCIES
guard-minitest
jbuilder
listen (~> 3.0.0)
package_json!
pry-byebug
rails (~> 7.0.x)
react-rails!
Expand Down
1 change: 0 additions & 1 deletion gemfiles/sprockets_3.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

source "http://rubygems.org"

gem "package_json", github: "G-Rath/package_json", branch: "add-bun-support"
gem "rails", "~> 7.0.x"
gem "sprockets", "~> 3.5"
gem "sprockets-rails"
Expand Down
8 changes: 0 additions & 8 deletions gemfiles/sprockets_3.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
GIT
remote: https://github.com/G-Rath/package_json.git
revision: 72e742afb7ea8c19369fa9a4ce0d74ce098e2678
branch: add-bun-support
specs:
package_json (0.1.0)

PATH
remote: ..
specs:
Expand Down Expand Up @@ -284,7 +277,6 @@ DEPENDENCIES
jbuilder
listen (~> 3.0.0)
mini_racer
package_json!
pry-byebug
rails (~> 7.0.x)
react-rails!
Expand Down
1 change: 0 additions & 1 deletion gemfiles/sprockets_4.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

source "http://rubygems.org"

gem "package_json", github: "G-Rath/package_json", branch: "add-bun-support"
gem "rails", "~> 7.0.x"
gem "sprockets", "~> 4.0.x"
gem "sprockets-rails"
Expand Down
8 changes: 0 additions & 8 deletions gemfiles/sprockets_4.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
GIT
remote: https://github.com/G-Rath/package_json.git
revision: 72e742afb7ea8c19369fa9a4ce0d74ce098e2678
branch: add-bun-support
specs:
package_json (0.1.0)

PATH
remote: ..
specs:
Expand Down Expand Up @@ -284,7 +277,6 @@ DEPENDENCIES
jbuilder
listen (~> 3.0.0)
mini_racer
package_json!
pry-byebug
rails (~> 7.0.x)
react-rails!
Expand Down
3 changes: 1 addition & 2 deletions lib/generators/react/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,10 @@ def setup_react_sprockets
ReactRailsUJS.useContext(componentRequireContext);
JS

# TODO: replace with standard "require" call once gem is published
def require_package_json_gem
require "bundler/inline"

gemfile { gem "package_json", github: "G-Rath/package_json", branch: "add-bun-support" }
gemfile(true) { gem "package_json" }

puts "using package_json v#{PackageJson::VERSION}"
end
Expand Down
1 change: 1 addition & 0 deletions react-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'selenium-webdriver'
s.add_development_dependency 'test-unit', '~> 2.5'
s.add_development_dependency 'pry-byebug'
s.add_development_dependency 'package_json'


s.add_dependency 'connection_pool'
Expand Down

0 comments on commit 718dc24

Please sign in to comment.