Skip to content

Commit ac63d8f

Browse files
committed
Move package.json to top level
Putting package.json at the top level follows convention of Webpacker and other gems that bundle JS. It allows sharing of the licence and readme when looking at the package on NPM
1 parent 4ef22da commit ac63d8f

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

Rakefile

+3-12
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ def copy_react_asset(webpack_file, destination_file)
1212
FileUtils.cp(full_webpack_path, full_destination_path)
1313
end
1414

15-
# Move to `dirname` and execute `yarn {cmd}`
16-
def yarn_run_in(dirname, cmd)
17-
Dir.chdir(dirname) do
18-
`yarn #{cmd}`
19-
end
20-
end
21-
2215
namespace :react do
2316
desc 'Run the JS build process to put files in the gem source'
2417
task update: [:install, :build, :copy]
@@ -54,12 +47,12 @@ namespace :ujs do
5447

5548
desc 'Install the JavaScript dependencies'
5649
task :install do
57-
yarn_run_in('react_ujs', 'upgrade')
50+
`yarn upgrade`
5851
end
5952

6053
desc 'Build the JS bundles with Webpack'
6154
task :build do
62-
yarn_run_in('react_ujs', 'build')
55+
`yarn build`
6356
end
6457

6558
desc "Copy browser-ready JS files to the gem's asset paths"
@@ -71,9 +64,7 @@ namespace :ujs do
7164

7265
desc 'Publish the package in ./react_ujs/ to npm as `react_ujs`'
7366
task publish: :update do
74-
Dir.chdir('react_ujs') do
75-
`npm publish`
76-
end
67+
`npm publish`
7768
end
7869
end
7970

react_ujs/package.json renamed to package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
"name": "react_ujs",
33
"version": "2.3.1",
44
"description": "Rails UJS for the react-rails gem",
5-
"main": "index.js",
5+
"main": "react_ujs/index.js",
6+
"files": [
7+
"react_ujs"
8+
],
69
"repository": "reactjs/react-rails",
710
"scripts": {
8-
"build": "webpack"
11+
"build": "cd react_ujs && webpack"
912
},
1013
"devDependencies": {
1114
"webpack": "^2.3.3"
File renamed without changes.

0 commit comments

Comments
 (0)