shopify-cli 1.9.1 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +28 -0
- data/CHANGELOG.md +4 -0
- data/README.md +2 -1
- data/lib/project_types/extension/features/argo.rb +1 -1
- data/lib/project_types/extension/features/argo_renderer_package.rb +3 -3
- data/lib/project_types/extension/messages/messages.rb +2 -1
- data/lib/project_types/script/cli.rb +4 -0
- data/lib/project_types/script/commands/push.rb +1 -1
- data/lib/project_types/script/config/extension_points.yml +2 -0
- data/lib/project_types/script/graphql/get_app_scripts.graphql +6 -0
- data/lib/project_types/script/layers/domain/script_project.rb +17 -1
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +0 -1
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +20 -1
- data/lib/project_types/script/layers/infrastructure/script_service.rb +6 -0
- data/lib/project_types/script/messages/messages.rb +7 -0
- data/lib/project_types/script/tasks/ensure_env.rb +77 -0
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +0 -1
- metadata +5 -3
- data/.travis.yml +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea41fa5cbfa0eb2bf575fe82111c6be56df6807ed7696e64acc741ef2fa2e6be
|
4
|
+
data.tar.gz: 899299251ed4b0a50b0c3a5c5ae55324ebd64e92fbb981da7d4a093df94d5596
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b757bbf4ef686593f3fe8fdf82da6c83468f40d04bc312476e2bea614d5f75e3d63afe097c149f3de34b35631032c096799f0728b12732dfbbb5bd3e5141384
|
7
|
+
data.tar.gz: 2059062ef9aff95cad44d2b4bcad442e2cf82636d6733c065bb83544ac4d0b8cef2a5de3c438d5f252a251fa0cf813b03fc064db407940e3469b476a26c35e0d
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
name: Ruby ${{ matrix.version }}
|
8
|
+
runs-on: macos-latest
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
version:
|
12
|
+
- 3.0.0
|
13
|
+
- 2.6.6
|
14
|
+
- 2.7.1
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
|
18
|
+
- name: Set up Ruby ${{ matrix.version }}
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.version }}
|
22
|
+
bundler-cache: true
|
23
|
+
|
24
|
+
- name: Install Dependencies
|
25
|
+
run: bundle install
|
26
|
+
|
27
|
+
- name: Run Tests
|
28
|
+
run: bundle exec rake
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
Unreleased
|
2
2
|
------
|
3
3
|
|
4
|
+
Version 1.10.0
|
5
|
+
-------------
|
6
|
+
* Updating internal features in development
|
7
|
+
|
4
8
|
Version 1.9.1
|
5
9
|
-------------
|
6
10
|
* [1201](https://github.com/Shopify/shopify-app-cli/pull/1201) Determine Argo Renderer Dynamically. This fixes `shopify serve` and `shopify push` for extensions.
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# [Shopify App CLI](https://shopify.dev/tools/cli)
|
2
2
|
|
3
|
-
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE.md)
|
3
|
+
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE.md)
|
4
|
+
[![Build Status](https://github.com/Shopify/shopify-app-cli/workflows/CI/badge.svg)](https://github.com/Shopify/shopify-app-cli/actions)
|
4
5
|
|
5
6
|
Shopify App CLI helps you build Shopify apps faster. It quickly generates Node.js and Ruby on Rails apps and automates many common development tasks.
|
6
7
|
|
@@ -61,7 +61,7 @@ module Extension
|
|
61
61
|
yarn_list = YARN_LIST_COMMAND + YARN_LIST_PARAMETERS
|
62
62
|
npm_list = NPM_LIST_COMMAND + NPM_LIST_PARAMETERS
|
63
63
|
|
64
|
-
result,
|
64
|
+
result, _error, _status = ShopifyCli::JsSystem.call(
|
65
65
|
context,
|
66
66
|
yarn: yarn_list,
|
67
67
|
npm: npm_list,
|
@@ -10,7 +10,7 @@ module Extension
|
|
10
10
|
PACKAGE_NAMES = [
|
11
11
|
ARGO_CHECKOUT,
|
12
12
|
ARGO_ADMIN,
|
13
|
-
ARGO_POST_PURCHASE
|
13
|
+
ARGO_POST_PURCHASE,
|
14
14
|
].freeze
|
15
15
|
MINIMUM_ARGO_VERSION = "0.9.3".freeze
|
16
16
|
|
@@ -22,7 +22,7 @@ module Extension
|
|
22
22
|
pattern = /(?<name>#{PACKAGE_NAMES.join("|")})@(?<version>\d.*)$/
|
23
23
|
match = package_manager_output.match(pattern)
|
24
24
|
raise PackageNotFound, package_manager_output if match.nil?
|
25
|
-
|
25
|
+
new(package_name: match[:name], version: match[:version].strip)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -38,7 +38,7 @@ module Extension
|
|
38
38
|
# Temporarily returns false in all cases as the argo webpack server is
|
39
39
|
# unable to handle the UUID flag.
|
40
40
|
def supports_uuid_flag?
|
41
|
-
|
41
|
+
false
|
42
42
|
# return false if checkout?
|
43
43
|
# Gem::Version.new(version) > Gem::Version.new(MINIMUM_ARGO_VERSION)
|
44
44
|
end
|
@@ -98,7 +98,8 @@ module Extension
|
|
98
98
|
node_not_installed: "Node must be installed to create this extension.",
|
99
99
|
version_too_low: "Your node version %s does not meet the minimum required version %s",
|
100
100
|
},
|
101
|
-
argo_missing_renderer_package_error: "Extension template references invalid renderer package
|
101
|
+
argo_missing_renderer_package_error: "Extension template references invalid renderer package "\
|
102
|
+
"please contact Shopify for help.",
|
102
103
|
yarn_install_error: "Something went wrong while running 'yarn install'. %s.",
|
103
104
|
yarn_run_script_error: "Something went wrong while running script. %s.",
|
104
105
|
},
|
@@ -24,6 +24,10 @@ module Script
|
|
24
24
|
autoload :ScriptForm, Project.project_filepath("forms/script_form")
|
25
25
|
end
|
26
26
|
|
27
|
+
module Tasks
|
28
|
+
autoload :EnsureEnv, Project.project_filepath("tasks/ensure_env")
|
29
|
+
end
|
30
|
+
|
27
31
|
module Layers
|
28
32
|
module Application
|
29
33
|
autoload :BuildScript, Project.project_filepath("layers/application/build_script")
|
@@ -8,7 +8,7 @@ module Script
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def call(_args, _name)
|
11
|
-
|
11
|
+
Tasks::EnsureEnv.call(@ctx)
|
12
12
|
|
13
13
|
api_key = Layers::Infrastructure::ScriptProjectRepository.new(ctx: @ctx).get.api_key
|
14
14
|
return @ctx.puts(self.class.help) unless api_key
|
@@ -11,6 +11,7 @@ unit_limit_per_order:
|
|
11
11
|
sdk-version: "^9.0.0"
|
12
12
|
toolchain-version: "^5.0.0"
|
13
13
|
payment_filter:
|
14
|
+
deprecated: true
|
14
15
|
assemblyscript:
|
15
16
|
package: "@shopify/extension-point-as-payment-filter"
|
16
17
|
sdk-version: "^9.0.0"
|
@@ -19,6 +20,7 @@ payment_filter:
|
|
19
20
|
beta: true
|
20
21
|
package: "https://github.com/Shopify/scripts-apis-rs"
|
21
22
|
shipping_filter:
|
23
|
+
deprecated: true
|
22
24
|
assemblyscript:
|
23
25
|
package: "@shopify/extension-point-as-shipping-filter"
|
24
26
|
sdk-version: "^9.0.0"
|
@@ -6,6 +6,8 @@ module Script
|
|
6
6
|
class ScriptProject
|
7
7
|
include SmartProperties
|
8
8
|
|
9
|
+
UUID_ENV_KEY = "UUID"
|
10
|
+
|
9
11
|
property! :id, accepts: String
|
10
12
|
property :env, accepts: ShopifyCli::Resources::EnvFile
|
11
13
|
|
@@ -29,8 +31,22 @@ module Script
|
|
29
31
|
env&.api_key
|
30
32
|
end
|
31
33
|
|
34
|
+
def api_secret
|
35
|
+
env&.secret
|
36
|
+
end
|
37
|
+
|
32
38
|
def uuid
|
33
|
-
|
39
|
+
uuid_defined? && !raw_uuid.empty? ? raw_uuid : nil
|
40
|
+
end
|
41
|
+
|
42
|
+
def uuid_defined?
|
43
|
+
!raw_uuid.nil?
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def raw_uuid
|
49
|
+
env&.extra&.[](UUID_ENV_KEY)
|
34
50
|
end
|
35
51
|
end
|
36
52
|
end
|
@@ -76,6 +76,25 @@ module Script
|
|
76
76
|
)
|
77
77
|
end
|
78
78
|
|
79
|
+
def create_env(api_key:, secret:, uuid:)
|
80
|
+
ShopifyCli::Resources::EnvFile.new(
|
81
|
+
api_key: api_key,
|
82
|
+
secret: secret,
|
83
|
+
extra: {
|
84
|
+
Domain::ScriptProject::UUID_ENV_KEY => uuid,
|
85
|
+
}
|
86
|
+
).write(ctx)
|
87
|
+
|
88
|
+
Domain::ScriptProject.new(
|
89
|
+
id: ctx.root,
|
90
|
+
env: project.env,
|
91
|
+
script_name: script_name,
|
92
|
+
extension_point_type: extension_point_type,
|
93
|
+
language: language,
|
94
|
+
config_ui: ConfigUiRepository.new(ctx: ctx).get(config_ui_file),
|
95
|
+
)
|
96
|
+
end
|
97
|
+
|
79
98
|
private
|
80
99
|
|
81
100
|
def capture_io(&block)
|
@@ -109,7 +128,7 @@ module Script
|
|
109
128
|
end
|
110
129
|
|
111
130
|
def project
|
112
|
-
ShopifyCli::Project.current
|
131
|
+
@project ||= ShopifyCli::Project.current(force_reload: true)
|
113
132
|
end
|
114
133
|
|
115
134
|
def default_config_ui_content(title)
|
@@ -58,6 +58,12 @@ module Script
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
def get_app_scripts(api_key:, extension_point_type:)
|
62
|
+
query_name = "get_app_scripts"
|
63
|
+
variables = { appKey: api_key, extensionPointName: extension_point_type.upcase }
|
64
|
+
script_service_request(query_name: query_name, api_key: api_key, variables: variables)["data"]["appScripts"]
|
65
|
+
end
|
66
|
+
|
61
67
|
private
|
62
68
|
|
63
69
|
class ScriptServiceAPI < ShopifyCli::API
|
@@ -192,6 +192,13 @@ module Script
|
|
192
192
|
disabled: "Disabled",
|
193
193
|
enabling: "Enabling",
|
194
194
|
enabled: "Enabled",
|
195
|
+
ensure_env: {
|
196
|
+
organization_select: "Which partner organization do you want to use?",
|
197
|
+
app_select: "Which app do you want to push this script to?",
|
198
|
+
ask_connect_to_existing_script: "This app has some scripts. Do you want to replace any of the "\
|
199
|
+
"existing scripts with the current script?",
|
200
|
+
ask_which_script_to_connect_to: "Which script do you want to replace?",
|
201
|
+
},
|
195
202
|
},
|
196
203
|
},
|
197
204
|
}.freeze
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require "shopify_cli"
|
2
|
+
|
3
|
+
module Script
|
4
|
+
module Tasks
|
5
|
+
class EnsureEnv < ShopifyCli::Task
|
6
|
+
attr_accessor :ctx
|
7
|
+
|
8
|
+
def call(ctx)
|
9
|
+
self.ctx = ctx
|
10
|
+
|
11
|
+
script_project_repo = Layers::Infrastructure::ScriptProjectRepository.new(ctx: ctx)
|
12
|
+
script_project = script_project_repo.get
|
13
|
+
|
14
|
+
return if script_project.api_key && script_project.api_secret && script_project.uuid_defined?
|
15
|
+
|
16
|
+
org = ask_org
|
17
|
+
app = ask_app(org["apps"])
|
18
|
+
uuid = ask_script_uuid(app, script_project.extension_point_type)
|
19
|
+
|
20
|
+
script_project_repo.create_env(
|
21
|
+
api_key: app["apiKey"],
|
22
|
+
secret: app["apiSecretKeys"].first["secret"],
|
23
|
+
uuid: uuid
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def ask_org
|
30
|
+
if ShopifyCli::Shopifolk.check && wants_to_run_against_shopify_org?
|
31
|
+
ShopifyCli::Shopifolk.act_as_shopify_organization
|
32
|
+
end
|
33
|
+
|
34
|
+
orgs = ShopifyCli::PartnersAPI::Organizations.fetch_with_app(ctx)
|
35
|
+
if orgs.count == 1
|
36
|
+
orgs.first
|
37
|
+
elsif orgs.count > 0
|
38
|
+
CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.organization_select")) do |handler|
|
39
|
+
orgs.each do |org|
|
40
|
+
handler.option("#{org["businessName"]} (#{org["id"]})") { org }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
else
|
44
|
+
raise Errors::NoExistingOrganizationsError
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def ask_app(apps)
|
49
|
+
if apps.count == 1
|
50
|
+
apps.first
|
51
|
+
elsif apps.count > 0
|
52
|
+
CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.app_select")) do |handler|
|
53
|
+
apps.each do |app|
|
54
|
+
handler.option(app["title"]) { app }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
else
|
58
|
+
raise Errors::NoExistingAppsError
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def ask_script_uuid(app, extension_point_type)
|
63
|
+
script_service = Layers::Infrastructure::ScriptService.new(ctx: ctx)
|
64
|
+
scripts = script_service.get_app_scripts(api_key: app["apiKey"], extension_point_type: extension_point_type)
|
65
|
+
|
66
|
+
return nil unless scripts.count > 0 &&
|
67
|
+
CLI::UI::Prompt.confirm(ctx.message("script.application.ensure_env.ask_connect_to_existing_script"))
|
68
|
+
|
69
|
+
CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.ask_which_script_to_connect_to")) do |handler|
|
70
|
+
scripts.each do |script|
|
71
|
+
handler.option("#{script["title"]} (#{script["uuid"]})") { script["uuid"] }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/lib/shopify-cli/version.rb
CHANGED
data/lib/shopify_cli.rb
CHANGED
@@ -110,7 +110,6 @@ module ShopifyCli
|
|
110
110
|
autoload :JsSystem, "shopify-cli/js_system"
|
111
111
|
autoload :MethodObject, "shopify-cli/method_object"
|
112
112
|
autoload :LazyDelegator, "shopify-cli/lazy_delegator"
|
113
|
-
autoload :Log, "shopify-cli/log"
|
114
113
|
autoload :OAuth, "shopify-cli/oauth"
|
115
114
|
autoload :Options, "shopify-cli/options"
|
116
115
|
autoload :PartnersAPI, "shopify-cli/partners_api"
|
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: 1.
|
4
|
+
version: 1.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- ".github/ISSUE_TEMPLATE.md"
|
78
78
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
79
79
|
- ".github/probots.yml"
|
80
|
+
- ".github/workflows/build.yml"
|
80
81
|
- ".github/workflows/release.yml"
|
81
82
|
- ".github/workflows/triage.yml"
|
82
83
|
- ".gitignore"
|
@@ -85,7 +86,6 @@ files:
|
|
85
86
|
- ".ruby-version"
|
86
87
|
- ".tmp/.gitkeep"
|
87
88
|
- ".tmp/sv/.gitkeep"
|
88
|
-
- ".travis.yml"
|
89
89
|
- CHANGELOG.md
|
90
90
|
- Gemfile
|
91
91
|
- Gemfile.lock
|
@@ -215,6 +215,7 @@ files:
|
|
215
215
|
- lib/project_types/script/errors.rb
|
216
216
|
- lib/project_types/script/forms/create.rb
|
217
217
|
- lib/project_types/script/graphql/app_script_update_or_create.graphql
|
218
|
+
- lib/project_types/script/graphql/get_app_scripts.graphql
|
218
219
|
- lib/project_types/script/graphql/script_service_proxy.graphql
|
219
220
|
- lib/project_types/script/layers/application/build_script.rb
|
220
221
|
- lib/project_types/script/layers/application/create_script.rb
|
@@ -239,6 +240,7 @@ files:
|
|
239
240
|
- lib/project_types/script/layers/infrastructure/script_service.rb
|
240
241
|
- lib/project_types/script/layers/infrastructure/task_runner.rb
|
241
242
|
- lib/project_types/script/messages/messages.rb
|
243
|
+
- lib/project_types/script/tasks/ensure_env.rb
|
242
244
|
- lib/project_types/script/ui/error_handler.rb
|
243
245
|
- lib/project_types/script/ui/printing_spinner.rb
|
244
246
|
- lib/project_types/script/ui/strict_spinner.rb
|