Skip to content

Commit 35c23bb

Browse files
committed
feat: use package_json from RubyGems
1 parent 8c4e9c9 commit 35c23bb

13 files changed

+8
-67
lines changed

Diff for: Gemfile

-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,4 @@
33
source "http://rubygems.org"
44

55
gemspec
6-
7-
gem "package_json", github: "G-Rath/package_json", branch: "add-bun-support"
8-
96
# This is an optional dev-dependency, required whenever sprockets is required

Diff for: Gemfile.lock

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
GIT
2-
remote: https://github.com/G-Rath/package_json.git
3-
revision: 72e742afb7ea8c19369fa9a4ce0d74ce098e2678
4-
branch: add-bun-support
5-
specs:
6-
package_json (0.1.0)
7-
81
PATH
92
remote: .
103
specs:
@@ -118,6 +111,7 @@ GEM
118111
notiffany (0.1.3)
119112
nenv (~> 0.1)
120113
shellany (~> 0.0)
114+
package_json (0.1.0)
121115
pry (0.14.2)
122116
coderay (~> 1.1)
123117
method_source (~> 1.0)
@@ -184,7 +178,7 @@ DEPENDENCIES
184178
guard-minitest
185179
jbuilder
186180
listen (~> 3.0.0)
187-
package_json!
181+
package_json
188182
pry-byebug
189183
react-rails!
190184
selenium-webdriver

Diff for: Rakefile

+1-17
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@ end
88

99
Bundler::GemHelper.install_tasks
1010

11-
def require_package_json_gem
12-
require "bundler/inline"
13-
14-
gemfile { gem "package_json", github: "G-Rath/package_json", branch: "add-bun-support" }
15-
16-
puts "using package_json v#{PackageJson::VERSION}"
17-
end
11+
require "package_json"
1812

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

2923
desc "Install the JavaScript dependencies"
3024
task :install do
31-
require_package_json_gem
32-
3325
PackageJson.read("react-builds").manager.install
3426
end
3527

3628
desc "Build the JS bundles with Webpack"
3729
task :build do
38-
require_package_json_gem
39-
4030
PackageJson.read("react-builds").manager.run("build")
4131
end
4232

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

5747
desc "Install the JavaScript dependencies"
5848
task :install do
59-
require_package_json_gem
60-
6149
PackageJson.read.manager.install
6250
end
6351

6452
desc "Build the JS bundles with Webpack"
6553
task :build do
66-
require_package_json_gem
67-
6854
PackageJson.read.manager.run("build")
6955
end
7056

@@ -96,8 +82,6 @@ task default: :test
9682

9783
task :test_setup do
9884
Dir.chdir("./test/dummy") do
99-
require_package_json_gem
100-
10185
PackageJson.read.manager.install
10286
end
10387
end

Diff for: gemfiles/base.gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
source "http://rubygems.org"
44

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

87
gemspec path: "../"

Diff for: gemfiles/base.gemfile.lock

-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
GIT
2-
remote: https://github.com/G-Rath/package_json.git
3-
revision: 72e742afb7ea8c19369fa9a4ce0d74ce098e2678
4-
branch: add-bun-support
5-
specs:
6-
package_json (0.1.0)
7-
81
PATH
92
remote: ..
103
specs:
@@ -265,7 +258,6 @@ DEPENDENCIES
265258
guard-minitest
266259
jbuilder
267260
listen (~> 3.0.0)
268-
package_json!
269261
pry-byebug
270262
rails (~> 7.0.x)
271263
react-rails!

Diff for: gemfiles/shakapacker.gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
source "http://rubygems.org"
44

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

Diff for: gemfiles/shakapacker.gemfile.lock

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
GIT
2-
remote: https://github.com/G-Rath/package_json.git
3-
revision: 72e742afb7ea8c19369fa9a4ce0d74ce098e2678
4-
branch: add-bun-support
5-
specs:
6-
package_json (0.1.0)
7-
81
GIT
92
remote: https://github.com/G-Rath/shakapacker.git
10-
revision: 8e9db60edd13429bdae9783d7f37bac70470870c
3+
revision: 992f156694499f62f35ddd32bb6d53597a78c453
114
branch: use-package_json
125
specs:
136
shakapacker (7.0.3)
147
activesupport (>= 5.2)
8+
package_json
159
rack-proxy (>= 0.6.1)
1610
railties (>= 5.2)
1711
semantic_range (>= 2.3.0)
@@ -194,6 +188,7 @@ GEM
194188
notiffany (0.1.3)
195189
nenv (~> 0.1)
196190
shellany (~> 0.0)
191+
package_json (0.1.0)
197192
pry (0.14.2)
198193
coderay (~> 1.1)
199194
method_source (~> 1.0)
@@ -281,7 +276,6 @@ DEPENDENCIES
281276
guard-minitest
282277
jbuilder
283278
listen (~> 3.0.0)
284-
package_json!
285279
pry-byebug
286280
rails (~> 7.0.x)
287281
react-rails!

Diff for: gemfiles/sprockets_3.gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
source "http://rubygems.org"
44

5-
gem "package_json", github: "G-Rath/package_json", branch: "add-bun-support"
65
gem "rails", "~> 7.0.x"
76
gem "sprockets", "~> 3.5"
87
gem "sprockets-rails"

Diff for: gemfiles/sprockets_3.gemfile.lock

-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
GIT
2-
remote: https://github.com/G-Rath/package_json.git
3-
revision: 72e742afb7ea8c19369fa9a4ce0d74ce098e2678
4-
branch: add-bun-support
5-
specs:
6-
package_json (0.1.0)
7-
81
PATH
92
remote: ..
103
specs:
@@ -277,7 +270,6 @@ DEPENDENCIES
277270
jbuilder
278271
listen (~> 3.0.0)
279272
mini_racer
280-
package_json!
281273
pry-byebug
282274
rails (~> 7.0.x)
283275
react-rails!

Diff for: gemfiles/sprockets_4.gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
source "http://rubygems.org"
44

5-
gem "package_json", github: "G-Rath/package_json", branch: "add-bun-support"
65
gem "rails", "~> 7.0.x"
76
gem "sprockets", "~> 4.0.x"
87
gem "sprockets-rails"

Diff for: gemfiles/sprockets_4.gemfile.lock

-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
GIT
2-
remote: https://github.com/G-Rath/package_json.git
3-
revision: 72e742afb7ea8c19369fa9a4ce0d74ce098e2678
4-
branch: add-bun-support
5-
specs:
6-
package_json (0.1.0)
7-
81
PATH
92
remote: ..
103
specs:
@@ -277,7 +270,6 @@ DEPENDENCIES
277270
jbuilder
278271
listen (~> 3.0.0)
279272
mini_racer
280-
package_json!
281273
pry-byebug
282274
rails (~> 7.0.x)
283275
react-rails!

Diff for: lib/generators/react/install_generator.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,10 @@ def setup_react_sprockets
103103
ReactRailsUJS.useContext(componentRequireContext);
104104
JS
105105

106-
# TODO: replace with standard "require" call once gem is published
107106
def require_package_json_gem
108107
require "bundler/inline"
109108

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

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

Diff for: react-rails.gemspec

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
2828
s.add_development_dependency 'selenium-webdriver'
2929
s.add_development_dependency 'test-unit', '~> 2.5'
3030
s.add_development_dependency 'pry-byebug'
31+
s.add_development_dependency 'package_json'
3132

3233

3334
s.add_dependency 'connection_pool'

0 commit comments

Comments
 (0)