breezy 0.15.0 → 0.18.1

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
  SHA256:
3
- metadata.gz: e9400844dcf51065a2b0fd72e55f9813a9d3c0e7ad6ff947f7944db6c9e009d0
4
- data.tar.gz: 6e0fa8b1140dec3660bfcacfcf148c91b9d0d094fbba0d0fbf4803f25a6cbf33
3
+ metadata.gz: f5407b99c417dc88944a8c1bf68fe6bda73a072ee43f25c1a45995d9545f97b2
4
+ data.tar.gz: 91354f50156543100d7f3add14668b9d1b8d324fa01c4207f6f0c87c863e7dfa
5
5
  SHA512:
6
- metadata.gz: 9fe9fc7f8b1edb98f34112d1447d99a56bd4ce825feb4594622609bebead8e504deb3ba15c28a4de9bc8db24f7e0f7447fb04f29b391c8af4f2bbdfae36f7f9a
7
- data.tar.gz: 16d79e3e4754bec10601b2a04200691f1e8b1379c3e14f6232796b942bfa96658f623d2f98f3515a3ce3545bd493ac7664278347fb100e875df000c71d9b42f8
6
+ metadata.gz: 449612b076ee7c7226ea368156901725f2736383054c3bef5b8bc103457e6aec4d2921013281d908ea49fa8ffc5d35226789aac47fb9c3e4ac8439ca98791ecb
7
+ data.tar.gz: 9d4e775dd2f41a0008bd3a5a8dd0f66032c68f4bc1e3321b3377fe8ae3c7bbcccb3c9a47449b3ec164fc2bab8687a8291a5bf568367847e9325ee3db89329d76
@@ -1,40 +1,31 @@
1
1
  import React from 'react'
2
- import {mapStateToProps, mapDispatchToProps} from '@jho406/breezy'
3
- import {connect} from 'react-redux'
4
- import RailsTag from '@jho406/breezy/dist/RailsTag'
5
- import * as applicationActionCreators from 'javascript/packs/action_creators'
2
+ import RailsTag from '@jho406/breezy/components/RailsTag'
3
+ // import * as actionCreators from 'javascript/packs/action_creators'
4
+ // import {useDispatch} from 'react-redux'
6
5
 
