Skip to content

Commit 6de549b

Browse files
committed
use rake react_on_rails:locale to generate js locale files
1 parent bf6721d commit 6de549b

File tree

9 files changed

+9
-13
lines changed

9 files changed

+9
-13
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ install:
2929
- npm install npm@latest -g
3030
- npm --version
3131
- npm install
32+
- rake react_on_rails:locale
33+
- npm run build:test
3234
- rake db:setup
33-
- npm run build:client && npm run build:server
3435

3536
# Tip: No need to run xvfb if running headless testing. However, we're going to start with
3637
# Poltergeist and switch to selenium if a test fails.

Procfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
rails: REACT_ON_RAILS_ENV=HOT rails s -b 0.0.0.0
88

99
# Run the hot reload server for client development
10-
hot-assets: sh -c 'rm app/assets/webpack/* || true && HOT_RAILS_PORT=3500 npm run hot-assets'
10+
hot-assets: sh -c 'rm app/assets/webpack/* || true && bundle exec rake react_on_rails:locale && HOT_RAILS_PORT=3500 npm run hot-assets'
1111

1212
# Render static client assets
1313
rails-static-client-assets: sh -c 'npm run build:dev:client'

Procfile.hot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
rails: REACT_ON_RAILS_ENV=HOT rails s -b 0.0.0.0
77

88
# Run the hot reload server for client development
9-
hot-assets: sh -c 'rm app/assets/webpack/* || true && HOT_RAILS_PORT=3500 npm run hot-assets'
9+
hot-assets: sh -c 'rm app/assets/webpack/* || true && bundle exec rake react_on_rails:locale && HOT_RAILS_PORT=3500 npm run hot-assets'
1010

1111
# Keep the JS fresh for server rendering. Remove if not server rendering
1212
rails-server-assets: sh -c 'npm run build:dev:server'

Procfile.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# in rails_helper.rb.
44

55
# Build client assets, watching for changes.
6-
rails-client-assets: sh -c 'npm run build:dev:client'
6+
rails-client-assets: sh -c 'bundle exec rake react_on_rails:locale && npm run build:dev:client'
77

88
# Build server assets, watching for changes. Remove if not server rendering.
99
rails-server-assets: sh -c 'npm run build:dev:server'

Procfile.static

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
rails: REACT_ON_RAILS_ENV= rails s -b 0.0.0.0
33

44
# Build client assets, watching for changes.
5-
rails-client-assets: rm app/assets/webpack/* || true && npm run build:dev:client
5+
rails-client-assets: rm app/assets/webpack/* || true && bundle exec rake react_on_rails:locale && npm run build:dev:client
66

77
# Build server assets, watching for changes. Remove if not server rendering.
88
rails-server-assets: npm run build:dev:server

Procfile.static.trace

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
rails: TRACE_REACT_ON_RAILS=TRUE rails s -b 0.0.0.0
33

44
# Build client assets, watching for changes.
5-
rails-client-assets: npm run build:dev:client
5+
rails-client-assets: bundle exec rake react_on_rails:locale && npm run build:dev:client
66

77
# Build server assets, watching for changes. Remove if not server rendering.
88
rails-server-assets: npm run build:dev:server

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"build:server": "webpack --config webpack.server.rails.build.config.js",
3636
"build:test": "npm run build:client && npm run build:server",
3737
"build:production": "npm run build:production:client && npm run build:production:server",
38+
"prebuild:client": "bundle exec rake react_on_rails:locale",
3839
"hot-assets": "babel-node server-rails-hot.js",
3940
"lint": "eslint --ext .js,.jsx ."
4041
},

config/application.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,5 @@ class Application < Rails::Application
1212
# Application configuration should go into files in config/initializers
1313
# -- all .rb files in that directory are automatically loaded.
1414
config.action_cable.allowed_request_origins = [Rails.application.secrets.action_cable_url]
15-
16-
################################################################################
17-
# ReactOnRails will convert rails locales to javascript files for react-intl.
18-
################################################################################
19-
config.after_initialize do
20-
ReactOnRails::LocalesToJs.new
21-
end
2215
end
2316
end

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"build:production:server": "(cd client && npm run build:production:server --silent)",
1919
"build:client": "(cd client && npm run build:client --silent)",
2020
"build:server": "(cd client && npm run build:server --silent)",
21+
"build:test": "npm run build:client && npm run build:server",
2122
"build:dev:client": "(cd client && npm run build:dev:client --silent)",
2223
"build:dev:server": "(cd client && npm run build:dev:server --silent)",
2324
"hot-assets": "(cd client && npm run hot-assets)",

0 commit comments

Comments
 (0)