shopify-cli 2.30.0 → 2.32.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: 3050c5be253ff04fbd3fa04ddd60389c0e6c0c2c0a3ae3fdcc6b059dc428c193
4
- data.tar.gz: 2d373f27b01e11cd4df467114ba00849c978ae7cca1d8529749be5ba5d5d663d
3
+ metadata.gz: b1f827e0b1d481a8fdd6e7160ef85d6e63bee0a7607f6bf148693956f901d67c
4
+ data.tar.gz: 5882878a69100c7ac97255c80a0ca868ca616be1eca5a523c3e1ddf1e8896dc4
5
5
  SHA512:
6
- metadata.gz: 8427e448b97accd935d7b6b16452070139a70139d53cfd3e4d7f4efff495873f4d1372e9e08bf4b75fae7150c95ddb431363b7d970dbcfffc1fbeb1b22f7c0af
7
- data.tar.gz: be22490e0dea78184b7bcd58c4bca6a1a52c2963c45063e9a7ad6703ecd295c6e31d37a02716f741a3a7682d0fc12f86a167b0d78d1ef9bd973894bc5b7b4ba1
6
+ metadata.gz: 5f2335aecb476e962d7283d33187acb94cae34a1b6b23f52f48ad890c4daaeeabf0afeaecb0a3740a57ac98c86a18a7f35422430da2eea5413472fc85c740360
7
+ data.tar.gz: 6e9b70d65c59e9531b44e270d752637999bccaaf844c7f89be659c04f3f6f343bd89ce72e1e25c46d0d16dc66873233a5268aba8aab2eed873e0a086a7af0b6a
data/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@ 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
+
13
+ ## Version 2.31.0 - 2022-11-07
14
+
15
+ ### Added
16
+ * [#2676](https://github.com/Shopify/shopify-cli/pull/2676): Introduce shorthand `-e` for `--theme-editor-sync` in `shopify theme serve`
17
+
5
18
  ## Version 2.30.0 - 2022-11-01
6
19
 
7
20
  ### Fixed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.30.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?
@@ -23,7 +23,7 @@ module Theme
23
23
  parser.on("--port=PORT") { |port| flags[:port] = port.to_i }
24
24
  parser.on("--poll") { flags[:poll] = true }
25
25
  parser.on("--live-reload=MODE") { |mode| flags[:mode] = as_reload_mode(mode) }
26
- parser.on("--theme-editor-sync") { flags[:editor_sync] = true }
26
+ parser.on("-e", "--theme-editor-sync") { flags[:editor_sync] = true }
27
27
  parser.on("--stable") { flags[:stable] = true }
28
28
  parser.on("-t", "--theme=NAME_OR_ID") { |theme| flags[:theme] = theme }
29
29
  parser.on("-o", "--only=PATTERN", Conversions::IncludeGlob) do |pattern|
@@ -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.
@@ -123,17 +125,17 @@ module Theme
123
125
  Usage: {{command:%s theme serve [ ROOT ]}}
124
126
 
125
127
  Options:
126
- {{command:-t, --theme=NAME_OR_ID}} Theme ID or name of the remote theme.
127
- {{command:-o, --only}} Hot reload only files that match the specified pattern.
128
- {{command:-x, --ignore}} Skip hot reloading any files that match the specified pattern.
129
- {{command:--port=PORT}} Local port to serve theme preview from.
130
- {{command:--poll}} Force polling to detect file changes.
131
- {{command:--host=HOST}} Set which network interface the web server listens on. The default value is 127.0.0.1.
132
- {{command:--theme-editor-sync}} Synchronize Theme Editor updates in the local theme files.
133
- {{command:--live-reload=MODE}} The live reload mode switches the server behavior when a file is modified:
134
- - {{command:hot-reload}} Hot reloads local changes to CSS and sections (default)
135
- - {{command:full-page}} Always refreshes the entire page
136
- - {{command:off}} Deactivate live reload
128
+ {{command:-t, --theme=NAME_OR_ID}} Theme ID or name of the remote theme.
129
+ {{command:-o, --only}} Hot reload only files that match the specified pattern.
130
+ {{command:-x, --ignore}} Skip hot reloading any files that match the specified pattern.
131
+ {{command:-e, --theme-editor-sync}} Synchronize Theme Editor updates in the local theme files.
132
+ {{command:--port=PORT}} Local port to serve theme preview from.
133
+ {{command:--poll}} Force polling to detect file changes.
134
+ {{command:--host=HOST}} Set which network interface the web server listens on. The default value is 127.0.0.1.
135
+ {{command:--live-reload=MODE}} The live reload mode switches the server behavior when a file is modified:
136
+ - {{command:hot-reload}} Hot reloads local changes to CSS and sections (default)
137
+ - {{command:full-page}} Always refreshes the entire page
138
+ - {{command:off}} Deactivate live reload
137
139
  HELP
138
140
  reload_mode_is_not_valid: "The live reload mode `%s` is not valid.",
139
141
  try_a_valid_reload_mode: "Try a valid live reload mode: %s.",
@@ -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
@@ -120,10 +120,8 @@ module ShopifyCLI
120
120
  end
121
121
 
122
122
  def update_homebrew_repo
123
- %w(shopify-cli.rb shopify-cli@2.rb).each do |source_filename|
124
- source_file = File.join(package_dir, source_filename)
125
- FileUtils.copy(source_file, homebrew_path)
126
- end
123
+ source_file = File.join(package_dir, "shopify-cli@2.rb")
124
+ FileUtils.copy(source_file, homebrew_path)
127
125
  Dir.chdir(homebrew_path) do
128
126
  system_or_fail("git commit -am '#{homebrew_update_message}'", "commit homebrew update")
129
127
  system_or_fail("git push -u origin #{homebrew_release_branch}", "push homebrew branch")
@@ -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.30.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.30.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-01 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