7
- class <%= plural_table_name.camelize %>Edit extends React.Component {
8
- render () {
9
- const {
10
- form,
11
- flash,
12
- <%= singular_table_name.camelize(:lower) %>Path,
13
- <%= plural_table_name.camelize(:lower) %>Path,
14
- } = this.props
15
- const error = flash.form_error
6
+ export default function <%= plural_table_name.camelize %>Edit ({
7
+ // visit,
8
+ // remote,
9
+ form,
10
+ flash,
11
+ <%= singular_table_name.camelize(:lower) %>Path,
12
+ <%= plural_table_name.camelize(:lower) %>Path,
13
+ }) {
14
+ const error = flash.form_error
16
15
 
17
- const messagesEl = error && (
18
- <div id="error_explanation">
19
- <h2>{ error.explanation }</h2>
20
- <ul>{ error.messages.map(({body})=> <li key={body}>{body}</li>) }</ul>
21
- </div>
22
- )
16
+ const messagesEl = error && (
17
+ <div id="error_explanation">
18
+ <h2>{ error.explanation }</h2>
19
+ <ul>{ error.messages.map(({body})=> <li key={body}>{body}</li>) }</ul>
20
+ </div>
21
+ )
23
22
 
24
- return (
25
- <div>
26
- {messagesEl}
27
- <RailsTag {...form} data-bz-visit={true}/>
28
- <a href={<%= singular_table_name.camelize(:lower) %>Path} data-bz-visit={true}>Show</a>
29
- <a href={<%= plural_table_name.camelize(:lower) %>Path} data-bz-visit={true}>Back</a>
30
- </div>
31
- )
32
- }
23
+ return (
24
+ <div>
25
+ {messagesEl}
26
+ <RailsTag {...form} data-bz-visit={true}/>
27
+ <a href={<%= singular_table_name.camelize(:lower) %>Path} data-bz-visit={true}>Show</a>
28
+ <a href={<%= plural_table_name.camelize(:lower) %>Path} data-bz-visit={true}>Back</a>
29
+ </div>
30
+ )
33
31
  }
34
-
35
- export default connect(
36
- mapStateToProps,
37
- {...mapDispatchToProps, ...applicationActionCreators}
38
- )(<%= plural_table_name.camelize %>Edit)
39
-
40
-
@@ -1,59 +1,49 @@
1
1
  import React from 'react'
2
- import {mapStateToProps, mapDispatchToProps} from '@jho406/breezy'
3
- import { connect } from 'react-redux'
4
-
5
- class <%= plural_table_name.camelize %>Index extends React.Component {
6
- static defaultProps = {
7
- <%= plural_table_name.camelize(:lower) %>: []
8
- }
9
-
10
- render () {
11
- const {
12
- flash,
13
- new<%= singular_table_name.camelize %>Path,
14
- } = this.props
15
- const <%= singular_table_name.camelize(:lower) %>Items = this.props.<%= plural_table_name.camelize(:lower) %>.map((<%= singular_table_name.camelize(:lower) %>, key) => {
16
- return (
17
- <tr key={<%= singular_table_name.camelize(:lower) %>.id}>
18
- <%- attributes_list.select{|attr| attr != :id }.each do |attr| -%>
19
- <td>{<%=singular_table_name.camelize(:lower)%>.<%=attr.camelize(:lower)%>}</td>
20
- <%- end -%>
21
- <td><a href={ <%=singular_table_name%>.<%=singular_table_name.camelize(:lower)%>Path } data-bz-visit={true}>Show</a></td>
22
- <td><a href={ <%=singular_table_name%>.edit<%=singular_table_name.camelize%>Path } data-bz-visit={true}>Edit</a></td>
23
- <td><a href={ <%=singular_table_name%>.delete<%=singular_table_name.camelize%>Path }data-bz-visit={true} data-bz-method={"DELETE"}>Delete</a></td>
24
- </tr>
25
- )
26
- })
27
-
2
+ // import * as actionCreators from 'javascript/packs/action_creators'
3
+ // import {useDispatch} from 'react-redux'
4
+
5
+ export default function <%= plural_table_name.camelize %>Index({
6
+ // visit,
7
+ // remote,
8
+ flash,
9
+ new<%= singular_table_name.camelize %>Path,
10
+ <%= plural_table_name.camelize(:lower) %> = [],
11
+ }) {
12
+ const <%= singular_table_name.camelize(:lower) %>Items = <%= plural_table_name.camelize(:lower) %>.map((<%= singular_table_name.camelize(:lower) %>, key) => {
28
13
  return (
29
- <div>
30
- <p id="notice">{flash.notice}</p>
14
+ <tr key={<%= singular_table_name.camelize(:lower) %>.id}>
15
+ <%- attributes_list.select{|attr| attr != :id }.each do |attr| -%>
16
+ <td>{<%=singular_table_name.camelize(:lower)%>.<%=attr.camelize(:lower)%>}</td>
17
+ <%- end -%>
18
+ <td><a href={ <%=singular_table_name%>.<%=singular_table_name.camelize(:lower)%>Path } data-bz-visit={true}>Show</a></td>
19
+ <td><a href={ <%=singular_table_name%>.edit<%=singular_table_name.camelize%>Path } data-bz-visit={true}>Edit</a></td>
20
+ <td><a href={ <%=singular_table_name%>.delete<%=singular_table_name.camelize%>Path }data-bz-visit={true} data-bz-method={"DELETE"}>Delete</a></td>
21
+ </tr>
22
+ )
23
+ })
31
24
 
32
- <h1><%= plural_table_name.capitalize %></h1>
25
+ return (
26
+ <div>
27
+ <p id="notice">{flash.notice}</p>
33
28
 
34
- <table>
35
- <thead>
36
- <%- attributes_list.select{|attr| attr != :id }.each do |attr| -%>
37
- <tr><th><%=attr.capitalize%></th></tr>
38
- <%- end -%>
39
- <tr>
40
- <th colSpan="3"></th>
41
- </tr>
42
- </thead>
29
+ <h1><%= plural_table_name.capitalize %></h1>
43
30
 
44
- <tbody>
45
- {<%= singular_table_name %>Items}
46
- </tbody>
47
- </table>
48
- <br />
49
- <a href={new<%= singular_table_name.camelize %>Path} data-bz-visit={true}>New <%= singular_table_name.capitalize %></a>
50
- </div>
51
- )
52
- }
31
+ <table>
32
+ <thead>
33
+ <%- attributes_list.select{|attr| attr != :id }.each do |attr| -%>
34
+ <tr><th><%=attr.capitalize%></th></tr>
35
+ <%- end -%>
36
+ <tr>
37
+ <th colSpan="3"></th>
38
+ </tr>
39
+ </thead>
40
+
41
+ <tbody>
42
+ {<%= singular_table_name %>Items}
43
+ </tbody>
44
+ </table>
45
+ <br />
46
+ <a href={new<%= singular_table_name.camelize %>Path} data-bz-visit={true}>New <%= singular_table_name.capitalize %></a>
47
+ </div>
48
+ )
53
49
  }
54
-
55
- export default connect(
56
- mapStateToProps,
57
- mapDispatchToProps
58
- )(<%= plural_table_name.camelize %>Index)
59
-
@@ -1,37 +1,29 @@
1
1
  import React from 'react'
2
- import {mapStateToProps, mapDispatchToProps} from '@jho406/breezy'
3
- import {connect} from 'react-redux'
4
- import RailsTag from '@jho406/breezy/dist/RailsTag'
5
- import * as applicationActionCreators from 'javascript/packs/action_creators'
2
+ import RailsTag from '@jho406/breezy/components/RailsTag'
3
+ // import * as actionCreators from 'javascript/packs/action_creators'
4
+ // import { useDispatch } from 'react-redux'
6
5
 
7
- class <%= plural_table_name.camelize %>New extends React.Component {
8
- render () {
9
- const {
10
- form,
11
- flash,
12
- <%= plural_table_name.camelize(:lower) %>Path,
13
- } = this.props
14
- const error = flash.form_error
6
+ export default function <%= plural_table_name.camelize %>New({
7
+ // visit,
8
+ // remote
9
+ form,
10
+ flash,
11
+ <%= plural_table_name.camelize(:lower) %>Path,
12
+ }) {
13
+ const error = flash.form_error
15
14
 
16
- const messagesEl = error && (
17
- <div id="error_explanation">
18
- <h2>{ error.explanation }</h2>
19
- <ul>{ error.messages.map(({body})=> <li key={body}>{body}</li>) }</ul>
20
- </div>
21
- )
15
+ const messagesEl = error && (
16
+ <div id="error_explanation">
17
+ <h2>{ error.explanation }</h2>
18
+ <ul>{ error.messages.map(({body})=> <li key={body}>{body}</li>) }</ul>
19
+ </div>
20
+ )
22
21
 
23
- return (
24
- <div>
25
- {messagesEl}
26
- <RailsTag {...this.props.form} data-bz-visit={true}/>
27
- <a href={<%= plural_table_name.camelize(:lower) %>Path} data-bz-visit={true}>Back</a>
28
- </div>
29
- )
30
- }
22
+ return (
23
+ <div>
24
+ {messagesEl}
25
+ <RailsTag {...form} data-bz-visit={true}/>
26
+ <a href={<%= plural_table_name.camelize(:lower) %>Path} data-bz-visit={true}>Back</a>
27
+ </div>
28
+ )
31
29
  }
32
-
33
- export default connect(
34
- mapStateToProps,
35
- {...mapDispatchToProps, ...applicationActionCreators}
36
- )(<%= plural_table_name.camelize %>New)
37
-
@@ -1,27 +1,28 @@
1
1
  import React from 'react'
2
- import {mapStateToProps, mapDispatchToProps} from '@jho406/breezy'
3
- import { connect } from 'react-redux'
2
+ // import * as actionCreators from 'javascript/packs/action_creators'
3
+ // import {useDispatch} from 'react-redux'
4
4
 
5
- class <%= plural_table_name.camelize %>Show extends React.Component {
6
- render () {
7
- return (
8
- <div>
9
- <p id="notice">{this.props.flash && this.props.flash.notice}</p>
10
- <%- attributes_list_with_timestamps.select{|attr| attr != :id }.each do |attr| -%>
11
- <p>
12
- <strong><%= attr.capitalize %>:</strong>
13
- {this.props.<%=attr.camelize(:lower)%>}
14
- </p>
15
- <%- end -%>
16
- <a href={ this.props.edit<%= singular_table_name.camelize %>Path } data-bz-visit={true}>Edit</a>
17
- <a href={ this.props.<%= plural_table_name.camelize(:lower) %>Path } data-bz-visit={true}>Back</a>
18
- </div>
19
- )
20
- }
5
+ export default function <%= plural_table_name.camelize %>Show({
6
+ // visit,
7
+ // remote,
8
+ flash,
9
+ <%- attributes_list_with_timestamps.select{|attr| attr != :id }.each do |attr| -%>
10
+ <%=attr.camelize(:lower)%>,
11
+ <%- end -%>
12
+ edit<%= singular_table_name.camelize %>Path,
13
+ <%= plural_table_name.camelize(:lower) %>Path
14
+ }) {
15
+ return (
16
+ <div>
17
+ <p id="notice">{flash && flash.notice}</p>
18
+ <%- attributes_list_with_timestamps.select{|attr| attr != :id }.each do |attr| -%>
19
+ <p>
20
+ <strong><%= attr.capitalize %>:</strong>
21
+ {<%=attr.camelize(:lower)%>}
22
+ </p>
23
+ <%- end -%>
24
+ <a href={ edit<%= singular_table_name.camelize %>Path } data-bz-visit={true}>Edit</a>
25
+ <a href={ <%= plural_table_name.camelize(:lower) %>Path } data-bz-visit={true}>Back</a>
26
+ </div>
27
+ )
21
28
  }
22
-
23
- export default connect(
24
- mapStateToProps,
25
- mapDispatchToProps
26
- )(<%= plural_table_name.camelize %>Show)
27
-
@@ -1,115 +1,63 @@
1
- import React from 'react'
2
- import {combineReducers, createStore, applyMiddleware, compose} from 'redux'
3
- import reduceReducers from 'reduce-reducers'
4
- import thunk from 'redux-thunk'
5
- import { Provider } from 'react-redux'
6
- import { render } from 'react-dom'
7
- import { createBrowserHistory, createMemoryHistory } from 'history'
8
- import { start } from '@jho406/breezy'
9
- import Nav from '@jho406/breezy/dist/NavComponent'
10
- import ujsHandlers from '@jho406/breezy/dist/utils/ujs'
11
- import { persistStore, persistReducer } from 'redux-persist'
12
- import storage from 'redux-persist/lib/storage'
13
- import { applicationRootReducer, applicationPagesReducer } from './reducer'
14
- import { buildVisitAndRemote } from './application_visit'
15
-
16
- if(typeof window !== 'undefined' ) {
17
- document.addEventListener("DOMContentLoaded", function() {
18
- const appEl = document.getElementById('app')
19
- const location = window.location
1
+ import React from 'react';
2
+ import { combineReducers, createStore, applyMiddleware, compose } from 'redux';
3
+ import reduceReducers from 'reduce-reducers';
4
+ import thunk from 'redux-thunk';
5
+ import { Provider } from 'react-redux';
6
+ import { render } from 'react-dom';
7
+ import { ApplicationBase } from '@jho406/breezy';
8
+ import { persistStore, persistReducer } from 'redux-persist';
9
+ import storage from 'redux-persist/lib/storage';
10
+ import { applicationRootReducer, applicationPagesReducer } from './reducer';
11
+ import { buildVisitAndRemote } from './application_visit';
12
+
13
+ // Mapping between your props template to Component, you must add to this
14
+ // to register any new page level component you create. If you are using the
15
+ // scaffold, it will auto append the identifers for you.
16
+ //
17
+ // e.g {'posts/new': PostNew}
18
+ const identifierToComponentMapping = {
19
+ };
20
+
21
+ if (typeof window !== "undefined") {
22
+ document.addEventListener("DOMContentLoaded", function () {
23
+ const appEl = document.getElementById("app");
24
+ const location = window.location;
20
25
 
21
26
  if (appEl) {
22
27
  render(
23
28
  <Application
24
29
  appEl={appEl}
25
- // The base url is an optional prefix to all calls made by the `visit`
30
+ // The base url prefixed to all calls made by the `visit`
26
31
  // and `remote` thunks.
27
- baseUrl={''}
32
+ baseUrl={location.origin}
28
33
  // The global var BREEZY_INITIAL_PAGE_STATE is set by your erb
29
34
  // template, e.g., index.html.erb
30
35
  initialPage={window.BREEZY_INITIAL_PAGE_STATE}
31
36
  // The initial path of the page, e.g., /foobar
32
37
  path={location.pathname + location.search + location.hash}
33
- />, appEl)
38
+ buildVisitAndRemote={buildVisitAndRemote}
39
+ />,
40
+ appEl
41
+ );
34
42
  }
35
- })
43
+ });
36
44
  }
37
45
 
38
- export default class Application extends React.Component {
39
- constructor(props) {
40
- super(props)
41
- this.hasWindow = typeof window !== 'undefined'
42
-
43
- // Mapping between your props template to Component, you must add to this
44
- // to register any new page level component you create. If you are using the
45
- // scaffold, it will auto append the identifers for you.
46
- //
47
- // e.g {'posts/new': PostNew}
48
- this.identifierToComponentMapping = {
49
- }
50
-
51
- // Create a navigator Ref for UJS attributes and to enhance the base `visit`
52
- // and `visit` thunks
53
- this.navigatorRef = React.createRef()
54
-
55
- // Start Breezy and return an object to prepare the Redux store
56
- const breezy = start({
57
- initialPage: this.props.initialPage,
58
- baseUrl: this.props.baseUrl,
59
- path: this.props.path,
60
- fetch: this.hasWindow ? window.fetch : undefined,
61
- })
62
- this.breezy = breezy
63
-
64
- // Build the store and pass Breezy's provided reducer to be combined with
65
- // your reducers located at `application_reducer.js`
66
- const {initialState, reducer} = breezy
67
- this.store = this.buildStore(initialState, reducer)
68
-
69
- // Fire initial events and populate the store
70
- breezy.prepareStore(this.store)
71
-
72
- // Build visit and remote thunks
73
- // Your modified `visit` and `remote` will get passed below to the
74
- // NavComponent then to your components through the provided
75
- // mapDispatchToProps.
76
- //
77
- // You can access them via `this.props.visit` or `this.props.remote`. In
78
- // your page components
79
- const {visit, remote} = buildVisitAndRemote(this.navigatorRef, this.store)
80
- this.visit = visit
81
- this.remote = remote
82
- }
83
-
84
- componentDidMount() {
85
- const { appEl } = this.props
86
- // Create the ujs event handlers. You can change the ujsAttributePrefix
87
- // in the event the data attribute conflicts with another.
88
- this.ujsHandlers = ujsHandlers({
89
- visit: this.visit,
90
- remote: this.remote,
91
- store: this.store,
92
- ujsAttributePrefix: 'data-bz'
93
- })
94
- const {onClick, onSubmit} = this.ujsHandlers
95
-
96
- appEl.addEventListener('click', onClick)
97
- appEl.addEventListener('submit', onSubmit)
46
+ export default class Application extends ApplicationBase {
47
+ mapping() {
48
+ return identifierToComponentMapping;
98
49
  }
99
50
 
100
- componentWillUnmount() {
101
- const { appEl } = this.props
102
- const {onClick, onSubmit} = this.ujsHandlers
103
-
104
- appEl.removeEventListener('click', onClick)
105
- appEl.removeEventListener('submit', onSubmit)
106
- this.breezy.stop()
51
+ visitAndRemote(navRef, store) {
52
+ return buildVisitAndRemote(navRef, store);
107
53
  }
108
54
 
109
- buildStore(initialState, {breezy: breezyReducer, pages: pagesReducer}) {
55
+ buildStore(initialState, { breezy: breezyReducer, pages: pagesReducer }) {
110
56
  // Create the store
111
57
  // See `./reducer.js` for an explaination of the two included reducers
112
- const composeEnhancers = (this.hasWindow && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;
58
+ const composeEnhancers =
59
+ (this.hasWindow && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) ||
60
+ compose;
113
61
  const reducer = this.wrapWithPersistReducer(
114
62
  reduceReducers(
115
63
  combineReducers({
@@ -118,19 +66,19 @@ export default class Application extends React.Component {
118
66
  }),
119
67
  applicationRootReducer
120
68
  )
121
- )
69
+ );
122
70
  const store = createStore(
123
71
  reducer,
124
72
  initialState,
125
73
  composeEnhancers(applyMiddleware(thunk))
126
- )
74
+ );
127
75
 
128
- if(this.hasWindow) {
76
+ if (this.hasWindow) {
129
77
  // Persist the store using Redux-Persist
130
- persistStore(store)
78
+ persistStore(store);
131
79
  }
132
80
 
133
- return store
81
+ return store;
134
82
  }
135
83
 
136
84
  wrapWithPersistReducer(reducers) {
@@ -138,53 +86,29 @@ export default class Application extends React.Component {
138
86
  // The key is set to the stringified JS asset path to remove the need for
139
87
  // migrations when hydrating.
140
88
  if (!this.hasWindow) {
141
- return reducers
89
+ return reducers;
142
90
  }
143
- const prefix = 'breezy'
144
- const persistKey = prefix + this.props.initialPage.assets.filter( asset => asset.endsWith('.js')).join(",")
91
+ const prefix = "breezy";
92
+ const persistKey =
93
+ prefix +
94
+ this.props.initialPage.assets
95
+ .filter((asset) => asset.endsWith(".js"))
96
+ .join(",");
145
97
  const persistConfig = {
146
98
  key: persistKey,
147
99
  storage,
148
- }
100
+ };
149
101
 
150
102
  // Remove older storage items that were used by previous JS assets
151
103
  if (this.hasWindow) {
152
- const storedKeys = Object.keys(localStorage)
104
+ const storedKeys = Object.keys(localStorage);
153
105
  storedKeys.forEach((key) => {
154
106
  if (key.startsWith(`persist:${prefix}`) && key !== persistKey) {
155
- localStorage.removeItem(key)
107
+ localStorage.removeItem(key);
156
108
  }
157
- })
158
- }
159
-
160
- return persistReducer(persistConfig, reducers)
161
- }
162
-
163
- createHistory() {
164
- if(this.hasWindow) {
165
- // This is used for client side rendering
166
- return createBrowserHistory({})
167
- } else {
168
- // This is used for server side rendering
169
- return createMemoryHistory({})
109
+ });
170
110
  }
171
- }
172
-
173
- render() {
174
- const history = this.createHistory()
175
111
 
176
- // The Nav component is pretty bare and can be inherited from for custom
177
- // behavior or replaced with your own.
178
- return <Provider store={this.store}>
179
- <Nav
180
- store={this.store}
181
- ref={this.navigatorRef}
182
- visit={this.visit}
183
- remote={this.remote}
184
- mapping={this.identifierToComponentMapping}
185
- history={history}
186
- initialPageKey={this.breezy.initialPageKey}
187
- />
188
- </Provider>
112
+ return persistReducer(persistConfig, reducers);
189
113
  }
190
114
  }
@@ -1,4 +1,4 @@
1
- import { visit, remote } from '@jho406/breezy/dist/action_creators'
1
+ import { visit, remote } from '@jho406/breezy/action_creators'
2
2
 
3
3
  export function buildVisitAndRemote(ref, store) {
4
4
  const appRemote = (...args) => {
@@ -19,14 +19,9 @@ export function buildVisitAndRemote(ref, store) {
19
19
  return
20
20
  }
21
21
 
22
- // There can only be one visit at a time, if `canNavigate` is false,
23
- // then this request will be saved to the store but should be ignored
24
- // for a more recent visit.
25
- if (meta.canNavigate) {
26
- ref.current.navigateTo(meta.pageKey, {
27
- action: meta.suggestedAction,
28
- })
29
- }
22
+ ref.current.navigateTo(meta.pageKey, {
23
+ action: meta.suggestedAction,
24
+ })
30
25
  })
31
26
  .finally(() => {
32
27
  // Do something after
@@ -1,3 +1 @@
1
1
  require 'props_template/core_ext'
2
-
3
- Props.reset_encoder!
data/lib/install/web.rb CHANGED
@@ -56,10 +56,13 @@ say "Adding required member methods to ApplicationRecord"
56
56
  add_member_methods
57
57
 
58
58
  say "Installing React, Redux, and Breezy"
59
- run "yarn add babel-plugin-module-resolver babel-preset-react history@\"^4\" html-react-parser@\"^0.13\" prop-types react-redux redux-thunk redux redux-persist reduce-reducers react react-dom immer @jho406/breezy --save"
59
+ run "yarn add babel-plugin-module-resolver history@\"^4\" html-react-parser@\"^0.13\" react-redux redux-thunk redux redux-persist reduce-reducers immer @jho406/breezy --save"
60
60
 
61
61
  say "Updating webpack config to include .jsx file extension and resolved_paths"
62
- insert_into_file Webpacker.config.config_path, " - .jsx\n", after: /extensions:\n/
62
+ insert_into_file Webpacker.config.config_path, " - .jsx\n", after: /\bextensions:\n/
63
+ # For newer webpacker
64
+ insert_into_file Webpacker.config.config_path, "'app/views', 'app/components'", after: /additional_paths: \[/
65
+ # For older webpacker
63
66
  insert_into_file Webpacker.config.config_path, "'app/views', 'app/components'", after: /resolved_paths: \[/
64
67
 
65
68
  say "Webpacker now supports breezy.js 🎉", :green
@@ -15,7 +15,7 @@ namespace :breezy do
15
15
  package_json = JSON.parse(File.read(Rails.root.join("package.json")))
16
16
 
17
17
  if package_json['dependencies']['react'].nil?
18
- $stderr.puts "React not installed. Did you run `rails webpacker:install:react`?"
18
+ $stderr.puts "React not installed. Did you install React? https://github.com/rails/webpacker#react"
19
19
  $stderr.puts "Exiting!" && exit!
20
20
  end
21
21
  end
data/test/render_test.rb CHANGED
@@ -44,8 +44,6 @@ class RenderTest < ActionController::TestCase
44
44
 
45
45
 
46
46
  setup do
47
- Props.reset_encoder!
48
-
49
47
  if Rails.version >= '6'
50
48
  # In rails 6, the fixture orders the templates based on their appearance in the handler
51
49
  # This doesn't happen IRL, so I'm going to explicitly set the handler here.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breezy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johny Ho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-23 00:00:00.000000000 Z
11
+ date: 2021-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: props_template
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.15.0
33
+ version: 0.20.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.15.0
40
+ version: 0.20.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: webpacker
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  - !ruby/object:Gem::Version
211
211
  version: '0'
212
212
  requirements: []
213
- rubygems_version: 3.0.3
213
+ rubygems_version: 3.1.2
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: Rails integration for BreezyJS