breezy 0.11.0 → 0.12.0

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: aa0ba31629a150f6450ba7c8608bfa993cf94647
4
- data.tar.gz: 3720bc116d960eec527161dc35eb6968f0ca8a60
3
+ metadata.gz: 7d24f3b08babf09a78c371b15e95bcb9ca5cfc9d
4
+ data.tar.gz: 3a0d29c9e69c63a01270739dde64031e1b0e9c1c
5
5
  SHA512:
6
- metadata.gz: da76c5c33c3cb43302fc0ae8c79771700e052ec2f05169d1fb0d187dc49e06af528a386090c18f1e1f7065bd74a4fdaa43470b59386dd15ab03089a3e6878af7
7
- data.tar.gz: c03fb6c6271db1ce4ef6bf8b6ebb40cdaef2d9243b0ab70a4c80acc58c126d4b6cadf6c0e60acd5ae4762fef8ba344ae887bbe8e9b5b42d98bbf1e9a7815e6fa
6
+ metadata.gz: 80b0cd8e3d1ef6aff04d65d9ae5a48e7b3779ea64e0352a751a0105aa6d72da71b6a4727bbe1353fc1f117c3129364beba37e8a38909a43b79c3515244394bc1
7
+ data.tar.gz: 533d572c650638dfb39195ac9a302aad02c41ad956bb5ed0748e5ed05a885d4f74b8aa904d8981feaf7881834038748a07b8fed0cd389bce5c26ec7b54836021
@@ -31,12 +31,10 @@ module Breezy
31
31
  config.breezy = ActiveSupport::OrderedOptions.new
32
32
  config.breezy.auto_include = true
33
33
 
34
- if Rails::VERSION::MAJOR >= 4
35
- generators do |app|
36
- Rails::Generators.configure! app.config.generators
37
- Rails::Generators.hidden_namespaces.uniq!
38
- require 'generators/rails/scaffold_controller_generator'
39
- end
34
+ generators do |app|
35
+ Rails::Generators.configure! app.config.generators
36
+ Rails::Generators.hidden_namespaces.uniq!
37
+ require 'generators/rails/scaffold_controller_generator'
40
38
  end
41
39
 
42
40
  initializer :breezy do |app|
@@ -16,7 +16,7 @@ class <%= plural_table_name.camelize %>Edit extends BaseScreen {
16
16
  body: JSON.stringify(values),
17
17
  }
18
18
 
