webpacker 5.0.1 → 6.0.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +8 -8
  3. data/.github/workflows/jest.yml +38 -0
  4. data/.github/workflows/js-lint.yml +39 -0
  5. data/.github/workflows/rubocop.yml +39 -0
  6. data/.github/workflows/ruby.yml +70 -0
  7. data/.gitignore +2 -0
  8. data/.node-version +1 -1
  9. data/.rubocop.yml +11 -16
  10. data/CHANGELOG.md +33 -1
  11. data/CONTRIBUTING.md +1 -1
  12. data/Gemfile.lock +91 -85
  13. data/README.md +27 -44
  14. data/docs/assets.md +21 -5
  15. data/docs/css.md +80 -30
  16. data/docs/deployment.md +18 -0
  17. data/docs/docker.md +2 -2
  18. data/docs/engines.md +1 -1
  19. data/docs/env.md +4 -1
  20. data/docs/es6.md +1 -1
  21. data/docs/integrations.md +2 -2
  22. data/docs/props.md +2 -38
  23. data/docs/react.md +183 -0
  24. data/docs/target.md +22 -0
  25. data/docs/testing.md +13 -3
  26. data/docs/troubleshooting.md +3 -1
  27. data/docs/typescript.md +92 -27
  28. data/docs/webpack-dev-server.md +17 -15
  29. data/docs/webpack.md +58 -107
  30. data/lib/install/config/webpack/base.js +3 -0
  31. data/lib/install/config/webpack/development.js +2 -2
  32. data/lib/install/config/webpack/production.js +2 -2
  33. data/lib/install/config/webpack/test.js +2 -2
  34. data/lib/install/config/webpacker.yml +9 -42
  35. data/lib/install/examples/{vue → vue3}/app.vue +10 -5
  36. data/lib/install/examples/vue3/hello_vue.js +15 -0
  37. data/lib/install/javascript/packs/application.css +9 -0
  38. data/lib/install/template.rb +33 -19
  39. data/lib/tasks/webpacker.rake +2 -11
  40. data/lib/tasks/webpacker/binstubs.rake +6 -4
  41. data/lib/tasks/webpacker/check_binstubs.rake +4 -4
  42. data/lib/tasks/webpacker/check_node.rake +1 -1
  43. data/lib/tasks/webpacker/check_yarn.rake +2 -3
  44. data/lib/tasks/webpacker/compile.rake +4 -2
  45. data/lib/tasks/webpacker/info.rake +12 -10
  46. data/lib/tasks/webpacker/install.rake +6 -4
  47. data/lib/tasks/webpacker/verify_install.rake +2 -1
  48. data/lib/tasks/webpacker/yarn_install.rake +9 -1
  49. data/lib/webpacker/commands.rb +1 -1
  50. data/lib/webpacker/compiler.rb +14 -9
  51. data/lib/webpacker/configuration.rb +7 -27
  52. data/lib/webpacker/dev_server_proxy.rb +3 -1
  53. data/lib/webpacker/dev_server_runner.rb +23 -4
  54. data/lib/webpacker/helper.rb +55 -46
  55. data/lib/webpacker/manifest.rb +1 -1
  56. data/lib/webpacker/railtie.rb +0 -43
  57. data/lib/webpacker/runner.rb +1 -0
  58. data/lib/webpacker/version.rb +1 -1
  59. data/lib/webpacker/webpack_runner.rb +7 -2
  60. data/package.json +27 -43
  61. data/package/__tests__/config.js +6 -27
  62. data/package/__tests__/dev_server.js +2 -0
  63. data/package/__tests__/development.js +18 -7
  64. data/package/__tests__/env.js +12 -4
  65. data/package/__tests__/production.js +6 -6
  66. data/package/__tests__/staging.js +7 -6
  67. data/package/__tests__/test.js +4 -5
  68. data/package/babel/preset-react.js +62 -0
  69. data/package/babel/preset.js +44 -0
  70. data/package/config.js +4 -9
  71. data/package/configPath.js +3 -0
  72. data/package/dev_server.js +1 -1
  73. data/package/env.js +9 -4
  74. data/package/environments/__tests__/base.js +21 -36
  75. data/package/environments/base.js +67 -128
  76. data/package/environments/development.js +46 -39
  77. data/package/environments/production.js +69 -67
  78. data/package/environments/test.js +2 -2
  79. data/package/index.js +6 -6
  80. data/package/rules/babel.js +20 -11
  81. data/package/rules/coffee.js +6 -0
  82. data/package/rules/erb.js +13 -0
  83. data/package/rules/file.js +19 -18
  84. data/package/rules/index.js +24 -18
  85. data/package/rules/less.js +18 -0
  86. data/package/rules/sass.js +6 -7
  87. data/package/rules/svg.js +23 -0
  88. data/package/utils/get_style_rule.js +22 -28
  89. data/package/utils/helpers.js +3 -35
  90. data/test/compiler_test.rb +4 -11
  91. data/test/configuration_test.rb +2 -32
  92. data/test/dev_server_runner_test.rb +25 -6
  93. data/test/engine_rake_tasks_test.rb +39 -0
  94. data/test/helper_test.rb +18 -9
  95. data/test/mounted_app/Rakefile +4 -0
  96. data/test/mounted_app/test/dummy/Rakefile +3 -0
  97. data/test/mounted_app/test/dummy/bin/rails +3 -0
  98. data/test/mounted_app/test/dummy/bin/rake +3 -0
  99. data/test/mounted_app/test/dummy/config.ru +5 -0
  100. data/test/mounted_app/test/dummy/config/application.rb +10 -0
  101. data/test/mounted_app/test/dummy/config/environment.rb +3 -0
  102. data/test/mounted_app/test/dummy/config/webpacker.yml +75 -0
  103. data/test/mounted_app/test/dummy/package.json +7 -0
  104. data/test/rake_tasks_test.rb +1 -10
  105. data/test/test_app/config/application.rb +0 -1
  106. data/test/test_app/config/webpacker.yml +3 -21
  107. data/test/test_app/config/webpacker_public_root.yml +0 -1
  108. data/test/test_app/public/packs/manifest.json +18 -13
  109. data/test/test_app/some.config.js +0 -0
  110. data/test/webpack_runner_test.rb +10 -4
  111. data/webpacker.gemspec +1 -1
  112. data/yarn.lock +2657 -6224
  113. metadata +53 -71
  114. data/.travis.yml +0 -43
  115. data/lib/install/angular.rb +0 -23
  116. data/lib/install/coffee.rb +0 -25
  117. data/lib/install/config/.browserslistrc +0 -1
  118. data/lib/install/config/babel.config.js +0 -72
  119. data/lib/install/config/postcss.config.js +0 -12
  120. data/lib/install/config/webpack/environment.js +0 -3
  121. data/lib/install/elm.rb +0 -39
  122. data/lib/install/erb.rb +0 -25
  123. data/lib/install/examples/angular/hello_angular.js +0 -7
  124. data/lib/install/examples/angular/hello_angular/app/app.component.ts +0 -9
  125. data/lib/install/examples/angular/hello_angular/app/app.module.ts +0 -16
  126. data/lib/install/examples/angular/hello_angular/index.ts +0 -8
  127. data/lib/install/examples/angular/hello_angular/polyfills.ts +0 -73
  128. data/lib/install/examples/coffee/hello_coffee.coffee +0 -4
  129. data/lib/install/examples/elm/Main.elm +0 -55
  130. data/lib/install/examples/elm/hello_elm.js +0 -16
  131. data/lib/install/examples/erb/hello_erb.js.erb +0 -6
  132. data/lib/install/examples/react/babel.config.js +0 -87
  133. data/lib/install/examples/react/hello_react.jsx +0 -26
  134. data/lib/install/examples/react/tsconfig.json +0 -20
  135. data/lib/install/examples/stimulus/application.js +0 -1
  136. data/lib/install/examples/stimulus/controllers/hello_controller.js +0 -18
  137. data/lib/install/examples/stimulus/controllers/index.js +0 -9
  138. data/lib/install/examples/svelte/app.svelte +0 -11
  139. data/lib/install/examples/svelte/hello_svelte.js +0 -20
  140. data/lib/install/examples/typescript/hello_typescript.ts +0 -4
  141. data/lib/install/examples/typescript/tsconfig.json +0 -23
  142. data/lib/install/examples/vue/hello_vue.js +0 -72
  143. data/lib/install/loaders/coffee.js +0 -6
  144. data/lib/install/loaders/elm.js +0 -25
  145. data/lib/install/loaders/erb.js +0 -11
  146. data/lib/install/loaders/svelte.js +0 -9
  147. data/lib/install/loaders/typescript.js +0 -11
  148. data/lib/install/loaders/vue.js +0 -6
  149. data/lib/install/react.rb +0 -18
  150. data/lib/install/stimulus.rb +0 -12
  151. data/lib/install/svelte.rb +0 -29
  152. data/lib/install/typescript.rb +0 -46
  153. data/lib/install/vue.rb +0 -49
  154. data/lib/tasks/installers.rake +0 -42
  155. data/package/config_types/__tests__/config_list.js +0 -118
  156. data/package/config_types/__tests__/config_object.js +0 -43
  157. data/package/config_types/config_list.js +0 -75
  158. data/package/config_types/config_object.js +0 -55
  159. data/package/config_types/index.js +0 -7
  160. data/package/rules/module.css.js +0 -3
  161. data/package/rules/module.sass.js +0 -8
  162. data/package/rules/node_modules.js +0 -24
  163. data/package/utils/__tests__/deep_assign.js +0 -32
  164. data/package/utils/__tests__/deep_merge.js +0 -10
  165. data/package/utils/__tests__/get_style_rule.js +0 -65
  166. data/package/utils/__tests__/objectify.js +0 -9
  167. data/package/utils/deep_assign.js +0 -22
  168. data/package/utils/deep_merge.js +0 -22
  169. data/package/utils/objectify.js +0 -3
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: 5.0.1
4
+ version: 6.0.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  - Gaurav Tiwari
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-03-24 00:00:00.000000000 Z
12
+ date: 2020-12-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -85,16 +85,16 @@ dependencies:
85
85
  name: rubocop
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - "<"
88
+ - - '='
89
89
  - !ruby/object:Gem::Version
