You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -57,14 +57,24 @@ Each of these pieces can be skipped or installed independently either using
57
57
built in installers and generators, or manually as explained in the
58
58
following sections.
59
59
60
+
At this point, you're fully installed.
61
+
62
+
If you're installing into a new rails app, you can run bundle exec foreman start
63
+
to start the server, and "app" will display on the top left hand side of the page.
64
+
65
+
If you're installing into an existing Rails apps, you can run bundle exec foreman start
66
+
to start the server, and your app should funcion exactly as it always has. From here, you'll need to
67
+
[add a Hypercomponent](#<user-content-adding-a-single-component-to-your-application>)
68
+
to have Hyperstack funcionality.
69
+
60
70
## Summary of Installers and Generators
61
71
62
72
```
63
73
bundle exec ... # for best results always use bundle exec!
64
74
rails hyperstack:install # full system install
65
-
rails hyperstack:install:webpack-only # just add webpack
75
+
rails hyperstack:install:webpack # just add webpack
66
76
rails hyperstack:install:skip-webpack # all but webpack
67
-
rails hyperstack:install:hyper-model-only # just add hyper-model
77
+
rails hyperstack:install:hyper-model # just add hyper-model
68
78
rails hyperstack:install:skip-hyper-model # all but hyper-model
69
79
rails hyperstack:install:hotloader-only # just add the hotloader
70
80
rails hyperstack:install:skip-hotloader # skip the hotloader
@@ -98,8 +108,8 @@ rails g hyper:router CompName # adds a router component
98
108
# Note that hyperstack:install is the same as running:
99
109
100
110
rails g hyper:component App --add-route
101
-
rails hyperstack:install:webpack-only
102
-
rails hyperstack:install:hyper-model-only
111
+
rails hyperstack:install:webpack
112
+
rails hyperstack:install:hyper-model
103
113
rails hyperstack:install:hotloader-only
104
114
```
105
115
@@ -113,9 +123,9 @@ The following subdirectories are standard:
113
123
app/
114
124
...
115
125
hyperstack/
116
-
components/
117
-
models/
118
-
operations/
126
+
components/
127
+
models/
128
+
operations/
119
129
stores/
120
130
shared/
121
131
lib/
@@ -158,8 +168,8 @@ class HyperComponent
158
168
param_accessor_style :accessors
159
169
end
160
170
```
161
-
> Note: You can override the base class name using the `--base-class` switch:
162
-
> For example if you prefer ApplicationComponent rather than HyperComponent
171
+
> Note: You can override the base class name using the `--base-class` switch:
172
+
> For example if you prefer ApplicationComponent rather than HyperComponent
163
173
```bash
164
174
bundle exec rails g hyper:component Test --base-class=ApplicationComponent
165
175
```
@@ -200,7 +210,7 @@ and override the default layout
200
210
201
211
For example
202
212
```erb
203
-
<% render_component 'Dashboard', user: @user %>
213
+
<%= react_component 'Dashboard', user: @user %>
204
214
```
205
215
> Note that you may have several component trees mounted in a single page using the `render_component` helper. While this is not typical for a clean sheet Hyperstack design, it is useful when mixing Hyperstack with legacy applications.
206
216
@@ -253,7 +263,7 @@ various routing methods.
253
263
254
264
> Note that in a large app you may have several single page apps working together,
255
265
along with some legacy routes.
256
-
In such an application the router structure might look like this:
266
+
In such an application the router structure might look like this:
257
267
```ruby
258
268
Rails.application.routes.draw do
259
269
... # legacy routes
@@ -332,7 +342,7 @@ Webpacker uses manifests to determine how to package up assets. Hyperstack depe
332
342
>
333
343
> This means that page load time is comparable to any other Rails view, and that Rails can cache the pages like any other view.
334
344
>
335
-
> But to make this work packages that rely on the `browser` object cannot be used during prerendering. Well structured packages that depend on the `browser` object will have a way to run in the prerendering environment.
345
+
> But to make this work packages that rely on the `browser` object cannot be used during prerendering. Well structured packages that depend on the `browser` object will have a way to run in the prerendering environment.
336
346
337
347
These two files look like this and are placed in the `app/javascript/packs` directory:
338
348
```javascript
@@ -387,13 +397,13 @@ include them in the sprockets asset pipeline.
387
397
To add the packages using yarn run these commands:
388
398
389
399
```bash
390
-
yarn 'react', '16'
391
-
yarn 'react-dom', '16'
392
-
yarn 'react-router', '^5.0.0'
393
-
yarn 'react-router-dom', '^5.0.0'
394
-
yarn 'react_ujs', '^2.5.0'
400
+
yarn add react@16
401
+
yarn add react-dom@16
402
+
yarn add react-router@^5.0.0
403
+
yarn add react-router-dom@^5.0.0
404
+
yarn add react_ujs@^2.5.0
405
+
yarn add jquery@^3.4.1
395
406
```
396
-
397
407
And then add a `cancel_import` directive to the `hyperstack.rb` initializer in your the Rails `config/initializers` directory:
398
408
399
409
```ruby
@@ -464,7 +474,7 @@ policies for legacy parts of your system.
464
474
465
475
#### Moving the `application_record.rb` File.
466
476
467
-
Once you have a basic Policy defined the client can access your Rails models. For your ActiveRecord model class definitions to be visible on the client you need to move them to the `app/hyperstack/models` directory. This directory (along with `app/hyperstack/operations` and `app/hyperstack/shared`) are *isomorphic* directories. The code in these directories will be accessible on both the client and the server.
477
+
Once you have a basic Policy defined the client can access your Rails models. For your ActiveRecord model class definitions to be visible on the client you need to move them to the `app/hyperstack/models` directory. This directory (along with `app/hyperstack/operations` and `app/hyperstack/shared`) are *isomorphic* directories. The code in these directories will be accessible on both the client and the server.
468
478
> Moving the files is necessary both because of the way Rails is structured, but its also very useful when evolving legacy systems to Hyperstack. Until a class
469
479
definition is moved to the `hyperstack/models` directory it will be ignored by Hyperstack.
0 commit comments