@@ -14,25 +14,22 @@ def copy_react_asset(webpack_file, destination_file)
1414 FileUtils . cp ( full_webpack_path , full_destination_path )
1515end
1616
17- # Move to `dirname` and execute `yarn {cmd}`
18- def yarn_run_in ( dirname , cmd )
19- Dir . chdir ( dirname ) do
20- `yarn #{ cmd } `
21- end
22- end
23-
2417namespace :react do
2518 desc "Run the JS build process to put files in the gem source"
2619 task update : %i[ install build copy ]
2720
2821 desc "Install the JavaScript dependencies"
2922 task :install do
30- yarn_run_in ( "react-builds" , "install" )
23+ require "package_json"
24+
25+ PackageJson . read ( "react-builds" ) . manager . install
3126 end
3227
3328 desc "Build the JS bundles with Webpack"
3429 task :build do
35- yarn_run_in ( "react-builds" , "build" )
30+ require "package_json"
31+
32+ PackageJson . read ( "react-builds" ) . manager . run ( "build" )
3633 end
3734
3835 desc "Copy browser-ready JS files to the gem's asset paths"
@@ -51,12 +48,16 @@ namespace :ujs do
5148
5249 desc "Install the JavaScript dependencies"
5350 task :install do
54- `yarn install`
51+ require "package_json"
52+
53+ PackageJson . read . manager . install
5554 end
5655
5756 desc "Build the JS bundles with Webpack"
5857 task :build do
59- `yarn build`
58+ require "package_json"
59+
60+ PackageJson . read . manager . run ( "build" )
6061 end
6162
6263 desc "Copy browser-ready JS files to the gem's asset paths"
@@ -87,7 +88,9 @@ task default: :test
8788
8889task :test_setup do
8990 Dir . chdir ( "./test/dummy" ) do
90- `yarn install`
91+ require "package_json"
92+
93+ PackageJson . read . manager . install
9194 end
9295end
9396
0 commit comments