shopify-cli 2.0.0 → 2.0.1

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: 24c62bd5226aa12bbd9bd97097bc876669c5b0e1ce9186ec204c77c195ae123e
4
- data.tar.gz: 0a35817ec758bfae2cace1cd28c1a4e1aa96357583926b17f14e31b05ae1b02a
3
+ metadata.gz: 8a3d1792a9f0fef3212722391bc41ac2cba899f60b65c61d75c624fb61aef1dc
4
+ data.tar.gz: 4927100649c20fbedd270715ff5e34fe89138548c2355f8fdff68ed19bdc6ce4
5
5
  SHA512:
6
- metadata.gz: 01be89d86afb3e057b85e02a2d68332ae16b04a3b44349995a594ba78fbd5f8f6a02d0a7f0ffc5ee418c930036c0845ef1076d647233a3482893005ada91d86c
7
- data.tar.gz: d018a62cdca9d060ccb110ee13f51064b718c792a20ae0a9f9b1eece38522572060b3cd338950385a0e17baed94ad10329f6519f6520788e81534d149c21cbf0
6
+ metadata.gz: 9cdddb7dc42cb7df1baa92baea6da019b180092aa54d40185a72a8f0552d1f894bf896fedc007ded724023bdce163a13fb16d7e8eb4f11554aafc19fbdedf318
7
+ data.tar.gz: 61e74dc5788edc4653902bf2a42ddc8ca9da3535bc4b1779a0ed73b475940c423a61374e6f5eb18c5e635115ea86634b29c0ebf3f081bce28cb7fec2fd4071cd
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  Unreleased
2
2
  ------
3
3
 