90
- version: '0.69'
90
+ version: 0.93.1
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - "<"
95
+ - - '='
96
96
  - !ruby/object:Gem::Version
97
- version: '0.69'
97
+ version: 0.93.1
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rubocop-performance
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +109,7 @@ dependencies:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
- description:
112
+ description:
113
113
  email:
114
114
  - david@basecamp.com
115
115
  - gaurav@gauravtiwari.co.uk
@@ -119,10 +119,13 @@ extra_rdoc_files: []
119
119
  files:
120
120
  - ".eslintignore"
121
121
  - ".eslintrc.js"
122
+ - ".github/workflows/jest.yml"
123
+ - ".github/workflows/js-lint.yml"
124
+ - ".github/workflows/rubocop.yml"
125
+ - ".github/workflows/ruby.yml"
122
126
  - ".gitignore"
123
127
  - ".node-version"
124
128
  - ".rubocop.yml"
125
- - ".travis.yml"
126
129
  - CHANGELOG.md
127
130
  - CONTRIBUTING.md
128
131
  - Gemfile
@@ -142,6 +145,8 @@ files:
142
145
  - docs/integrations.md
143
146
  - docs/misc.md
144
147
  - docs/props.md
148
+ - docs/react.md
149
+ - docs/target.md
145
150
  - docs/testing.md
