ember-cli-rails 0.13.0 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/README.md +20 -1
- data/app/helpers/ember_rails_helper.rb +7 -1
- data/lib/ember_cli/app.rb +21 -2
- data/lib/ember_cli/errors.rb +1 -0
- data/lib/ember_cli/route_helpers.rb +1 -1
- data/lib/ember_cli/runner.rb +3 -1
- data/lib/ember_cli/shell.rb +1 -1
- data/lib/ember_cli/version.rb +1 -1
- data/lib/ember_cli.rb +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '01934a2a5a3ef903507625bbb0f2d3f7ad9d3bc80e026b2b127814d0c43e3945'
|
|
4
|
+
data.tar.gz: 3b03f7954e570fa28a5def013795b75541aa2e64b7bf81698936b91ad636fed4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 24d38e8a374602833f3955354b8aea2056d97f2f20da42926f9de96fd2b16da768833364211b9f3a0518a9c6ce51637ca94636a0675f9380d53f784395cf2b93
|
|
7
|
+
data.tar.gz: c12ff4d4cb60463d50ad52e1be2c68bf3a9b0e89bc5f7caceabba76fcb65cee4ff3b3cafff6ea0ab7db1a9c5427e821a40c30863890abfa81ab481e76f6540d8
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
0.13.2
|
|
2
|
+
------
|
|
3
|
+
|
|
4
|
+
* Raise `EmberCli::BuildError` when `ember build` or a dependency
|
|
5
|
+
installation fails, instead of exiting the process from inside the gem —
|
|
6
|
+
`rake ember:compile` and `rake ember:install` still exit nonzero
|
|
7
|
+
* Remap the root-relative asset URLs in a Vite build's `index.html` onto the
|
|
8
|
+
mount point when `mount_ember_app` serves the application from a path other
|
|
9
|
+
than `/`, so non-root mounts work without a matching `rootURL`
|
|
10
|
+
|
|
11
|
+
0.13.1
|
|
12
|
+
------
|
|
13
|
+
|
|
14
|
+
* Fix `EmberCli::App#test` to report a failing suite by returning `false`
|
|
15
|
+
instead of exiting the process from inside the gem — one failing Ember suite
|
|
16
|
+
no longer aborts the caller (RSpec included) mid-run. `EmberCli.test!`
|
|
17
|
+
raises `EmberCli::TestFailureError` when a suite fails, which still exits
|
|
18
|
+
`rake ember:test` nonzero
|
|
19
|
+
|
|
1
20
|
0.13.0
|
|
2
21
|
------
|
|
3
22
|
|
data/README.md
CHANGED
|
@@ -142,6 +142,7 @@ end
|
|
|
142
142
|
For instance, mounting `mount_ember_app :frontend, to: "/frontend"` will handle a
|
|
143
143
|
`format: :html` request to `/frontend/posts`.
|
|
144
144
|
*Note:* If you specify a custom path, you must also update the `rootURL` in `frontend/config/environment.js`. See [Mounting multiple Ember applications](#mounting-multiple-ember-applications) for more information.
|
|
145
|
+
*Note:* Requests without `Accept: text/html` — `curl`'s default, most health checkers — skip this route and receive the raw `index.html` from the asset handler.
|
|
145
146
|
* `controller` - Defaults to `"ember_cli/ember"`
|
|
146
147
|
* `action` - Defaults to `"index"`
|
|
147
148
|
|
|
@@ -195,6 +196,8 @@ Rails still renders the application's `index.html`, but reads it from the
|
|
|
195
196
|
development server rather than from disk. The root-relative URLs in that
|
|
196
197
|
document are rewritten to point at the development server, so the browser
|
|
197
198
|
loads the application's modules — and Vite's HMR client — from it directly.
|
|
199
|
+
The rewriting covers every tag the server emits: Vite externalizes even the
|
|
200
|
+
document's inline bootstrapping script.
|
|
198
201
|
Changes to the Ember application are hot-reloaded without reloading the page,
|
|
199
202
|
and without restarting Rails.
|
|
200
203
|
|
|
@@ -238,6 +241,11 @@ end
|
|
|
238
241
|
With `host: "0.0.0.0"`, Rails itself reaches the development server through the
|
|
239
242
|
loopback interface.
|
|
240
243
|
|
|
244
|
+
Vite's default CORS setting allows localhost origins only: to open the page on
|
|
245
|
+
a LAN IP or a custom domain, configure
|
|
246
|
+
[`server.cors`](https://vite.dev/config/server-options#server-cors) in
|
|
247
|
+
`vite.config.*`.
|
|
248
|
+
|
|
241
249
|
The development server's output is written to
|
|
242
250
|
`log/ember-<app>.<environment>.log`.
|
|
243
251
|
|
|
@@ -469,6 +477,9 @@ helper in your view:
|
|
|
469
477
|
The `body` block argument and the corresponding call to `body.append` in the
|
|
470
478
|
example are both optional, and can be omitted.
|
|
471
479
|
|
|
480
|
+
`render_ember_app` emits a complete HTML document, so render it with the
|
|
481
|
+
layout disabled (see below).
|
|
482
|
+
|
|
472
483
|
### Serving Rails-generated CSS
|
|
473
484
|
|
|
474
485
|
For more information on how to work with EmberCLI-generated stylesheets, refer
|
|
@@ -591,7 +602,15 @@ Rails.application.routes.draw do
|
|
|
591
602
|
end
|
|
592
603
|
```
|
|
593
604
|
|
|
594
|
-
|
|
605
|
+
The `index.html` of a Vite build refers to its assets with root-relative URLs.
|
|
606
|
+
When the application is served from the build output, `mount_ember_app` remaps
|
|
607
|
+
those references onto the mount point, where the assets are served — references
|
|
608
|
+
that already carry the mount point, from a `rootURL` configured to match it,
|
|
609
|
+
are left alone. Development-server-backed applications are unaffected: their
|
|
610
|
+
asset URLs point at the development server absolutely.
|
|
611
|
+
|
|
612
|
+
For classic (Broccoli-based) applications, set each Ember application's
|
|
613
|
+
`rootURL` to the mount point:
|
|
595
614
|
|
|
596
615
|
```javascript
|
|
597
616
|
// frontend/config/environment.js
|
|
@@ -8,6 +8,12 @@ module EmberRailsHelper
|
|
|
8
8
|
|
|
9
9
|
head, body = markup_capturer.capture
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
index_html = EmberCli[name].index_html(
|
|
12
|
+
head: head,
|
|
13
|
+
body: body,
|
|
14
|
+
mount_point: params[:ember_mount_point],
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
render html: index_html.html_safe
|
|
12
18
|
end
|
|
13
19
|
end
|
data/lib/ember_cli/app.rb
CHANGED
|
@@ -63,11 +63,11 @@ module EmberCli
|
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
-
def index_html(head:, body:)
|
|
66
|
+
def index_html(head:, body:, mount_point: nil)
|
|
67
67
|
html = HtmlPage::Renderer.new(
|
|
68
68
|
head: head,
|
|
69
69
|
body: body,
|
|
70
|
-
content: deploy.index_html,
|
|
70
|
+
content: remap_to_mount_point(deploy.index_html, mount_point),
|
|
71
71
|
)
|
|
72
72
|
|
|
73
73
|
html.render
|
|
@@ -131,6 +131,25 @@ module EmberCli
|
|
|
131
131
|
env.to_s == "test"
|
|
132
132
|
end
|
|
133
133
|
|
|
134
|
+
# The `index.html` of a Vite build refers to its assets with root-relative
|
|
135
|
+
# URLs. When the application is mounted somewhere other than `/`, remap
|
|
136
|
+
# them onto the mount point, where `mount_ember_assets` serves them.
|
|
137
|
+
# References that already carry the mount point — a `rootURL` configured
|
|
138
|
+
# to match it — are left alone.
|
|
139
|
+
def remap_to_mount_point(html, mount_point)
|
|
140
|
+
prefix = mount_point.to_s.chomp("/")
|
|
141
|
+
|
|
142
|
+
if prefix.empty? || !paths.vite?
|
|
143
|
+
return html
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
already_mounted = Regexp.escape(prefix.delete_prefix("/"))
|
|
147
|
+
|
|
148
|
+
html.gsub(%r{(\s)(src|href)=(["'])/(?!/)(?!#{already_mounted}/)}i) do
|
|
149
|
+
"#{$1}#{$2}=#{$3}#{prefix}/"
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
134
153
|
def deploy
|
|
135
154
|
deploy_strategy.new(self)
|
|
136
155
|
end
|
data/lib/ember_cli/errors.rb
CHANGED
data/lib/ember_cli/runner.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
require "open3"
|
|
2
2
|
|
|
3
|
+
require "ember_cli/errors"
|
|
4
|
+
|
|
3
5
|
module EmberCli
|
|
4
6
|
class Runner
|
|
5
7
|
def initialize(out:, err:, env: {}, options: {})
|
|
@@ -25,7 +27,7 @@ module EmberCli
|
|
|
25
27
|
def run!(command)
|
|
26
28
|
run(command).tap do |status|
|
|
27
29
|
unless status.success?
|
|
28
|
-
|
|
30
|
+
fail BuildError, "`#{command}` failed with status #{status.exitstatus}"
|
|
29
31
|
end
|
|
30
32
|
end
|
|
31
33
|
end
|
data/lib/ember_cli/shell.rb
CHANGED
data/lib/ember_cli/version.rb
CHANGED
data/lib/ember_cli.rb
CHANGED