4
+ Version 2.0.1
5
+ -------------
6
+ * [#1295](https://github.com/Shopify/shopify-cli/pull/1295): Ignore files at the root of a theme app extension project
7
+ * [#1296](https://github.com/Shopify/shopify-cli/pull/1296): Fix issue [#1294](https://github.com/Shopify/shopify-cli/issues/1294) regarding call to Windows `start` command with URL.
8
+ * [#1298](https://github.com/Shopify/shopify-cli/pull/1298): Fix error in `theme serve` command
9
+ * [#1301](https://github.com/Shopify/shopify-cli/pull/1301): Add `theme init` command
10
+
4
11
  Version 2.0.0
5
12
  -------------
6
13
  * Adds support for theme development
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.0.0)
4
+ shopify-cli (2.0.1)
5
5
  listen (~> 3.5)
6
6
  theme-check (~> 1.0)
7
7
 
data/RELEASING.md CHANGED
@@ -15,6 +15,8 @@
15
15
 
16
16
  1. Update the version of Shopify CLI in `lib/shopify-cli/version.rb`
17
17
 
18
+ 1. Update the version of Shopify CLI at the top of `Gemfile.lock` (failing to do so causes the CI build to fail)
19
+
18
20
  1. Add an entry for the new release to `CHANGELOG.md`
19
21
 
20
22
  1. Commit the changes with a commit message like "Packaging for release X.Y.Z"
@@ -64,6 +64,9 @@ module Extension
64
64
 
65
65
  def validate(filename)
66
66
  dirname = File.dirname(filename)
67
+ # Skip files in the root of the directory tree
68
+ return false if dirname == "."
69
+
67
70
  unless SUPPORTED_BUCKETS.include?(dirname)
68
71
  raise Extension::Errors::InvalidFilenameError, "Invalid directory: #{dirname}"
69
72
  end
@@ -75,19 +75,30 @@ module Script
75
75
  class ScriptServiceAPI < ShopifyCli::API
76
76
  property(:api_key, accepts: String)
77
77
 
78
+ LOCAL_INSTANCE_URL = "https://script-service.myshopify.io"
79
+
78
80
  def self.query(ctx, query_name, api_key: nil, variables: {})
79
81
  api_client(ctx, api_key).query(query_name, variables: variables)
80
82
  end
81
83
 
82
84
  def self.api_client(ctx, api_key)
85
+ instance_url = spin_instance_url || LOCAL_INSTANCE_URL
83
86
  new(
84
87
  ctx: ctx,
85
- url: "https://script-service.myshopify.io/graphql",
88
+ url: "#{instance_url}/graphql",
86
89
  token: "",
87
90
  api_key: api_key
88
91
  )
89
92
  end
90
93
 
94
+ def self.spin_instance_url
95
+ workspace = ENV["SPIN_WORKSPACE"]
96
+ namespace = ENV["SPIN_NAMESPACE"]
97
+ return if workspace.nil? || namespace.nil?
98
+
99
+ "https://script-service.#{workspace}.#{namespace}.us.spin.dev"
100
+ end
101
+
91
102
  def auth_headers(*)
92
103
  tokens = { "APP_KEY" => api_key }.compact.to_json
93
104
  { "X-Shopify-Authenticated-Tokens" => tokens }
@@ -104,7 +115,7 @@ module Script
104
115
  private_constant(:PartnersProxyAPI)
105
116
 
106
117
  def script_service_request(query_name:, variables: nil, **options)
107
- resp = if ENV["BYPASS_PARTNERS_PROXY"]
118
+ resp = if bypass_partners_proxy
108
119
  ScriptServiceAPI.query(ctx, query_name, variables: variables, **options)
109
120
  else
110
121
  proxy_through_partners(query_name: query_name, variables: variables, **options)
@@ -113,6 +124,10 @@ module Script
113
124
  resp
114
125
  end
115
126
 
127
+ def bypass_partners_proxy
128
+ !ENV["BYPASS_PARTNERS_PROXY"].nil?
129
+ end
130
+
116
131
  def proxy_through_partners(query_name:, variables: nil, **options)
117
132
  options[:variables] = variables.to_json if variables
118
133
  resp = PartnersProxyAPI.query(ctx, query_name, **options)
@@ -6,6 +6,7 @@ module Theme
6
6
  end
7
7
 
8
8
  class Command < ShopifyCli::ProjectCommands
9
+ subcommand :Init, "init", Project.project_filepath("commands/init")
9
10
  subcommand :Serve, "serve", Project.project_filepath("commands/serve")
10
11
  subcommand :Pull, "pull", Project.project_filepath("commands/pull")
11
12
  subcommand :Push, "push", Project.project_filepath("commands/push")
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Theme
4
+ class Command
5
+ class Init < ShopifyCli::SubCommand
6
+ options do |parser, flags|
7
+ parser.on("-u", "--clone-url URL") { |url| flags[:clone_url] = url }
8
+ end
9
+
10
+ DEFAULT_CLONE_URL = "https://github.com/Shopify/dawn.git"
11
+
12
+ def call(args, _name)
13
+ name = args.first || ask_name
14
+ clone_url = options.flags[:clone_url] || DEFAULT_CLONE_URL
15
+ clone(clone_url, name)
16
+ end
17
+
18
+ def self.help
19
+ ShopifyCli::Context.message("theme.init.help", ShopifyCli::TOOL_NAME, ShopifyCli::TOOL_NAME)
20
+ end
21
+
22
+ private
23
+
24
+ def ask_name
25
+ CLI::UI::Prompt.ask(@ctx.message("theme.init.ask_name"))
26
+ end
27
+
28
+ def clone(url, name)
29
+ ShopifyCli::Git.clone(url, name)
30
+
31
+ @ctx.root = File.join(@ctx.root, name)
32
+
33
+ begin
34
+ @ctx.rm_r(".git")
35
+ @ctx.rm_r(".github")
36
+ rescue Errno::ENOENT => e
37
+ @ctx.debug(e)
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -10,7 +10,9 @@ module Theme
10
10
 
11
11
  def call(*)
12
12
  flags = options.flags.dup
13
- ShopifyCli::Theme::DevServer.start(@ctx, ".", **flags)
13
+ ShopifyCli::Theme::DevServer.start(@ctx, ".", **flags) do |syncer|
14
+ UI::SyncProgressBar.new(syncer).progress(:upload_theme!, delay_low_priority_files: true)
15
+ end
14
16
  end
15
17
 
16
18
  def self.help
@@ -8,6 +8,17 @@ module Theme
8
8
  Usage: {{command:%1$s theme [ %2$s ]}}
9
9
  HELP
10
10
 
11
+ init: {
12
+ help: <<~HELP,
13
+ {{command:%s theme init}}: Clones a Git repository to use as a starting point for building a new theme.
14
+
15
+ Usage: {{command:%s theme init [ NAME ]}}
16
+
17
+ Options:
18
+ {{command:-u, --clone-url=URL}} The Git URL to clone from. Defaults to Shopify's example theme, Dawn: https://github.com/Shopify/dawn.git
19
+ HELP
20
+ ask_name: "Theme name",
21
+ },
11
22
  publish: {
12
23
  confirmation: "This will change your live theme. Do you want to continue?",
13
24
  deploying: "Deploying theme",
@@ -327,7 +327,7 @@ module ShopifyCli
327
327
  if linux? && which("xdg-open")
328
328
  system("xdg-open", uri.to_s)
329
329
  elsif windows?
330
- system("start", uri.to_s)
330
+ system("start \"\" \"#{uri}\"")
331
331
  elsif mac?
332
332
  system("open", uri.to_s)
333
333
  else
@@ -1,4 +1,5 @@
1
1
  require "net/http"
2
+ require "openssl"
2
3
 
3
4
  module ShopifyCli
4
5
  class HttpRequest
@@ -24,8 +25,13 @@ module ShopifyCli
24
25
  end
25
26
 
26
27
  def request(uri, body, headers, req)
28
+ cert_store = OpenSSL::X509::Store.new
29
+ cert_store.set_default_paths
30
+
27
31
  http = ::Net::HTTP.new(uri.host, uri.port)
28
32
  http.use_ssl = true
33
+ http.cert_store = cert_store
34
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE if ENV["SSL_VERIFY_NONE"]
29
35
 
30
36
  req.body = body unless body.nil?
31
37
  req["Content-Type"] = "application/json"
@@ -20,7 +20,7 @@ module ShopifyCli
20
20
  class << self
21
21
  attr_accessor :ctx
22
22
 
23
- def start(ctx, root, port: 9292, silent: false)
23
+ def start(ctx, root, port: 9292)
24
24
  @ctx = ctx
25
25
  theme = DevelopmentTheme.new(ctx, root: root)
26
26
  ignore_filter = IgnoreFilter.from_path(root)
@@ -43,10 +43,10 @@ module ShopifyCli
43
43
  CLI::UI::Frame.open(@ctx.message("theme.serve.serve")) do
44
44
  ctx.print_task("Syncing theme ##{theme.id} on #{theme.shop}")
45
45
  @syncer.start_threads
46
- if silent
47
- @syncer.upload_theme!(delay_low_priority_files: true)
46
+ if block_given?
47
+ yield @syncer
48
48
  else
49
- @syncer.upload_theme_with_progress_bar!(delay_low_priority_files: true)
49
+ @syncer.upload_theme!(delay_low_priority_files: true)
50
50
  end
51
51
 
52
52
  return if stopped
@@ -1,3 +1,3 @@
1
1
  module ShopifyCli
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
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.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-28 00:00:00.000000000 Z
11
+ date: 2021-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -280,6 +280,7 @@ files:
280
280
  - lib/project_types/theme/cli.rb
281
281
  - lib/project_types/theme/commands/check.rb
282
282
  - lib/project_types/theme/commands/delete.rb
283
+ - lib/project_types/theme/commands/init.rb
283
284
  - lib/project_types/theme/commands/language_server.rb
284
285
  - lib/project_types/theme/commands/package.rb
285
286
  - lib/project_types/theme/commands/publish.rb