146
151
  - docs/troubleshooting.md
147
152
  - docs/typescript.md
@@ -152,56 +157,19 @@ files:
152
157
  - gemfiles/Gemfile-rails-edge
153
158
  - gemfiles/Gemfile-rails.5.2.x
154
159
  - gemfiles/Gemfile-rails.6.0.x
155
- - lib/install/angular.rb
156
160
  - lib/install/bin/webpack
157
161
  - lib/install/bin/webpack-dev-server
158
162
  - lib/install/binstubs.rb
159
- - lib/install/coffee.rb
160
- - lib/install/config/.browserslistrc
161
- - lib/install/config/babel.config.js
162
- - lib/install/config/postcss.config.js
163
+ - lib/install/config/webpack/base.js
163
164
  - lib/install/config/webpack/development.js
164
- - lib/install/config/webpack/environment.js
165
165
  - lib/install/config/webpack/production.js
166
166
  - lib/install/config/webpack/test.js
167
167
  - lib/install/config/webpacker.yml
168
- - lib/install/elm.rb
169
- - lib/install/erb.rb
170
- - lib/install/examples/angular/hello_angular.js
171
- - lib/install/examples/angular/hello_angular/app/app.component.ts
172
- - lib/install/examples/angular/hello_angular/app/app.module.ts
173
- - lib/install/examples/angular/hello_angular/index.ts
174
- - lib/install/examples/angular/hello_angular/polyfills.ts
175
- - lib/install/examples/coffee/hello_coffee.coffee
176
- - lib/install/examples/elm/Main.elm
177
- - lib/install/examples/elm/hello_elm.js
178
- - lib/install/examples/erb/hello_erb.js.erb
179
- - lib/install/examples/react/babel.config.js
180
- - lib/install/examples/react/hello_react.jsx
181
- - lib/install/examples/react/tsconfig.json
182
- - lib/install/examples/stimulus/application.js
183
- - lib/install/examples/stimulus/controllers/hello_controller.js
184
- - lib/install/examples/stimulus/controllers/index.js
185
- - lib/install/examples/svelte/app.svelte
186
- - lib/install/examples/svelte/hello_svelte.js
187
- - lib/install/examples/typescript/hello_typescript.ts
188
- - lib/install/examples/typescript/tsconfig.json
189
- - lib/install/examples/vue/app.vue
190
- - lib/install/examples/vue/hello_vue.js
168
+ - lib/install/examples/vue3/app.vue
169
+ - lib/install/examples/vue3/hello_vue.js
170
+ - lib/install/javascript/packs/application.css
191
171
  - lib/install/javascript/packs/application.js
