shopify-cli 2.15.0 → 2.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/stale.yml +7 -2
- data/CHANGELOG.md +10 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +39 -7
- data/Rakefile +27 -0
- data/ext/shopify-extensions/version +1 -1
- data/lib/project_types/extension/forms/questions/ask_template.rb +5 -8
- data/lib/project_types/extension/messages/messages.rb +10 -0
- data/lib/project_types/extension/models/development_server_requirements.rb +13 -7
- data/lib/project_types/extension/models/server_config/root.rb +2 -0
- data/lib/project_types/script/config/extension_points.yml +18 -0
- data/lib/project_types/theme/messages/messages.rb +7 -0
- data/lib/shopify_cli/changelog.rb +76 -0
- data/lib/shopify_cli/command.rb +7 -0
- data/lib/shopify_cli/messages/messages.rb +6 -0
- data/lib/shopify_cli/release.rb +94 -0
- data/lib/shopify_cli/sed.rb +19 -0
- data/lib/shopify_cli/services/app/create/rails_service.rb +1 -1
- data/lib/shopify_cli/theme/theme.rb +12 -4
- data/lib/shopify_cli/tunnel.rb +9 -0
- data/lib/shopify_cli/version.rb +1 -1
- data/shopify-cli.gemspec +3 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 141760dcf4bd3da2b9e92a238c72ee4612fc9e72ce4f522db84f190028439175
|
4
|
+
data.tar.gz: f16bc2db60656219f7f1484ce455380822fb7d7da4c65faeceeaf065953076c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1df93436fa11a84a2df90f354a59277fbf29bd2445b097da8c2ddd6d727dc9d2d4792602de476f3479329e58873dfd222ea185fd096271896bd4ee8533f5b242
|
7
|
+
data.tar.gz: ada360c3f4529d52a0315c70b1c4fea63ad69f0da1ca7aab384958adb8bf342003d4c4dced65ddc4984e5732fb5e2604f77ba82702908242b1d1427570362626
|
data/.github/workflows/stale.yml
CHANGED
@@ -8,6 +8,7 @@ name: Mark stale issues and pull requests
|
|
8
8
|
on:
|
9
9
|
schedule:
|
10
10
|
- cron: '31 3 * * *' # randomly chosen time of day
|
11
|
+
workflow_dispatch:
|
11
12
|
|
12
13
|
jobs:
|
13
14
|
stale:
|
@@ -18,7 +19,7 @@ jobs:
|
|
18
19
|
pull-requests: write
|
19
20
|
|
20
21
|
steps:
|
21
|
-
- uses: actions/stale@
|
22
|
+
- uses: actions/stale@v4
|
22
23
|
with:
|
23
24
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
24
25
|
days-before-issue-stale: 90
|
@@ -38,4 +39,8 @@ jobs:
|
|
38
39
|
Thanks for helping to improve Shopify's dev tooling and experience.
|
39
40
|
stale-issue-label: 'no-issue-activity'
|
40
41
|
stale-pr-label: 'no-pr-activity'
|
41
|
-
|
42
|
+
ascending: true
|
43
|
+
# The math seems a bit fuzzy, but this should amount to a max of 50 issues daily.
|
44
|
+
# But then the same issues get checked first so we don't end up progressing too quickly until we can close what we started.
|
45
|
+
# Hopefully https://github.com/actions/stale/issues/692 will be closed and fix some of this mess.
|
46
|
+
operations-per-run: 200
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,16 @@ 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.15.1
|
6
|
+
|
7
|
+
### Added
|
8
|
+
* [#1934](https://github.com/Shopify/shopify-cli/pull/1934): Block directories in theme assets
|
9
|
+
* [#1880](https://github.com/Shopify/shopify-cli/pull/1880): Recognize attempts to pass a store name and suggest correction
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
* [#1874](https://github.com/Shopify/shopify-cli/pull/1874): Make ngrok errors more robust and helpful
|
13
|
+
* [#2172](https://github.com/Shopify/shopify-cli/pull/2172): Fix Ruby check for Rails app creation
|
14
|
+
|
5
15
|
## Version 2.15.0
|
6
16
|
|
7
17
|
### Fixed
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
shopify-cli (2.15.
|
4
|
+
shopify-cli (2.15.1)
|
5
5
|
bugsnag (~> 6.22)
|
6
6
|
listen (~> 3.7.0)
|
7
7
|
theme-check (~> 1.10.1)
|
@@ -13,13 +13,13 @@ GEM
|
|
13
13
|
public_suffix (>= 2.0.2, < 5.0)
|
14
14
|
ansi (1.5.0)
|
15
15
|
ast (2.4.2)
|
16
|
-
bugsnag (6.
|
16
|
+
bugsnag (6.24.2)
|
17
17
|
concurrent-ruby (~> 1.0)
|
18
18
|
builder (3.2.4)
|
19
19
|
byebug (11.1.3)
|
20
20
|
coderay (1.1.3)
|
21
21
|
colorize (0.8.1)
|
22
|
-
concurrent-ruby (1.1.
|
22
|
+
concurrent-ruby (1.1.10)
|
23
23
|
crack (0.4.5)
|
24
24
|
rexml
|
25
25
|
cucumber (7.0.0)
|
@@ -55,11 +55,34 @@ GEM
|
|
55
55
|
cucumber-messages (~> 17.0, >= 17.0.1)
|
56
56
|
diff-lcs (1.4.4)
|
57
57
|
fakefs (1.3.2)
|
58
|
+
faraday (1.10.0)
|
59
|
+
faraday-em_http (~> 1.0)
|
60
|
+
faraday-em_synchrony (~> 1.0)
|
61
|
+
faraday-excon (~> 1.1)
|
62
|
+
faraday-httpclient (~> 1.0)
|
63
|
+
faraday-multipart (~> 1.0)
|
64
|
+
faraday-net_http (~> 1.0)
|
65
|
+
faraday-net_http_persistent (~> 1.0)
|
66
|
+
faraday-patron (~> 1.0)
|
67
|
+
faraday-rack (~> 1.0)
|
68
|
+
faraday-retry (~> 1.0)
|
69
|
+
ruby2_keywords (>= 0.0.4)
|
70
|
+
faraday-em_http (1.0.0)
|
71
|
+
faraday-em_synchrony (1.0.0)
|
72
|
+
faraday-excon (1.1.0)
|
73
|
+
faraday-httpclient (1.0.1)
|
74
|
+
faraday-multipart (1.0.3)
|
75
|
+
multipart-post (>= 1.2, < 3)
|
76
|
+
faraday-net_http (1.0.1)
|
77
|
+
faraday-net_http_persistent (1.2.0)
|
78
|
+
faraday-patron (1.0.0)
|
79
|
+
faraday-rack (1.0.0)
|
80
|
+
faraday-retry (1.0.3)
|
58
81
|
ffi (1.15.4)
|
59
82
|
hashdiff (1.0.1)
|
60
83
|
iniparse (1.5.0)
|
61
|
-
liquid (5.
|
62
|
-
listen (3.7.
|
84
|
+
liquid (5.3.0)
|
85
|
+
listen (3.7.1)
|
63
86
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
64
87
|
rb-inotify (~> 0.9, >= 0.9.10)
|
65
88
|
method_source (1.0.0)
|
@@ -77,9 +100,13 @@ GEM
|
|
77
100
|
ruby-progressbar
|
78
101
|
mocha (1.13.0)
|
79
102
|
multi_test (0.1.2)
|
103
|
+
multipart-post (2.1.1)
|
80
104
|
nokogiri (1.13.3)
|
81
105
|
mini_portile2 (~> 2.8.0)
|
82
106
|
racc (~> 1.4)
|
107
|
+
octokit (4.22.0)
|
108
|
+
faraday (>= 0.9)
|
109
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
83
110
|
parallel (1.21.0)
|
84
111
|
parser (3.1.1.0)
|
85
112
|
ast (~> 2.4.1)
|
@@ -94,7 +121,7 @@ GEM
|
|
94
121
|
rack (2.2.3)
|
95
122
|
rainbow (3.1.1)
|
96
123
|
rake (13.0.6)
|
97
|
-
rb-fsevent (0.11.
|
124
|
+
rb-fsevent (0.11.1)
|
98
125
|
rb-inotify (0.10.1)
|
99
126
|
ffi (~> 1.0)
|
100
127
|
regexp_parser (2.2.0)
|
@@ -117,9 +144,13 @@ GEM
|
|
117
144
|
rubocop-shopify (2.0.1)
|
118
145
|
rubocop (~> 1.11)
|
119
146
|
ruby-progressbar (1.11.0)
|
147
|
+
ruby2_keywords (0.0.5)
|
148
|
+
sawyer (0.8.2)
|
149
|
+
addressable (>= 2.3.5)
|
150
|
+
faraday (> 0.8, < 2.0)
|
120
151
|
sys-uname (1.2.2)
|
121
152
|
ffi (~> 1.1)
|
122
|
-
theme-check (1.10.
|
153
|
+
theme-check (1.10.2)
|
123
154
|
liquid (>= 5.1.0)
|
124
155
|
nokogiri (>= 1.12)
|
125
156
|
parser (~> 3)
|
@@ -144,6 +175,7 @@ DEPENDENCIES
|
|
144
175
|
minitest-fail-fast
|
145
176
|
minitest-reporters
|
146
177
|
mocha
|
178
|
+
octokit (~> 4.0)
|
147
179
|
pry-byebug
|
148
180
|
rack
|
149
181
|
rake
|
data/Rakefile
CHANGED
@@ -129,6 +129,33 @@ end
|
|
129
129
|
desc("Builds all distribution packages of the CLI")
|
130
130
|
task(package: "package:all")
|
131
131
|
|
132
|
+
namespace :release do
|
133
|
+
require "shopify_cli/release"
|
134
|
+
|
135
|
+
task :prepare, [:new_version] do |_t, args|
|
136
|
+
new_version = args[:new_version]
|
137
|
+
unless new_version
|
138
|
+
raise <<~NO_NEW_VERSION
|
139
|
+
New version must be provided, e.g.:
|
140
|
+
|
141
|
+
$ GITHUB_ACCESS_TOKEN=abcdef rake "release:prepare[1.2.3]"
|
142
|
+
|
143
|
+
NO_NEW_VERSION
|
144
|
+
end
|
145
|
+
github_access_token = ENV["GITHUB_ACCESS_TOKEN"]
|
146
|
+
unless github_access_token
|
147
|
+
raise <<~NO_GITHUB_ACCESS_TOKEN
|
148
|
+
GitHub access token must be provided, e.g.:
|
149
|
+
|
150
|
+
$ GITHUB_ACCESS_TOKEN=abcdef rake "release:prepare[1.2.3]"
|
151
|
+
NO_GITHUB_ACCESS_TOKEN
|
152
|
+
end
|
153
|
+
|
154
|
+
ShopifyCLI::Release.new(new_version, github_access_token).prepare!
|
155
|
+
puts "Completed!"
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
132
159
|
namespace :extensions do
|
133
160
|
task :update do
|
134
161
|
version = ENV.fetch("VERSION").strip
|
@@ -1 +1 @@
|
|
1
|
-
v0.
|
1
|
+
v0.2.0
|
@@ -11,21 +11,18 @@ module Extension
|
|
11
11
|
default: -> { CLI::UI::Prompt.method(:ask) }
|
12
12
|
|
13
13
|
def call(project_details)
|
14
|
-
|
15
|
-
|
14
|
+
if template_required?(project_details)
|
15
|
+
project_details.template = template || choose_interactively
|
16
|
+
end
|
16
17
|
project_details
|
17
18
|
end
|
18
19
|
|
19
20
|
private
|
20
21
|
|
21
22
|
def template_required?(project_details)
|
22
|
-
return false unless extension_server_beta?
|
23
23
|
type = project_details&.type&.identifier
|
24
|
-
Models::DevelopmentServerRequirements
|
25
|
-
|
26
|
-
|
27
|
-
def extension_server_beta?
|
28
|
-
ShopifyCLI::Shopifolk.check && ShopifyCLI::Feature.enabled?(:extension_server_beta)
|
24
|
+
(Models::DevelopmentServerRequirements.beta_enabled? &&
|
25
|
+
Models::DevelopmentServerRequirements.type_supported?(type.downcase))
|
29
26
|
end
|
30
27
|
|
31
28
|
def choose_interactively
|
@@ -115,6 +115,16 @@ module Extension
|
|
115
115
|
tunnel_already_running: "A tunnel running on another port has been detected. Close the tunnel and try again.",
|
116
116
|
},
|
117
117
|
tunnel: {
|
118
|
+
duplicate_session: <<~MESSAGE,
|
119
|
+
Another ngrok tunnel is currently running with your auth token, possibly on another machine.
|
120
|
+
|
121
|
+
Terminate that tunnel before opening a new one.
|
122
|
+
MESSAGE
|
123
|
+
invalid_token: <<~MESSAGE,
|
124
|
+
The ngrok token currently configured is invalid.
|
125
|
+
|
126
|
+
After generating a new token, update your local ngrok configuration using {{command:shopify app tunnel auth <token>}}
|
127
|
+
MESSAGE
|
118
128
|
missing_token: "{{x}} {{red:auth requires a token argument}}. "\
|
119
129
|
"Find it on your ngrok dashboard: {{underline:https://dashboard.ngrok.com/auth/your-authtoken}}.",
|
120
130
|
invalid_port: "%s is not a valid port.",
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "shopify_cli"
|
3
4
|
|
4
5
|
module Extension
|
@@ -12,21 +13,26 @@ module Extension
|
|
12
13
|
|
13
14
|
class << self
|
14
15
|
def supported?(type)
|
15
|
-
binary_installed? && type_supported?(type) &&
|
16
|
+
binary_installed? && type_supported?(type) && type_enabled?(type)
|
16
17
|
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
def binary_installed?
|
21
|
-
Models::DevelopmentServer.new.executable_installed?
|
19
|
+
def beta_enabled?
|
20
|
+
ShopifyCLI::Feature.enabled?(:extension_server_beta)
|
22
21
|
end
|
23
22
|
|
24
23
|
def type_supported?(type)
|
25
24
|
SUPPORTED_EXTENSION_TYPES.include?(type.downcase)
|
26
25
|
end
|
27
26
|
|
28
|
-
|
29
|
-
|
27
|
+
private
|
28
|
+
|
29
|
+
def binary_installed?
|
30
|
+
Models::DevelopmentServer.new.executable_installed?
|
31
|
+
end
|
32
|
+
|
33
|
+
# Some types are enabled unconditionally; others require beta_enabled
|
34
|
+
def type_enabled?(type)
|
35
|
+
beta_enabled? || "checkout_ui_extension" == type.downcase
|
30
36
|
end
|
31
37
|
end
|
32
38
|
end
|
@@ -36,3 +36,21 @@ delivery_discount_types:
|
|
36
36
|
repo: "https://github.com/Shopify/scripts-apis-examples"
|
37
37
|
wasm:
|
38
38
|
repo: "https://github.com/Shopify/scripts-apis-examples"
|
39
|
+
product_discount_type:
|
40
|
+
beta: true
|
41
|
+
domain: 'discounts'
|
42
|
+
libraries:
|
43
|
+
wasm:
|
44
|
+
repo: "https://github.com/Shopify/scripts-apis-examples"
|
45
|
+
order_discount_type:
|
46
|
+
beta: true
|
47
|
+
domain: 'discounts'
|
48
|
+
libraries:
|
49
|
+
wasm:
|
50
|
+
repo: "https://github.com/Shopify/scripts-apis-examples"
|
51
|
+
shipping_discount_type:
|
52
|
+
beta: true
|
53
|
+
domain: 'discounts'
|
54
|
+
libraries:
|
55
|
+
wasm:
|
56
|
+
repo: "https://github.com/Shopify/scripts-apis-examples"
|
@@ -124,6 +124,13 @@ module Theme
|
|
124
124
|
error: {
|
125
125
|
address_binding_error: "Couldn't bind to localhost."\
|
126
126
|
" To serve your theme, set a different address with {{command:%s theme serve --host=<address>}}",
|
127
|
+
invalid_subdirectory: <<~MESSAGE,
|
128
|
+
The presence of %s in the directory structure isn't supported.
|
129
|
+
|
130
|
+
Move any files to a parent folder, then delete unsupported subdirectories.
|
131
|
+
|
132
|
+
• Required directory structure: https://shopify.dev/themes/architecture#directory-structure-and-component-types
|
133
|
+
MESSAGE
|
127
134
|
},
|
128
135
|
serving: <<~SERVING,
|
129
136
|
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require "shopify_cli/sed"
|
2
|
+
|
3
|
+
module ShopifyCLI
|
4
|
+
class Changelog
|
5
|
+
CHANGELOG_FILE = File.join(ShopifyCLI::ROOT, "CHANGELOG.md")
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
load(File.read(CHANGELOG_FILE))
|
9
|
+
end
|
10
|
+
|
11
|
+
def update_version!(new_version)
|
12
|
+
Sed.new.replace_inline(
|
13
|
+
CHANGELOG_FILE,
|
14
|
+
"## \\[Unreleased\\]",
|
15
|
+
"## [Unreleased]\\n\\n## Version #{new_version}"
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
def release_notes(version)
|
20
|
+
changes[version].map do |change_category, changes|
|
21
|
+
<<~CHANGES
|
22
|
+
### #{change_category}
|
23
|
+
#{changes.map { |change| entry(**change) }.join("\n")}
|
24
|
+
CHANGES
|
25
|
+
end.join("\n")
|
26
|
+
end
|
27
|
+
|
28
|
+
def entry(pr_id:, desc:)
|
29
|
+
"* [##{pr_id}](https://github.com/Shopify/shopify-cli/pull/#{pr_id}): #{desc}"
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def changes
|
35
|
+
@changes ||= Hash.new do |h, k|
|
36
|
+
h[k] = Hash.new do |h2, k2|
|
37
|
+
h2[k2] = []
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def load(log)
|
43
|
+
state = :initial
|
44
|
+
change_category = nil
|
45
|
+
current_version = nil
|
46
|
+
@remainder = ""
|
47
|
+
log.each_line do |line|
|
48
|
+
case state
|
49
|
+
when :initial
|
50
|
+
next unless line.chomp == "\#\# [Unreleased]"
|
51
|
+
state = :unreleased
|
52
|
+
current_version = "Unreleased"
|
53
|
+
when :unreleased, :last_version
|
54
|
+
if /\A\#\#\# (?<category>\w+)/ =~ line
|
55
|
+
change_category = category
|
56
|
+
elsif %r{\A\* \[\#(?<pr_id>\d+)\]\(https://github.com/Shopify/shopify-cli/pull/\d+\): (?<desc>.+)\n} =~ line
|
57
|
+
changes[current_version][change_category] << { pr_id: pr_id, desc: desc }
|
58
|
+
elsif /\A\#\# Version (?<version>\d+\.\d+\.\d+)/ =~ line
|
59
|
+
current_version = version
|
60
|
+
state =
|
61
|
+
case state
|
62
|
+
when :unreleased
|
63
|
+
:last_version
|
64
|
+
else
|
65
|
+
:finished
|
66
|
+
end
|
67
|
+
elsif !line.match?(/\s*\n/)
|
68
|
+
raise "Unrecognized line: #{line.inspect}"
|
69
|
+
end
|
70
|
+
when :finished
|
71
|
+
@remainder << line
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/shopify_cli/command.rb
CHANGED
@@ -36,6 +36,13 @@ module ShopifyCLI
|
|
36
36
|
end
|
37
37
|
rescue OptionParser::InvalidOption => error
|
38
38
|
arg = error.args.first
|
39
|
+
store_name = arg.match(/\A--(?<store_name>.*\.myshopify\.com)\z/)&.[](:store_name)
|
40
|
+
if store_name && !arg.match?(/\A--(store|shop)=/)
|
41
|
+
# Sometimes it may look like --invalidoption=https://storename.myshopify.com
|
42
|
+
store_name = store_name.sub(%r{\A(.*=)?(https?://)?}, "")
|
43
|
+
raise ShopifyCLI::Abort,
|
44
|
+
@ctx.message("core.errors.option_parser.invalid_option_store_equals", arg, store_name)
|
45
|
+
end
|
39
46
|
raise ShopifyCLI::Abort, @ctx.message("core.errors.option_parser.invalid_option", arg)
|
40
47
|
rescue OptionParser::MissingArgument => error
|
41
48
|
arg = error.args.first
|
@@ -20,6 +20,12 @@ module ShopifyCLI
|
|
20
20
|
missing_ruby: "Ruby is required to continue. Install Ruby here: https://www.ruby-lang.org/en/downloads.",
|
21
21
|
option_parser: {
|
22
22
|
invalid_option: "The option {{command:%s}} is not supported.",
|
23
|
+
invalid_option_store_equals: <<~MESSAGE,
|
24
|
+
The option {{command:%s}} isn't recognized.
|
25
|
+
|
26
|
+
Try this:
|
27
|
+
{{command:--store=%s}}.
|
28
|
+
MESSAGE
|
23
29
|
missing_argument: "The required argument {{command:%s}} is missing.",
|
24
30
|
},
|
25
31
|
},
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require "shopify_cli/sed"
|
2
|
+
require "shopify_cli/changelog"
|
3
|
+
require "octokit"
|
4
|
+
|
5
|
+
module ShopifyCLI
|
6
|
+
class Release
|
7
|
+
def initialize(new_version, github_access_token)
|
8
|
+
@new_version = new_version
|
9
|
+
@changelog = ShopifyCLI::Changelog.new
|
10
|
+
@github = Octokit::Client.new(access_token: github_access_token)
|
11
|
+
end
|
12
|
+
|
13
|
+
def prepare!
|
14
|
+
ensure_updated_main
|
15
|
+
create_release_branch
|
16
|
+
update_changelog
|
17
|
+
update_versions_in_files
|
18
|
+
commit
|
19
|
+
pr = create_pr
|
20
|
+
system("open #{pr["html_url"]}")
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_reader :new_version, :changelog, :github
|
26
|
+
|
27
|
+
def ensure_updated_main
|
28
|
+
current_branch = %x(git branch --show-current)
|
29
|
+
unless current_branch == "main"
|
30
|
+
raise "Must be on the main branch to package a release!"
|
31
|
+
end
|
32
|
+
unless system("git pull")
|
33
|
+
raise "git pull failed, cannot be sure there aren't new commits!"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def create_release_branch
|
38
|
+
puts "Checking out release branch"
|
39
|
+
unless system("git checkout -b #{release_branch_name}")
|
40
|
+
puts "Cannot check out release branch!"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def update_changelog
|
45
|
+
if release_notes.empty?
|
46
|
+
puts "No unreleased CHANGELOG updates found!"
|
47
|
+
else
|
48
|
+
puts "Updating CHANGELOG"
|
49
|
+
changelog.update_version!(new_version)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def update_versions_in_files
|
54
|
+
version_file = File.join(ShopifyCLI::ROOT, "lib/shopify_cli/version.rb")
|
55
|
+
puts "Updating version.rb"
|
56
|
+
ShopifyCLI::Sed.new.replace_inline(version_file, ShopifyCLI::VERSION, new_version)
|
57
|
+
gemfile_lock = File.join(ShopifyCLI::ROOT, "Gemfile.lock")
|
58
|
+
puts "Updating Gemfile.lock"
|
59
|
+
ShopifyCLI::Sed.new.replace_inline(
|
60
|
+
gemfile_lock,
|
61
|
+
"shopify-cli (#{ShopifyCLI::VERSION})",
|
62
|
+
"shopify-cli (#{new_version})",
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
def commit
|
67
|
+
puts "Committing"
|
68
|
+
unless system("git commit -am 'Packaging for release v#{new_version}'")
|
69
|
+
puts "Commit failed!"
|
70
|
+
end
|
71
|
+
unless system("git push -u origin #{release_branch_name}")
|
72
|
+
puts "Failed to push branch!"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def create_pr
|
77
|
+
github.create_pull_request(
|
78
|
+
"Shopify/shopify-cli",
|
79
|
+
"main",
|
80
|
+
release_branch_name,
|
81
|
+
"Packaging for release v#{new_version}",
|
82
|
+
release_notes
|
83
|
+
).tap { |results| puts "Created PR ##{results["number"]}" }
|
84
|
+
end
|
85
|
+
|
86
|
+
def release_branch_name
|
87
|
+
@release_branch_name ||= "release_#{new_version.split(".").join("_")}"
|
88
|
+
end
|
89
|
+
|
90
|
+
def release_notes
|
91
|
+
@release_notes ||= changelog.release_notes("Unreleased")
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ShopifyCLI
|
2
|
+
class Sed
|
3
|
+
class SedError < StandardError; end
|
4
|
+
|
5
|
+
def replace_inline(filename, pattern, output)
|
6
|
+
command =
|
7
|
+
case CLI::Kit::System.os
|
8
|
+
when :mac
|
9
|
+
"sed -i ''"
|
10
|
+
when :linux
|
11
|
+
"sed -i"
|
12
|
+
else
|
13
|
+
raise "Unrecognized system!"
|
14
|
+
end
|
15
|
+
success = system("#{command} 's/#{pattern}/#{output}/' #{filename}")
|
16
|
+
raise SedError unless success
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -108,7 +108,7 @@ module ShopifyCLI
|
|
108
108
|
end
|
109
109
|
|
110
110
|
def check_ruby
|
111
|
-
ruby_version = Environment.ruby_version(context)
|
111
|
+
ruby_version = Environment.ruby_version(context: context)
|
112
112
|
return if ruby_version.satisfies?("~>2.5") || ruby_version.satisfies?("~>3.1.0")
|
113
113
|
context.abort(context.message("core.app.create.rails.error.invalid_ruby_version"))
|
114
114
|
end
|
@@ -21,11 +21,11 @@ module ShopifyCLI
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def theme_files
|
24
|
-
glob(["**/*.liquid", "**/*.json"
|
24
|
+
(glob(["**/*.liquid", "**/*.json"]) + static_asset_files).uniq
|
25
25
|
end
|
26
26
|
|
27
27
|
def static_asset_files
|
28
|
-
glob("assets/*").reject(&:liquid?)
|
28
|
+
glob("assets/*", raise_on_dir: true).reject(&:liquid?)
|
29
29
|
end
|
30
30
|
|
31
31
|
def liquid_files
|
@@ -36,8 +36,11 @@ module ShopifyCLI
|
|
36
36
|
glob("**/*.json")
|
37
37
|
end
|
38
38
|
|
39
|
-
def glob(pattern)
|
40
|
-
root.glob(pattern).map
|
39
|
+
def glob(pattern, raise_on_dir: false)
|
40
|
+
root.glob(pattern).map do |path|
|
41
|
+
abort_if_directory!(path) if raise_on_dir
|
42
|
+
File.new(path, root)
|
43
|
+
end
|
41
44
|
end
|
42
45
|
|
43
46
|
def theme_file?(file)
|
@@ -218,6 +221,11 @@ module ShopifyCLI
|
|
218
221
|
|
219
222
|
self
|
220
223
|
end
|
224
|
+
|
225
|
+
def abort_if_directory!(path)
|
226
|
+
return unless ::File.directory?(path)
|
227
|
+
@ctx.abort(@ctx.message("theme.serve.error.invalid_subdirectory", path.to_s))
|
228
|
+
end
|
221
229
|
end
|
222
230
|
end
|
223
231
|
end
|
data/lib/shopify_cli/tunnel.rb
CHANGED
@@ -178,6 +178,15 @@ module ShopifyCLI
|
|
178
178
|
|
179
179
|
def fetch_url(ctx, log_path)
|
180
180
|
LogParser.new(log_path)
|
181
|
+
rescue NgrokError => e
|
182
|
+
# Full error messages/descriptions: https://ngrok.com/docs/errors
|
183
|
+
case e.message
|
184
|
+
when /ERR_NGROK_107/
|
185
|
+
ctx.abort(ctx.message("tunnel.invalid_token", e.message))
|
186
|
+
when /ERR_NGROK_108/
|
187
|
+
ctx.abort(ctx.message("tunnel.duplicate_session", e.message))
|
188
|
+
end
|
189
|
+
raise e.class, e.message
|
181
190
|
rescue RuntimeError => e
|
182
191
|
stop(ctx)
|
183
192
|
raise e.class, e.message
|
data/lib/shopify_cli/version.rb
CHANGED
data/shopify-cli.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
29
29
|
%x(git ls-files -z).split("\x0").reject do |f|
|
30
30
|
f.match(%r{^(test|spec|features|packaging)/}) ||
|
31
|
-
|
31
|
+
f.match(%r{^bin/(update-deps|shopify.bat)$})
|
32
32
|
end
|
33
33
|
end
|
34
34
|
spec.bindir = "bin"
|
@@ -49,4 +49,6 @@ Gem::Specification.new do |spec|
|
|
49
49
|
# Both shopify-cli and theme-check gems are owned and developed by Shopify.
|
50
50
|
# These gems are currently being actively developed and it's easiest to update them together.
|
51
51
|
spec.add_dependency("theme-check", "~> 1.10.1")
|
52
|
+
|
53
|
+
spec.extensions = ["ext/shopify-extensions/extconf.rb"]
|
52
54
|
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.15.
|
4
|
+
version: 2.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -109,7 +109,8 @@ email:
|
|
109
109
|
- dev-tools-education@shopify.com
|
110
110
|
executables:
|
111
111
|
- shopify
|
112
|
-
extensions:
|
112
|
+
extensions:
|
113
|
+
- ext/shopify-extensions/extconf.rb
|
113
114
|
extra_rdoc_files: []
|
114
115
|
files:
|
115
116
|
- ".devcontainer.json"
|
@@ -369,6 +370,7 @@ files:
|
|
369
370
|
- lib/shopify_cli/admin_api/schema.rb
|
370
371
|
- lib/shopify_cli/api.rb
|
371
372
|
- lib/shopify_cli/app_type_detector.rb
|
373
|
+
- lib/shopify_cli/changelog.rb
|
372
374
|
- lib/shopify_cli/command.rb
|
373
375
|
- lib/shopify_cli/command/app_sub_command.rb
|
374
376
|
- lib/shopify_cli/command/project_command.rb
|
@@ -444,11 +446,13 @@ files:
|
|
444
446
|
- lib/shopify_cli/project.rb
|
445
447
|
- lib/shopify_cli/project_commands.rb
|
446
448
|
- lib/shopify_cli/project_type.rb
|
449
|
+
- lib/shopify_cli/release.rb
|
447
450
|
- lib/shopify_cli/reporting_configuration_controller.rb
|
448
451
|
- lib/shopify_cli/resolve_constant.rb
|
449
452
|
- lib/shopify_cli/resources.rb
|
450
453
|
- lib/shopify_cli/resources/env_file.rb
|
451
454
|
- lib/shopify_cli/result.rb
|
455
|
+
- lib/shopify_cli/sed.rb
|
452
456
|
- lib/shopify_cli/services.rb
|
453
457
|
- lib/shopify_cli/services/app/connect_service.rb
|
454
458
|
- lib/shopify_cli/services/app/create/node_service.rb
|