Skip to content

Commit bcbd98d

Browse files
committed
fix: replace config/routes.rb
1 parent 32db68a commit bcbd98d

File tree

2 files changed

+30
-31
lines changed

2 files changed

+30
-31
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Rails.application.routes.draw do
2+
# Workaround a "bug" in lighthouse CLI
3+
#
4+
# Lighthouse CLI (versions 5.4 - 5.6 tested) issues a `GET /asset-manifest.json`
5+
# request during its run - the URL seems to be hard-coded. This file does not
6+
# exist so, during tests, your test will fail because rails will die with a 404.
7+
#
8+
# Lighthouse run from Chrome Dev-tools does not have the same behaviour.
9+
#
10+
# This hack works around this. This behaviour might be fixed by the time you
11+
# read this. You can check by commenting out this block and running the
12+
# accessibility and performance tests. You are encouraged to remove this hack
13+
# as soon as it is no longer needed.
14+
if defined?(Shakapacker) && Rails.env.test?
15+
# manifest paths depend on your shakapacker config so we inspect it
16+
manifest_path = Shakapacker::Configuration
17+
.new(root_path: Rails.root, config_path: Rails.root.join("config/shakapacker.yml"), env: Rails.env)
18+
.public_manifest_path
19+
.relative_path_from(Rails.public_path)
20+
.to_s
21+
get "/asset-manifest.json", to: redirect(manifest_path)
22+
end
23+
24+
root "home#index"
25+
26+
mount OkComputer::Engine, at: "/healthchecks"
27+
28+
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
29+
end

variants/backend-base/config/template.rb

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,7 @@
2525
apply "variants/backend-base/config/environments/test.rb"
2626
template "variants/backend-base/config/environments/staging.rb.tt", "config/environments/staging.rb"
2727

28-
route <<~HEALTH_CHECK_ROUTES
29-
mount OkComputer::Engine, at: "/healthchecks"
30-
HEALTH_CHECK_ROUTES
31-
32-
route <<-EO_ROUTES
33-
##
34-
# Workaround a "bug" in lighthouse CLI
35-
#
36-
# Lighthouse CLI (versions 5.4 - 5.6 tested) issues a `GET /asset-manifest.json`
37-
# request during its run - the URL seems to be hard-coded. This file does not
38-
# exist so, during tests, your test will fail because rails will die with a 404.
39-
#
40-
# Lighthouse run from Chrome Dev-tools does not have the same behaviour.
41-
#
42-
# This hack works around this. This behaviour might be fixed by the time you
43-
# read this. You can check by commenting out this block and running the
44-
# accessibility and performance tests. You are encouraged to remove this hack
45-
# as soon as it is no longer needed.
46-
#
47-
if defined?(Shakapacker) && Rails.env.test?
48-
# manifest paths depend on your shakapacker config so we inspect it
49-
manifest_path = Shakapacker::Configuration
50-
.new(root_path: Rails.root, config_path: Rails.root.join("config/shakapacker.yml"), env: Rails.env)
51-
.public_manifest_path
52-
.relative_path_from(Rails.public_path)
53-
.to_s
54-
get "/asset-manifest.json", to: redirect(manifest_path)
55-
end
56-
57-
root "home#index"
58-
EO_ROUTES
28+
copy_file "variants/backend-base/config/routes.rb", "config/routes.rb", force: true
5929

6030
if File.exist? "config/storage.yml"
6131
gsub_file! "config/storage.yml", /# service: S3/ do

0 commit comments

Comments
 (0)