webpacker 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintignore +3 -0
- data/.gitignore +0 -2
- data/.travis.yml +3 -3
- data/CHANGELOG.md +45 -1
- data/Gemfile.lock +144 -0
- data/README.md +23 -7
- data/docs/deployment.md +3 -6
- data/docs/env.md +1 -1
- data/docs/misc.md +1 -1
- data/docs/props.md +119 -1
- data/docs/testing.md +103 -0
- data/docs/typescript.md +2 -1
- data/docs/webpack-dev-server.md +44 -1
- data/docs/webpack.md +37 -1
- data/exe/webpack +8 -0
- data/exe/webpack-dev-server +8 -0
- data/lib/install/config/webpacker.yml +9 -2
- data/lib/install/elm.rb +11 -9
- data/lib/install/examples/elm/hello_elm.js +4 -3
- data/lib/install/examples/vue/hello_vue.js +1 -1
- data/lib/install/template.rb +3 -5
- data/lib/install/vue.rb +7 -5
- data/lib/tasks/webpacker/check_node.rake +6 -3
- data/lib/webpacker/configuration.rb +4 -0
- data/lib/webpacker/dev_server.rb +19 -5
- data/lib/webpacker/dev_server_proxy.rb +1 -1
- data/lib/webpacker/dev_server_runner.rb +51 -0
- data/lib/webpacker/helper.rb +5 -16
- data/lib/webpacker/manifest.rb +8 -8
- data/lib/webpacker/runner.rb +22 -0
- data/lib/webpacker/version.rb +1 -1
- data/lib/webpacker/webpack_runner.rb +15 -0
- data/package.json +4 -2
- data/package/config.js +19 -2
- data/package/environment.js +3 -3
- data/package/environments/development.js +15 -11
- data/package/environments/production.js +2 -2
- data/package/index.js +1 -1
- data/package/loaders/file.js +4 -4
- data/package/loaders/style.js +2 -2
- data/package/loaders/vue.js +2 -2
- data/test/configuration_test.rb +5 -0
- data/test/manifest_test.rb +10 -2
- data/webpacker.gemspec +3 -1
- data/yarn.lock +5133 -0
- metadata +16 -8
- data/lib/install/bin/webpack-dev-server.tt +0 -68
- data/lib/install/bin/webpack.tt +0 -27
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpacker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
- Gaurav Tiwari
|
9
9
|
autorequire:
|
10
|
-
bindir:
|
10
|
+
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-10-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -71,16 +71,20 @@ description:
|
|
71
71
|
email:
|
72
72
|
- david@basecamp.com
|
73
73
|
- gaurav@gauravtiwari.co.uk
|
74
|
-
executables:
|
74
|
+
executables:
|
75
|
+
- webpack
|
76
|
+
- webpack-dev-server
|
75
77
|
extensions: []
|
76
78
|
extra_rdoc_files: []
|
77
79
|
files:
|
80
|
+
- ".eslintignore"
|
78
81
|
- ".eslintrc.js"
|
79
82
|
- ".gitignore"
|
80
83
|
- ".rubocop.yml"
|
81
84
|
- ".travis.yml"
|
82
85
|
- CHANGELOG.md
|
83
86
|
- Gemfile
|
87
|
+
- Gemfile.lock
|
84
88
|
- MIT-LICENSE
|
85
89
|
- README.md
|
86
90
|
- Rakefile
|
@@ -98,9 +102,9 @@ files:
|
|
98
102
|
- docs/webpack-dev-server.md
|
99
103
|
- docs/webpack.md
|
100
104
|
- docs/yarn.md
|
105
|
+
- exe/webpack
|
106
|
+
- exe/webpack-dev-server
|
101
107
|
- lib/install/angular.rb
|
102
|
-
- lib/install/bin/webpack-dev-server.tt
|
103
|
-
- lib/install/bin/webpack.tt
|
104
108
|
- lib/install/config/.babelrc
|
105
109
|
- lib/install/config/.postcssrc.yml
|
106
110
|
- lib/install/config/webpack/development.js
|
@@ -141,11 +145,14 @@ files:
|
|
141
145
|
- lib/webpacker/configuration.rb
|
142
146
|
- lib/webpacker/dev_server.rb
|
143
147
|
- lib/webpacker/dev_server_proxy.rb
|
148
|
+
- lib/webpacker/dev_server_runner.rb
|
144
149
|
- lib/webpacker/helper.rb
|
145
150
|
- lib/webpacker/instance.rb
|
146
151
|
- lib/webpacker/manifest.rb
|
147
152
|
- lib/webpacker/railtie.rb
|
153
|
+
- lib/webpacker/runner.rb
|
148
154
|
- lib/webpacker/version.rb
|
155
|
+
- lib/webpacker/webpack_runner.rb
|
149
156
|
- package.json
|
150
157
|
- package/asset_host.js
|
151
158
|
- package/config.js
|
@@ -172,6 +179,7 @@ files:
|
|
172
179
|
- test/test_app/public/packs/manifest.json
|
173
180
|
- test/webpacker_test_helper.rb
|
174
181
|
- webpacker.gemspec
|
182
|
+
- yarn.lock
|
175
183
|
homepage: https://github.com/rails/webpacker
|
176
184
|
licenses:
|
177
185
|
- MIT
|
@@ -184,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
192
|
requirements:
|
185
193
|
- - ">="
|
186
194
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
195
|
+
version: 2.2.0
|
188
196
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
197
|
requirements:
|
190
198
|
- - ">="
|
@@ -192,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
200
|
version: '0'
|
193
201
|
requirements: []
|
194
202
|
rubyforge_project:
|
195
|
-
rubygems_version: 2.
|
203
|
+
rubygems_version: 2.5.1
|
196
204
|
signing_key:
|
197
205
|
specification_version: 4
|
198
206
|
summary: Use Webpack to manage app-like JavaScript modules in Rails
|
@@ -1,68 +0,0 @@
|
|
1
|
-
<%= shebang %>
|
2
|
-
$stdout.sync = true
|
3
|
-
|
4
|
-
require "shellwords"
|
5
|
-
require "yaml"
|
6
|
-
require "socket"
|
7
|
-
|
8
|
-
ENV["RAILS_ENV"] ||= "development"
|
9
|
-
RAILS_ENV = ENV["RAILS_ENV"]
|
10
|
-
|
11
|
-
ENV["NODE_ENV"] ||= RAILS_ENV
|
12
|
-
NODE_ENV = ENV["NODE_ENV"]
|
13
|
-
|
14
|
-
APP_PATH = File.expand_path("../", __dir__)
|
15
|
-
CONFIG_FILE = File.join(APP_PATH, "config/webpacker.yml")
|
16
|
-
NODE_MODULES_PATH = File.join(APP_PATH, "node_modules")
|
17
|
-
WEBPACK_CONFIG = File.join(APP_PATH, "config/webpack/#{NODE_ENV}.js")
|
18
|
-
|
19
|
-
DEFAULT_LISTEN_HOST_ADDR = NODE_ENV == 'development' ? 'localhost' : '0.0.0.0'
|
20
|
-
|
21
|
-
def args(key)
|
22
|
-
index = ARGV.index(key)
|
23
|
-
index ? ARGV[index + 1] : nil
|
24
|
-
end
|
25
|
-
|
26
|
-
begin
|
27
|
-
dev_server = YAML.load_file(CONFIG_FILE)[RAILS_ENV]["dev_server"]
|
28
|
-
|
29
|
-
HOSTNAME = args('--host') || dev_server["host"]
|
30
|
-
PORT = args('--port') || dev_server["port"]
|
31
|
-
HTTPS = ARGV.include?('--https') || dev_server["https"]
|
32
|
-
DEV_SERVER_ADDR = "http#{"s" if HTTPS}://#{HOSTNAME}:#{PORT}"
|
33
|
-
LISTEN_HOST_ADDR = args('--listen-host') || DEFAULT_LISTEN_HOST_ADDR
|
34
|
-
|
35
|
-
rescue Errno::ENOENT, NoMethodError
|
36
|
-
$stdout.puts "Webpack dev_server configuration not found in #{CONFIG_FILE}."
|
37
|
-
$stdout.puts "Please run bundle exec rails webpacker:install to install webpacker"
|
38
|
-
exit!
|
39
|
-
end
|
40
|
-
|
41
|
-
begin
|
42
|
-
server = TCPServer.new(LISTEN_HOST_ADDR, PORT)
|
43
|
-
server.close
|
44
|
-
|
45
|
-
rescue Errno::EADDRINUSE
|
46
|
-
$stdout.puts "Another program is running on port #{PORT}. Set a new port in #{CONFIG_FILE} for dev_server"
|
47
|
-
exit!
|
48
|
-
end
|
49
|
-
|
50
|
-
# Delete supplied host, port and listen-host CLI arguments
|
51
|
-
["--host", "--port", "--listen-host"].each do |arg|
|
52
|
-
ARGV.delete(args(arg))
|
53
|
-
ARGV.delete(arg)
|
54
|
-
end
|
55
|
-
|
56
|
-
env = { "NODE_PATH" => NODE_MODULES_PATH.shellescape }
|
57
|
-
|
58
|
-
cmd = [
|
59
|
-
"#{NODE_MODULES_PATH}/.bin/webpack-dev-server", "--progress", "--color",
|
60
|
-
"--config", WEBPACK_CONFIG,
|
61
|
-
"--host", LISTEN_HOST_ADDR,
|
62
|
-
"--public", "#{HOSTNAME}:#{PORT}",
|
63
|
-
"--port", PORT.to_s
|
64
|
-
] + ARGV
|
65
|
-
|
66
|
-
Dir.chdir(APP_PATH) do
|
67
|
-
exec env, *cmd
|
68
|
-
end
|
data/lib/install/bin/webpack.tt
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
<%= shebang %>
|
2
|
-
$stdout.sync = true
|
3
|
-
|
4
|
-
require "shellwords"
|
5
|
-
|
6
|
-
ENV["RAILS_ENV"] ||= "development"
|
7
|
-
RAILS_ENV = ENV["RAILS_ENV"]
|
8
|
-
|
9
|
-
ENV["NODE_ENV"] ||= RAILS_ENV
|
10
|
-
NODE_ENV = ENV["NODE_ENV"]
|
11
|
-
|
12
|
-
APP_PATH = File.expand_path("../", __dir__)
|
13
|
-
NODE_MODULES_PATH = File.join(APP_PATH, "node_modules")
|
14
|
-
WEBPACK_CONFIG = File.join(APP_PATH, "config/webpack/#{NODE_ENV}.js")
|
15
|
-
|
16
|
-
unless File.exist?(WEBPACK_CONFIG)
|
17
|
-
puts "Webpack configuration not found."
|
18
|
-
puts "Please run bundle exec rails webpacker:install to install webpacker"
|
19
|
-
exit!
|
20
|
-
end
|
21
|
-
|
22
|
-
env = { "NODE_PATH" => NODE_MODULES_PATH.shellescape }
|
23
|
-
cmd = [ "#{NODE_MODULES_PATH}/.bin/webpack", "--config", WEBPACK_CONFIG ] + ARGV
|
24
|
-
|
25
|
-
Dir.chdir(APP_PATH) do
|
26
|
-
exec env, *cmd
|
27
|
-
end
|