webpack-rails 0.9.9 → 0.9.10

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: 1eda41f8a2de63c4b9dd46b6d6cd17d68d448d51
4
- data.tar.gz: 647d5fa7649c014b59f83f83f6bc215c650b4e6c
3
+ metadata.gz: d76732ad3ef23985457b10deac1256897b760c1c
4
+ data.tar.gz: 210e16a7fbac05a2ae55d1b65429d6b815d8d469
5
5
  SHA512:
6
- metadata.gz: cf133061ab304c49203928d81ffec20ebe5fe7a466c98d97dbdc895a2cbc8927fb9a16faf5f8d3abc96521d0a8ac361229dbf2043a4ae4792b584add121882e0
7
- data.tar.gz: 54f64553a2e5e18e819e384e0751aa6084e6fb869e430db2bf97174b120321a3d9d6c1a11ab655ea15d391b4661012a8ff83168cf1c89f76cdb062b1c59ab4f1
6
+ metadata.gz: 6699ca844fd6634ba50bfef7503e7356133f4bd43b8ea9e1b5e938eb6c8ef7a25f5a53ed0ed44d019192ba9bffa3033e3596e190728201550b5cfe876da68a0e
7
+ data.tar.gz: baa696f3ad7da465eae27ae318c8ef5a08f9bf463c0af5c11ec1c501fc3013de0f69566df92f2b7c5f61513f909cf0599d920b4ad496d13b889f7dc43091c442
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **webpack-rails** gives you tools to integrate Webpack in to an existing Ruby on Rails application.
6
6
 
7
- It will happily co-exist with sprockets but does not use it for production fingerprinting or asset serving. **webpack-rails** is designed with the assumption that if you're using Webpack you treat Javascript as a first-class citizen. This means that you control the webpack config, package.json, and use npm to install Webpack & its plugins.
7
+ It will happily co-exist with sprockets but does not use it for production fingerprinting or asset serving. **webpack-rails** is designed with the assumption that if you're using Webpack you treat Javascript as a first-class citizen. This means that you control the webpack config, package.json, and use yarn to install Webpack & its plugins.
8
8
 
9
9
  In development mode [webpack-dev-server](http://webpack.github.io/docs/webpack-dev-server.html) is used to serve webpacked entry points and offer hot module reloading. In production entry points are built in to `public/webpack`. **webpack-rails** uses [stats-webpack-plugin](https://www.npmjs.com/package/stats-webpack-plugin) to translate entry points in to asset paths.
10
10
 
@@ -20,6 +20,7 @@ This gem has been tested against Rails 4.2 and Ruby 2.2. Earlier versions of Rai
20
20
 
21
21
  ### Installation
22
22
 
23
+ 1. Install [yarn](https://yarnpkg.com/en/docs/install) if you haven't already
23
24
  1. Add `webpack-rails` to your gemfile
24
25
  1. Run `bundle install` to install the gem
25
26
  1. Run `bundle exec rails generate webpack_rails:install` to copy across example files
@@ -3,8 +3,8 @@
3
3
  "version": "0.0.1",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
- "stats-webpack-plugin": "^0.2.1",
7
- "webpack": "^1.9.11",
8
- "webpack-dev-server": "^1.9.0"
6
+ "stats-webpack-plugin": "^0.4.3",
7
+ "webpack": "^1.14.0",
8
+ "webpack-dev-server": "^1.16.2"
9
9
  }
10
10
  }
@@ -40,8 +40,8 @@ module WebpackRails
40
40
  end
41
41
  end
42
42
 
43
- def run_npm_install
44
- run "npm install" if yes?("Would you like us to run 'npm install' for you?")
43
+ def run_yarn_install
44
+ run "yarn install" if yes?("Would you like us to run 'yarn install' for you?")
45
45
  end
46
46
 
47
47
  def run_bundle_install
@@ -2,7 +2,7 @@ namespace :webpack do
2
2
  desc "Compile webpack bundles"
3
3
  task compile: :environment do
4
4
  ENV["TARGET"] = 'production' # TODO: Deprecated, use NODE_ENV instead
5
- ENV["NODE_ENV"] = 'production'
5
+ ENV["NODE_ENV"] ||= 'production'
6
6
  webpack_bin = ::Rails.root.join(::Rails.configuration.webpack.binary)
7
7
  config_file = ::Rails.root.join(::Rails.configuration.webpack.config_file)
8
8
 
@@ -26,7 +26,7 @@ module Webpack
26
26
  class << self
27
27
  # :nodoc:
28
28
  def asset_paths(source)
29
- raise WebpackError, manifest["errors"] if manifest["errors"].present?
29
+ raise WebpackError, manifest["errors"] unless manifest_bundled?
30
30
 
31
31
  paths = manifest["assetsByChunkName"][source]
32
32
  if paths
@@ -42,6 +42,10 @@ module Webpack
42
42
 
43
43
  private
44
44
 
45
+ def manifest_bundled?
46
+ !manifest["errors"].any? { |error| error.include? "Module build failed" }
47
+ end
48
+
45
49
  def manifest
46
50
  if ::Rails.configuration.webpack.dev_server.enabled
47
51
  # Don't cache if we're in dev server mode, manifest may change ...
@@ -66,7 +70,7 @@ module Webpack
66
70
  port = ::Rails.configuration.webpack.dev_server.manifest_port
67
71
  http = Net::HTTP.new(host, port)
68
72
  http.use_ssl = ::Rails.configuration.webpack.dev_server.https
69
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
73
+ http.verify_mode = ::Rails.configuration.webpack.dev_server.https_verify_peer ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
70
74
  http.get(dev_server_path).body
71
75
  rescue => e
72
76
  raise ManifestLoadError.new("Could not load manifest from webpack-dev-server at http://#{host}:#{port}#{dev_server_path} - is it running, and is stats-webpack-plugin loaded?", e)
@@ -1,6 +1,6 @@
1
1
  module Webpack
2
2
  # :nodoc:
3
3
  module Rails
4
- VERSION = "0.9.9"
4
+ VERSION = "0.9.10"
5
5
  end
6
6
  end
@@ -30,9 +30,11 @@ module Webpack
30
30
  config.webpack.dev_server.manifest_host = 'localhost'
31
31
  config.webpack.dev_server.manifest_port = 3808
32
32
 
33
- config.webpack.dev_server.https = false # note - this will use OpenSSL::SSL::VERIFY_NONE
33
+ config.webpack.dev_server.https = false
34
+ # Below will default to 'true' in 1.0 release
35
+ config.webpack.dev_server.https_verify_peer = false
34
36
  config.webpack.dev_server.binary = 'node_modules/.bin/webpack-dev-server'
35
- config.webpack.dev_server.enabled = !::Rails.env.production?
37
+ config.webpack.dev_server.enabled = ::Rails.env.development? || ::Rails.env.test?
36
38
 
37
39
  config.webpack.output_dir = "public/webpack"
38
40
  config.webpack.public_path = "webpack"
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpack-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9
4
+ version: 0.9.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Pearson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-02 00:00:00.000000000 Z
11
+ date: 2017-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: railties
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 3.2.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 3.2.0
27
41
  description: Production-tested, JavaScript-first tooling to use webpack within your
28
42
  Rails application
29
43
  email: