Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
Port changes from CLI 3 to CLI 2 (#2737)
Browse files Browse the repository at this point in the history
### WHY are these changes introduced?
Backports changes from CLI 3 to CLI 2, until CLI 2 is sunset.

### WHAT is this pull request doing?
Back-port from
* Shopify/cli#1568
  • Loading branch information
Julien Poitrin authored Mar 13, 2023
1 parent b5d3d2a commit 9df60a0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h

### Fixed
* [#2735](https://github.com/Shopify/shopify-cli/pull/2735): Remove theme directory confirmation during tests and make confirmation dialogue respect `SHOPIFY_CLI_TTY` (from cli#1369)
* [#2737](https://github.com/Shopify/shopify-cli/pull/2737): Do not inject hot-reload code into web-pixels-manager sandbox (from cli#1568)

### Added
* [#2735](https://github.com/Shopify/shopify-cli/pull/2735): Pass development theme from CLI 3’s to CLI 2’s local storage (from cli#1410)
Expand Down
2 changes: 1 addition & 1 deletion lib/shopify_cli/theme/dev_server/hot_reload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def request_is_html?(headers)
end

def leads_to_injectable_body?(path)
path !~ /web-pixels-manager.+sandbox/
path !~ /.+\/sandbox/
end

def inject_hot_reload_javascript(body)
Expand Down
12 changes: 12 additions & 0 deletions test/shopify-cli/theme/dev_server/hot_reload_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ def test_calls_reload_script_injector
assert_equal(correct_output, request.get("/").body)
end

def test_does_not_call_reload_script_injector_for_web_pixels_manager_sandbox
correct_output = "<html></html>"
app = lambda do |_env|
[200, { "content-type" => "text/html" }, [correct_output]]
end
stack = HotReload.new(@ctx, app, watcher: @watcher, mode: @mode)
request = Rack::MockRequest.new(stack)

assert_equal(correct_output, request.get("/[email protected]/sandbox/").body)
assert_equal(correct_output, request.get("/[email protected]@6b2037/sandbox/").body)
end

private

def app
Expand Down

0 comments on commit 9df60a0

Please sign in to comment.