shopify-cli 2.19.0 → 2.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.yaml +2 -1
  3. data/.github/ISSUE_TEMPLATE/config.yml +9 -0
  4. data/.github/workflows/cla.yml +22 -0
  5. data/CHANGELOG.md +34 -2
  6. data/Gemfile.lock +1 -1
  7. data/README.md +7 -6
  8. data/docs/users/installation.md +1 -1
  9. data/lib/project_types/extension/messages/messages.rb +1 -1
  10. data/lib/project_types/extension/tasks/fetch_specifications.rb +4 -1
  11. data/lib/project_types/theme/commands/push.rb +3 -1
  12. data/lib/project_types/theme/commands/serve.rb +1 -0
  13. data/lib/project_types/theme/messages/messages.rb +39 -2
  14. data/lib/shopify_cli/assets/post_auth_page/index.html.erb +34 -0
  15. data/lib/shopify_cli/assets/post_auth_page/style.css +58 -0
  16. data/lib/shopify_cli/constants.rb +1 -0
  17. data/lib/shopify_cli/context.rb +3 -2
  18. data/lib/shopify_cli/environment.rb +4 -0
  19. data/lib/shopify_cli/identity_auth/servlet.rb +4 -20
  20. data/lib/shopify_cli/messages/messages.rb +6 -8
  21. data/lib/shopify_cli/theme/dev_server/hot-reload-no-script.html +27 -0
  22. data/lib/shopify_cli/theme/dev_server/hot-reload.js +38 -11
  23. data/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_deleter.rb +62 -0
  24. data/lib/shopify_cli/theme/dev_server/hot_reload.rb +25 -1
  25. data/lib/shopify_cli/theme/dev_server/proxy.rb +1 -0
  26. data/lib/shopify_cli/theme/dev_server.rb +3 -2
  27. data/lib/shopify_cli/theme/file.rb +5 -0
  28. data/lib/shopify_cli/theme/syncer/json_update_handler.rb +21 -7
  29. data/lib/shopify_cli/theme/syncer/operation.rb +7 -6
  30. data/lib/shopify_cli/theme/syncer/unsupported_script_warning.rb +90 -0
  31. data/lib/shopify_cli/theme/syncer.rb +86 -32
  32. data/lib/shopify_cli/theme/theme.rb +5 -0
  33. data/lib/shopify_cli/theme/theme_admin_api.rb +16 -11
  34. data/lib/shopify_cli/theme/theme_admin_api_throttler/bulk.rb +102 -0
  35. data/lib/shopify_cli/theme/theme_admin_api_throttler/bulk_job.rb +75 -0
  36. data/lib/shopify_cli/theme/theme_admin_api_throttler/errors.rb +7 -0
  37. data/lib/shopify_cli/theme/theme_admin_api_throttler/put_request.rb +52 -0
  38. data/lib/shopify_cli/theme/theme_admin_api_throttler/request_parser.rb +39 -0
  39. data/lib/shopify_cli/theme/theme_admin_api_throttler/response_parser.rb +21 -0
  40. data/lib/shopify_cli/theme/theme_admin_api_throttler.rb +62 -0
  41. data/lib/shopify_cli/version.rb +1 -1
  42. metadata +16 -3
  43. data/.github/probots.yml +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b9c76cb4695f372d6c7466af04e48d99559d192a27b4dd5cc15b59e472cb373
4
- data.tar.gz: 8157cfdb59c6028c981720d6612e6c93f09927eddb8555082b31338f6361c696
3
+ metadata.gz: 8971e6497feaa24c2fd34b00c29208f44ffb4cd6405b1b1ec08324b41ade05ad
4
+ data.tar.gz: 111bbf0f53d8d57812916ee930773887e07163008bd04a1796312378148d70ea
5
5
  SHA512:
6
- metadata.gz: ced373c7de01d36a939bc99de89fabaab7aabd80126ed51d12d233f3b15579eb256dc0da84bf63af1778434e4e9b24828c71e83018bf016608174941add9e266
7
- data.tar.gz: 49c1a0a1f55ac07d91d504aadf98131327124dcceaa0d07f957bbdceb7039c3b2e840c96c6d87a80327846f9a26c7af27202e5d92375c0a1ede40407114ab100
6
+ metadata.gz: f83037ed5100015bb76f76864af37bff6a735c61d43f1d7870f67441f45d565530e2ebe43537f1f0891a6eda67a2631604916359b678ab8a7d262576a576171d
7
+ data.tar.gz: 7dd3af12ba1f384d7232c48c5a6f2724a99917eeb598d61d9a01cb86be4d2f114142daf226dc4f58f8083b4f0f8937cbd7f55d9b9283272be4e5c8c6e257ae04
@@ -13,8 +13,9 @@ body:
13
13
  id: preflight_checks
14
14
  attributes:
15
15
  label: |-
16
- Please confirm that you have:
16
+ Please confirm that you:
17
17
  options:
18
+ - label: Are working with Shopify CLI 2.0, not 3.0. (You can [open a 3.0 issue here](https://github.com/Shopify/cli/issues/new/choose).)
18
19
  - label: Searched [existing issues](https://github.com/Shopify/shopify-cli/issues) to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
19
20
  required: true
20
21
  - label: Reproduced the issue in [the latest CLI version](https://github.com/Shopify/shopify-cli/releases).
@@ -0,0 +1,9 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Shopify Partners Community 🙌
4
+ url: https://www.shopify.com/partners/community#conversation
5
+ about: Connect with Shopify and other Shopify Partners through our online communities!
6
+ - name: Shopify CLI 3.0 issues 📝
7
+ url: https://www.github.com/Shopify/cli/issues/new/choose
8
+ about: |-
9
+ You're about to open an issue about Shopify CLI 2.0. Are you actually using our new CLI? If so, please create an issue there instead.
@@ -0,0 +1,22 @@
1
+ name: Contributor License Agreement (CLA)
2
+
3
+ on:
4
+ pull_request_target:
5
+ types: [opened, synchronize]
6
+ issue_comment:
7
+ types: [created]
8
+
9
+ jobs:
10
+ cla:
11
+ runs-on: ubuntu-latest
12
+ if: |
13
+ (github.event.issue.pull_request
14
+ && !github.event.issue.pull_request.merged_at
15
+ && contains(github.event.comment.body, 'signed')
16
+ )
17
+ || (github.event.pull_request && !github.event.pull_request.merged)
18
+ steps:
19
+ - uses: Shopify/shopify-cla-action@v1
20
+ with:
21
+ github-token: ${{ secrets.GITHUB_TOKEN }}
22
+ cla-token: ${{ secrets.CLA_TOKEN }}
data/CHANGELOG.md CHANGED
@@ -2,6 +2,37 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## Version 2.21.0 - 2022-08-03
6
+
7
+ ### Fixed
8
+ * [#2453](https://github.com/Shopify/shopify-cli/pull/2453): Fix [#2382](https://github.com/Shopify/shopify-cli/issues/2382): Ensure we wait 24 hours to show update message again
9
+ * [#2463](https://github.com/Shopify/shopify-cli/pull/2463): Fix for "Keep the remote version" deletes files on new development theme
10
+ * [#2405](https://github.com/Shopify/shopify-cli/pull/2405): Fix `theme serve` to trigger page refresh when a file is deleted
11
+ * [#2489](https://github.com/Shopify/shopify-cli/pull/2489): Fix `theme serve` to hot reload many occurrences of a stylesheet
12
+
13
+ ### Added
14
+ * [#2496](https://github.com/Shopify/shopify-cli/pull/2496): Accept storefront renderer token from ENV variable
15
+
16
+ ## Version 2.20.1 - 2022-07-18
17
+
18
+ ### Fixed
19
+ * [#2458](https://github.com/Shopify/shopify-cli/pull/2458): Fix shop URL in unauthorized error message
20
+ * [#2459](https://github.com/Shopify/shopify-cli/pull/2459): Fix `.json` file ignore issues with `shopify theme push`
21
+ * [#2460](https://github.com/Shopify/shopify-cli/pull/2460): Fix job retries for .json theme file dependencies and support wider range of asset API errors
22
+
23
+ ## Version 2.20.0 - 2022-07-11
24
+
25
+ ### Added
26
+ * [#2368](https://github.com/Shopify/shopify-cli/pull/2368): Add performance enhancements to the `theme serve` and `theme push` commands
27
+ * [#2437](https://github.com/Shopify/shopify-cli/pull/2437): Add support to the `warnings` field in the assets API
28
+ * [#2446](https://github.com/Shopify/shopify-cli/pull/2446): Show a friendly message when developers use a browser without SSE support
29
+
30
+ ### Fixed
31
+ * [#2418](https://github.com/Shopify/shopify-cli/pull/2418): Improve the help message of the `theme open -e/--editor` flag
32
+
33
+ ### Changed
34
+ * [#2444](https://github.com/Shopify/shopify-cli/pull/2444): Expose the `-s` option in the help text of `login`, `switch` etc.
35
+
5
36
  ## Version 2.18.0 - 2022-05-30
6
37
 
7
38
  ### Added
@@ -12,6 +43,7 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
12
43
  ### Fixed
13
44
  * [#2352](https://github.com/Shopify/shopify-cli/pull/2352): Provide better DX when dealing with empty theme selection
14
45
  * [#2347](https://github.com/Shopify/shopify-cli/pull/2347): Fix #2346 Heroku CLI installation for Apple silicon
46
+ * [#2422](https://github.com/Shopify/shopify-cli/pull/2422): Add Shopify branding and styling to post-authentication browser page
15
47
 
16
48
  ## Version 2.17.0 - 2022-05-12
17
49
 
@@ -42,7 +74,7 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
42
74
 
43
75
  ### Added
44
76
  * [#2189](https://github.com/Shopify/shopify-cli/pull/2189): Retrieve latest CLI version in the background
45
- * [#2263](https://github.com/Shopify/shopify-cli/pull/2263): Add `POS UI Extension` to support third party developers to extend POS smart grid functionality using native retail components.
77
+ * [#2263](https://github.com/Shopify/shopify-cli/pull/2263): Add `POS UI Extension` to support third party developers to extend POS smart grid functionality using native retail components.
46
78
 
47
79
  ### Changed
48
80
  * [#2272](https://github.com/Shopify/shopify-cli/pull/2272): Changed interactive apps list scope for extension create|register|connect commands
@@ -50,7 +82,7 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
50
82
  ## Version 2.15.6 - 2022-04-12
51
83
 
52
84
  ### Fixed
53
- * [#2246](https://github.com/Shopify/shopify-cli/pull/2246): Fix callback urls for app serve
85
+ * [#2246](https://github.com/Shopify/shopify-cli/pull/2246): Fix callback urls for app serve
54
86
 
55
87
  ## Version 2.15.5 - 2022-04-08
56
88
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.19.0)
4
+ shopify-cli (2.21.0)
5
5
  bugsnag (~> 6.22)
6
6
  listen (~> 3.7.0)
7
7
  theme-check (~> 1.10.3)
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
- <div align="center">
2
- <img src="assets/logo.png" width="150"/>
3
- <h1>Shopify CLI</h1>
1
+ # Shopify CLI 2.0
2
+
4
3
  <a href=""><img src="https://github.com/shopify/shopify-cli/workflows/CI/badge.svg" alt="Shopify"></a>
5
4
  <img src="https://img.shields.io/github/v/release/shopify/shopify-cli?include_prereleases&style=flat-square" alt="Latest Version">
6
5
  <img src="https://img.shields.io/github/forks/shopify/shopify-cli?style=flat-square" alt="GitHub forks">
@@ -11,12 +10,14 @@
11
10
  <a href="http://twitter.com/ShopifyDevs"><img src="https://img.shields.io/twitter/follow/ShopifyDevs?style=flat-square" alt="Twitter Followers"></a>
12
11
  <img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License">
13
12
  <img src="https://img.shields.io/badge/Powered%20by-Ruby-red" alt="Powered by Ruby">
14
- </div>
15
13
 
16
14
 
17
- Shopify CLI helps you build Shopify themes and apps. Use Shopify CLI to automate and enhance your local development workflow.
15
+ Shopify CLI 2.0 is a command line to help you build on Shopify. It's available as a Ruby gem and can be run and installed on Mac, Linux, and Windows systems.
16
+
17
+ ## Note on Shopify CLI 2.0 versus Shopify CLI 3.0 ##
18
+
19
+ Use 2.0 for developing themes. For developing apps and custom storefronts, we recommend using [Shopify CLI 3.0](https://github.com/Shopify/cli).
18
20
 
19
- Shopify CLI is available as a gem and can be run and installed on Mac, Linux and Windows systems.
20
21
 
21
22
  ## Installation
22
23
 
@@ -1,3 +1,3 @@
1
1
  # Installation
2
2
 
3
- The installation guide can be found here: https://shopify.dev/apps/tools/cli/installation
3
+ The installation guide can be found here: https://shopify.dev/apps/tools/cli/cli-2#installing-shopify-cli-2-x
@@ -183,7 +183,7 @@ module Extension
183
183
  },
184
184
  errors: {
185
185
  unknown_type: "Unknown extension type %s. Valid extension types include: CHECKOUT_POST_PURCHASE, " \
186
- "CHECKOUT_UI_EXTENSION, THEME_APP_EXTENSION, and PRODUCT_SUBSCRIPTION.",
186
+ "THEME_APP_EXTENSION, and PRODUCT_SUBSCRIPTION.",
187
187
  package_not_found: "`%s` package not found.",
188
188
  missing_push_options_ci: "The following are missing: %s. ",
189
189
  missing_push_options_ci_solution: "To add them to a CI environment:\n\t1. Run a connect command " \
@@ -11,7 +11,10 @@ module Extension
11
11
  .query(context, "fetch_specifications", api_key: api_key)
12
12
  .dig("data", "extensionSpecifications")
13
13
  context.abort(context.message("tasks.errors.parse_error")) if response.nil?
14
- response
14
+
15
+ response.reject do |line|
16
+ ::Extension::Features::Runtimes::CheckoutUiExtension::IDENTIFIERS.include?(line["identifier"].upcase)
17
+ end
15
18
  end
16
19
  end
17
20
  end
@@ -28,6 +28,7 @@ module Theme
28
28
  parser.on("-j", "--json") { flags[:json] = true }
29
29
  parser.on("-a", "--allow-live") { flags[:allow_live] = true }
30
30
  parser.on("-p", "--publish") { flags[:publish] = true }
31
+ parser.on("-s", "--stable") { flags[:stable] = true }
31
32
  parser.on("-o", "--only=PATTERN", Conversions::IncludeGlob) do |pattern|
32
33
  flags[:includes] ||= []
33
34
  flags[:includes] |= pattern
@@ -56,7 +57,8 @@ module Theme
56
57
 
57
58
  syncer = ShopifyCLI::Theme::Syncer.new(@ctx, theme: theme,
58
59
  include_filter: include_filter,
59
- ignore_filter: ignore_filter)
60
+ ignore_filter: ignore_filter,
61
+ stable: options.flags[:stable])
60
62
  begin
61
63
  syncer.start_threads
62
64
  if options.flags[:json]
@@ -17,6 +17,7 @@ module Theme
17
17
  parser.on("--poll") { flags[:poll] = true }
18
18
  parser.on("--live-reload=MODE") { |mode| flags[:mode] = as_reload_mode(mode) }
19
19
  parser.on("--theme-editor-sync") { flags[:editor_sync] = true }
20
+ parser.on("--stable") { flags[:stable] = true }
20
21
  parser.on("-t", "--theme=NAME_OR_ID") { |theme| flags[:theme] = theme }
21
22
  end
22
23
 
@@ -11,11 +11,13 @@ module Theme
11
11
  unauthorized_error: <<~EOD,
12
12
  You can't use Shopify CLI with development stores if you only have Partner staff member access. If you want to use Shopify CLI to work on a development store, then you should be the store owner or create a staff account on the store.
13
13
 
14
- If you're the store owner, then you need to log in to the store directly using the store URL at least once (for example, using %s.myshopify.com/admin) before you log in using Shopify CLI. Logging in to the Shopify admin directly connects the development store with your Shopify login.
14
+ If you're the store owner, then you need to log in to the store directly using the store URL at least once (for example, using %s/admin) before you log in using Shopify CLI. Logging in to the Shopify admin directly connects the development store with your Shopify login.
15
15
  EOD
16
16
  ensure_user_try_this: <<~ENSURE_USER,
17
17
  Check if your user is activated, has permission to edit themes at the store, and try to re-login.
18
18
  ENSURE_USER
19
+ stable_flag_suggestion: "If the current command isn't working as expected," \
20
+ " we suggest re-running the command with the {{command: --stable}} flag",
19
21
  init: {
20
22
  help: <<~HELP,
21
23
  {{command:%s theme init}}: Clones a Git repository to use as a starting point for building a new theme.
@@ -179,6 +181,41 @@ module Theme
179
181
  exit: "Exit",
180
182
  },
181
183
  },
184
+ warnings: {
185
+ unsupported_script: "unsupported script",
186
+ unsupported_script_text: <<~UNSUPPORTED_SCRIPT,
187
+
188
+ {{underline:Unsupported external checkout script}}
189
+
190
+ You have a code snippet on your storefront that violates
191
+ Shopify's Terms of Service. This script removes Shopify's
192
+ ability to protect your store against fraudulent orders,
193
+ could steal customer data and may cause customers to be
194
+ charged the wrong amount.
195
+
196
+ %s
197
+ By proceeding, you're acknowledging that you understand the
198
+ risks and will not hold Shopify liable for any problems that
199
+ occur due to the use of an external checkout, including:
200
+
201
+ - Discounts
202
+ - Shipping rules
203
+ - Multi-currency rules
204
+ - Variant selection
205
+ - Orders and fulfillment workflows
206
+ - Shopify Fraud Protection
207
+ - Payment settings
208
+ - Cart
209
+
210
+ You also acknowledge that you will not be able to reliably
211
+ get support for those features from Shopify because you are
212
+ violating Shopify's terms of service and that your account
213
+ may become suspended as a result.
214
+ UNSUPPORTED_SCRIPT
215
+ line_and_column: <<~LINE_AND_COLUMN,
216
+ - Line: %s Column: %s
217
+ LINE_AND_COLUMN
218
+ },
182
219
  },
183
220
  error: {
184
221
  address_binding_error: "Couldn't bind to localhost."\
@@ -309,7 +346,7 @@ module Theme
309
346
  {{command:-t, --theme=NAME_OR_ID}} Theme ID or name of your theme.
310
347
  {{command:-l, --live}} Open your live theme.
311
348
  {{command:-d, --development}} Open your development theme.
312
- {{command:-e, --editor}} Open the editor to the specified/selected theme.
349
+ {{command:-e, --editor}} Open the theme editor for the specified theme in the browser.
313
350
  HELP
314
351
  },
315
352
  list: {
@@ -0,0 +1,34 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Shopify CLI</title>
8
+ <style><%= locals[:css] %></style>
9
+ <link rel="icon" href="data:image/svg+xml;charset=UTF-8,%3c?xml version='1.0' encoding='utf-8'?%3e%3c!-- Generator: Adobe Illustrator 23.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3e%3csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 109.5 124.5' style='enable-background:new 0 0 109.5 124.5;' xml:space='preserve'%3e%3cstyle type='text/css'%3e .st0%7bfill:%2395BF47;%7d .st1%7bfill:%235E8E3E;%7d .st2%7bfill:%23FFFFFF;%7d %3c/style%3e%3cg%3e%3cpath class='st0' d='M95.9,23.9c-0.1-0.6-0.6-1-1.1-1c-0.5,0-9.3-0.2-9.3-0.2s-7.4-7.2-8.1-7.9c-0.7-0.7-2.2-0.5-2.7-0.3 c0,0-1.4,0.4-3.7,1.1c-0.4-1.3-1-2.8-1.8-4.4c-2.6-5-6.5-7.7-11.1-7.7c0,0,0,0,0,0c-0.3,0-0.6,0-1,0.1c-0.1-0.2-0.3-0.3-0.4-0.5 c-2-2.2-4.6-3.2-7.7-3.1c-6,0.2-12,4.5-16.8,12.2c-3.4,5.4-6,12.2-6.8,17.5c-6.9,2.1-11.7,3.6-11.8,3.7c-3.5,1.1-3.6,1.2-4,4.5 c-0.3,2.5-9.5,73-9.5,73l76.4,13.2l33.1-8.2C109.5,115.8,96,24.5,95.9,23.9z M67.2,16.8c-1.8,0.5-3.8,1.2-5.9,1.8 c0-3-0.4-7.3-1.8-10.9C64,8.6,66.2,13.7,67.2,16.8z M57.2,19.9c-4,1.2-8.4,2.6-12.8,3.9c1.2-4.7,3.6-9.4,6.4-12.5 c1.1-1.1,2.6-2.4,4.3-3.2C56.9,11.6,57.3,16.5,57.2,19.9z M49.1,4c1.4,0,2.6,0.3,3.6,0.9C51.1,5.8,49.5,7,48,8.6 c-3.8,4.1-6.7,10.5-7.9,16.6c-3.6,1.1-7.2,2.2-10.5,3.2C31.7,18.8,39.8,4.3,49.1,4z'/%3e%3cg%3e%3cpath class='st1' d='M94.8,22.9c-0.5,0-9.3-0.2-9.3-0.2s-7.4-7.2-8.1-7.9c-0.3-0.3-0.6-0.4-1-0.5l0,109.7l33.1-8.2 c0,0-13.5-91.3-13.6-92C95.8,23.3,95.3,22.9,94.8,22.9z'/%3e%3cpath class='st2' d='M58,39.9l-3.8,14.4c0,0-4.3-2-9.4-1.6c-7.5,0.5-7.5,5.2-7.5,6.4c0.4,6.4,17.3,7.8,18.3,22.9 c0.7,11.9-6.3,20-16.4,20.6c-12.2,0.8-18.9-6.4-18.9-6.4l2.6-11c0,0,6.7,5.1,12.1,4.7c3.5-0.2,4.8-3.1,4.7-5.1 c-0.5-8.4-14.3-7.9-15.2-21.7c-0.7-11.6,6.9-23.4,23.7-24.4C54.7,38.2,58,39.9,58,39.9z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e" sizes="any" type="image/svg+xml">
10
+ </head>
11
+
12
+ <% if successful %>
13
+ <body class="body-success">
14
+ <div class="app-success">
15
+ <div class="container">
16
+ <h1><%= locals[:message] %></h1>
17
+ <p>You can close this tab and return to your terminal.</p>
18
+ </div>
19
+ </div>
20
+ </body>
21
+ <% else %>
22
+ <body class="body-error">
23
+ <div class="app-error">
24
+ <div class="container">
25
+ <h1>Something went wrong!</h1>
26
+ <p><%= locals[:message] %></p>
27
+ <br>
28
+ <br>
29
+ <p>Return to your terminal and try running the previous command again.</p>
30
+ </div>
31
+ </div>
32
+ </body>
33
+ <% end %>
34
+ </html>
@@ -0,0 +1,58 @@
1
+ html {
2
+ font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
3
+ text-size-adjust: 100%;
4
+ text-rendering: optimizeLegibility;
5
+ -webkit-font-smoothing: antialiased;
6
+ -moz-osx-font-smoothing: grayscale;
7
+ }
8
+
9
+ body {
10
+ font-size: 26px;
11
+ line-height: normal;
12
+ margin: 0;
13
+ padding: 0;
14
+ }
15
+
16
+ button, input, optgroup, select, textarea {
17
+ font-family: inherit;
18
+ }
19
+
20
+ h1 {
21
+ font-weight: 600;
22
+ font-size: 1em;
23
+ }
24
+
25
+ p {
26
+ font-weight: 400;
27
+ }
28
+
29
+ .body-success {
30
+ color: #F6F6F7;
31
+ }
32
+
33
+ .body-error {
34
+ color: #202223;
35
+ }
36
+
37
+ .app-success {
38
+ width: 100vw;
39
+ height: 100vh;
40
+ background-color: #054A49;
41
+ display: flex;
42
+ }
43
+
44
+ .app-error {
45
+ width: 100vw;
46
+ height: 100vh;
47
+ background-color: #F6F6F7;
48
+ display: flex;
49
+ }
50
+
51
+ .container {
52
+ display: flex;
53
+ flex-direction: column;
54
+ justify-content: center;
55
+ width: 100%;
56
+ height: 100%;
57
+ padding-left: 7.5em;
58
+ }
@@ -54,6 +54,7 @@ module ShopifyCLI
54
54
  # Authentication
55
55
  AUTH_TOKEN = "SHOPIFY_CLI_AUTH_TOKEN"
56
56
  ADMIN_AUTH_TOKEN = "SHOPIFY_CLI_ADMIN_AUTH_TOKEN"
57
+ STOREFRONT_RENDERER_AUTH_TOKEN = "SHOPIFY_CLI_STOREFRONT_RENDERER_AUTH_TOKEN"
57
58
 
58
59
  # Monorail
59
60
  MONORAIL_REAL_EVENTS = "MONORAIL_REAL_EVENTS"
@@ -628,9 +628,10 @@ module ShopifyCLI
628
628
  thread = Thread.new { retrieve_latest_gem_version }
629
629
  at_exit { thread.join }
630
630
  end
631
+ latest_version =
632
+ ShopifyCLI::Config.get(VERSION_CHECK_SECTION, LATEST_VERSION_FIELD, default: ShopifyCLI::VERSION)
633
+ latest_version if ::Semantic::Version.new(latest_version) > ::Semantic::Version.new(ShopifyCLI::VERSION)
631
634
  end
632
- latest_version = ShopifyCLI::Config.get(VERSION_CHECK_SECTION, LATEST_VERSION_FIELD, default: ShopifyCLI::VERSION)
633
- latest_version if ::Semantic::Version.new(latest_version) > ::Semantic::Version.new(ShopifyCLI::VERSION)
634
635
  end
635
636
 
636
637
  # Returns file extension depending on OS
@@ -170,6 +170,10 @@ module ShopifyCLI
170
170
  env_variables[Constants::EnvironmentVariables::ADMIN_AUTH_TOKEN]
171
171
  end
172
172
 
173
+ def self.storefront_renderer_auth_token(env_variables: ENV)
174
+ env_variables[Constants::EnvironmentVariables::STOREFRONT_RENDERER_AUTH_TOKEN]
175
+ end
176
+
173
177
  def self.store(env_variables: ENV)
174
178
  env_variables[Constants::EnvironmentVariables::STORE]
175
179
  end
@@ -1,20 +1,8 @@
1
1
  module ShopifyCLI
2
2
  class IdentityAuth
3
3
  class Servlet < WEBrick::HTTPServlet::AbstractServlet
4
- TEMPLATE = %{<!DOCTYPE html>
5
- <html>
6
- <head>
7
- <title>%{title}</title>
8
- </head>
9
- <body>
10
- <h1 style="color: #%{color};">%{message}</h1>
11
- %{autoclose}
12
- </body>
13
- </html>
14
- }
15
- AUTOCLOSE_TEMPLATE = %{
16
- <script>window.close();</script>
17
- }
4
+ ERB_FILENAME = File.join(ROOT, "lib/shopify_cli/assets/post_auth_page/index.html.erb")
5
+ CSS_FILENAME = File.join(ROOT, "lib/shopify_cli/assets/post_auth_page/style.css")
18
6
 
19
7
  def initialize(server, identity_auth, token)
20
8
  super
@@ -46,14 +34,10 @@ module ShopifyCLI
46
34
  locals = {
47
35
  status: status,
48
36
  message: message,
49
- color: successful ? "black" : "red",
50
- title: Context.message(
51
- successful ? "core.identity_auth.servlet.authenticated" : "core.identity_auth.servlet.not_authenticated"
52
- ),
53
- autoclose: successful ? AUTOCLOSE_TEMPLATE : "",
37
+ css: File.read(CSS_FILENAME),
54
38
  }
55
39
  response.status = status
56
- response.body = format(TEMPLATE, locals)
40
+ response.body = ERB.new(File.read(ERB_FILENAME)).result(binding)
57
41
  end
58
42
  end
59
43
  end
@@ -449,7 +449,7 @@ module ShopifyCLI
449
449
  login: {
450
450
  help: <<~HELP,
451
451
  Log in to the Shopify CLI by authenticating with a store or partner organization
452
- Usage: {{command:%s login [--store STORE]}}
452
+ Usage: {{command:%s login [--store/-s STORE]}}
453
453
  HELP
454
454
  invalid_shop: <<~MESSAGE,
455
455
  Invalid store provided (%s). Please provide the store in the following format: my-store.myshopify.com
@@ -476,7 +476,7 @@ module ShopifyCLI
476
476
  switch: {
477
477
  help: <<~HELP,
478
478
  Switch between development stores in your partner organization
479
- Usage: {{command:%s switch [--store STORE]}}
479
+ Usage: {{command:%s switch [--store/-s STORE]}}
480
480
  HELP
481
481
  disabled_as_shopify_org: "Can't switch development stores logged in as {{green:Shopify partners org}}",
482
482
  success: "Switched development store to {{green:%s}}",
@@ -498,11 +498,9 @@ module ShopifyCLI
498
498
  "{{i}} Authentication required. Login to the URL below with your %s credentials to continue.",
499
499
 
500
500
  servlet: {
501
- success_response: "Authenticated successfully. You may now close this page.",
501
+ success_response: "You've successfuly logged into the Shopify CLI!",
502
502
  invalid_request_response: "Invalid request: %s",
503
- invalid_state_response: "Anti-forgery state token does not match the initial request.",
504
- authenticated: "Authenticated successfully",
505
- not_authenticated: "Failed to authenticate",
503
+ invalid_state_response: "The anti-forgery state token does not match the initial request.",
506
504
  },
507
505
  login_prompt: "Please ensure you've logged in with {{command:%s login}} and try again",
508
506
  token_authentication: "%s environment variable. We'll authenticate using its value as a token.",
@@ -589,7 +587,7 @@ module ShopifyCLI
589
587
  HELP
590
588
 
591
589
  error: {
592
- no_shop: "No store found. Please run {{command:%s login --store STORE}} to login to a specific store",
590
+ no_shop: "No store found. Please run {{command:%s login --store/-s STORE}} to login to a specific store",
593
591
  },
594
592
 
595
593
  customer: {
@@ -820,7 +818,7 @@ module ShopifyCLI
820
818
  not_logged_in: <<~MESSAGE,
821
819
  It doesn't appear that you're logged in. You must log into a partner organization or a store staff account.
822
820
 
823
- If trying to log into a store staff account, please use {{command:%s login --store STORE}} to log in.
821
+ If trying to log into a store staff account, please use {{command:%s login --store/-s STORE}} to log in.
824
822
  MESSAGE
825
823
  logged_in_shop_only: <<~MESSAGE,
826
824
  Logged into store {{green:%s}} as staff (no partner organizations available for this login)
@@ -0,0 +1,27 @@
1
+ <noscript>
2
+ <style type="text/css">
3
+ .shopify-cli-no-script-message {
4
+ font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
5
+ text-size-adjust: 100%;
6
+ text-rendering: optimizeLegibility;
7
+ -webkit-font-smoothing: antialiased;
8
+ -moz-osx-font-smoothing: grayscale;
9
+ position: fixed;
10
+ z-index: 999;
11
+ font-weight: 500;
12
+ left: 0;
13
+ top: 0;
14
+ width: 100vw;
15
+ height: 100vh;
16
+ padding: 10rem 0;
17
+ color: #202223;
18
+ text-align: center;
19
+ background-color: #F6F6F7;
20
+ }
21
+ </style>
22
+ <div class="shopify-cli-no-script-message">
23
+ Shopify CLI requires JavaScript to work.
24
+ <br />
25
+ Activate JavaScript support or try a different browser.
26
+ </div>
27
+ </noscript>
@@ -1,8 +1,20 @@
1
+ (() => {
2
+ function verifySSE() {
3
+ if (typeof (EventSource) === "undefined") {
4
+ console.error("[HotReload] Error: SSE features are not supported. Try a different browser.");
5
+ }
6
+ }
7
+
8
+ console.log("[HotReload] Initializing...");
9
+
10
+ verifySSE();
11
+ })();
12
+
1
13
  (() => {
2
14
  function connect() {
3
15
  const eventSource = new EventSource('/hot-reload');
4
16
 
5
- eventSource.onmessage = handleUpdate;
17
+ eventSource.onmessage = onMessage;
6
18
 
7
19
  eventSource.onopen = () => console.log('[HotReload] SSE connected.');
8
20
 
@@ -32,7 +44,7 @@
32
44
 
33
45
  function fetchDOMSections(name) {
34
46
  const domSections = sectionNamesByType(name).flatMap((n) => querySelectDOMSections(n));
35
-
47
+
36
48
  if (domSections.length > 0) {
37
49
  return domSections;
38
50
  }
@@ -40,11 +52,11 @@
40
52
  return querySelectDOMSections(name);
41
53
  }
42
54
 
43
- function isFullPageReloadMode(){
55
+ function isFullPageReloadMode() {
44
56
  return reloadMode() === 'full-page';
45
57
  }
46
58
 
47
- function isReloadModeActive(){
59
+ function isReloadModeActive() {
48
60
  return reloadMode() !== 'off';
49
61
  }
50
62
 
@@ -72,7 +84,7 @@
72
84
 
73
85
  // Hot reload cookie expires in 3 seconds
74
86
  date.setSeconds(date.getSeconds() + 3);
75
-
87
+
76
88
  var sections = files.join(',');
77
89
  var expires = date.toUTCString();
78
90
 
@@ -85,10 +97,23 @@
85
97
  window.location.reload();
86
98
  }
87
99
 
88
- function handleUpdate(message) {
89
- var data = JSON.parse(message.data);
100
+ function onMessage(message) {
101
+ const data = JSON.parse(message.data);
102
+ if (data.reload_page) {
103
+ refreshPage([]);
104
+ return;
105
+ }
106
+
107
+ handleUpdate(data);
108
+ }
109
+
110
+ function handleUpdate(data) {
90
111
  var modifiedFiles = data.modified;
91
112
 
113
+ if (modifiedFiles === undefined) {
114
+ return;
115
+ }
116
+
92
117
  if (isRefreshRequired(modifiedFiles)) {
93
118
  refreshPage(modifiedFiles);
94
119
  } else {
@@ -102,13 +127,15 @@
102
127
 
103
128
  function reloadCssFile(filename) {
104
129
  // Find a stylesheet link starting with /assets (locally-served only) containing the filename
105
- let link = document.querySelector(`link[href^="/assets"][href*="${filename}"][rel="stylesheet"]`);
130
+ let links = document.querySelectorAll(`link[href^="/assets"][href*="${filename}"][rel="stylesheet"]`);
106
131
 
107
- if (!link) {
132
+ if (!links.length) {
108
133
  console.log(`[HotReload] Could not find link for stylesheet ${filename}`);
109
134
  } else {
110
- link.href = new URL(link.href).pathname + `?v=${Date.now()}`;
111
- console.log(`[HotReload] Reloaded stylesheet ${filename}`);
135
+ links.forEach(link => {
136
+ link.href = new URL(link.href).pathname + `?v=${Date.now()}`;
137
+ console.log(`[HotReload] Reloaded stylesheet ${filename}`);
138
+ })
112
139
  }
113
140
  }
114
141