From 45474a8c033341f2596939ff2fe1a3d290340b75 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Sat, 9 Mar 2024 08:28:36 +1300 Subject: [PATCH] feat!: remove `https` option (#414) --- CHANGELOG.md | 2 ++ lib/shakapacker/dev_server.rb | 17 +---------------- spec/dummy/config/shakapacker.yml | 1 - .../mounted_app/test/dummy/config/webpacker.yml | 1 - spec/shakapacker/dev_server_spec.rb | 17 +---------------- spec/shakapacker/shakapacker_spec.rb | 1 - ...packer_css_extract_ignore_order_warnings.yml | 1 - .../config/shakapacker_manifest_path.yml | 1 - .../config/shakapacker_nested_entries.yml | 1 - .../config/shakapacker_other_location.yml | 1 - 10 files changed, 4 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 933b004af..5fddb744c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ Changes since the last non-beta release. The usage of those has been deprecated in Shakapacker v7 and now fully removed in v8. See the [v7 Upgrade Guide](./docs/v7_upgrade.md) for more information if you are still yet to address this deprecation. +- Remove `https` option for `webpack-dev-server` [PR 414](https://github.com/shakacode/shakapacker/pull/414) by [G-Rath](https://github.com/g-rath). + - Drop support for Ruby 2.6 [PR 415](https://github.com/shakacode/shakapacker/pull/415) by [G-Rath](https://github.com/g-rath). ## [v7.2.3] - March 23, 2024 diff --git a/lib/shakapacker/dev_server.rb b/lib/shakapacker/dev_server.rb index a1af51292..bf64c175b 100644 --- a/lib/shakapacker/dev_server.rb +++ b/lib/shakapacker/dev_server.rb @@ -30,21 +30,6 @@ def port fetch(:port) end - def https? - value = fetch(:https) - - unless value.nil? - puts "WARNING: `https: true` has been deprecated in favor of `server: 'https'`" - end - - case value - when true, "true", Hash - true - else - false - end - end - def server server_value = fetch(:server) server_type = server_value.is_a?(Hash) ? server_value[:type] : server_value @@ -65,7 +50,7 @@ def server end def protocol - return "https" if server == "https" || https? == true + return "https" if server == "https" "http" end diff --git a/spec/dummy/config/shakapacker.yml b/spec/dummy/config/shakapacker.yml index 43ae61bcf..0081eaeb3 100644 --- a/spec/dummy/config/shakapacker.yml +++ b/spec/dummy/config/shakapacker.yml @@ -22,7 +22,6 @@ development: # Reference: https://webpack.js.org/configuration/dev-server/ dev_server: - https: false host: localhost port: 3035 # Hot Module Replacement updates modules while the application is running without a full reload diff --git a/spec/mounted_app/test/dummy/config/webpacker.yml b/spec/mounted_app/test/dummy/config/webpacker.yml index 4de9764cb..a1466d2cd 100644 --- a/spec/mounted_app/test/dummy/config/webpacker.yml +++ b/spec/mounted_app/test/dummy/config/webpacker.yml @@ -36,7 +36,6 @@ development: # Reference: https://webpack.js.org/configuration/dev-server/ dev_server: - https: false host: localhost port: 3035 public: localhost:3035 diff --git a/spec/shakapacker/dev_server_spec.rb b/spec/shakapacker/dev_server_spec.rb index 42710859e..5ba8644d1 100644 --- a/spec/shakapacker/dev_server_spec.rb +++ b/spec/shakapacker/dev_server_spec.rb @@ -17,12 +17,6 @@ end end - it "doesn't use https in development environment" do - with_rails_env("development") do - expect(Shakapacker.dev_server.https?).to be false - end - end - it "uses http protocol in development environment" do with_rails_env("development") do expect(Shakapacker.dev_server.protocol).to eq "http" @@ -48,7 +42,7 @@ context "#protocol in development environment" do let(:dev_server) { Shakapacker.dev_server } - it "returns `http` by default (with unset `server` and `https`)" do + it "returns `http` by default (with unset `server`)" do with_rails_env("development") do expect(dev_server.protocol).to eq "http" end @@ -61,15 +55,6 @@ expect(dev_server.protocol).to eq "https" end end - - it "returns `https` with unset `server` and `https` set to `true`" do - expect(dev_server).to receive(:server).and_return("http") - expect(dev_server).to receive(:https?).and_return(true) - - with_rails_env("development") do - expect(dev_server.protocol).to eq "https" - end - end end context "#server in development environment" do diff --git a/spec/shakapacker/shakapacker_spec.rb b/spec/shakapacker/shakapacker_spec.rb index 692d6b236..96c5ba806 100644 --- a/spec/shakapacker/shakapacker_spec.rb +++ b/spec/shakapacker/shakapacker_spec.rb @@ -8,7 +8,6 @@ allow(dev_server).to receive(:host).and_return("localhost") allow(dev_server).to receive(:port).and_return("3035") allow(dev_server).to receive(:pretty?).and_return(false) - allow(dev_server).to receive(:https?).and_return(true) allow(dev_server).to receive(:running?).and_return(true) end diff --git a/spec/shakapacker/test_app/config/shakapacker_css_extract_ignore_order_warnings.yml b/spec/shakapacker/test_app/config/shakapacker_css_extract_ignore_order_warnings.yml index b73770516..d8e8d2a15 100644 --- a/spec/shakapacker/test_app/config/shakapacker_css_extract_ignore_order_warnings.yml +++ b/spec/shakapacker/test_app/config/shakapacker_css_extract_ignore_order_warnings.yml @@ -45,7 +45,6 @@ development: # Reference: https://webpack.js.org/configuration/dev-server/ dev_server: - https: false host: localhost port: 3035 public: localhost:3035 diff --git a/spec/shakapacker/test_app/config/shakapacker_manifest_path.yml b/spec/shakapacker/test_app/config/shakapacker_manifest_path.yml index f6262181d..3897c7a93 100644 --- a/spec/shakapacker/test_app/config/shakapacker_manifest_path.yml +++ b/spec/shakapacker/test_app/config/shakapacker_manifest_path.yml @@ -41,7 +41,6 @@ development: # Reference: https://webpack.js.org/configuration/dev-server/ dev_server: - https: false host: localhost port: 3035 public: localhost:3035 diff --git a/spec/shakapacker/test_app/config/shakapacker_nested_entries.yml b/spec/shakapacker/test_app/config/shakapacker_nested_entries.yml index 52f091ac9..55db7e5e8 100644 --- a/spec/shakapacker/test_app/config/shakapacker_nested_entries.yml +++ b/spec/shakapacker/test_app/config/shakapacker_nested_entries.yml @@ -44,7 +44,6 @@ development: # Reference: https://webpack.js.org/configuration/dev-server/ dev_server: - https: false host: localhost port: 3035 public: localhost:3035 diff --git a/spec/shakapacker/test_app/config/shakapacker_other_location.yml b/spec/shakapacker/test_app/config/shakapacker_other_location.yml index 5d972ea8b..d8726a872 100644 --- a/spec/shakapacker/test_app/config/shakapacker_other_location.yml +++ b/spec/shakapacker/test_app/config/shakapacker_other_location.yml @@ -38,7 +38,6 @@ development: # Reference: https://webpack.js.org/configuration/dev-server/ dev_server: - https: false host: localhost port: 3035 public: localhost:3035