webpacker 1.1 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -8
- data/CHANGELOG.md +64 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +68 -1
- data/README.md +42 -25
- data/Rakefile +11 -0
- data/lib/install/angular.rb +1 -1
- data/lib/install/bin/webpack-dev-server.tt +2 -2
- data/lib/install/bin/webpack.tt +2 -9
- data/lib/install/bin/yarn.tt +3 -2
- data/lib/install/config/.babelrc +5 -0
- data/lib/install/config/loaders/core/assets.js +1 -1
- data/lib/install/config/loaders/core/babel.js +1 -6
- data/lib/install/config/loaders/core/erb.js +1 -1
- data/lib/install/config/loaders/core/sass.js +6 -1
- data/lib/install/config/loaders/installers/react.js +1 -7
- data/lib/install/config/loaders/installers/vue.js +4 -2
- data/lib/install/config/webpack/configuration.js +9 -4
- data/lib/install/config/webpack/development.js +1 -1
- data/lib/install/config/webpack/development.server.yml +17 -4
- data/lib/install/config/webpack/paths.yml +33 -19
- data/lib/install/config/webpack/production.js +2 -1
- data/lib/install/config/webpack/shared.js +13 -10
- data/lib/install/config/webpack/test.js +6 -0
- data/lib/install/examples/react/.babelrc +4 -1
- data/lib/install/examples/react/hello_react.jsx +2 -1
- data/lib/install/examples/vue/app.vue +1 -1
- data/lib/install/react.rb +20 -4
- data/lib/install/template.rb +21 -9
- data/lib/install/vue.rb +1 -1
- data/lib/tasks/installers.rake +2 -2
- data/lib/tasks/webpacker.rake +2 -0
- data/lib/tasks/webpacker/check_node.rake +19 -0
- data/lib/tasks/webpacker/check_yarn.rake +12 -0
- data/lib/tasks/webpacker/clobber.rake +17 -0
- data/lib/tasks/webpacker/compile.rake +15 -2
- data/lib/tasks/webpacker/install.rake +3 -3
- data/lib/tasks/webpacker/verify_install.rake +1 -1
- data/lib/webpacker.rb +5 -0
- data/lib/webpacker/configuration.rb +15 -6
- data/lib/webpacker/env.rb +27 -0
- data/lib/webpacker/manifest.rb +6 -1
- data/lib/webpacker/railtie.rb +6 -4
- data/lib/webpacker/version.rb +1 -1
- data/package.json +4 -1
- data/test/env_test.rb +16 -0
- data/test/webpacker_test.rb +14 -0
- data/webpacker.gemspec +2 -2
- metadata +18 -5
- data/lib/install/bin/webpack-watcher.tt +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ccfe0b6654653e31fa2f154132007bbde99b751
|
4
|
+
data.tar.gz: 14f29f16a493bc35b35162feaea491027dd736fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40170698d19c5b726d2a6407ea14c385d57c4e90feb44b72e42b1bb05f478cb2e8467ec9b727a32be423b74efe3e1aa97c6bd2f667205354b82ab3f66dc32488
|
7
|
+
data.tar.gz: fa16cf6e69c87157b4f0eb310d1a2c3d978dc71469ec42cab00926e55db77aa7706dacf749c4871c21e71baaf49d1fada7c4626d2560699bb8e3e7c49b7621fe
|
data/.travis.yml
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
sudo:
|
1
|
+
sudo: false
|
2
2
|
language: ruby
|
3
3
|
rvm:
|
4
4
|
- 2.2.6
|
5
|
-
|
6
|
-
|
7
|
-
- docker
|
8
|
-
|
5
|
+
- 2.3.3
|
6
|
+
- 2.4.1
|
9
7
|
cache:
|
10
8
|
bundler: true
|
11
9
|
directories:
|
@@ -13,12 +11,12 @@ cache:
|
|
13
11
|
yarn: true
|
14
12
|
|
15
13
|
install:
|
16
|
-
-
|
14
|
+
- bundle install
|
17
15
|
- nvm install node
|
18
16
|
- node -v
|
19
17
|
- npm i -g yarn
|
20
18
|
- yarn
|
21
|
-
|
22
19
|
script:
|
23
20
|
- yarn lint
|
24
|
-
- rubocop
|
21
|
+
- bundle exec rubocop
|
22
|
+
- bundle exec rake test
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
## [1.2] - 2017-04-27
|
2
|
+
Some of the changes made requires you to run below commands to install new changes.
|
3
|
+
|
4
|
+
```bash
|
5
|
+
bundle update webpacker
|
6
|
+
bundle exec rails webpacker:install
|
7
|
+
```
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
- Support Spring - [#205](https://github.com/rails/webpacker/issues/205)
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
Spring.after_fork { Webpacker.bootstrap } if defined?(Spring)
|
14
|
+
```
|
15
|
+
- Check node version and yarn before installing webpacker - [#217](https://github.com/rails/webpacker/issues/217)
|
16
|
+
|
17
|
+
- Include webpacker helper to views - [#172](https://github.com/rails/webpacker/issues/172)
|
18
|
+
|
19
|
+
- Webpacker installer on windows - [#245](https://github.com/rails/webpacker/issues/245)
|
20
|
+
|
21
|
+
- Yarn duplication - [#278](https://github.com/rails/webpacker/issues/278)
|
22
|
+
|
23
|
+
- Add back Spring for `rails-erb-loader` - [#216](https://github.com/rails/webpacker/issues/216)
|
24
|
+
|
25
|
+
- Move babel presets and plugins to .babelrc - [#202](https://github.com/rails/webpacker/issues/202)
|
26
|
+
|
27
|
+
### Added
|
28
|
+
- A changelog - [#211](https://github.com/rails/webpacker/issues/211)
|
29
|
+
- Minimize CSS assets - [#218](https://github.com/rails/webpacker/issues/218)
|
30
|
+
- Pack namespacing support - [#201](https://github.com/rails/webpacker/pull/201)
|
31
|
+
|
32
|
+
```
|
33
|
+
app/javascript/packs/admin/hello_vue.js
|
34
|
+
app/javascript/packs/admin/hello.vue
|
35
|
+
app/javascript/packs/hello_vue.js
|
36
|
+
app/javascript/packs/hello.vue
|
37
|
+
```
|
38
|
+
- Add tree-shaking support - [#250](https://github.com/rails/webpacker/pull/250)
|
39
|
+
- Add initial test case by @kimquy [#259](https://github.com/rails/webpacker/pull/259)
|
40
|
+
- Compile assets before test:controllers and test:system
|
41
|
+
|
42
|
+
### Removed
|
43
|
+
- Webpack watcher - [#295](https://github.com/rails/webpacker/pull/295)
|
44
|
+
|
45
|
+
## [1.1] - 2017-03-24
|
46
|
+
|
47
|
+
This release requires you to run below commands to install new features.
|
48
|
+
|
49
|
+
```bash
|
50
|
+
bundle update webpacker
|
51
|
+
bundle exec rails webpacker:install
|
52
|
+
# if installed react, vue or angular
|
53
|
+
bundle exec rails webpacker:install:[react, angular, vue]
|
54
|
+
```
|
55
|
+
|
56
|
+
### Added (breaking changes)
|
57
|
+
- Static assets support - [#153](https://github.com/rails/webpacker/pull/153)
|
58
|
+
- Advanced webpack configuration - [#153](https://github.com/rails/webpacker/pull/153)
|
59
|
+
|
60
|
+
### Removed
|
61
|
+
|
62
|
+
```rb
|
63
|
+
config.x.webpacker[:digesting] = true
|
64
|
+
```
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
webpacker (1.
|
4
|
+
webpacker (1.1)
|
5
5
|
activesupport (>= 4.2)
|
6
6
|
multi_json (~> 1.2)
|
7
7
|
railties (>= 4.2)
|
@@ -9,6 +9,16 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
+
actioncable (5.0.1)
|
13
|
+
actionpack (= 5.0.1)
|
14
|
+
nio4r (~> 1.2)
|
15
|
+
websocket-driver (~> 0.6.1)
|
16
|
+
actionmailer (5.0.1)
|
17
|
+
actionpack (= 5.0.1)
|
18
|
+
actionview (= 5.0.1)
|
19
|
+
activejob (= 5.0.1)
|
20
|
+
mail (~> 2.5, >= 2.5.4)
|
21
|
+
rails-dom-testing (~> 2.0)
|
12
22
|
actionpack (5.0.1)
|
13
23
|
actionview (= 5.0.1)
|
14
24
|
activesupport (= 5.0.1)
|
@@ -22,26 +32,60 @@ GEM
|
|
22
32
|
erubis (~> 2.7.0)
|
23
33
|
rails-dom-testing (~> 2.0)
|
24
34
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
35
|
+
activejob (5.0.1)
|
36
|
+
activesupport (= 5.0.1)
|
37
|
+
globalid (>= 0.3.6)
|
38
|
+
activemodel (5.0.1)
|
39
|
+
activesupport (= 5.0.1)
|
40
|
+
activerecord (5.0.1)
|
41
|
+
activemodel (= 5.0.1)
|
42
|
+
activesupport (= 5.0.1)
|
43
|
+
arel (~> 7.0)
|
25
44
|
activesupport (5.0.1)
|
26
45
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
27
46
|
i18n (~> 0.7)
|
28
47
|
minitest (~> 5.1)
|
29
48
|
tzinfo (~> 1.1)
|
49
|
+
arel (7.1.4)
|
50
|
+
ast (2.3.0)
|
30
51
|
builder (3.2.3)
|
31
52
|
concurrent-ruby (1.0.5)
|
32
53
|
erubis (2.7.0)
|
54
|
+
globalid (0.3.7)
|
55
|
+
activesupport (>= 4.1.0)
|
33
56
|
i18n (0.8.1)
|
34
57
|
loofah (2.0.3)
|
35
58
|
nokogiri (>= 1.5.9)
|
59
|
+
mail (2.6.4)
|
60
|
+
mime-types (>= 1.16, < 4)
|
36
61
|
method_source (0.8.2)
|
62
|
+
mime-types (3.1)
|
63
|
+
mime-types-data (~> 3.2015)
|
64
|
+
mime-types-data (3.2016.0521)
|
37
65
|
mini_portile2 (2.1.0)
|
38
66
|
minitest (5.10.1)
|
39
67
|
multi_json (1.12.1)
|
68
|
+
nio4r (1.2.1)
|
40
69
|
nokogiri (1.7.0.1)
|
41
70
|
mini_portile2 (~> 2.1.0)
|
71
|
+
parser (2.4.0.0)
|
72
|
+
ast (~> 2.2)
|
73
|
+
powerpack (0.1.1)
|
42
74
|
rack (2.0.1)
|
43
75
|
rack-test (0.6.3)
|
44
76
|
rack (>= 1.0)
|
77
|
+
rails (5.0.1)
|
78
|
+
actioncable (= 5.0.1)
|
79
|
+
actionmailer (= 5.0.1)
|
80
|
+
actionpack (= 5.0.1)
|
81
|
+
actionview (= 5.0.1)
|
82
|
+
activejob (= 5.0.1)
|
83
|
+
activemodel (= 5.0.1)
|
84
|
+
activerecord (= 5.0.1)
|
85
|
+
activesupport (= 5.0.1)
|
86
|
+
bundler (>= 1.3.0, < 2.0)
|
87
|
+
railties (= 5.0.1)
|
88
|
+
sprockets-rails (>= 2.0.0)
|
45
89
|
rails-dom-testing (2.0.2)
|
46
90
|
activesupport (>= 4.2.0, < 6.0)
|
47
91
|
nokogiri (~> 1.6)
|
@@ -53,17 +97,40 @@ GEM
|
|
53
97
|
method_source
|
54
98
|
rake (>= 0.8.7)
|
55
99
|
thor (>= 0.18.1, < 2.0)
|
100
|
+
rainbow (2.2.1)
|
56
101
|
rake (12.0.0)
|
102
|
+
rubocop (0.47.1)
|
103
|
+
parser (>= 2.3.3.1, < 3.0)
|
104
|
+
powerpack (~> 0.1)
|
105
|
+
rainbow (>= 1.99.1, < 3.0)
|
106
|
+
ruby-progressbar (~> 1.7)
|
107
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
108
|
+
ruby-progressbar (1.8.1)
|
109
|
+
sprockets (3.7.1)
|
110
|
+
concurrent-ruby (~> 1.0)
|
111
|
+
rack (> 1, < 3)
|
112
|
+
sprockets-rails (3.2.0)
|
113
|
+
actionpack (>= 4.0)
|
114
|
+
activesupport (>= 4.0)
|
115
|
+
sprockets (>= 3.0.0)
|
57
116
|
thor (0.19.4)
|
58
117
|
thread_safe (0.3.6)
|
59
118
|
tzinfo (1.2.2)
|
60
119
|
thread_safe (~> 0.1)
|
120
|
+
unicode-display_width (1.1.3)
|
121
|
+
websocket-driver (0.6.5)
|
122
|
+
websocket-extensions (>= 0.1.0)
|
123
|
+
websocket-extensions (0.1.2)
|
61
124
|
|
62
125
|
PLATFORMS
|
63
126
|
ruby
|
64
127
|
|
65
128
|
DEPENDENCIES
|
66
129
|
bundler (~> 1.12)
|
130
|
+
minitest (~> 5.0)
|
131
|
+
rails
|
132
|
+
rake (>= 11.1)
|
133
|
+
rubocop (>= 0.47)
|
67
134
|
webpacker!
|
68
135
|
|
69
136
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -1,14 +1,26 @@
|
|
1
1
|
# Webpacker
|
2
2
|
![travis-ci status](https://api.travis-ci.org/rails/webpacker.svg?branch=master)
|
3
|
+
[![node.js](https://img.shields.io/badge/node-%3E%3D%206.4.0-brightgreen.svg)](https://nodejs.org/en/)
|
4
|
+
[![Gem](https://img.shields.io/gem/v/webpacker.svg)](https://github.com/rails/webpacker)
|
3
5
|
|
4
|
-
Webpacker makes it easy to use the JavaScript preprocessor and bundler [Webpack](https://webpack.
|
6
|
+
Webpacker makes it easy to use the JavaScript preprocessor and bundler [Webpack 2.x.x+](https://webpack.js.org/)
|
5
7
|
to manage application-like JavaScript in Rails. It coexists with the asset pipeline,
|
6
|
-
as the purpose
|
7
|
-
even JavaScript Sprinkles (that all continues to live in app/assets).
|
8
|
+
as the primary purpose for Webpack is app-like JavaScript, not images, css, or
|
9
|
+
even JavaScript Sprinkles (that all continues to live in app/assets). It is, however,
|
10
|
+
possible to use Webpacker for CSS and images assets as well, in which case you may not
|
11
|
+
even need the asset pipeline. This is mostly relevant when exclusively using component-based
|
12
|
+
JavaScript frameworks.
|
8
13
|
|
9
14
|
It's designed to work with Rails 5.1+ and makes use of the [Yarn](https://yarnpkg.com) dependency management
|
10
15
|
that's been made default from that version forward.
|
11
16
|
|
17
|
+
## Prerequisites
|
18
|
+
|
19
|
+
* Ruby 2.2+
|
20
|
+
* Rails 4.2+
|
21
|
+
* Node.js 6.4.0+
|
22
|
+
* Yarn
|
23
|
+
|
12
24
|
## Installation
|
13
25
|
|
14
26
|
Webpacker is currently compatible with Rails 4.2+, but there's no guarantee it will still be
|
@@ -27,24 +39,13 @@ You can also see a list of available commands by running `./bin/rails webpacker`
|
|
27
39
|
|
28
40
|
## Binstubs
|
29
41
|
|
30
|
-
Webpacker ships with
|
31
|
-
They're thin wrappers around the standard webpack.js executable, just to ensure that the right configuration
|
32
|
-
file is loaded.
|
33
|
-
|
42
|
+
Webpacker ships with two binstubs: `./bin/webpack` and `./bin/webpack-dev-server`.
|
43
|
+
They're thin wrappers around the standard webpack.js executable, just to ensure that the right configuration file is loaded depending on your environment.
|
34
44
|
|
35
45
|
A binstub is also created to install your npm dependencies,
|
36
46
|
and can be called via `./bin/yarn`.
|
37
47
|
|
38
|
-
In development, you'll need to run `./bin/webpack-
|
39
|
-
`./bin/rails server` to have your `app/javascript/packs/*.js` files compiled as you make changes.
|
40
|
-
If you'd rather not have to run the two processes separately by hand, you can use
|
41
|
-
[Foreman](https://ddollar.github.io/foreman).
|
42
|
-
|
43
|
-
Alternatively, you can run `./bin/webpack-dev-server`. This will launch a
|
44
|
-
[Webpack Dev Server](https://webpack.github.io/docs/webpack-dev-server.html) listening on http://localhost:8080/
|
45
|
-
serving your pack files. This setup allows you to leverage advanced Webpack features, such
|
46
|
-
as [Hot Module Replacement](https://webpack.github.io/docs/hot-module-replacement-with-webpack.html).
|
47
|
-
|
48
|
+
In development, you'll need to run `./bin/webpack-dev-server` in a separate terminal from `./bin/rails server` to have your `app/javascript/packs/*.js` files compiled as you make changes. If you'd rather not have to run the two processes separately by hand, you can use [Foreman](https://ddollar.github.io/foreman). `./bin/webpack-dev-server` launches the [Webpack Dev Server](https://webpack.js.org/configuration/dev-server/), which serves your pack files on http://localhost:8080/, and provides advanced Webpack features, such as [Hot Module Replacement](https://webpack.js.org/guides/hmr-react/).
|
48
49
|
|
49
50
|
## Configuration
|
50
51
|
|
@@ -72,13 +73,34 @@ app/javascript/calendar/models/month.js
|
|
72
73
|
```
|
73
74
|
|
74
75
|
```erb
|
75
|
-
<%# app/views/
|
76
|
+
<%# app/views/layouts/application.html.erb %>
|
76
77
|
<%= javascript_pack_tag 'calendar' %>
|
77
78
|
<%= stylesheet_pack_tag 'calendar' %>
|
78
79
|
```
|
79
80
|
|
80
81
|
But it could also look a million other ways.
|
81
82
|
|
83
|
+
**Note:** You can also namespace your packs using directories, similar to a Rails app.
|
84
|
+
|
85
|
+
```
|
86
|
+
app/javascript/packs/admin/orders.js
|
87
|
+
app/javascript/packs/shop/orders.js
|
88
|
+
```
|
89
|
+
|
90
|
+
and reference them in your views like this:
|
91
|
+
|
92
|
+
```erb
|
93
|
+
<%# app/views/admin/orders/index.html.erb %>
|
94
|
+
<%= javascript_pack_tag 'admin/orders' %>
|
95
|
+
```
|
96
|
+
|
97
|
+
and
|
98
|
+
|
99
|
+
```erb
|
100
|
+
<%# app/views/shop/orders/index.html.erb %>
|
101
|
+
<%= javascript_pack_tag 'shop/orders' %>
|
102
|
+
```
|
103
|
+
|
82
104
|
## Advanced Configuration
|
83
105
|
|
84
106
|
By default, webpacker offers simple conventions for where the webpack configs, javascript app files and compiled webpack bundles will go in your rails app,
|
@@ -109,11 +131,6 @@ port: 8080
|
|
109
131
|
By default, `webpack-dev-server` uses `output` option specified in
|
110
132
|
`paths.yml` as `contentBase`.
|
111
133
|
|
112
|
-
**Note:** Don't forget to disable `webpack-dev-server` incase you are using
|
113
|
-
`./bin/webpack-watcher` to serve assets in development mode otherwise
|
114
|
-
you will get 404 for assets because the helper tag will use webpack-dev-server url
|
115
|
-
to serve assets instead of public directory.
|
116
|
-
|
117
134
|
## Linking to static assets
|
118
135
|
|
119
136
|
Static assets like images, fonts and stylesheets support is enabled out-of-box so, you can link them into your javascript app code and have them compiled automatically.
|
@@ -124,7 +141,7 @@ Static assets like images, fonts and stylesheets support is enabled out-of-box s
|
|
124
141
|
import React from 'react'
|
125
142
|
import ReactDOM from 'react-dom'
|
126
143
|
import helloIcon from '../hello_react/images/icon.png'
|
127
|
-
import '
|
144
|
+
import '../hello_react/styles/hello-react.sass'
|
128
145
|
|
129
146
|
const Hello = props => (
|
130
147
|
<div className="hello-react">
|
@@ -214,7 +231,7 @@ Webpacker uses a `manifest.json` file to keep track of packs in all environments
|
|
214
231
|
however since this file is generated after packs are compiled by webpack. So,
|
215
232
|
if you load a view in browser whilst webpack is compiling you will get this error.
|
216
233
|
Therefore, make sure webpack
|
217
|
-
(i.e `./bin/webpack-
|
234
|
+
(i.e `./bin/webpack-dev-server`) is running and has
|
218
235
|
completed the compilation successfully before loading a view.
|
219
236
|
|
220
237
|
## Wishlist
|
data/Rakefile
CHANGED
data/lib/install/angular.rb
CHANGED
@@ -15,4 +15,4 @@ copy_file "#{__dir__}/examples/angular/tsconfig.json", "tsconfig.json"
|
|
15
15
|
puts "Installing all angular dependencies"
|
16
16
|
run "./bin/yarn add typescript ts-loader core-js zone.js rxjs @angular/core @angular/common @angular/compiler @angular/platform-browser @angular/platform-browser-dynamic"
|
17
17
|
|
18
|
-
puts "Webpacker now supports angular
|
18
|
+
puts "Webpacker now supports angular and typescript 🎉"
|
@@ -14,7 +14,7 @@ APP_PATH = File.expand_path("../", __dir__)
|
|
14
14
|
CONFIG_PATH = File.join(APP_PATH, "config/webpack/paths.yml")
|
15
15
|
|
16
16
|
begin
|
17
|
-
paths = YAML.load(File.read(CONFIG_PATH))
|
17
|
+
paths = YAML.load(File.read(CONFIG_PATH))[NODE_ENV]
|
18
18
|
|
19
19
|
NODE_MODULES_PATH = File.join(APP_PATH.shellescape, paths["node_modules"])
|
20
20
|
WEBPACK_CONFIG_PATH = File.join(APP_PATH.shellescape, paths["config"])
|
@@ -29,5 +29,5 @@ end
|
|
29
29
|
|
30
30
|
Dir.chdir(APP_PATH) do
|
31
31
|
exec "NODE_PATH=#{NODE_MODULES_PATH} #{WEBPACK_BIN} --progress --color " \
|
32
|
-
"--config #{DEV_SERVER_CONFIG}"
|
32
|
+
"--config #{DEV_SERVER_CONFIG} #{ARGV.join(" ")}"
|
33
33
|
end
|
data/lib/install/bin/webpack.tt
CHANGED
@@ -12,21 +12,14 @@ NODE_ENV = ENV["NODE_ENV"]
|
|
12
12
|
|
13
13
|
APP_PATH = File.expand_path("../", __dir__)
|
14
14
|
CONFIG_PATH = File.join(APP_PATH, "config/webpack/paths.yml")
|
15
|
-
DEV_SERVER_CONFIG_PATH = File.join(APP_PATH, "config/webpack/development.server.yml")
|
16
15
|
|
17
16
|
begin
|
18
|
-
paths = YAML.load(File.read(CONFIG_PATH))
|
19
|
-
dev_server = YAML.load(File.read(DEV_SERVER_CONFIG_PATH))
|
17
|
+
paths = YAML.load(File.read(CONFIG_PATH))[NODE_ENV]
|
20
18
|
|
21
19
|
NODE_MODULES_PATH = File.join(APP_PATH.shellescape, paths["node_modules"])
|
22
20
|
WEBPACK_CONFIG_PATH = File.join(APP_PATH.shellescape, paths["config"])
|
23
|
-
|
24
|
-
if NODE_ENV == "development" && dev_server["enabled"]
|
25
|
-
puts "Warning: webpack-dev-server is currently enabled in #{DEV_SERVER_CONFIG_PATH}. " \
|
26
|
-
"Disable to serve assets directly from public/packs directory"
|
27
|
-
end
|
28
21
|
rescue Errno::ENOENT, NoMethodError
|
29
|
-
puts "Configuration not found in config/webpack/paths.yml
|
22
|
+
puts "Configuration not found in config/webpack/paths.yml"
|
30
23
|
puts "Please run bundle exec rails webpacker:install to install webpacker"
|
31
24
|
exit!
|
32
25
|
end
|
data/lib/install/bin/yarn.tt
CHANGED
@@ -4,7 +4,8 @@ Dir.chdir(VENDOR_PATH) do
|
|
4
4
|
begin
|
5
5
|
exec "yarnpkg #{ARGV.join(" ")}"
|
6
6
|
rescue Errno::ENOENT
|
7
|
-
puts "Yarn executable was not detected in the system."
|
8
|
-
puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
7
|
+
$stderr.puts "Yarn executable was not detected in the system."
|
8
|
+
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
9
|
+
exit 1
|
9
10
|
end
|
10
11
|
end
|