192
- - lib/install/loaders/coffee.js
193
- - lib/install/loaders/elm.js
194
- - lib/install/loaders/erb.js
195
- - lib/install/loaders/svelte.js
196
- - lib/install/loaders/typescript.js
197
- - lib/install/loaders/vue.js
198
- - lib/install/react.rb
199
- - lib/install/stimulus.rb
200
- - lib/install/svelte.rb
201
172
  - lib/install/template.rb
202
- - lib/install/typescript.rb
203
- - lib/install/vue.rb
204
- - lib/tasks/installers.rake
205
173
  - lib/tasks/webpacker.rake
206
174
  - lib/tasks/webpacker/binstubs.rake
207
175
  - lib/tasks/webpacker/check_binstubs.rake
@@ -237,12 +205,10 @@ files:
237
205
  - package/__tests__/production.js
238
206
  - package/__tests__/staging.js
239
207
  - package/__tests__/test.js
208
+ - package/babel/preset-react.js
209
+ - package/babel/preset.js
240
210
  - package/config.js
241
- - package/config_types/__tests__/config_list.js
242
- - package/config_types/__tests__/config_object.js
243
- - package/config_types/config_list.js
244
- - package/config_types/config_object.js
245
- - package/config_types/index.js
211
+ - package/configPath.js
246
212
  - package/dev_server.js
247
213
  - package/env.js
248
214
  - package/environments/__tests__/base.js
@@ -252,30 +218,34 @@ files:
252
218
  - package/environments/test.js
253
219
  - package/index.js
254
220
  - package/rules/babel.js
221
+ - package/rules/coffee.js
255
222
  - package/rules/css.js
223
+ - package/rules/erb.js
256
224
  - package/rules/file.js
257
225
  - package/rules/index.js
258
- - package/rules/module.css.js
259
- - package/rules/module.sass.js
260
- - package/rules/node_modules.js
226
+ - package/rules/less.js
261
227
  - package/rules/sass.js
262
- - package/utils/__tests__/deep_assign.js
263
- - package/utils/__tests__/deep_merge.js
264
- - package/utils/__tests__/get_style_rule.js
265
- - package/utils/__tests__/objectify.js
266
- - package/utils/deep_assign.js
267
- - package/utils/deep_merge.js
228
+ - package/rules/svg.js
268
229
  - package/utils/get_style_rule.js
269
230
  - package/utils/helpers.js
270
- - package/utils/objectify.js
271
231
  - test/command_test.rb
272
232
  - test/compiler_test.rb
273
233
  - test/configuration_test.rb
274
234
  - test/dev_server_runner_test.rb
275
235
  - test/dev_server_test.rb
236
+ - test/engine_rake_tasks_test.rb
276
237
  - test/env_test.rb
277
238
  - test/helper_test.rb
