shopify-cli 2.31.0 → 2.32.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 671907fe67b2c0ee4ff9c99a55bfbf53562f15f7540c23c6fb07ddb9b46398df
4
- data.tar.gz: 5a327f5060b50fa1761a20d5ca1601cab1fc44e7f3e1b7ab62e6747b9a92a164
3
+ metadata.gz: b1f827e0b1d481a8fdd6e7160ef85d6e63bee0a7607f6bf148693956f901d67c
4
+ data.tar.gz: 5882878a69100c7ac97255c80a0ca868ca616be1eca5a523c3e1ddf1e8896dc4
5
5
  SHA512:
6
- metadata.gz: 2baa5372dc8502fe0764378b556b043eb136415ee9f94f1ea42fead7e367f46bdc0114b6e79f0eef99cb92270117561f004d09157e9bce3b45912aaead4bd20a
7
- data.tar.gz: 42819560813ed73fc39d09e68d5e7d07a68ca6b70af5666abca8741740f6d2fb912d500a28bd5ba9dbcb076ad0f9444097157a778cabd506abca06c6db302021
6
+ metadata.gz: 5f2335aecb476e962d7283d33187acb94cae34a1b6b23f52f48ad890c4daaeeabf0afeaecb0a3740a57ac98c86a18a7f35422430da2eea5413472fc85c740360
7
+ data.tar.gz: 6e9b70d65c59e9531b44e270d752637999bccaaf844c7f89be659c04f3f6f343bd89ce72e1e25c46d0d16dc66873233a5268aba8aab2eed873e0a086a7af0b6a
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@ 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.32.0 - 2022-11-14
6
+
7
+ ### Added
8
+ * [#2680](https://github.com/Shopify/shopify-cli/pull/2680): Validate on `shopify theme share/pull/push/serve` if users are running the command in a theme/empty directory
9
+
10
+ ### Fixed
11
+ * [#2683](https://github.com/Shopify/shopify-cli/pull/2683): Fix timeout issue with the `shopify theme push` command and the `--json` flag
12
+
5
13
  ## Version 2.31.0 - 2022-11-07
6
14
 
7
15
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.31.0)
4
+ shopify-cli (2.32.0)
5
5
  bugsnag (~> 6.22)
6
6
  listen (~> 3.7.0)
7
7
  theme-check (~> 1.11.0)
@@ -101,7 +101,7 @@ GEM
101
101
  mocha (1.13.0)
102
102
  multi_test (0.1.2)
103
103
  multipart-post (2.1.1)
104
- nokogiri (1.13.8)
104
+ nokogiri (1.13.9)
105
105
  mini_portile2 (~> 2.8.0)
106
106
  racc (~> 1.4)
107
107
  octokit (4.22.0)
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "project_types/theme/models/specification_handlers/theme"
4
+
3
5
  module Theme
4
6
  class Command
5
7
  module Common
@@ -35,8 +37,28 @@ module Theme
35
37
  "."
36
38
  end
37
39
 
40
+ def valid_theme_directory?(root)
41
+ Theme::Models::SpecificationHandlers::Theme.new(root).valid? ||
42
+ current_directory_confirmed?
43
+ end
44
+
45
+ def exist_and_not_empty?(root)
46
+ Dir.exist?(root) && !Dir[File.join(root, "*")].empty?
47
+ end
48
+
38
49
  private
39
50
 
51
+ def current_directory_confirmed?
52
+ raise "Current theme directory can't be confirmed during tests" if @ctx.testing?
53
+
54
+ Forms::ConfirmStore.ask(
55
+ @ctx,
56
+ [],
57
+ title: @ctx.message("theme.confirm_current_directory"),
58
+ force: options.flags[:force],
59
+ ).confirmed?
60
+ end
61
+
40
62
  def default_argv(options)
41
63
  options.parser.default_argv.compact
42
64
  end
@@ -34,10 +34,13 @@ module Theme
34
34
  flags[:ignores] ||= []
35
35
  flags[:ignores] |= pattern
36
36
  end
37
+ parser.on("-f", "--force") { flags[:force] = true }
37
38
  end
38
39
 
39
40
  def call(_args, name)
40
41
  root = root_value(options, name)
42
+ return if exist_and_not_empty?(root) && !valid_theme_directory?(root)
43
+
41
44
  delete = !options.flags[:nodelete]
42
45
  theme = find_theme(root, **options.flags)
43
46
  return if theme.nil?
@@ -39,10 +39,13 @@ module Theme
39
39
  flags[:ignores] ||= []
40
40
  flags[:ignores] |= pattern
41
41
  end
42
+ parser.on("-f", "--force") { flags[:force] = true }
42
43
  end
43
44
 
44
45
  def call(_args, name)
45
46
  root = root_value(options, name)
47
+ return unless valid_theme_directory?(root)
48
+
46
49
  delete = !options.flags[:nodelete]
47
50
  theme = find_theme(root, **options.flags)
48
51
  return if theme.nil?
@@ -34,12 +34,15 @@ module Theme
34
34
  flags[:ignores] ||= []
35
35
  flags[:ignores] |= pattern
36
36
  end
37
+ parser.on("-f", "--force") { flags[:force] = true }
37
38
  end
38
39
 
39
40
  def call(_args, name)
40
41
  valid_authentication_method!
41
42
 
42
43
  root = root_value(options, name)
44
+ return unless valid_theme_directory?(root)
45
+
43
46
  flags = options.flags.dup
44
47
  host = flags[:host] || DEFAULT_HTTP_HOST
45
48
 
@@ -11,8 +11,14 @@ module Theme
11
11
 
12
12
  recommend_default_ruby_range
13
13
 
14
+ options do |parser, flags|
15
+ parser.on("-f", "--force") { flags[:force] = true }
16
+ end
17
+
14
18
  def call(_args, name)
15
19
  root = root_value(options, name)
20
+ return unless valid_theme_directory?(root)
21
+
16
22
  theme = create_theme(root)
17
23
 
18
24
  upload(theme)
@@ -18,6 +18,8 @@ module Theme
18
18
  ENSURE_USER
19
19
  stable_flag_suggestion: "If the current command isn't working as expected," \
20
20
  " we suggest re-running the command with the {{command: --stable}} flag",
21
+ confirm_current_directory: "It doesn’t seem like you’re running this command in a theme directory. " \
22
+ "Are you sure you want to proceed?",
21
23
  init: {
22
24
  help: <<~HELP,
23
25
  {{command:%s theme init}}: Clones a Git repository to use as a starting point for building a new theme.
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Theme
4
+ module Models
5
+ module SpecificationHandlers
6
+ class Theme
7
+ REQUIRED_FOLDERS = %w(config layout sections templates)
8
+
9
+ def initialize(root)
10
+ @root = root
11
+ end
12
+
13
+ def valid?
14
+ REQUIRED_FOLDERS.all? { |required_folder| Dir.exist?(File.join(@root, required_folder)) }
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -212,7 +212,7 @@ module ShopifyCLI
212
212
  end
213
213
 
214
214
  def update_progress_bar(size, total)
215
- @update_progress_bar_block.call(size, total)
215
+ @update_progress_bar_block&.call(size, total)
216
216
  end
217
217
 
218
218
  # Handler errors
@@ -1,3 +1,3 @@
1
1
  module ShopifyCLI
2
- VERSION = "2.31.0"
2
+ VERSION = "2.32.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.31.0
4
+ version: 2.32.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-11-07 00:00:00.000000000 Z
11
+ date: 2022-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -328,6 +328,7 @@ files:
328
328
  - lib/project_types/theme/forms/confirm_store.rb
329
329
  - lib/project_types/theme/forms/select.rb
330
330
  - lib/project_types/theme/messages/messages.rb
331
+ - lib/project_types/theme/models/specification_handlers/theme.rb
331
332
  - lib/project_types/theme/presenters/theme_presenter.rb
332
333
  - lib/project_types/theme/presenters/themes_presenter.rb
333
334
  - lib/project_types/theme/ui/sync_progress_bar.rb