shopify-cli 2.18.1 → 2.20.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) 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 +23 -2
  6. data/Gemfile.lock +4 -4
  7. data/README.md +7 -6
  8. data/dev.yml +0 -1
  9. data/docs/users/installation.md +1 -1
  10. data/lib/project_types/extension/messages/messages.rb +1 -1
  11. data/lib/project_types/extension/models/development_server_requirements.rb +1 -6
  12. data/lib/project_types/extension/tasks/fetch_specifications.rb +4 -1
  13. data/lib/project_types/script/commands/create.rb +1 -1
  14. data/lib/project_types/script/config/extension_points.yml +15 -15
  15. data/lib/project_types/script/forms/ask_app.rb +0 -5
  16. data/lib/project_types/script/layers/domain/metadata.rb +3 -5
  17. data/lib/project_types/script/layers/infrastructure/script_service.rb +1 -1
  18. data/lib/project_types/theme/commands/push.rb +3 -1
  19. data/lib/project_types/theme/commands/serve.rb +1 -0
  20. data/lib/project_types/theme/messages/messages.rb +39 -2
  21. data/lib/shopify_cli/assets/post_auth_page/index.html.erb +34 -0
  22. data/lib/shopify_cli/assets/post_auth_page/style.css +58 -0
  23. data/lib/shopify_cli/identity_auth/servlet.rb +4 -20
  24. data/lib/shopify_cli/messages/messages.rb +6 -8
  25. data/lib/shopify_cli/theme/dev_server/hot-reload-no-script.html +27 -0
  26. data/lib/shopify_cli/theme/dev_server/hot-reload.js +16 -4
  27. data/lib/shopify_cli/theme/dev_server/hot_reload.rb +2 -0
  28. data/lib/shopify_cli/theme/dev_server.rb +3 -2
  29. data/lib/shopify_cli/theme/file.rb +5 -0
  30. data/lib/shopify_cli/theme/syncer/json_update_handler.rb +21 -7
  31. data/lib/shopify_cli/theme/syncer/operation.rb +7 -6
  32. data/lib/shopify_cli/theme/syncer/unsupported_script_warning.rb +90 -0
  33. data/lib/shopify_cli/theme/syncer.rb +81 -31
  34. data/lib/shopify_cli/theme/theme_admin_api.rb +16 -11
  35. data/lib/shopify_cli/theme/theme_admin_api_throttler/bulk.rb +102 -0
  36. data/lib/shopify_cli/theme/theme_admin_api_throttler/bulk_job.rb +75 -0
  37. data/lib/shopify_cli/theme/theme_admin_api_throttler/errors.rb +7 -0
  38. data/lib/shopify_cli/theme/theme_admin_api_throttler/put_request.rb +52 -0
  39. data/lib/shopify_cli/theme/theme_admin_api_throttler/request_parser.rb +39 -0
  40. data/lib/shopify_cli/theme/theme_admin_api_throttler/response_parser.rb +21 -0
  41. data/lib/shopify_cli/theme/theme_admin_api_throttler.rb +62 -0
  42. data/lib/shopify_cli/version.rb +1 -1
  43. data/shopify-cli.gemspec +1 -1
  44. metadata +18 -6
  45. data/.github/probots.yml +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bad168cdd878e04ba4bc934a9caa6bfd19ffba653564734395d0e53a20957a81
4
- data.tar.gz: 2f45edbce9f20fe63472a26221a71ef4733ad6e9f951abe86f3b213a869b0cc4
3
+ metadata.gz: 2bab2227e665dd4dec8e90ca261705072971a838f85d19bcbb85d18ed1a1d5b0
4
+ data.tar.gz: 90e22472586a681a26974882b79ac3fd326fdcf696db2aa29201ab5d9a37c2b0
5
5
  SHA512:
