react_on_rails 9.0.0.beta.10 → 9.0.0.beta.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b78d18af7d1cec47bbcbd58c3656487cbb800c0
4
- data.tar.gz: d93af368b0c21769e0040f0665b09b6fbdc05eb6
3
+ metadata.gz: 152c5b1177a2a18b4f42911852dc05e8d317ca1d
4
+ data.tar.gz: d4d456575c0bc79630f9f2ae6df6b38e241437e1
5
5
  SHA512:
6
- metadata.gz: 262fb81eea87383f5bc2acd2a756eb5f73b1ac4835fd33b512bc3c202f1bffc1543ce7b11c9d4838fb1595dca6d8c8dafdbd5884f024001fa6e83db97752d65b
7
- data.tar.gz: 3d630cbc5e0bdf911b79a1ee48f225357b64ec80b2f1017da76d18a9c4d30af9fc987daa518dc25db2d927036195a2be743a8a45fbe6591f914cc8712760b01f
6
+ metadata.gz: e8e80dc096f8aac19a20abcc62e7b8a2b249a036fdf933a59cff68e2b3dc6e2521c411e37ce6774b65a5ba2d37bc3fb63e11e1b651eb1c1be53c78b7ca8be7b6
7
+ data.tar.gz: ece4de2349632633fce5f2a070713a39e686dac7fe34150112455085ee7d91cc6c303608358c8bbed07840f82dd82809e8e39b3628dca49fad9955cec40da50e
@@ -18,7 +18,7 @@ All 9.0.0 beta versions can be viewed in [PR 908](https://github.com/shakacode/r
18
18
 
19
19
  ```rb
20
20
  gem "webpacker", git: "https://github.com/shakacode/webpacker.git",
21
- branch: "issue-464-merge-webpacker-lite-into-webpacker-v3"
21
+ branch: "issue-464-merge-webpacker-lite-into-webpacker-v5"
22
22
  ```
23
23
 
24
24
  - Update for the renaming in the `WebpackConfigLoader` in your webpack configuration.
@@ -36,27 +36,31 @@ gem "webpacker", git: "https://github.com/shakacode/webpacker.git",
36
36
  - Edit your Webpack.config files:
37
37
  - Change your Webpack output to be like:
38
38
  ```
39
- // Leading slash is necessary
40
- publicPath: `/${output.publicPath}`,
41
- path: output.path,
42
- ```
43
- - Change your ManifestPlugin definition to include publicPath
44
- ```
39
+ const webpackConfigLoader = require('react-on-rails/webpackConfigLoader');
40
+ const configPath = resolve('..', 'config');
41
+ const { output, settings } = webpackConfigLoader(configPath);
42
+ const devBuild = process.env.NODE_ENV !== 'production';
43
+
45
44
  output: {
46
- // Name comes from the entry section.
47
- filename: '[name]-[chunkhash].js',
45
+ filename: isHMR ? '[name]-[hash].js' : '[name]-[chunkhash].js',
46
+ chunkFilename: '[name]-[chunkhash].chunk.js',
48
47
 
49
48
  publicPath: output.publicPath,
50
49
  path: output.path,
51
50
  },
51
+ ```
52
+ - Change your ManifestPlugin definition to something like the following
53
+ ```
54
+ new ManifestPlugin({
55
+ publicPath: output.publicPath,
56
+ writeToFileEmit: true
57
+ }),
52
58
 
53
59
  ```
54
-
55
60
 
56
61
  - Find your `webpacker_lite.yml` and rename it to `webpacker.yml`
57
62
  - Add a default setting
58
63
  ```
59
- custom_compile: true
60
64
  cache_manifest: false
61
65
  ```
62
66
  - For production, set:
@@ -70,6 +74,7 @@ gem "webpacker", git: "https://github.com/shakacode/webpacker.git",
70
74
  port: 3035
71
75
  hmr: false
72
76
  ```
77
+ Set hmr to your preference.
73
78
  - See the example `spec/dummy/config/webpacker.yml`.
74
79
  - Remove keys `hot_reloading_host` and `hot_reloading_enabled_by_default`. These are replaced by the `dev_server` key.
75
80
  - Rename `webpack_public_output_dir` to `public_output_path`.
@@ -744,17 +749,19 @@ Best done with Object destructing:
744
749
  ##### Fixed
745
750
  - Fix several generator related issues.
746
751
 
747
- [Unreleased]: https://github.com/shakacode/react_on_rails/compare/rails-webpacker...9.0.0-beta.8
748
- [9.0.0]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.9...master
749
- [9.0.0-beta.9]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.9...9.0.0-beta.8
750
- [9.0.0-beta.8]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.8...9.0.0-beta.7
751
- [9.0.0-beta.7]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.7...9.0.0-beta.6
752
- [9.0.0-beta.6]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.6...9.0.0-beta.5
753
- [9.0.0-beta.5]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.5...9.0.0-beta.4
754
- [9.0.0-beta.4]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.4...9.0.0-beta.3
755
- [9.0.0-beta.3]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.3...9.0.0-beta.2
756
- [9.0.0-beta.2]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.2...9.0.0-beta.1
757
- [9.0.0-beta.1]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.1...master
752
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/rails-webpacker...9.0.0-beta.11
753
+ [9.0.0]: https://github.com/shakacode/react_on_rails/compare/master...9.0.0-beta.11
754
+ [9.0.0-beta.11]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.10...9.0.0-beta.11
755
+ [9.0.0-beta.10]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.9...9.0.0-beta.10
756
+ [9.0.0-beta.9]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.8...9.0.0-beta.9
757
+ [9.0.0-beta.8]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.7...9.0.0-beta.8
758
+ [9.0.0-beta.7]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.6...9.0.0-beta.7
759
+ [9.0.0-beta.6]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.5...9.0.0-beta.6
760
+ [9.0.0-beta.5]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.4...9.0.0-beta.5
761
+ [9.0.0-beta.4]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.3...9.0.0-beta.4
762
+ [9.0.0-beta.3]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.2...9.0.0-beta.3
763
+ [9.0.0-beta.2]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.1...9.0.0-beta.2
764
+ [9.0.0-beta.1]: https://github.com/shakacode/react_on_rails/compare/master...9.0.0-beta.1
758
765
  [8.0.6]: https://github.com/shakacode/react_on_rails/compare/8.0.5...8.0.6
759
766
  [8.0.5]: https://github.com/shakacode/react_on_rails/compare/8.0.3...8.0.5
760
767
  [8.0.3]: https://github.com/shakacode/react_on_rails/compare/8.0.2...8.0.3
data/Gemfile CHANGED
@@ -39,7 +39,7 @@ gem "launchy"
39
39
  gem "poltergeist"
40
40
  gem "selenium-webdriver"
41
41
  gem "webpacker", git: "https://github.com/shakacode/webpacker.git",
42
- branch: "issue-464-merge-webpacker-lite-into-webpacker-v3"
42
+ branch: "issue-464-merge-webpacker-lite-into-webpacker-v5"
43
43
 
44
44
  # TODO: remove once we get out of beta.
45
45
  # gem 'webpacker', path: "../../forks/webpacker"
@@ -75,7 +75,7 @@ module ReactOnRails
75
75
 
76
76
  gem 'mini_racer', platforms: :ruby
77
77
  gem 'webpacker', git: "https://github.com/shakacode/webpacker.git",
78
- branch: "issue-464-merge-webpacker-lite-into-webpacker-v3"
78
+ branch: "issue-464-merge-webpacker-lite-into-webpacker-v5"
79
79
  GEMS
80
80
  append_to_file("Gemfile",
81
81
  gems)
@@ -11,15 +11,14 @@ development:
11
11
  # generated files for development, in /public/webpack/development
12
12
  public_output_path: webpack/development
13
13
 
14
- # Temporarily disabling live-reloading until the server script is added.
15
- # dev_server:
16
- # host: localhost
17
- # port: 3035
18
- # hmr: false
14
+ dev_server:
15
+ host: localhost
16
+ port: 3035
17
+ hmr: true
19
18
 
20
19
  test:
21
20
  <<: *default
22
- # generated files for tests, in /public/webpack/test
21
+ # generated files for test, in /public/webpack/test
23
22
  public_output_path: webpack/test
24
23
 
25
24
  production:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReactOnRails
4
- VERSION = "9.0.0.beta.10"
4
+ VERSION = "9.0.0.beta.11"
5
5
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-on-rails",
3
- "version": "9.0.0-beta.10",
3
+ "version": "9.0.0-beta.11",
4
4
  "description": "react-on-rails JavaScript for react_on_rails Ruby gem",
5
5
  "main": "node_package/lib/ReactOnRails.js",
6
6
  "directories": {
@@ -16,13 +16,23 @@ function removeOuterSlashes(string) {
16
16
  return string.replace(/^\/*/, '').replace(/\/*$/, '');
17
17
  }
18
18
 
19
- function formatPublicPath(host = '', path = '') {
20
- let formattedHost = removeOuterSlashes(host);
21
- if (formattedHost && !/^http/i.test(formattedHost)) {
22
- formattedHost = `//${formattedHost}`;
19
+ function formatPublicPath(settings) {
20
+ if (settings.dev_server) {
21
+ const host = settings.dev_server.host;
22
+ const port = settings.dev_server.port;
23
+ const path = settings.public_output_path;
24
+ const hostWithHttp = `http://${host}:${port}`;
25
+
26
+ let formattedHost = removeOuterSlashes(hostWithHttp);
27
+ if (formattedHost && !/^http/i.test(formattedHost)) {
28
+ formattedHost = `//${formattedHost}`;
29
+ }
30
+ const formattedPath = removeOuterSlashes(path);
31
+ return `${formattedHost}/${formattedPath}/`;
23
32
  }
24
- const formattedPath = removeOuterSlashes(path);
25
- return `${formattedHost}/${formattedPath}/`;
33
+
34
+ const publicOuterPathWithoutOutsideSlashes = removeOuterSlashes(settings.public_output_path);
35
+ return `//${publicOuterPathWithoutOutsideSlashes}/`;
26
36
  }
27
37
 
28
38
  /**
@@ -33,12 +43,12 @@ function formatPublicPath(host = '', path = '') {
33
43
  * @returns {{
34
44
  settings,
35
45
  resolvedModules,
36
- output: { path, publicPath, publicPathWithHosts }
46
+ output: { path, publicPath, publicPathWithHost }
37
47
  }}
38
48
  */
39
49
  const configLoader = (configPath) => {
40
50
  // Some test environments might not have the NODE_ENV set, so we'll have fallbacks.
41
- const configEnv = (process.env.NODE_ENV || process.env.RAILS_ENV || 'development');
51
+ const configEnv = (env.NODE_ENV || env.RAILS_ENV || 'development');
42
52
  const ymlConfigPath = join(configPath, 'webpacker.yml');
43
53
  const settings = safeLoad(readFileSync(ymlConfigPath, 'utf8'))[configEnv];
44
54
 
@@ -48,7 +58,7 @@ const configLoader = (configPath) => {
48
58
  // the relative path.
49
59
  path: resolve(configPath, '..', 'public', settings.public_output_path),
50
60
  publicPath: `/${settings.public_output_path}/`.replace(/([^:]\/)\/+/g, '$1'),
51
- publicPathWithHost: formatPublicPath(env.ASSET_HOST, settings.public_output_path),
61
+ publicPathWithHost: formatPublicPath(settings),
52
62
  };
53
63
 
54
64
  return {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.0.0.beta.10
4
+ version: 9.0.0.beta.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Gordon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-18 00:00:00.000000000 Z
11
+ date: 2017-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow