shopify-cli 2.22.0 → 2.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4fdf2b1a1c6ff2b21a3adb26654fda425436a5660d27b487dd1473fc2530b02c
4
- data.tar.gz: 572fa0ba305ec75391c3aac020f1bb72c0874a8d138c7b05da8aaf0fdba68719
3
+ metadata.gz: db890ff22a5395154b92a4cf782ad621c2462b8aac8cc843c102be2a388a098b
4
+ data.tar.gz: e1ce745c465a52a84b33075e0b7ba8ffe15a10397061a9a5bea5bc1bd3669618
5
5
  SHA512:
6
- metadata.gz: bb78577fab62082d1fb27eacb1865a690c04a8985fea4af5684399e84a942d025e79b36792c1c382704231f8e73c67e71edd9cd055898de0aa48099b2d5dfb2e
7
- data.tar.gz: 7e19eb12d7e1cfc5d22002bde244451f21277547180a13617f3211de1b657099e12b85efa46ce8f5649954336cd24c672c98e9ac807af00212f7ea921e57f37f
6
+ metadata.gz: 506f249416682dda65299eaf0dd6d589f1dea1fbb2097f92f4738e5ad529184aabeb3b84387ed8d012db60da271e28ef53df24a9c49a85bdcfab0d722be23459
7
+ data.tar.gz: 7fdb0b575be5f09c9185479a04313bb16f0144e21316ebe48e17e98ef80d9766d765760c6d65fdcca1611eb367f2a3b59153c60f6406f92e5c98fa4cd1c36b58
data/.github/CODEOWNERS CHANGED
@@ -1,5 +1,5 @@
1
1
  * @shopify/core-build-learn
2
- * @shopify/development-lifecycle
2
+ * @shopify/cli-foundations
3
3
 
4
4
  /lib/project_types/script/ @shopify/scripts-platform
5
5
  /test/project_types/script/ @shopify/scripts-platform
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@ 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.23.0 - 2022-08-22
6
+
7
+ ### Fixed
8
+ * [#2528](https://github.com/Shopify/shopify-cli/pull/2528): Switch from using absolute file paths to relative paths for ignore filter
9
+
10
+ ### Added
11
+ * [#2520](https://github.com/Shopify/shopify-cli/pull/2520): Add the option to ignore new version warnings by passing the `SHOPIFY_CLI_RUN_AS_SUBPROCESS` environment variable
12
+ * [#2440](https://github.com/Shopify/shopify-cli/pull/2440): Warn when using CLI 2.0 in a CLI 3.0 project
13
+
5
14
  ## Version 2.22.0 - 2022-08-08
6
15
 
7
16
  ### Fixed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.22.0)
4
+ shopify-cli (2.23.0)
5
5
  bugsnag (~> 6.22)
6
6
  listen (~> 3.7.0)
7
7
  theme-check (~> 1.10.3)
@@ -1,14 +1,3 @@
1
- payment_methods:
2
- domain: 'checkout'
3
- libraries:
4
- typescript:
5
- beta: true
6
- package: "@shopify/scripts-checkout-apis"
7
- repo: "https://github.com/Shopify/function-examples"
8
- wasm:
9
- repo: "https://github.com/Shopify/function-examples"
10
- rust:
11
- repo: "https://github.com/Shopify/function-examples"
12
1
  payment_customization:
13
2
  beta: true
14
3
  domain: 'checkout'
@@ -20,10 +9,6 @@ payment_customization:
20
9
  shipping_methods:
21
10
  domain: 'checkout'
22
11
  libraries:
23
- typescript:
24
- beta: true
25
- package: "@shopify/scripts-checkout-apis"
26
- repo: "https://github.com/Shopify/function-examples"
27
12
  wasm:
28
13
  repo: "https://github.com/Shopify/function-examples"
29
14
  rust:
@@ -85,7 +85,7 @@ module Theme
85
85
  def push_completion_handler(theme, has_errors)
86
86
  if options.flags[:json]
87
87
  output = { theme: theme.to_h }
88
- output[:warning] = "Theme pushed with errors." if has_errors
88
+ output[:warning] = @ctx.message("theme.push.with_errors") if has_errors
89
89
 
90
90
  puts(JSON.generate(output))
91
91
  elsif options.flags[:publish]
@@ -113,6 +113,7 @@ module Theme
113
113
  {{underline:%s}}
114
114
  WARN
115
115
  name: "Theme name",
116
+ with_errors: "Theme pushed with errors.",
116
117
  },
117
118
  serve: {
118
119
  theme_not_found: "Theme \"%s\" doesn't exist",
@@ -31,6 +31,7 @@ module ShopifyCLI
31
31
  module EnvironmentVariables
32
32
  STACKTRACE = "SHOPIFY_CLI_STACKTRACE"
33
33
  TTY = "SHOPIFY_CLI_TTY"
34
+ RUN_AS_SUBPROCESS = "SHOPIFY_CLI_RUN_AS_SUBPROCESS"
34
35
 
35
36
  # When true the CLI points to a local instance of
36
37
  # the partners dashboard and identity.
@@ -0,0 +1,20 @@
1
+ module ShopifyCLI
2
+ module Core
3
+ ##
4
+ # ShopifyCLI::Core::CliVersion checks that the CLI in use is correct for the project.
5
+ #
6
+ class CliVersion
7
+ class << self
8
+ def using_3_0?
9
+ !!cli_3_0_toml_dir
10
+ end
11
+
12
+ private
13
+
14
+ def cli_3_0_toml_dir
15
+ Utilities.directory("shopify.app.toml", Dir.pwd)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -5,13 +5,27 @@ module ShopifyCLI
5
5
  module EntryPoint
6
6
  class << self
7
7
  def call(args, ctx = Context.new)
8
- if ctx.development? && !ctx.testing?
9
- ctx.warn(
10
- ctx.message("core.warning.development_version", File.join(ShopifyCLI::ROOT, "bin", ShopifyCLI::TOOL_NAME))
11
- )
12
- elsif !ctx.testing?
13
- new_version = ctx.new_version
14
- ctx.warn(ctx.message("core.warning.new_version", ShopifyCLI::VERSION, new_version)) unless new_version.nil?
8
+ # Only instruct the user to update the CLI, or warn them that they're
9
+ # using CLI2 not CLI3, if they're running CLI2 directly. Otherwise the
10
+ # warnings will be confusing and/or incorrect.
11
+ unless Environment.run_as_subprocess?
12
+ if ctx.development? && !ctx.testing?
13
+ ctx.warn(
14
+ ctx.message(
15
+ "core.warning.development_version",
16
+ File.join(ShopifyCLI::ROOT, "bin", ShopifyCLI::TOOL_NAME)
17
+ )
18
+ )
19
+ # because `!ctx.new_version.nil?` will change the config by calling ::Config.set
20
+ # it's important to keep the checks in this order so that we don't trigger it while testing
21
+ # since changing the config will throw errors
22
+ elsif !ctx.testing? && !ctx.new_version.nil?
23
+ ctx.warn(ctx.message("core.warning.new_version", ShopifyCLI::VERSION, ctx.new_version))
24
+ end
25
+
26
+ if ShopifyCLI::Core::CliVersion.using_3_0?
27
+ ctx.warn(ctx.message("core.warning.in_3_0_directory"))
28
+ end
15
29
  end
16
30
 
17
31
  ProjectType.load_all
@@ -4,5 +4,6 @@ module ShopifyCLI
4
4
  autoload :Executor, "shopify_cli/core/executor"
5
5
  autoload :HelpResolver, "shopify_cli/core/help_resolver"
6
6
  autoload :Monorail, "shopify_cli/core/monorail"
7
+ autoload :CliVersion, "shopify_cli/core/cli_version"
7
8
  end
8
9
  end
@@ -181,5 +181,12 @@ module ShopifyCLI
181
181
  def self.env_variable_truthy?(variable_name, env_variables: ENV)
182
182
  TRUTHY_ENV_VARIABLE_VALUES.include?(env_variables[variable_name.to_s])
183
183
  end
184
+
185
+ def self.run_as_subprocess?(env_variables: ENV)
186
+ env_variable_truthy?(
187
+ Constants::EnvironmentVariables::RUN_AS_SUBPROCESS,
188
+ env_variables: env_variables
189
+ )
190
+ end
184
191
  end
185
192
  end
@@ -791,6 +791,16 @@ module ShopifyCLI
791
791
  {{underline:https://shopify.dev/tools/cli/troubleshooting#upgrade-shopify-cli}}}}
792
792
 
793
793
  MESSAGE
794
+
795
+ in_3_0_directory: <<~MESSAGE,
796
+ {{*}} {{yellow:You appear to be working with a CLI 3.0 project, but running a CLI 2.0 command. New syntax documentation: https://shopify.dev/apps/tools/cli/commands#command-syntax}}
797
+
798
+ For more information on CLI 3.0, see the documentation:
799
+ {{underline:https://shopify.dev/apps/tools/cli}}
800
+
801
+ Already have CLI 3.0 installed? Run it using your node package manager, as explained here:
802
+ {{underline:https://shopify.dev/apps/tools/cli/cli-2#running-shopify-cli-2-x-and-3-x-in-the-same-environment}}
803
+ MESSAGE
794
804
  },
795
805
  reporting: {
796
806
  help: <<~HELP,
@@ -119,18 +119,9 @@ module ShopifyCLI
119
119
  private
120
120
 
121
121
  def directory(dir)
122
- @dir ||= Hash.new { |h, k| h[k] = __directory(k) }
122
+ @dir ||= Hash.new { |h, k| h[k] = Utilities.directory(".shopify-cli.yml", k) }
123
123
  @dir[dir]
124
124
  end
125
-
126
- def __directory(curr)
127
- loop do
128
- return nil if curr == "/" || /^[A-Z]:\/$/.match?(curr)
129
- file = File.join(curr, ".shopify-cli.yml")
130
- return curr if File.exist?(file)
131
- curr = File.dirname(curr)
132
- end
133
- end
134
125
  end
135
126
 
136
127
  property :directory # :nodoc:
@@ -40,14 +40,14 @@ module ShopifyCLI
40
40
 
41
41
  def notify_streams_of_file_change(modified, added, removed)
42
42
  files = (modified + added)
43
- .reject { |file| @ignore_filter&.ignore?(file) }
44
43
  .map { |file| @theme[file] }
44
+ .reject { |file| @ignore_filter&.ignore?(file.relative_path) }
45
45
 
46
46
  files -= liquid_css_files = files.select(&:liquid_css?)
47
47
 
48
48
  deleted_files = removed
49
- .reject { |file| @ignore_filter&.ignore?(file) }
50
49
  .map { |file| @theme[file] }
50
+ .reject { |file| @ignore_filter&.ignore?(file.relative_path) }
51
51
 
52
52
  remote_delete(deleted_files) unless deleted_files.empty?
53
53
  reload_page(removed) unless deleted_files.empty?
@@ -10,7 +10,7 @@ module ShopifyCLI
10
10
  end
11
11
 
12
12
  def ignore_file?(file)
13
- path = file.path
13
+ path = file.relative_path
14
14
  ignore_path?(path)
15
15
  end
16
16
 
@@ -382,7 +382,9 @@ module ShopifyCLI
382
382
  rescue JSON::ParserError
383
383
  [exception.message]
384
384
  rescue StandardError => e
385
- ["The asset #{operation.file} is could not be synced (cause: #{e.message})."]
385
+ cause = "(cause: #{e.message})"
386
+ backtrace = e.backtrace.join("\n")
387
+ ["The asset #{operation.file} could not be synced #{cause} #{backtrace}"]
386
388
  end
387
389
 
388
390
  def backoff_if_near_limit!(used, limit)
@@ -3,5 +3,14 @@ module ShopifyCLI
3
3
  def self.version_dropping_pre_and_build(version)
4
4
  Semantic::Version.new("#{version.major}.#{version.minor}.#{version.patch}")
5
5
  end
6
+
7
+ def self.directory(pattern, curr)
8
+ loop do
9
+ return nil if curr == "/" || /^[A-Z]:\/$/.match?(curr)
10
+ file = File.join(curr, pattern)
11
+ return curr if File.exist?(file)
12
+ curr = File.dirname(curr)
13
+ end
14
+ end
6
15
  end
7
16
  end
@@ -1,3 +1,3 @@
1
1
  module ShopifyCLI
2
- VERSION = "2.22.0"
2
+ VERSION = "2.23.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.22.0
4
+ version: 2.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-08 00:00:00.000000000 Z
11
+ date: 2022-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -422,6 +422,7 @@ files:
422
422
  - lib/shopify_cli/constants.rb
423
423
  - lib/shopify_cli/context.rb
424
424
  - lib/shopify_cli/core.rb
425
+ - lib/shopify_cli/core/cli_version.rb
425
426
  - lib/shopify_cli/core/entry_point.rb
426
427
  - lib/shopify_cli/core/executor.rb
427
428
  - lib/shopify_cli/core/finalize.rb