19
- this.enhancedVisit(this.props.<%= singular_table_name.camelize(:lower) %>, options).then( rsp => {
19
+ this.enhancedVisit(this.props.<%= singular_table_name.camelize(:lower) %>Path, options).then( rsp => {
20
20
  setSubmitting(false)
21
21
  if (this.props.errors) {
22
22
  this.formRef.current.setErrors(this.props.errors)
@@ -1,6 +1,15 @@
1
1
  require 'breezy_template/core_ext'
2
2
 
3
3
  Breezy.configure do |config|
4
- config.track_sprockets_assets = ['application.js', 'application.css']
4
+ # Configure breezy.js to refresh the browser when sprockets or
5
+ # webpacker asset fingerpint changes. This is similar to Turbolink's
6
+ # `data-turbolinks-track`.
7
+ #
8
+ # Note that this file was generated without sprockets JS tracking.
9
+ # If you need to change this behavior, add it like so:
10
+ #
11
+ # config.track_sprockets_assets = ['application.js', 'application.css']
12
+ config.track_sprockets_assets = ['application.css']
13
+
5
14
  config.track_pack_assets = ['application.js']
6
15
  end
@@ -1,6 +1,7 @@
1
1
  require "webpacker/configuration"
2
2
 
3
3
  babelrc = Rails.root.join(".babelrc")
4
+ babel_config = Rails.root.join("babel.config.js")
4
5
 
5
6
  def append_js_tags
6
7
  app_html = 'app/views/layouts/application.html.erb'
@@ -35,38 +36,40 @@ def add_member_methods
35
36
  end
36
37
  end
37
38
 
38
-
39
39
  if File.exist?(babelrc)
40
40
  react_babelrc = JSON.parse(File.read(babelrc))
41
41
  react_babelrc["presets"] ||= []
42
42
  react_babelrc["plugins"] ||= []
43
43
 
44
- if !react_babelrc["presets"].include?("react")
45
- react_babelrc["presets"].push("react")
46
- say "Copying react preset to your .babelrc file"
44
+ react_babelrc["plugins"].push(["module-resolver", {
45
+ "root": ["./app"],
46
+ "alias": {
47
+ "views": "./app/views",
48
+ "components": "./app/components",
49
+ "javascript": "./app/javascript"
50
+ }
51
+ }])
47
52
 
48
- File.open(babelrc, "w") do |f|
49
- f.puts JSON.pretty_generate(react_babelrc)
50
- end
51
- end
53
+ say "Copying module-resolver preset to your .babelrc file"
52
54
 
53
- if !react_babelrc["plugins"].any?{|plugin| Array(plugin).include?("module-resolver")}
54
- react_babelrc["plugins"].push(["module-resolver", {
55
- "root": ["./app"],
56
- "alias": {
57
- "views": "./app/views",
58
- "components": "./app/components",
59
- "javascript": "./app/javascript"
60
- }
61
- }])
62
-
63
- say "Copying module-resolver preset to your .babelrc file"
64
-
65
- File.open(babelrc, "w") do |f|
66
- f.puts JSON.pretty_generate(react_babelrc)
67
- end
55
+ File.open(babelrc, "w") do |f|
56
+ f.puts JSON.pretty_generate(react_babelrc)
68
57
  end
69
-
58
+ elsif File.exist?(babel_config)
59
+ say "Copying module-resolver preset to your babel.config.js"
60
+ resolver_snippet = <<~PLUGIN
61
+ [
62
+ require('babel-plugin-module-resolver').default, {
63
+ "root": ["./app"],
64
+ "alias": {
65
+ "views": "./app/views",
66
+ "components": "./app/components",
67
+ "javascript": "./app/javascript"
68
+ }
69
+ }
70
+ ],
71
+ PLUGIN
72
+ insert_into_file "babel.config.js", resolver_snippet, after: /plugins: \[\n/
70
73
  else
71
74
  say "Copying .babelrc to app root directory"
72
75
  copy_file "#{__dir__}/templates/web/babelrc", ".babelrc"
@@ -96,7 +99,8 @@ add_member_methods
96
99
  say "Installing React, Redux, and Breezy"
97
100
  run "yarn add babel-plugin-module-resolver babel-preset-react formik history prop-types react-redux redux-thunk redux reduce-reducers react react-dom immer @jho406/breezy --save"
98
101
 
99
- say "Updating webpack paths to include .jsx file extension"
102
+ say "Updating webpack config to include .jsx file extension and resolved_paths"
100
103
  insert_into_file Webpacker.config.config_path, " - .jsx\n", after: /extensions:\n/
104
+ insert_into_file Webpacker.config.config_path, "'app/views', 'app/components'", after: /resolved_paths: \[/
101
105
 
102
106
  say "Webpacker now supports breezy.js 🎉", :green
@@ -27,12 +27,6 @@ namespace :breezy do
27
27
  template = File.expand_path("../install/web.rb", __dir__)
28
28
  exec "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{template}"
29
29
  end
30
-
31
- desc "Install everything needed for breezy mobile"
32
- task 'mobile' => ["breezy:verify_yarn"] do
33
- template = File.expand_path("../install/mobile.rb", __dir__)
34
- exec "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{template}"
35
- end
36
30
  end
37
31
  end
38
32
 
@@ -47,6 +47,15 @@ class RenderTest < ActionController::TestCase
47
47
 
48
48
 
49
49
  setup do
50
+ if Rails.version >= '6'
51
+ # In rails 6, the fixture orders the templates based on their appearance in the handler
52
+ # This doesn't happen IRL, so I'm going to explicitly set the handler here.
53
+ #
54
+ # Note that the original is the following
55
+ # @controller.lookup_context.handlers = [:raw, :breezy, :erb, :js, :html, :builder, :ruby]
56
+ @controller.lookup_context.handlers = [:breezy, :erb]
57
+ end
58
+
50
59
  Breezy.configuration.track_sprockets_assets = ['app.js']
51
60
  Breezy.configuration.track_pack_assets = ['app.js']
52
61
  end
@@ -5,7 +5,7 @@ require 'action_controller'
5
5
  require 'breezy'
6
6
  require "active_support"
7
7
  require 'active_record'
8
- require 'active_support/testing/autorun' if Rails.version >= '4'
8
+ require 'active_support/testing/autorun'
9
9
  require 'active_support/test_case'
10
10
 
11
11
  require 'breezy_template'
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breezy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johny Ho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-08 00:00:00.000000000 Z
11
+ date: 2019-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: 5.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '5.0'
26
+ version: 5.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: breezy_template
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.11.0
33
+ version: 0.12.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.11.0
40
+ version: 0.12.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: webpacker
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activerecord
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '5.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '5.0'
69
69
  - !ruby/object:Gem::Dependency
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  version: '0'
212
212
  requirements: []
213
213
  rubyforge_project:
214
- rubygems_version: 2.5.2
214
+ rubygems_version: 2.6.11
215
215
  signing_key:
216
216
  specification_version: 4
217
217
  summary: Rails integration for BreezyJS