Skip to content

Commit 650f40a

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 cf355d0 commit 650f40a

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]
@@ -49,12 +42,12 @@ namespace :ujs do
4942

5043
desc 'Install the JavaScript dependencies'
5144
task :install do
52-
yarn_run_in('react_ujs', 'upgrade')
45+
`yarn upgrade`
5346
end
5447

5548
desc 'Build the JS bundles with Webpack'
5649
task :build do
57-
yarn_run_in('react_ujs', 'build')
50+
`yarn build`
5851
end
5952

6053
desc "Copy browser-ready JS files to the gem's asset paths"
@@ -66,9 +59,7 @@ namespace :ujs do
6659

6760
desc 'Publish the package in ./react_ujs/ to npm as `react_ujs`'
6861
task publish: :update do
69-
Dir.chdir('react_ujs') do
70-
`npm publish`
71-
end
62+
`npm publish`
7263
end
7364
end
7465

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)