6
- metadata.gz: 14ced1d055b8aa918d0168aa0b91ba8e8a3093a99838868a630866b34af28f4547e55cf208dc6051ee4ef20426b5202badaa5b7ab2ac5c536a9e39030a4d1744
7
- data.tar.gz: 37d84adeb8489f6596f2ed9bf1481ecc9060697a88fb10fcd5b59e8c20bf3e021c0502019c43b38fb0ec1e424b06ecd4f377ebb20a5517272a9e46cce2fcc1ff
6
+ metadata.gz: 24701865a98be1b3062ff7644fff3d35b61532803e96c39d84c7fae636b8205531e57e41641d1222dbd09275288e4dee2f2f94c837d58846212a0f4ed1643b28
7
+ data.tar.gz: 6e5c53ef75f07879d338692ce9271749002c13f8174a19fe3857b3396ec1512a2368770ec50bd24de2a0c9dc325dddb5b3547564c79cc360a40d1b19b35d2c50
@@ -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,26 @@ 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.20.1 - 2022-07-18
6
+
7
+ ### Fixed
8
+ * [#2458](https://github.com/Shopify/shopify-cli/pull/2458): Fix shop URL in unauthorized error message
9
+ * [#2459](https://github.com/Shopify/shopify-cli/pull/2459): Fix `.json` file ignore issues with `shopify theme push`
10
+ * [#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
11
+
12
+ ## Version 2.20.0 - 2022-07-11
13
+
14
+ ### Added
15
+ * [#2368](https://github.com/Shopify/shopify-cli/pull/2368): Add performance enhancements to the `theme serve` and `theme push` commands
16
+ * [#2437](https://github.com/Shopify/shopify-cli/pull/2437): Add support to the `warnings` field in the assets API
17
+ * [#2446](https://github.com/Shopify/shopify-cli/pull/2446): Show a friendly message when developers use a browser without SSE support
18
+
19
+ ### Fixed
20
+ * [#2418](https://github.com/Shopify/shopify-cli/pull/2418): Improve the help message of the `theme open -e/--editor` flag
21
+
22
+ ### Changed
23
+ * [#2444](https://github.com/Shopify/shopify-cli/pull/2444): Expose the `-s` option in the help text of `login`, `switch` etc.
24
+
5
25
  ## Version 2.18.0 - 2022-05-30
6
26
 
7
27
  ### Added
@@ -12,6 +32,7 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
12
32
  ### Fixed
13
33
  * [#2352](https://github.com/Shopify/shopify-cli/pull/2352): Provide better DX when dealing with empty theme selection
14
34
  * [#2347](https://github.com/Shopify/shopify-cli/pull/2347): Fix #2346 Heroku CLI installation for Apple silicon
35
+ * [#2422](https://github.com/Shopify/shopify-cli/pull/2422): Add Shopify branding and styling to post-authentication browser page
15
36
 
16
37
  ## Version 2.17.0 - 2022-05-12
17
38
 
@@ -42,7 +63,7 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
42
63
 
43
64
  ### Added
44
65
  * [#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.
66
+ * [#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
67
 
47
68
  ### Changed
48
69
  * [#2272](https://github.com/Shopify/shopify-cli/pull/2272): Changed interactive apps list scope for extension create|register|connect commands
@@ -50,7 +71,7 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
50
71
  ## Version 2.15.6 - 2022-04-12
51
72
 
52
73
  ### Fixed
53
- * [#2246](https://github.com/Shopify/shopify-cli/pull/2246): Fix callback urls for app serve
74
+ * [#2246](https://github.com/Shopify/shopify-cli/pull/2246): Fix callback urls for app serve
54
75
 
55
76
  ## Version 2.15.5 - 2022-04-08
56
77
 
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.18.1)
4
+ shopify-cli (2.20.1)
5
5
  bugsnag (~> 6.22)
6
6
  listen (~> 3.7.0)
7
- theme-check (~> 1.10.1)
7
+ theme-check (~> 1.10.3)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
@@ -108,7 +108,7 @@ GEM
108
108
  faraday (>= 0.9)
109
109
  sawyer (~> 0.8.0, >= 0.5.3)
110
110
  parallel (1.21.0)
111
- parser (3.1.1.0)
111
+ parser (3.1.2.0)
112
112
  ast (~> 2.4.1)
113
113
  pry (0.13.1)
114
114
  coderay (~> 1.1)
@@ -150,7 +150,7 @@ GEM
150
150
  faraday (> 0.8, < 2.0)
151
151
  sys-uname (1.2.2)
152
152
  ffi (~> 1.1)
153
- theme-check (1.10.2)
153
+ theme-check (1.10.3)
154
154
  liquid (>= 5.1.0)
155
155
  nokogiri (>= 1.12)
156
156
  parser (~> 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
 
data/dev.yml CHANGED
@@ -13,7 +13,6 @@ up:
13
13
  - rpm:
14
14
  version: 4.17.0
15
15
  - bundler
16
- - docker
17
16
 
18
17
  test:
19
18
  desc: "Run tests."
@@ -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 " \
@@ -15,7 +15,7 @@ module Extension
15
15
 
16
16
  class << self
17
17
  def supported?(type)
18
- if type_supported?(type) && type_enabled?(type)
18
+ if type_supported?(type) && beta_enabled?
19
19
  return true if binary_installed?
20
20
  warn_about_missing_binary
21
21
  end
@@ -31,11 +31,6 @@ module Extension
31
31
  SUPPORTED_EXTENSION_TYPES.include?(type.downcase)
32
32
  end
33
33
 
34
- # Some types are enabled unconditionally; others require beta_enabled
35
- def type_enabled?(type)
36
- beta_enabled? || "checkout_ui_extension" == type.downcase
37
- end
38
-
39
34
  private
40
35
 
41
36
  def binary_installed?
@@ -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
@@ -25,7 +25,7 @@ module Script
25
25
  project = Layers::Application::CreateScript.call(
26
26
  ctx: @ctx,
27
27
  language: options.flags[:language]&.downcase || "wasm",
28
- sparse_checkout_branch: options.flags[:branch] || "master",
28
+ sparse_checkout_branch: options.flags[:branch] || "main",
29
29
  title: form.title,
30
30
  extension_point_type: form.extension_point,
31
31
  )
@@ -4,57 +4,57 @@ payment_methods:
4
4
  typescript:
5
5
  beta: true
6
6
  package: "@shopify/scripts-checkout-apis"
7
- repo: "https://github.com/Shopify/scripts-apis-examples"
7
+ repo: "https://github.com/Shopify/function-examples"
8
8
  wasm:
9
- repo: "https://github.com/Shopify/scripts-apis-examples"
9
+ repo: "https://github.com/Shopify/function-examples"
10
10
  rust:
11
- repo: "https://github.com/Shopify/scripts-apis-examples"
11
+ repo: "https://github.com/Shopify/function-examples"
12
12
  payment_customization:
13
13
  beta: true
14
14
  domain: 'checkout'
15
15
  libraries:
16
16
  wasm:
17
- repo: "https://github.com/Shopify/scripts-apis-examples"
17
+ repo: "https://github.com/Shopify/function-examples"
18
18
  rust:
19
- repo: "https://github.com/Shopify/scripts-apis-examples"
19
+ repo: "https://github.com/Shopify/function-examples"
20
20
  shipping_methods:
21
21
  domain: 'checkout'
22
22
  libraries:
23
23
  typescript:
24
24
  beta: true
25
25
  package: "@shopify/scripts-checkout-apis"
26
- repo: "https://github.com/Shopify/scripts-apis-examples"
26
+ repo: "https://github.com/Shopify/function-examples"
27
27
  wasm:
28
- repo: "https://github.com/Shopify/scripts-apis-examples"
28
+ repo: "https://github.com/Shopify/function-examples"
29
29
  rust:
30
- repo: "https://github.com/Shopify/scripts-apis-examples"
30
+ repo: "https://github.com/Shopify/function-examples"
31
31
  product_discounts:
32
32
  beta: true
33
33
  domain: 'discounts'
34
34
  libraries:
35
35
  wasm:
36
- repo: "https://github.com/Shopify/scripts-apis-examples"
36
+ repo: "https://github.com/Shopify/function-examples"
37
37
  rust:
38
- repo: "https://github.com/Shopify/scripts-apis-examples"
38
+ repo: "https://github.com/Shopify/function-examples"
39
39
  order_discounts:
40
40
  beta: true
41
41
  domain: 'discounts'
42
42
  libraries:
43
43
  wasm:
44
- repo: "https://github.com/Shopify/scripts-apis-examples"
44
+ repo: "https://github.com/Shopify/function-examples"
45
45
  rust:
46
- repo: "https://github.com/Shopify/scripts-apis-examples"
46
+ repo: "https://github.com/Shopify/function-examples"
47
47
  shipping_discounts:
48
48
  beta: true
49
49
  domain: 'discounts'
50
50
  libraries:
51
51
  wasm:
52
- repo: "https://github.com/Shopify/scripts-apis-examples"
52
+ repo: "https://github.com/Shopify/function-examples"
53
53
  rust:
54
- repo: "https://github.com/Shopify/scripts-apis-examples"
54
+ repo: "https://github.com/Shopify/function-examples"
55
55
  shipping_rates_consolidation:
56
56
  beta: true
57
57
  domain: 'checkout'
58
58
  libraries:
59
59
  wasm:
60
- repo: "https://github.com/Shopify/scripts-apis-examples"
60
+ repo: "https://github.com/Shopify/function-examples"
@@ -7,11 +7,6 @@ module Script
7
7
 
8
8
  def ask
9
9
  apps = @xargs.fetch(:apps)
10
-
11
- unless @xargs[:acting_as_shopify_organization]
12
- apps = apps.select { |app| app["appType"] == "custom" }
13
- end
14
-
15
10
  raise Errors::NoExistingAppsError if apps.empty?
16
11
 
17
12
  @app =
@@ -4,12 +4,11 @@ module Script
4
4
  module Layers
5
5
  module Domain
6
6
  class Metadata
7
- attr_reader :schema_major_version, :schema_minor_version, :use_msgpack
7
+ attr_reader :schema_major_version, :schema_minor_version
8
8
 
9
- def initialize(schema_major_version, schema_minor_version, use_msgpack)
9
+ def initialize(schema_major_version, schema_minor_version)
10
10
  @schema_major_version = schema_major_version
11
11
  @schema_minor_version = schema_minor_version
12
- @use_msgpack = use_msgpack
13
12
  end
14
13
 
15
14
  class << self
@@ -17,7 +16,6 @@ module Script
17
16
  err_tag = nil
18
17
  metadata_hash = JSON.parse(metadata_json)
19
18
 
20
- use_msgpack = !!metadata_hash.dig("flags", "use_msgpack")
21
19
  schema_versions = metadata_hash["schemaVersions"] || {}
22
20
 
23
21
  version = schema_versions.values.first || {}
@@ -35,7 +33,7 @@ module Script
35
33
  err_tag = "script.error.metadata_schema_versions_missing_minor"
36
34
  end
37
35
 
38
- Metadata.new(schema_major_version, schema_minor_version, use_msgpack)
36
+ Metadata.new(schema_major_version, schema_minor_version)
39
37
  rescue JSON::ParserError
40
38
  err_tag = "script.error.metadata_validation_cause"
41
39
  ensure
@@ -90,7 +90,7 @@ module Script
90
90
  )
91
91
  elsif (errors = user_errors.filter { |err| err["tag"] == "input_query_validation_error" }).any?
92
92
  raise Errors::InvalidInputQueryErrors, errors.map { |err| err["message"] }
93
- elsif user_errors.find { |err| %w(not_use_msgpack_error schema_version_argument_error).include?(err["tag"]) }
93
+ elsif user_errors.find { |err| %w(schema_version_argument_error).include?(err["tag"]) }
94
94
  raise Domain::Errors::MetadataValidationError
95
95
  elsif user_errors.find { |err| err["tag"] == "invalid_app_bridge_create_path" }
96
96
  raise Errors::InvalidAppBridgePathError, "create"
@@ -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
+ }
@@ -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)