shopify-cli 2.15.6 → 2.16.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 +4 -4
- data/.github/CODEOWNERS +4 -4
- data/.github/workflows/shopify.yml +0 -33
- data/CHANGELOG.md +13 -1
- data/Gemfile.lock +4 -4
- data/Tests.dockerfile +1 -1
- data/ext/shopify-extensions/version +1 -1
- data/lib/graphql/find_organization_with_apps.graphql +20 -0
- data/lib/project_types/extension/cli.rb +2 -1
- data/lib/project_types/extension/commands/create.rb +6 -0
- data/lib/project_types/extension/features/argo.rb +0 -31
- data/lib/project_types/extension/features/argo_config.rb +0 -1
- data/lib/project_types/extension/messages/messages.rb +23 -0
- data/lib/project_types/extension/models/development_server.rb +2 -1
- data/lib/project_types/extension/models/development_server_requirements.rb +24 -4
- data/lib/project_types/extension/models/npm_package.rb +15 -3
- data/lib/project_types/extension/models/server_config/development_renderer.rb +6 -1
- data/lib/project_types/extension/models/server_config/root.rb +0 -2
- data/lib/project_types/extension/tasks/configure_features.rb +4 -0
- data/lib/project_types/extension/tasks/convert_server_config.rb +1 -1
- data/lib/project_types/extension/tasks/execute_commands/base.rb +2 -0
- data/lib/project_types/extension/tasks/execute_commands/build.rb +2 -1
- data/lib/project_types/extension/tasks/execute_commands/create.rb +0 -3
- data/lib/project_types/extension/tasks/execute_commands/outdated_extension_detection.rb +53 -0
- data/lib/project_types/extension/tasks/execute_commands/serve.rb +2 -1
- data/lib/project_types/extension/tasks/get_apps.rb +6 -9
- data/lib/project_types/extension/tasks/get_extensions.rb +12 -11
- data/lib/project_types/extension/tasks/merge_server_config.rb +0 -1
- data/lib/project_types/script/config/extension_points.yml +2 -0
- data/lib/project_types/script/layers/application/connect_app.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/errors.rb +0 -3
- data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +3 -2
- data/lib/project_types/script/layers/infrastructure/languages/task_runner.rb +2 -2
- data/lib/shopify_cli/admin_api.rb +4 -1
- data/lib/shopify_cli/constants.rb +2 -0
- data/lib/shopify_cli/context.rb +10 -9
- data/lib/shopify_cli/environment.rb +8 -0
- data/lib/shopify_cli/partners_api/app_extensions.rb +5 -5
- data/lib/shopify_cli/partners_api/organizations.rb +12 -4
- data/lib/shopify_cli/tasks/ensure_env.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/local_assets.rb +1 -1
- data/lib/shopify_cli/theme/theme.rb +4 -0
- data/lib/shopify_cli/version.rb +1 -1
- data/{shipit.yml → shipit.rubygems.yml} +0 -0
- data/shopify-cli.gemspec +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 26f358d4694d7c5dd9b64208107c69def6144f79ee55ba2536c138a14ca81ea7
|
|
4
|
+
data.tar.gz: f1dccbffeece205fb67601a3510a351073ea61ff45e2c1276679a1604a489c2d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e208397e4a7ed51e65a651b567c535d23bcbd90f5587a518c69bb1aa70f67efa9cd21bce69a5eda57e005d427456776ab76543938f8188be2a262c421935ac52
|
|
7
|
+
data.tar.gz: '083e6f590ccdb81cc43f9c1200bceca765c5242d7b701a872311b49f10184fb62723df553df74f76f7e311343e814038a360821dc434ffa46a83c9907ff881e4'
|
data/.github/CODEOWNERS
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/lib/project_types/script/ @shopify/scripts-platform
|
|
5
5
|
/test/project_types/script/ @shopify/scripts-platform
|
|
6
6
|
|
|
7
|
-
/lib/project_types/theme/ @shopify/theme-
|
|
8
|
-
/lib/shopify_cli/theme/ @shopify/theme-
|
|
9
|
-
/test/project_types/theme/ @shopify/theme-
|
|
10
|
-
/test/shopify-cli/theme/ @shopify/theme-
|
|
7
|
+
/lib/project_types/theme/ @shopify/theme-developer-tools
|
|
8
|
+
/lib/shopify_cli/theme/ @shopify/theme-developer-tools
|
|
9
|
+
/test/project_types/theme/ @shopify/theme-developer-tools
|
|
10
|
+
/test/shopify-cli/theme/ @shopify/theme-developer-tools
|
|
@@ -44,39 +44,6 @@ jobs:
|
|
|
44
44
|
|
|
45
45
|
- name: Run Tests
|
|
46
46
|
run: bundle exec rake test
|
|
47
|
-
acceptance_tests:
|
|
48
|
-
name: Acceptance Tests
|
|
49
|
-
runs-on: ${{ matrix.os }}
|
|
50
|
-
strategy:
|
|
51
|
-
matrix:
|
|
52
|
-
version:
|
|
53
|
-
- 3.0.2
|
|
54
|
-
os:
|
|
55
|
-
- ubuntu-20.04
|
|
56
|
-
steps:
|
|
57
|
-
- uses: actions/checkout@v2
|
|
58
|
-
- name: Set Git configuration
|
|
59
|
-
run: |
|
|
60
|
-
git config --global user.email "development-lifecycle@shopify.com"
|
|
61
|
-
git config --global user.name "Development Lifecycle"
|
|
62
|
-
|
|
63
|
-
- name: Set up Ruby ${{ matrix.version }}
|
|
64
|
-
uses: ruby/setup-ruby@v1
|
|
65
|
-
with:
|
|
66
|
-
ruby-version: ${{ matrix.version }}
|
|
67
|
-
bundler-cache: true
|
|
68
|
-
|
|
69
|
-
- uses: actions/setup-node@v2
|
|
70
|
-
with:
|
|
71
|
-
node-version: "14.9.0"
|
|
72
|
-
|
|
73
|
-
- uses: docker-practice/actions-setup-docker@master
|
|
74
|
-
|
|
75
|
-
- name: Install Dependencies
|
|
76
|
-
run: bundle install
|
|
77
|
-
|
|
78
|
-
- name: Run Tests
|
|
79
|
-
run: bundle exec cucumber
|
|
80
47
|
rubocop:
|
|
81
48
|
name: Rubocop
|
|
82
49
|
runs-on: ${{ matrix.os }}
|
data/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,22 @@ 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.16.0 - 2022-04-25
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
* [#2274](https://github.com/Shopify/shopify-cli/pull/2274): Fix broken `shopify extension register` and `shopify extension push`
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
* [#2189](https://github.com/Shopify/shopify-cli/pull/2189): Retrieve latest CLI version in the background
|
|
12
|
+
* [#2263](https://github.com/Shopify/shopify-cli/pull/2263): Add `POS UI Extension` to support third party developers to extend POS smart grid functionality using native retail components.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
* [#2272](https://github.com/Shopify/shopify-cli/pull/2272): Changed interactive apps list scope for extension create|register|connect commands
|
|
16
|
+
|
|
5
17
|
## Version 2.15.6 - 2022-04-12
|
|
6
18
|
|
|
7
19
|
### Fixed
|
|
8
|
-
* [#2246](https://github.com/Shopify/shopify-cli/pull/2246): Fix callback urls for app serve
|
|
20
|
+
* [#2246](https://github.com/Shopify/shopify-cli/pull/2246): Fix callback urls for app serve
|
|
9
21
|
|
|
10
22
|
## Version 2.15.5 - 2022-04-08
|
|
11
23
|
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
shopify-cli (2.
|
|
4
|
+
shopify-cli (2.16.0)
|
|
5
5
|
bugsnag (~> 6.22)
|
|
6
6
|
listen (~> 3.7.0)
|
|
7
7
|
theme-check (~> 1.10.1)
|
|
@@ -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.
|
|
104
|
+
nokogiri (1.13.4)
|
|
105
105
|
mini_portile2 (~> 2.8.0)
|
|
106
106
|
racc (~> 1.4)
|
|
107
107
|
octokit (4.22.0)
|
|
@@ -165,7 +165,7 @@ PLATFORMS
|
|
|
165
165
|
ruby
|
|
166
166
|
|
|
167
167
|
DEPENDENCIES
|
|
168
|
-
bundler (~> 2.3.
|
|
168
|
+
bundler (~> 2.3.11)
|
|
169
169
|
byebug
|
|
170
170
|
colorize (~> 0.8.1)
|
|
171
171
|
cucumber (~> 7.0)
|
|
@@ -187,4 +187,4 @@ DEPENDENCIES
|
|
|
187
187
|
webmock
|
|
188
188
|
|
|
189
189
|
BUNDLED WITH
|
|
190
|
-
2.3.
|
|
190
|
+
2.3.11
|
data/Tests.dockerfile
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
v0.
|
|
1
|
+
v0.4.0
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require "pathname"
|
|
4
4
|
require "json"
|
|
5
|
-
require "yaml"
|
|
6
5
|
|
|
7
6
|
module Extension
|
|
8
7
|
class PackageResolutionFailed < RuntimeError; end
|
|
@@ -63,6 +62,8 @@ module Extension
|
|
|
63
62
|
autoload :Build, Project.project_filepath("tasks/execute_commands/build")
|
|
64
63
|
autoload :Create, Project.project_filepath("tasks/execute_commands/create")
|
|
65
64
|
autoload :Serve, Project.project_filepath("tasks/execute_commands/serve")
|
|
65
|
+
autoload :OutdatedExtensionDetection,
|
|
66
|
+
Project.project_filepath("tasks/execute_commands/outdated_extension_detection")
|
|
66
67
|
|
|
67
68
|
class << self
|
|
68
69
|
def build(*args)
|
|
@@ -59,7 +59,13 @@ module Extension
|
|
|
59
59
|
root_dir: form.directory_name,
|
|
60
60
|
template: form.template,
|
|
61
61
|
type: form.type.identifier.downcase,
|
|
62
|
+
context: @ctx,
|
|
62
63
|
)
|
|
64
|
+
.then { |output| @ctx.puts(output) }
|
|
65
|
+
.unwrap do |error|
|
|
66
|
+
raise ShopifyCLI::Abort, error.message unless error.nil?
|
|
67
|
+
end
|
|
68
|
+
|
|
63
69
|
@ctx.chdir(form.directory_name)
|
|
64
70
|
write_env_file(form)
|
|
65
71
|
rescue => error
|
|
@@ -24,11 +24,6 @@ module Extension
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def config(context, include_renderer_version: true)
|
|
27
|
-
js_system = ShopifyCLI::JsSystem.new(ctx: context)
|
|
28
|
-
if js_system.package_manager == "yarn"
|
|
29
|
-
run_yarn_install(context, js_system)
|
|
30
|
-
run_yarn_run_script(context, js_system)
|
|
31
|
-
end
|
|
32
27
|
filepath = File.join(context.root, SCRIPT_PATH)
|
|
33
28
|
context.abort(context.message("features.argo.missing_file_error")) unless File.exist?(filepath)
|
|
34
29
|
|
|
@@ -50,32 +45,6 @@ module Extension
|
|
|
50
45
|
def renderer_package(context)
|
|
51
46
|
Tasks::FindPackageFromJson.call(renderer_package_name, context: context)
|
|
52
47
|
end
|
|
53
|
-
|
|
54
|
-
private
|
|
55
|
-
|
|
56
|
-
def run_yarn_install(context, js_system)
|
|
57
|
-
_result, error, status = js_system.call(
|
|
58
|
-
yarn: YARN_INSTALL_COMMAND + YARN_INSTALL_PARAMETERS,
|
|
59
|
-
npm: [],
|
|
60
|
-
capture_response: true
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
context.abort(
|
|
64
|
-
context.message("features.argo.dependencies.yarn_install_error", error)
|
|
65
|
-
) unless status.success?
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def run_yarn_run_script(context, js_system)
|
|
69
|
-
_result, error, status = js_system.call(
|
|
70
|
-
yarn: YARN_RUN_COMMAND + YARN_RUN_SCRIPT_NAME,
|
|
71
|
-
npm: [],
|
|
72
|
-
capture_response: true
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
context.abort(
|
|
76
|
-
context.message("features.argo.dependencies.yarn_run_script_error", error)
|
|
77
|
-
) unless status.success?
|
|
78
|
-
end
|
|
79
48
|
end
|
|
80
49
|
end
|
|
81
50
|
end
|
|
@@ -194,6 +194,29 @@ module Extension
|
|
|
194
194
|
"{{command:%1$s extension connect}} " \
|
|
195
195
|
"or run {{command:%1$s extension register}} to register a new extension.",
|
|
196
196
|
module_not_found: "Unable to find module %s. Ensure your dependencies are up-to-date and try again.",
|
|
197
|
+
development_server_binary_not_found: {
|
|
198
|
+
title: "Development Server Binary Missing",
|
|
199
|
+
message: <<~ERROR,
|
|
200
|
+
The extension development server binary could not be found!
|
|
201
|
+
|
|
202
|
+
If you're running a development version of the CLI, please run `rake extensions:install` to install it.
|
|
203
|
+
Otherwise, please file a bug report via https://github.com/Shopify/shopify-cli/issues/new.
|
|
204
|
+
ERROR
|
|
205
|
+
},
|
|
206
|
+
outdated_extensions: {
|
|
207
|
+
unknown: <<~TEXT.strip,
|
|
208
|
+
Please refer to the documentation for more information on how to upgrade your extension:
|
|
209
|
+
https://shopify.dev/apps/app-extensions
|
|
210
|
+
TEXT
|
|
211
|
+
checkout_ui_extension: <<~TEXT.strip,
|
|
212
|
+
Please update your package.json as follows:
|
|
213
|
+
* Replace the development dependency @shopify/checkout-ui-extensions-run
|
|
214
|
+
with @shopify/shopify-cli-extensions
|
|
215
|
+
* Remove the start and server script
|
|
216
|
+
* Add a develop script: shopify-cli-extensions develop
|
|
217
|
+
* Change the build script to: shopify-cli-extensions build
|
|
218
|
+
TEXT
|
|
219
|
+
},
|
|
197
220
|
},
|
|
198
221
|
warnings: {
|
|
199
222
|
resource_url_auto_generation_failed: "{{*}} {{yellow:Warning:}} Unable to auto generate " \
|
|
@@ -27,7 +27,8 @@ module Extension
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def create(server_config)
|
|
30
|
-
CLI::Kit::System.
|
|
30
|
+
output, _ = CLI::Kit::System.capture2e(executable, "create", "-", stdin_data: server_config.to_yaml)
|
|
31
|
+
output
|
|
31
32
|
rescue StandardError => error
|
|
32
33
|
raise error
|
|
33
34
|
end
|
|
@@ -10,11 +10,17 @@ module Extension
|
|
|
10
10
|
"checkout_post_purchase",
|
|
11
11
|
"product_subscription",
|
|
12
12
|
"beacon_extension",
|
|
13
|
+
"pos_ui_extension",
|
|
13
14
|
]
|
|
14
15
|
|
|
15
16
|
class << self
|
|
16
17
|
def supported?(type)
|
|
17
|
-
|
|
18
|
+
if type_supported?(type) && type_enabled?(type)
|
|
19
|
+
return true if binary_installed?
|
|
20
|
+
warn_about_missing_binary
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
false
|
|
18
24
|
end
|
|
19
25
|
|
|
20
26
|
def beta_enabled?
|
|
@@ -25,15 +31,29 @@ module Extension
|
|
|
25
31
|
SUPPORTED_EXTENSION_TYPES.include?(type.downcase)
|
|
26
32
|
end
|
|
27
33
|
|
|
34
|
+
# Some types are enabled unconditionally; others require beta_enabled
|
|
35
|
+
def type_enabled?(type)
|
|
36
|
+
beta_enabled? || "checkout_ui_extension" == type.downcase
|
|
37
|
+
end
|
|
38
|
+
|
|
28
39
|
private
|
|
29
40
|
|
|
30
41
|
def binary_installed?
|
|
31
42
|
Models::DevelopmentServer.new.executable_installed?
|
|
32
43
|
end
|
|
33
44
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
def warn_about_missing_binary
|
|
46
|
+
CLI::UI::Frame.open(message("errors.development_server_binary_not_found.title"), color: :yellow) do
|
|
47
|
+
context.puts(message("errors.development_server_binary_not_found.message"))
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def message(key)
|
|
52
|
+
context.message(key)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def context
|
|
56
|
+
@context ||= ShopifyCLI::Context.new
|
|
37
57
|
end
|
|
38
58
|
end
|
|
39
59
|
end
|
|
@@ -8,9 +8,9 @@ module Extension
|
|
|
8
8
|
|
|
9
9
|
property :name
|
|
10
10
|
property :version
|
|
11
|
-
property :scripts, accepts: Hash
|
|
12
|
-
property :dependencies, accepts: Hash
|
|
13
|
-
property :dev_dependencies, accepts: Hash
|
|
11
|
+
property :scripts, accepts: Hash, default: -> { {} }
|
|
12
|
+
property :dependencies, accepts: Hash, default: -> { {} }
|
|
13
|
+
property :dev_dependencies, accepts: Hash, default: -> { {} }
|
|
14
14
|
|
|
15
15
|
def initialize(**config)
|
|
16
16
|
super(**config.select { |property_name, _| self.class.properties.key?(property_name) })
|
|
@@ -27,6 +27,18 @@ module Extension
|
|
|
27
27
|
return nil unless name == other.name
|
|
28
28
|
Semantic::Version.new(version) <=> Semantic::Version.new(other.version)
|
|
29
29
|
end
|
|
30
|
+
|
|
31
|
+
def script?(name)
|
|
32
|
+
scripts.key?(name)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def dependency?(name)
|
|
36
|
+
dependencies.key?(name)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def dev_dependency?(name)
|
|
40
|
+
dev_dependencies.key?(name)
|
|
41
|
+
end
|
|
30
42
|
end
|
|
31
43
|
end
|
|
32
44
|
end
|
|
@@ -10,6 +10,7 @@ module Extension
|
|
|
10
10
|
"@shopify/admin-ui-extensions",
|
|
11
11
|
"@shopify/post-purchase-ui-extensions",
|
|
12
12
|
"@shopify/checkout-ui-extensions",
|
|
13
|
+
"@shopify/retail-ui-extensions",
|
|
13
14
|
]
|
|
14
15
|
|
|
15
16
|
property! :name, accepts: VALID_RENDERERS
|
|
@@ -20,9 +21,13 @@ module Extension
|
|
|
20
21
|
when "product_subscription"
|
|
21
22
|
new(name: "@shopify/admin-ui-extensions", version: "^1.0.1")
|
|
22
23
|
when "checkout_ui_extension"
|
|
23
|
-
new(name: "@shopify/checkout-ui-extensions", version: "^0.
|
|
24
|
+
new(name: "@shopify/checkout-ui-extensions", version: "^0.15.0")
|
|
24
25
|
when "checkout_post_purchase"
|
|
25
26
|
new(name: "@shopify/post-purchase-ui-extensions", version: "^0.13.2")
|
|
27
|
+
when "pos_ui_extension"
|
|
28
|
+
new(name: "@shopify/retail-ui-extensions", version: "^0.1.0")
|
|
29
|
+
else
|
|
30
|
+
raise ArgumentError, "Unknown extension type: #{type}"
|
|
26
31
|
end
|
|
27
32
|
end
|
|
28
33
|
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module Extension
|
|
2
|
+
module Tasks
|
|
3
|
+
module ExecuteCommands
|
|
4
|
+
module OutdatedExtensionDetection
|
|
5
|
+
class OutdatedCheck
|
|
6
|
+
include ShopifyCLI::MethodObject
|
|
7
|
+
|
|
8
|
+
property! :type, accepts: Models::DevelopmentServerRequirements.method(:type_supported?)
|
|
9
|
+
property! :context, accepts: ShopifyCLI::Context
|
|
10
|
+
property! :project, accepts: ShopifyCLI::Project, default: -> { ShopifyCLI::Project.current }
|
|
11
|
+
|
|
12
|
+
def call
|
|
13
|
+
return false if valid?(parse_package)
|
|
14
|
+
context.abort(upgrade_instructions)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def upgrade_instructions
|
|
20
|
+
case type
|
|
21
|
+
when "checkout_ui_extension"
|
|
22
|
+
context.message("errors.outdated_extensions.checkout_ui_extension")
|
|
23
|
+
else
|
|
24
|
+
context.message("errors.outdated_extensions.unknown")
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def parse_package
|
|
29
|
+
File.open(Pathname(project.directory).join("package.json")) do |file|
|
|
30
|
+
Models::NpmPackage.parse(file)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def valid?(package)
|
|
35
|
+
case type
|
|
36
|
+
when "checkout_ui_extension"
|
|
37
|
+
package.dev_dependency?("@shopify/shopify-cli-extensions") &&
|
|
38
|
+
package.script?("build") &&
|
|
39
|
+
package.script?("develop")
|
|
40
|
+
else
|
|
41
|
+
true
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def call(*)
|
|
47
|
+
return super unless Models::DevelopmentServerRequirements.supported?(type)
|
|
48
|
+
OutdatedCheck.call(type: type, context: context).then { super }
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -5,7 +5,8 @@ module Extension
|
|
|
5
5
|
module Tasks
|
|
6
6
|
module ExecuteCommands
|
|
7
7
|
class Serve < Base
|
|
8
|
-
|
|
8
|
+
prepend OutdatedExtensionDetection
|
|
9
|
+
|
|
9
10
|
property! :config_file_path, accepts: String
|
|
10
11
|
property :port, accepts: Integer, default: ShopifyCLI::Constants::Extension::DEFAULT_PORT
|
|
11
12
|
property :resource_url, accepts: String
|
|
@@ -5,20 +5,17 @@ module Extension
|
|
|
5
5
|
module Tasks
|
|
6
6
|
class GetApps < ShopifyCLI::Task
|
|
7
7
|
def call(context:)
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
org_id = ShopifyCLI::DB.get(:organization_id)
|
|
9
|
+
return [] unless org_id
|
|
10
|
+
|
|
11
|
+
organization = ShopifyCLI::PartnersAPI::Organizations.fetch_with_apps(context, id: org_id)
|
|
12
|
+
apps_owned_by_organization(organization)
|
|
10
13
|
end
|
|
11
14
|
|
|
12
15
|
private
|
|
13
16
|
|
|
14
|
-
def apps_from_organizations(organizations)
|
|
15
|
-
organizations.flat_map do |organization|
|
|
16
|
-
apps_owned_by_organization(organization)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
17
|
def apps_owned_by_organization(organization)
|
|
21
|
-
return [] unless organization
|
|
18
|
+
return [] unless organization&.dig("apps")
|
|
22
19
|
|
|
23
20
|
organization["apps"].map do |app|
|
|
24
21
|
Converters::AppConverter.from_hash(app, organization)
|
|
@@ -5,28 +5,29 @@ module Extension
|
|
|
5
5
|
module Tasks
|
|
6
6
|
class GetExtensions < ShopifyCLI::Task
|
|
7
7
|
def call(context:, type:)
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
org_id = ShopifyCLI::DB.get(:organization_id)
|
|
9
|
+
return [] unless org_id
|
|
10
|
+
|
|
11
|
+
organization = ShopifyCLI::PartnersAPI::Organizations.fetch_with_extensions(context, type, id: org_id)
|
|
12
|
+
return [] unless organization_with_apps?(organization)
|
|
13
|
+
extensions_owned_by_organization(organization, context: context)
|
|
10
14
|
end
|
|
11
15
|
|
|
12
16
|
private
|
|
13
17
|
|
|
14
|
-
def extensions_from_organizations(organizations, context:)
|
|
15
|
-
organizations.flat_map do |organization|
|
|
16
|
-
extensions_owned_by_organization(organization, context: context)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
18
|
def extensions_owned_by_organization(organization, context:)
|
|
21
|
-
return [] unless organization.key?("apps") && organization["apps"].any?
|
|
22
|
-
|
|
23
19
|
organization["apps"].flat_map do |app|
|
|
24
|
-
app["extensionRegistrations"]
|
|
20
|
+
registrations = app["extensionRegistrations"] || []
|
|
21
|
+
registrations.map do |registration|
|
|
25
22
|
[Converters::AppConverter.from_hash(app, organization),
|
|
26
23
|
Converters::RegistrationConverter.from_hash(context, registration)]
|
|
27
24
|
end
|
|
28
25
|
end
|
|
29
26
|
end
|
|
27
|
+
|
|
28
|
+
def organization_with_apps?(organization)
|
|
29
|
+
organization&.key?("apps") && organization["apps"].any?
|
|
30
|
+
end
|
|
30
31
|
end
|
|
31
32
|
end
|
|
32
33
|
end
|
|
@@ -7,6 +7,8 @@ payment_methods:
|
|
|
7
7
|
repo: "https://github.com/Shopify/scripts-apis-examples"
|
|
8
8
|
wasm:
|
|
9
9
|
repo: "https://github.com/Shopify/scripts-apis-examples"
|
|
10
|
+
rust:
|
|
11
|
+
repo: "https://github.com/Shopify/scripts-apis-examples"
|
|
10
12
|
shipping_methods:
|
|
11
13
|
domain: 'checkout'
|
|
12
14
|
libraries:
|
|
@@ -137,8 +137,6 @@ module Script
|
|
|
137
137
|
end
|
|
138
138
|
end
|
|
139
139
|
|
|
140
|
-
class ProjectCreatorNotFoundError < ScriptProjectError; end
|
|
141
|
-
|
|
142
140
|
class SystemCallFailureError < ScriptProjectError
|
|
143
141
|
attr_reader :out, :cmd
|
|
144
142
|
def initialize(out:, cmd:)
|
|
@@ -157,7 +155,6 @@ module Script
|
|
|
157
155
|
end
|
|
158
156
|
|
|
159
157
|
class ScriptProjectAlreadyExistsError < ScriptProjectError; end
|
|
160
|
-
class TaskRunnerNotFoundError < ScriptProjectError; end
|
|
161
158
|
class BuildScriptNotFoundError < ScriptProjectError; end
|
|
162
159
|
|
|
163
160
|
class WebAssemblyBinaryNotFoundError < ScriptProjectError
|
|
@@ -26,8 +26,9 @@ module Script
|
|
|
26
26
|
"wasm" => WasmProjectCreator,
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
project_creator = project_creators[language] || WasmProjectCreator
|
|
30
|
+
|
|
31
|
+
project_creator.new(
|
|
31
32
|
ctx: ctx,
|
|
32
33
|
type: type,
|
|
33
34
|
project_name: project_name,
|
|
@@ -13,8 +13,8 @@ module Script
|
|
|
13
13
|
"wasm" => WasmTaskRunner,
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
task_runner = task_runners[language] || WasmTaskRunner
|
|
17
|
+
task_runner.new(ctx)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def initialize(ctx)
|
|
@@ -98,6 +98,8 @@ module ShopifyCLI
|
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
def get_shop_or_abort(ctx)
|
|
101
|
+
env_store = Environment.store
|
|
102
|
+
return env_store unless env_store.nil?
|
|
101
103
|
ctx.abort(
|
|
102
104
|
ctx.message("core.populate.error.no_shop", ShopifyCLI::TOOL_NAME)
|
|
103
105
|
) unless ShopifyCLI::DB.exists?(:shop)
|
|
@@ -119,7 +121,8 @@ module ShopifyCLI
|
|
|
119
121
|
end
|
|
120
122
|
|
|
121
123
|
def access_token(ctx, shop)
|
|
122
|
-
|
|
124
|
+
env_token = Environment.admin_auth_token
|
|
125
|
+
env_token || ShopifyCLI::DB.get(:shopify_exchange_token) do
|
|
123
126
|
authenticate(ctx, shop)
|
|
124
127
|
ShopifyCLI::DB.get(:shopify_exchange_token)
|
|
125
128
|
end
|
|
@@ -53,9 +53,11 @@ module ShopifyCLI
|
|
|
53
53
|
|
|
54
54
|
# Authentication
|
|
55
55
|
AUTH_TOKEN = "SHOPIFY_CLI_AUTH_TOKEN"
|
|
56
|
+
ADMIN_AUTH_TOKEN = "SHOPIFY_CLI_ADMIN_AUTH_TOKEN"
|
|
56
57
|
|
|
57
58
|
# Monorail
|
|
58
59
|
MONORAIL_REAL_EVENTS = "MONORAIL_REAL_EVENTS"
|
|
60
|
+
STORE = "SHOPIFY_CLI_STORE"
|
|
59
61
|
end
|
|
60
62
|
|
|
61
63
|
module SupportedVersions
|
data/lib/shopify_cli/context.rb
CHANGED
|
@@ -17,6 +17,7 @@ module ShopifyCLI
|
|
|
17
17
|
GEM_LATEST_URI = URI.parse("https://rubygems.org/api/v1/versions/shopify-cli/latest.json")
|
|
18
18
|
VERSION_CHECK_SECTION = "versioncheck"
|
|
19
19
|
LAST_CHECKED_AT_FIELD = "last_checked_at"
|
|
20
|
+
LATEST_VERSION_FIELD = "latest_version"
|
|
20
21
|
VERSION_CHECK_INTERVAL = 86400
|
|
21
22
|
|
|
22
23
|
class << self
|
|
@@ -619,11 +620,13 @@ module ShopifyCLI
|
|
|
619
620
|
# : nil otherwise
|
|
620
621
|
#
|
|
621
622
|
def new_version
|
|
622
|
-
if (time_of_last_check + VERSION_CHECK_INTERVAL) < (
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
623
|
+
if (time_of_last_check + VERSION_CHECK_INTERVAL) < (Time.now.to_i)
|
|
624
|
+
fork do
|
|
625
|
+
retrieve_latest_gem_version
|
|
626
|
+
end
|
|
626
627
|
end
|
|
628
|
+
latest_version = ShopifyCLI::Config.get(VERSION_CHECK_SECTION, LATEST_VERSION_FIELD, default: ShopifyCLI::VERSION)
|
|
629
|
+
latest_version unless latest_version == ShopifyCLI::VERSION
|
|
627
630
|
end
|
|
628
631
|
|
|
629
632
|
# Returns file extension depending on OS
|
|
@@ -669,17 +672,15 @@ module ShopifyCLI
|
|
|
669
672
|
def retrieve_latest_gem_version
|
|
670
673
|
response = Net::HTTP.get_response(GEM_LATEST_URI)
|
|
671
674
|
latest = JSON.parse(response.body)
|
|
672
|
-
latest["version"]
|
|
675
|
+
ShopifyCLI::Config.set(VERSION_CHECK_SECTION, LATEST_VERSION_FIELD, latest["version"])
|
|
673
676
|
rescue
|
|
674
677
|
nil
|
|
678
|
+
ensure
|
|
679
|
+
ShopifyCLI::Config.set(VERSION_CHECK_SECTION, LAST_CHECKED_AT_FIELD, Time.now.to_i)
|
|
675
680
|
end
|
|
676
681
|
|
|
677
682
|
def time_of_last_check
|
|
678
683
|
(val = ShopifyCLI::Config.get(VERSION_CHECK_SECTION, LAST_CHECKED_AT_FIELD)) ? val.to_i : 0
|
|
679
684
|
end
|
|
680
|
-
|
|
681
|
-
def update_time_of_last_check(time)
|
|
682
|
-
ShopifyCLI::Config.set(VERSION_CHECK_SECTION, LAST_CHECKED_AT_FIELD, time)
|
|
683
|
-
end
|
|
684
685
|
end
|
|
685
686
|
end
|
|
@@ -166,6 +166,14 @@ module ShopifyCLI
|
|
|
166
166
|
env_variables[Constants::EnvironmentVariables::AUTH_TOKEN]
|
|
167
167
|
end
|
|
168
168
|
|
|
169
|
+
def self.admin_auth_token(env_variables: ENV)
|
|
170
|
+
env_variables[Constants::EnvironmentVariables::ADMIN_AUTH_TOKEN]
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def self.store(env_variables: ENV)
|
|
174
|
+
env_variables[Constants::EnvironmentVariables::STORE]
|
|
175
|
+
end
|
|
176
|
+
|
|
169
177
|
def self.env_variable_truthy?(variable_name, env_variables: ENV)
|
|
170
178
|
TRUTHY_ENV_VARIABLE_VALUES.include?(env_variables[variable_name.to_s])
|
|
171
179
|
end
|
|
@@ -8,19 +8,19 @@ module ShopifyCLI
|
|
|
8
8
|
class PartnersAPI
|
|
9
9
|
class AppExtensions
|
|
10
10
|
class << self
|
|
11
|
-
def fetch_apps_extensions(ctx,
|
|
12
|
-
jobs = apps(
|
|
11
|
+
def fetch_apps_extensions(ctx, org, type)
|
|
12
|
+
jobs = apps(org).map { |app| AppExtensions::Job.new(ctx, app, type) }
|
|
13
13
|
|
|
14
14
|
consume_jobs!(jobs)
|
|
15
15
|
patch_apps_with_extensions!(jobs)
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
org
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
private
|
|
21
21
|
|
|
22
|
-
def apps(
|
|
23
|
-
|
|
22
|
+
def apps(org)
|
|
23
|
+
(org && org["apps"]) || []
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def consume_jobs!(jobs)
|
|
@@ -18,7 +18,7 @@ module ShopifyCLI
|
|
|
18
18
|
org
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def
|
|
21
|
+
def fetch_all_with_apps(ctx)
|
|
22
22
|
resp = PartnersAPI.query(ctx, "all_orgs_with_apps")
|
|
23
23
|
(resp&.dig("data", "organizations", "nodes") || []).map do |org|
|
|
24
24
|
org["stores"] = (org.dig("stores", "nodes") || [])
|
|
@@ -27,9 +27,17 @@ module ShopifyCLI
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
def
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
def fetch_with_apps(ctx, id:)
|
|
31
|
+
resp = PartnersAPI.query(ctx, "find_organization_with_apps", id: id)
|
|
32
|
+
organization = resp&.dig("data", "organizations", "nodes")&.first
|
|
33
|
+
return unless organization
|
|
34
|
+
|
|
35
|
+
organization.tap { organization["apps"] = (organization.dig("apps", "nodes") || []) }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def fetch_with_extensions(ctx, type, id:)
|
|
39
|
+
organization = fetch_with_apps(ctx, id: id)
|
|
40
|
+
AppExtensions.fetch_apps_extensions(ctx, organization, type)
|
|
33
41
|
end
|
|
34
42
|
end
|
|
35
43
|
end
|
|
@@ -25,7 +25,7 @@ module ShopifyCLI
|
|
|
25
25
|
if Shopifolk.check && wants_to_run_against_shopify_org?
|
|
26
26
|
Shopifolk.act_as_shopify_organization
|
|
27
27
|
end
|
|
28
|
-
orgs = PartnersAPI::Organizations.
|
|
28
|
+
orgs = PartnersAPI::Organizations.fetch_all_with_apps(@ctx)
|
|
29
29
|
org_id = if orgs.count == 1
|
|
30
30
|
orgs.first["id"]
|
|
31
31
|
else
|
data/lib/shopify_cli/version.rb
CHANGED
|
File without changes
|
data/shopify-cli.gemspec
CHANGED
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
|
35
35
|
spec.require_paths = ["lib", "vendor"]
|
|
36
36
|
spec.executables << "shopify"
|
|
37
37
|
|
|
38
|
-
spec.add_development_dependency("bundler", "~> 2.3.
|
|
38
|
+
spec.add_development_dependency("bundler", "~> 2.3.11")
|
|
39
39
|
spec.add_development_dependency("rake", "~> 12.3", ">= 12.3.3")
|
|
40
40
|
spec.add_development_dependency("minitest", "~> 5.0")
|
|
41
41
|
|
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.
|
|
4
|
+
version: 2.16.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-04-
|
|
11
|
+
date: 2022-04-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 2.3.
|
|
19
|
+
version: 2.3.11
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 2.3.
|
|
26
|
+
version: 2.3.11
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rake
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -192,6 +192,7 @@ files:
|
|
|
192
192
|
- lib/graphql/extension_update_draft.graphql
|
|
193
193
|
- lib/graphql/fetch_specifications.graphql
|
|
194
194
|
- lib/graphql/find_organization.graphql
|
|
195
|
+
- lib/graphql/find_organization_with_apps.graphql
|
|
195
196
|
- lib/graphql/get_app_by_api_key.graphql
|
|
196
197
|
- lib/graphql/get_app_urls.graphql
|
|
197
198
|
- lib/graphql/get_extension_registrations.graphql
|
|
@@ -275,6 +276,7 @@ files:
|
|
|
275
276
|
- lib/project_types/extension/tasks/execute_commands/base.rb
|
|
276
277
|
- lib/project_types/extension/tasks/execute_commands/build.rb
|
|
277
278
|
- lib/project_types/extension/tasks/execute_commands/create.rb
|
|
279
|
+
- lib/project_types/extension/tasks/execute_commands/outdated_extension_detection.rb
|
|
278
280
|
- lib/project_types/extension/tasks/execute_commands/serve.rb
|
|
279
281
|
- lib/project_types/extension/tasks/fetch_specifications.rb
|
|
280
282
|
- lib/project_types/extension/tasks/find_npm_packages.rb
|
|
@@ -538,7 +540,7 @@ files:
|
|
|
538
540
|
- lib/shopify_cli/tunnel.rb
|
|
539
541
|
- lib/shopify_cli/utilities.rb
|
|
540
542
|
- lib/shopify_cli/version.rb
|
|
541
|
-
- shipit.yml
|
|
543
|
+
- shipit.rubygems.yml
|
|
542
544
|
- shopify-cli.gemspec
|
|
543
545
|
- shopify-dev
|
|
544
546
|
- utilities/constants.rb
|