278
239
  - test/manifest_test.rb
240
+ - test/mounted_app/Rakefile
241
+ - test/mounted_app/test/dummy/Rakefile
242
+ - test/mounted_app/test/dummy/bin/rails
243
+ - test/mounted_app/test/dummy/bin/rake
244
+ - test/mounted_app/test/dummy/config.ru
245
+ - test/mounted_app/test/dummy/config/application.rb
246
+ - test/mounted_app/test/dummy/config/environment.rb
247
+ - test/mounted_app/test/dummy/config/webpacker.yml
248
+ - test/mounted_app/test/dummy/package.json
279
249
  - test/rake_tasks_test.rb
280
250
  - test/test_app/Rakefile
281
251
  - test/test_app/app/javascript/packs/application.js
@@ -291,6 +261,7 @@ files:
291
261
  - test/test_app/config/webpacker_public_root.yml
292
262
  - test/test_app/package.json
293
263
  - test/test_app/public/packs/manifest.json
264
+ - test/test_app/some.config.js
294
265
  - test/test_app/yarn.lock
295
266
  - test/test_helper.rb
296
267
  - test/webpack_runner_test.rb
@@ -301,9 +272,9 @@ homepage: https://github.com/rails/webpacker
301
272
  licenses:
302
273
  - MIT
303
274
  metadata:
304
- source_code_uri: https://github.com/rails/webpacker/tree/v5.0.1
305
- changelog_uri: https://github.com/rails/webpacker/blob/v5.0.1/CHANGELOG.md
306
- post_install_message:
275
+ source_code_uri: https://github.com/rails/webpacker/tree/v6.0.0.pre.1
276
+ changelog_uri: https://github.com/rails/webpacker/blob/v6.0.0.pre.1/CHANGELOG.md
277
+ post_install_message:
307
278
  rdoc_options: []
308
279
  require_paths:
309
280
  - lib
@@ -314,12 +285,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
314
285
  version: 2.4.0
315
286
  required_rubygems_version: !ruby/object:Gem::Requirement
316
287
  requirements:
317
- - - ">="
288
+ - - ">"
318
289
  - !ruby/object:Gem::Version
319
- version: '0'
290
+ version: 1.3.1
320
291
  requirements: []
321
292
  rubygems_version: 3.0.3
322
- signing_key:
293
+ signing_key:
323
294
  specification_version: 4
324
295
  summary: Use webpack to manage app-like JavaScript modules in Rails
325
296
  test_files:
@@ -328,9 +299,19 @@ test_files:
328
299
  - test/configuration_test.rb
329
300
  - test/dev_server_runner_test.rb
330
301
  - test/dev_server_test.rb
302
+ - test/engine_rake_tasks_test.rb
331
303
  - test/env_test.rb
332
304
  - test/helper_test.rb
333
305
  - test/manifest_test.rb
306
+ - test/mounted_app/Rakefile
307
+ - test/mounted_app/test/dummy/Rakefile
308
+ - test/mounted_app/test/dummy/bin/rails
309
+ - test/mounted_app/test/dummy/bin/rake
310
+ - test/mounted_app/test/dummy/config.ru
311
+ - test/mounted_app/test/dummy/config/application.rb
312
+ - test/mounted_app/test/dummy/config/environment.rb
313
+ - test/mounted_app/test/dummy/config/webpacker.yml
314
+ - test/mounted_app/test/dummy/package.json
334
315
  - test/rake_tasks_test.rb
335
316
  - test/test_app/Rakefile
336
317
  - test/test_app/app/javascript/packs/application.js
@@ -346,6 +327,7 @@ test_files:
346
327
  - test/test_app/config/webpacker_public_root.yml
347
328
  - test/test_app/package.json
348
329
  - test/test_app/public/packs/manifest.json
330
+ - test/test_app/some.config.js
349
331
  - test/test_app/yarn.lock
350
332
  - test/test_helper.rb
351
333
  - test/webpack_runner_test.rb
@@ -1,43 +0,0 @@
1
- language: ruby
2
- dist: xenial
3
- before_install:
4
- - gem install rubygems-update && update_rubygems
5
- - yes | rvm @global do gem install bundler -v 2.1.4 || true
6
- rvm:
7
- - 2.4.9
8
- - 2.5.5
9
- - 2.6.5
10
- - 2.7.0
11
- - ruby-head
12
- gemfile:
13
- - gemfiles/Gemfile-rails.5.2.x
14
- - gemfiles/Gemfile-rails.6.0.x
15
- - gemfiles/Gemfile-rails-edge
16
- cache:
17
- bundler: true
18
- directories:
19
- - node_modules
20
- yarn: true
21
-
22
- install:
23
- - bundle install --jobs 3 --retry 3
24
- - nvm install 12
25
- - node -v
26
- - npm i -g yarn
27
- - yarn
28
- script:
29
- - yarn lint
30
- - yarn test
31
- - bundle exec rubocop
32
- - bundle exec rake test
33
- matrix:
34
- allow_failures:
35
- - gemfile: gemfiles/Gemfile-rails-edge
36
- - rvm: ruby-head
37
- exclude:
38
- - rvm: 2.4.9
39
- gemfile: gemfiles/Gemfile-rails-edge
40
- - rvm: 2.5.5
41
- gemfile: gemfiles/Gemfile-rails-edge
42
- - rvm: 2.4.9
43
- gemfile: gemfiles/Gemfile-rails.6.0.x
@@ -1,23 +0,0 @@
1
- require "webpacker/configuration"
2
-
3
- say "Copying angular example entry file to #{Webpacker.config.source_entry_path}"
4
- copy_file "#{__dir__}/examples/angular/hello_angular.js", "#{Webpacker.config.source_entry_path}/hello_angular.js"
5
-
6
- say "Copying hello_angular app to #{Webpacker.config.source_path}"
7
- directory "#{__dir__}/examples/angular/hello_angular", "#{Webpacker.config.source_path}/hello_angular"
8
-
9
- say "Installing all angular dependencies"
10
- run "yarn add core-js zone.js rxjs @angular/core @angular/common @angular/compiler @angular/platform-browser @angular/platform-browser-dynamic"
11
-
12
- if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR > 1
13
- say "You need to enable unsafe-eval rule.", :yellow
14
- say "This can be done in Rails 5.2+ for development environment in the CSP initializer", :yellow
15
- say "config/initializers/content_security_policy.rb with a snippet like this:", :yellow
16
- say "if Rails.env.development?", :yellow
17
- say " policy.script_src :self, :https, :unsafe_eval", :yellow
18
- say "else", :yellow
19
- say " policy.script_src :self, :https", :yellow
20
- say "end", :yellow
21
- end
22
-
23
- say "Webpacker now supports angular 🎉", :green
@@ -1,25 +0,0 @@
1
- require "webpacker/configuration"
2
-
3
- say "Copying coffee loader to config/webpack/loaders"
4
- copy_file "#{__dir__}/loaders/coffee.js", Rails.root.join("config/webpack/loaders/coffee.js").to_s
5
-
6
- say "Adding coffee loader to config/webpack/environment.js"
7
- insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
8
- "const coffee = require('./loaders/coffee')\n",
9
- after: /require\(('|")@rails\/webpacker\1\);?\n/
10
-
11
- insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
12
- "environment.loaders.prepend('coffee', coffee)\n",
13
- before: "module.exports"
14
-
15
- say "Updating webpack paths to include .coffee file extension"
16
- insert_into_file Webpacker.config.config_path, "- .coffee\n".indent(4), after: /\s+extensions:\n/
17
-
18
- say "Copying the example entry file to #{Webpacker.config.source_entry_path}"
19
- copy_file "#{__dir__}/examples/coffee/hello_coffee.coffee",
20
- "#{Webpacker.config.source_entry_path}/hello_coffee.coffee"
21
-
22
- say "Installing all Coffeescript dependencies"
23
- run "yarn add coffeescript@1.12.7 coffee-loader"
24
-
25
- say "Webpacker now supports Coffeescript 🎉", :green
@@ -1 +0,0 @@
1
- defaults
@@ -1,72 +0,0 @@
1
- module.exports = function(api) {
2
- var validEnv = ['development', 'test', 'production']
3
- var currentEnv = api.env()
4
- var isDevelopmentEnv = api.env('development')
5
- var isProductionEnv = api.env('production')
6
- var isTestEnv = api.env('test')
7
-
8
- if (!validEnv.includes(currentEnv)) {
9
- throw new Error(
10
- 'Please specify a valid `NODE_ENV` or ' +
11
- '`BABEL_ENV` environment variables. Valid values are "development", ' +
12
- '"test", and "production". Instead, received: ' +
13
- JSON.stringify(currentEnv) +
14
- '.'
15
- )
16
- }
17
-
18
- return {
19
- presets: [
20
- isTestEnv && [
21
- '@babel/preset-env',
22
- {
23
- targets: {
24
- node: 'current'
25
- }
26
- }
27
- ],
28
- (isProductionEnv || isDevelopmentEnv) && [
29
- '@babel/preset-env',
30
- {
31
- forceAllTransforms: true,
32
- useBuiltIns: 'entry',
33
- corejs: 3,
34
- modules: false,
35
- exclude: ['transform-typeof-symbol']
36
- }
37
- ]
38
- ].filter(Boolean),
39
- plugins: [
40
- 'babel-plugin-macros',
41
- '@babel/plugin-syntax-dynamic-import',
42
- isTestEnv && 'babel-plugin-dynamic-import-node',
43
- '@babel/plugin-transform-destructuring',
44
- [
45
- '@babel/plugin-proposal-class-properties',
46
- {
47
- loose: true
48
- }
49
- ],
50
- [
51
- '@babel/plugin-proposal-object-rest-spread',
52
- {
53
- useBuiltIns: true
54
- }
55
- ],
56
- [
57
- '@babel/plugin-transform-runtime',
58
- {
59
- helpers: false,
60
- regenerator: true,
61
- corejs: false
62
- }
63
- ],
64
- [
65
- '@babel/plugin-transform-regenerator',
66
- {
67
- async: false
68
- }
69
- ]
70
- ].filter(Boolean)
71
- }
72
- }
@@ -1,12 +0,0 @@
1
- module.exports = {
2
- plugins: [
3
- require('postcss-import'),
4
- require('postcss-flexbugs-fixes'),
5
- require('postcss-preset-env')({
6
- autoprefixer: {
7
- flexbox: 'no-2009'
8
- },
9
- stage: 3
10
- })
11
- ]
12
- }
@@ -1,3 +0,0 @@
1
- const { environment } = require('@rails/webpacker')
2
-
3
- module.exports = environment
@@ -1,39 +0,0 @@
1
- require "webpacker/configuration"
2
-
3
- say "Copying elm loader to config/webpack/loaders"
4
- copy_file "#{__dir__}/loaders/elm.js", Rails.root.join("config/webpack/loaders/elm.js").to_s
5
-
6
- say "Adding elm loader to config/webpack/environment.js"
7
- insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
8
- "const elm = require('./loaders/elm')\n",
9
- after: /require\(('|")@rails\/webpacker\1\);?\n/
10
-
11
- insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
12
- "environment.loaders.prepend('elm', elm)\n",
13
- before: "module.exports"
14
-
15
- say "Copying Elm example entry file to #{Webpacker.config.source_entry_path}"
16
- copy_file "#{__dir__}/examples/elm/hello_elm.js",
17
- "#{Webpacker.config.source_entry_path}/hello_elm.js"
18
-
19
- say "Copying Elm app file to #{Webpacker.config.source_path}"
20
- copy_file "#{__dir__}/examples/elm/Main.elm",
21
- "#{Webpacker.config.source_path}/Main.elm"
22
-
23
- say "Installing all Elm dependencies"
24
- run "yarn add elm elm-webpack-loader"
25
- run "yarn add --dev elm-hot-webpack-loader"
26
- run "yarn run elm init"
27
- run "yarn run elm make #{Webpacker.config.source_path}/Main.elm"
28
-
29
- say "Updating webpack paths to include .elm file extension"
30
- insert_into_file Webpacker.config.config_path, "- .elm\n".indent(4), after: /\s+extensions:\n/
31
-
32
- say "Updating Elm source location"
33
- gsub_file "elm.json", /\"src\"\n/,
34
- %("#{Webpacker.config.source_path.relative_path_from(Rails.root)}"\n)
35
-
36
- say "Updating .gitignore to include elm-stuff folder"
37
- insert_into_file ".gitignore", "/elm-stuff\n", before: "/node_modules\n"
38
-
39
- say "Webpacker now supports Elm 🎉", :green