shopify-cli 1.8.0 → 1.9.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/.rubocop_todo.yml +15 -2
- data/CHANGELOG.md +4 -1
- data/Gemfile.lock +3 -3
- data/dev.yml +3 -0
- data/lib/graphql/extension_create.graphql +17 -2
- data/lib/project_types/extension/cli.rb +2 -0
- data/lib/project_types/extension/commands/extension_command.rb +4 -4
- data/lib/project_types/extension/commands/push.rb +2 -2
- data/lib/project_types/extension/commands/register.rb +4 -3
- data/lib/project_types/extension/commands/serve.rb +1 -35
- data/lib/project_types/extension/extension_project.rb +15 -4
- data/lib/project_types/extension/extension_project_keys.rb +2 -1
- data/lib/project_types/extension/features/argo.rb +6 -0
- data/lib/project_types/extension/features/argo_renderer_package.rb +32 -0
- data/lib/project_types/extension/features/argo_serve.rb +69 -0
- data/lib/project_types/extension/messages/message_loading.rb +3 -1
- data/lib/project_types/extension/models/registration.rb +1 -0
- data/lib/project_types/extension/models/specification.rb +2 -0
- data/lib/project_types/extension/models/specification_handlers/default.rb +8 -0
- data/lib/project_types/extension/tasks/configure_features.rb +2 -0
- data/lib/project_types/extension/tasks/converters/registration_converter.rb +2 -0
- data/lib/project_types/node/commands/generate.rb +0 -22
- data/lib/project_types/script/cli.rb +2 -8
- data/lib/project_types/script/commands/create.rb +0 -7
- data/lib/project_types/script/commands/push.rb +2 -2
- data/lib/project_types/script/config/extension_points.yml +2 -0
- data/lib/project_types/script/errors.rb +0 -19
- data/lib/project_types/script/forms/create.rb +3 -14
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +0 -3
- data/lib/project_types/script/graphql/script_service_proxy.graphql +1 -2
- data/lib/project_types/script/layers/application/build_script.rb +1 -2
- data/lib/project_types/script/layers/application/create_script.rb +30 -51
- data/lib/project_types/script/layers/application/extension_points.rb +3 -2
- data/lib/project_types/script/layers/application/push_script.rb +2 -4
- data/lib/project_types/script/layers/domain/extension_point.rb +56 -46
- data/lib/project_types/script/layers/domain/metadata.rb +18 -25
- data/lib/project_types/script/layers/domain/push_package.rb +0 -4
- data/lib/project_types/script/layers/domain/script_project.rb +34 -0
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +6 -2
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +4 -4
- data/lib/project_types/script/layers/infrastructure/errors.rb +12 -10
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +10 -12
- data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +145 -0
- data/lib/project_types/script/layers/infrastructure/script_service.rb +9 -72
- data/lib/project_types/script/messages/messages.rb +0 -47
- data/lib/project_types/script/ui/error_handler.rb +7 -24
- data/lib/shopify-cli/context.rb +28 -0
- data/lib/shopify-cli/version.rb +1 -1
- metadata +6 -10
- data/lib/project_types/script/commands/disable.rb +0 -25
- data/lib/project_types/script/commands/enable.rb +0 -80
- data/lib/project_types/script/graphql/shop_script_delete.graphql +0 -14
- data/lib/project_types/script/graphql/shop_script_update_or_create.graphql +0 -28
- data/lib/project_types/script/layers/application/disable_script.rb +0 -21
- data/lib/project_types/script/layers/application/enable_script.rb +0 -23
- data/lib/project_types/script/layers/infrastructure/config_ui_repository.rb +0 -46
- data/lib/project_types/script/script_project.rb +0 -64
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1eb0f785e6ead5199faf7921e48209506987a24d942568e24661e96f2bc0861
|
4
|
+
data.tar.gz: 06e4effc8a4b95bf78404630b452e4cf364407019846660b0d293cace45ae245
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65df9edf44e3c2ce1263acb79d619736ffc6c4b30c50d9d71f6943dfa7c740dd0a9c9440a6879d46c59387f9bc2db6671cd65a31f700bf964b65bfb9dc1da2dc
|
7
|
+
data.tar.gz: a1b9f5a17dc58b2570294205e33dd3fc1cb0a198bb4b7ca9594d91366d6169d4c92f7c9b7df0cbf8401f9a81123e78b55331ef8afd909247889a17cc046e58a2
|
data/.rubocop_todo.yml
CHANGED
@@ -1,11 +1,24 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2021-04-08 18:25:36 UTC using RuboCop version 1.12.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
9
|
+
# Offense count: 35
|
10
10
|
Minitest/MultipleAssertions:
|
11
11
|
Max: 9
|
12
|
+
|
13
|
+
# Offense count: 1
|
14
|
+
# Cop supports --auto-correct.
|
15
|
+
Style/PerlBackrefs:
|
16
|
+
Exclude:
|
17
|
+
- 'lib/docgen/markdown.rb'
|
18
|
+
|
19
|
+
# Offense count: 2
|
20
|
+
# Cop supports --auto-correct.
|
21
|
+
Style/RedundantBegin:
|
22
|
+
Exclude:
|
23
|
+
- 'lib/shopify-cli/shopifolk.rb'
|
24
|
+
- 'test/shopify-cli/tunnel_test.rb'
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
Unreleased
|
2
2
|
------
|
3
3
|
|
4
|
-
Version 1.
|
4
|
+
Version 1.9.0
|
5
5
|
-------------
|
6
|
+
* [1181](https://github.com/Shopify/shopify-app-cli/pull/1181): Remove the subcommand references of the `generate` command for node apps (fixes [1176](https://github.com/Shopify/shopify-app-cli/issues/1176))
|
6
7
|
|
8
|
+
Version 1.8.0
|
9
|
+
-------------
|
7
10
|
* [1119](https://github.com/Shopify/shopify-app-cli/pull/1119): Enable guest serialization for scripts
|
8
11
|
|
9
12
|
Version 1.7.1
|
data/Gemfile.lock
CHANGED
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
ruby-progressbar
|
23
23
|
mocha (1.11.2)
|
24
24
|
parallel (1.20.1)
|
25
|
-
parser (3.0.
|
25
|
+
parser (3.0.1.0)
|
26
26
|
ast (~> 2.4.1)
|
27
27
|
pry (0.13.1)
|
28
28
|
coderay (~> 1.1)
|
@@ -34,8 +34,8 @@ GEM
|
|
34
34
|
rainbow (3.0.0)
|
35
35
|
rake (13.0.1)
|
36
36
|
regexp_parser (2.1.1)
|
37
|
-
rexml (3.2.
|
38
|
-
rubocop (1.
|
37
|
+
rexml (3.2.5)
|
38
|
+
rubocop (1.12.1)
|
39
39
|
parallel (~> 1.10)
|
40
40
|
parser (>= 3.0.0.0)
|
41
41
|
rainbow (>= 2.2.2, < 4.0)
|
data/dev.yml
CHANGED
@@ -1,7 +1,22 @@
|
|
1
|
-
mutation ExtensionCreate(
|
2
|
-
|
1
|
+
mutation ExtensionCreate(
|
2
|
+
$api_key: String!
|
3
|
+
$type: ExtensionType!
|
4
|
+
$title: String!
|
5
|
+
$config: JSON!
|
6
|
+
$extension_context: String
|
7
|
+
) {
|
8
|
+
extensionCreate(
|
9
|
+
input: {
|
10
|
+
apiKey: $api_key
|
11
|
+
type: $type
|
12
|
+
title: $title
|
13
|
+
config: $config
|
14
|
+
context: $extension_context
|
15
|
+
}
|
16
|
+
) {
|
3
17
|
extensionRegistration {
|
4
18
|
id
|
19
|
+
uuid
|
5
20
|
type
|
6
21
|
title
|
7
22
|
draftVersion {
|
@@ -57,6 +57,8 @@ module Extension
|
|
57
57
|
end
|
58
58
|
|
59
59
|
module Features
|
60
|
+
autoload :ArgoRendererPackage, Project.project_filepath("features/argo_renderer_package")
|
61
|
+
autoload :ArgoServe, Project.project_filepath("features/argo_serve")
|
60
62
|
autoload :ArgoSetup, Project.project_filepath("features/argo_setup")
|
61
63
|
autoload :ArgoSetupStep, Project.project_filepath("features/argo_setup_step")
|
62
64
|
autoload :ArgoSetupSteps, Project.project_filepath("features/argo_setup_steps")
|
@@ -8,16 +8,16 @@ module Extension
|
|
8
8
|
@project ||= ExtensionProject.current
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
@
|
13
|
-
identifier = project.
|
11
|
+
def specification_handler
|
12
|
+
@specification_handler ||= begin
|
13
|
+
identifier = project.specification_identifier
|
14
14
|
Models::LazySpecificationHandler.new(identifier) do
|
15
15
|
specifications = Models::Specifications.new(
|
16
16
|
fetch_specifications: Tasks::FetchSpecifications.new(api_key: project.app.api_key, context: @ctx)
|
17
17
|
)
|
18
18
|
|
19
19
|
unless specifications.valid?(identifier)
|
20
|
-
@ctx.abort(@ctx.message("errors.unknown_type", project.
|
20
|
+
@ctx.abort(@ctx.message("errors.unknown_type", project.specification_identifier))
|
21
21
|
end
|
22
22
|
|
23
23
|
specifications[identifier]
|
@@ -59,8 +59,8 @@ module Extension
|
|
59
59
|
context: @ctx,
|
60
60
|
api_key: project.app.api_key,
|
61
61
|
registration_id: project.registration_id,
|
62
|
-
config:
|
63
|
-
extension_context:
|
62
|
+
config: specification_handler.config(@ctx),
|
63
|
+
extension_context: specification_handler.extension_context(@ctx)
|
64
64
|
)
|
65
65
|
end
|
66
66
|
end
|
@@ -27,7 +27,7 @@ module Extension
|
|
27
27
|
private
|
28
28
|
|
29
29
|
def confirm_registration
|
30
|
-
@ctx.puts(@ctx.message("register.confirm_info",
|
30
|
+
@ctx.puts(@ctx.message("register.confirm_info", specification_handler.name))
|
31
31
|
CLI::UI::Prompt.confirm(@ctx.message("register.confirm_question"))
|
32
32
|
end
|
33
33
|
|
@@ -37,10 +37,10 @@ module Extension
|
|
37
37
|
Tasks::CreateExtension.call(
|
38
38
|
context: @ctx,
|
39
39
|
api_key: app.api_key,
|
40
|
-
type:
|
40
|
+
type: specification_handler.graphql_identifier,
|
41
41
|
title: project.title,
|
42
42
|
config: {},
|
43
|
-
extension_context:
|
43
|
+
extension_context: specification_handler.extension_context(@ctx)
|
44
44
|
)
|
45
45
|
end
|
46
46
|
|
@@ -50,6 +50,7 @@ module Extension
|
|
50
50
|
api_key: app.api_key,
|
51
51
|
api_secret: app.secret,
|
52
52
|
registration_id: registration.id,
|
53
|
+
registration_uuid: registration.uuid,
|
53
54
|
title: project.title
|
54
55
|
)
|
55
56
|
end
|
@@ -3,27 +3,8 @@
|
|
3
3
|
module Extension
|
4
4
|
module Commands
|
5
5
|
class Serve < ExtensionCommand
|
6
|
-
YARN_SERVE_COMMAND = %w(server)
|
7
|
-
NPM_SERVE_COMMAND = %w(run-script server)
|
8
|
-
|
9
6
|
def call(_args, _command_name)
|
10
|
-
|
11
|
-
ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop])
|
12
|
-
ShopifyCli::Tasks::EnsureDevStore.call(@ctx)
|
13
|
-
validate_env
|
14
|
-
end
|
15
|
-
|
16
|
-
CLI::UI::Frame.open(@ctx.message("serve.frame_title")) do
|
17
|
-
yarn_serve_command = YARN_SERVE_COMMAND
|
18
|
-
npm_serve_command = NPM_SERVE_COMMAND
|
19
|
-
if argo_admin?
|
20
|
-
serve_args = %W(--shop=#{project.env.shop} --apiKey=#{project.env.api_key})
|
21
|
-
yarn_serve_command += serve_args
|
22
|
-
npm_serve_command += %w(--) + serve_args
|
23
|
-
end
|
24
|
-
success = ShopifyCli::JsSystem.call(@ctx, yarn: yarn_serve_command, npm: npm_serve_command)
|
25
|
-
@ctx.abort(@ctx.message("serve.serve_failure_message")) unless success
|
26
|
-
end
|
7
|
+
specification_handler.serve(@ctx)
|
27
8
|
end
|
28
9
|
|
29
10
|
def self.help
|
@@ -32,21 +13,6 @@ module Extension
|
|
32
13
|
Usage: {{command:#{ShopifyCli::TOOL_NAME} serve}}
|
33
14
|
HELP
|
34
15
|
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def argo_admin?
|
39
|
-
ShopifyCli::Shopifolk.check &&
|
40
|
-
ShopifyCli::Feature.enabled?(:argo_admin_beta) &&
|
41
|
-
extension_type.specification.features&.argo&.surface == "admin"
|
42
|
-
end
|
43
|
-
|
44
|
-
def validate_env
|
45
|
-
ExtensionProject.reload
|
46
|
-
@ctx.abort(@ctx.message("serve.serve_missing_information")) if
|
47
|
-
project.env.shop.nil? || project.env.api_key.nil? ||
|
48
|
-
project.env.shop.strip.empty? || project.env.api_key.strip.empty?
|
49
|
-
end
|
50
16
|
end
|
51
17
|
end
|
52
18
|
end
|
@@ -9,17 +9,20 @@ module Extension
|
|
9
9
|
context,
|
10
10
|
project_type: :extension,
|
11
11
|
organization_id: nil,
|
12
|
-
"#{ExtensionProjectKeys::
|
12
|
+
"#{ExtensionProjectKeys::SPECIFICATION_IDENTIFIER_KEY}": type
|
13
13
|
)
|
14
14
|
end
|
15
15
|
|
16
|
-
def write_env_file(
|
16
|
+
def write_env_file(
|
17
|
+
context:, title:, api_key: "", api_secret: "", registration_id: nil, registration_uuid: nil
|
18
|
+
)
|
17
19
|
ShopifyCli::Resources::EnvFile.new(
|
18
20
|
api_key: api_key,
|
19
21
|
secret: api_secret,
|
20
22
|
extra: {
|
21
23
|
ExtensionProjectKeys::TITLE_KEY => title,
|
22
24
|
ExtensionProjectKeys::REGISTRATION_ID_KEY => registration_id,
|
25
|
+
ExtensionProjectKeys::REGISTRATION_UUID_KEY => registration_uuid || generate_temporary_uuid,
|
23
26
|
}.compact
|
24
27
|
).write(context)
|
25
28
|
|
@@ -49,8 +52,8 @@ module Extension
|
|
49
52
|
get_extra_field(ExtensionProjectKeys::TITLE_KEY)
|
50
53
|
end
|
51
54
|
|
52
|
-
def
|
53
|
-
config[ExtensionProjectKeys::
|
55
|
+
def specification_identifier
|
56
|
+
config[ExtensionProjectKeys::SPECIFICATION_IDENTIFIER_KEY]
|
54
57
|
end
|
55
58
|
|
56
59
|
def registration_id?
|
@@ -63,10 +66,18 @@ module Extension
|
|
63
66
|
get_extra_field(ExtensionProjectKeys::REGISTRATION_ID_KEY).to_i
|
64
67
|
end
|
65
68
|
|
69
|
+
def registration_uuid
|
70
|
+
get_extra_field(ExtensionProjectKeys::REGISTRATION_UUID_KEY)
|
71
|
+
end
|
72
|
+
|
66
73
|
def reload
|
67
74
|
@env = nil
|
68
75
|
end
|
69
76
|
|
77
|
+
def self.generate_temporary_uuid
|
78
|
+
"dev-#{SecureRandom.uuid}"
|
79
|
+
end
|
80
|
+
|
70
81
|
private
|
71
82
|
|
72
83
|
def get_extra_field(key)
|
@@ -4,7 +4,8 @@ require "shopify_cli"
|
|
4
4
|
module Extension
|
5
5
|
module ExtensionProjectKeys
|
6
6
|
REGISTRATION_ID_KEY = "EXTENSION_ID"
|
7
|
-
|
7
|
+
REGISTRATION_UUID_KEY = "EXTENSION_UUID"
|
8
|
+
SPECIFICATION_IDENTIFIER_KEY = "EXTENSION_TYPE"
|
8
9
|
TITLE_KEY = "EXTENSION_TITLE"
|
9
10
|
end
|
10
11
|
end
|
@@ -47,6 +47,12 @@ module Extension
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
+
def renderer_package(context)
|
51
|
+
Features::ArgoRendererPackage.new(
|
52
|
+
package_name: renderer_package_name, version: extract_argo_renderer_version(context)
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
50
56
|
private
|
51
57
|
|
52
58
|
def extract_argo_renderer_version(context)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Extension
|
2
|
+
module Features
|
3
|
+
class ArgoRendererPackage
|
4
|
+
include SmartProperties
|
5
|
+
|
6
|
+
ARGO_CHECKOUT = "@shopify/argo-checkout"
|
7
|
+
ARGO_ADMIN = "@shopify/argo-admin"
|
8
|
+
|
9
|
+
PACKAGE_NAMES = [
|
10
|
+
ARGO_CHECKOUT,
|
11
|
+
ARGO_ADMIN,
|
12
|
+
].freeze
|
13
|
+
MINIMUM_ARGO_VERSION = "0.9.3".freeze
|
14
|
+
|
15
|
+
property! :package_name, accepts: PACKAGE_NAMES
|
16
|
+
property! :version, accepts: String
|
17
|
+
|
18
|
+
def checkout?
|
19
|
+
package_name == ARGO_CHECKOUT
|
20
|
+
end
|
21
|
+
|
22
|
+
def admin?
|
23
|
+
package_name == ARGO_ADMIN
|
24
|
+
end
|
25
|
+
|
26
|
+
def supports_uuid_flag?
|
27
|
+
return false if checkout?
|
28
|
+
Gem::Version.new(version) > Gem::Version.new(MINIMUM_ARGO_VERSION)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Extension
|
2
|
+
module Features
|
3
|
+
class ArgoServe
|
4
|
+
include SmartProperties
|
5
|
+
|
6
|
+
property! :specification_handler, accepts: Extension::Models::SpecificationHandlers::Default
|
7
|
+
property! :context, accepts: ShopifyCli::Context
|
8
|
+
|
9
|
+
YARN_SERVE_COMMAND = %w(server)
|
10
|
+
NPM_SERVE_COMMAND = %w(run-script server)
|
11
|
+
|
12
|
+
def call
|
13
|
+
validate_env!
|
14
|
+
|
15
|
+
CLI::UI::Frame.open(context.message("serve.frame_title")) do
|
16
|
+
success = ShopifyCli::JsSystem.call(context, yarn: yarn_serve_command, npm: npm_serve_command)
|
17
|
+
context.abort(context.message("serve.serve_failure_message")) unless success
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def specification
|
24
|
+
specification_handler.specification
|
25
|
+
end
|
26
|
+
|
27
|
+
def validate_env!
|
28
|
+
ExtensionProject.reload
|
29
|
+
|
30
|
+
ShopifyCli::Shopifolk.check && ShopifyCli::Feature.enabled?(:argo_admin_beta)
|
31
|
+
|
32
|
+
required_fields = specification.features.argo.required_fields
|
33
|
+
|
34
|
+
return if required_fields.none?
|
35
|
+
|
36
|
+
ShopifyCli::Tasks::EnsureEnv.call(context, required: required_fields)
|
37
|
+
ShopifyCli::Tasks::EnsureDevStore.call(context) if required_fields.include?(:shop)
|
38
|
+
|
39
|
+
project = ExtensionProject.current
|
40
|
+
|
41
|
+
return if required_fields.all? do |field|
|
42
|
+
value = project.env.public_send(field)
|
43
|
+
value && !value.strip.empty?
|
44
|
+
end
|
45
|
+
|
46
|
+
context.abort(context.message("serve.serve_missing_information"))
|
47
|
+
end
|
48
|
+
|
49
|
+
def yarn_serve_command
|
50
|
+
YARN_SERVE_COMMAND + serve_options(specification.features.argo.required_fields)
|
51
|
+
end
|
52
|
+
|
53
|
+
def npm_serve_command
|
54
|
+
NPM_SERVE_COMMAND + ["--"] + serve_options(specification.features.argo.required_fields)
|
55
|
+
end
|
56
|
+
|
57
|
+
def serve_options(required_fields)
|
58
|
+
renderer_package = specification_handler.renderer_package(context)
|
59
|
+
project = ExtensionProject.current
|
60
|
+
@serve_options ||= [].tap do |options|
|
61
|
+
options << "--shop=#{project.env.shop}" if required_fields.include?(:shop)
|
62
|
+
options << "--apiKey=#{project.env.api_key}" if required_fields.include?(:api_key)
|
63
|
+
options << "--argoVersion=#{renderer_package.version}" if renderer_package.admin?
|
64
|
+
options << "--uuid=#{project.registration_uuid}" if renderer_package.supports_uuid_flag?
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -16,7 +16,9 @@ module Extension
|
|
16
16
|
|
17
17
|
def self.load_current_type_messages
|
18
18
|
return unless ShopifyCli::Project.has_current?
|
19
|
-
messages_for_type(
|
19
|
+
messages_for_type(
|
20
|
+
ShopifyCli::Project.current.config[Extension::ExtensionProjectKeys::SPECIFICATION_IDENTIFIER_KEY]
|
21
|
+
)
|
20
22
|
end
|
21
23
|
|
22
24
|
def self.messages_for_type(type_identifier)
|
@@ -10,6 +10,8 @@ module Extension
|
|
10
10
|
property! :surface, converts: :to_str
|
11
11
|
property! :renderer_package_name, converts: :to_str
|
12
12
|
property! :git_template, converts: :to_str
|
13
|
+
property! :required_fields, accepts: Array, default: []
|
14
|
+
property! :required_shop_beta_flags, accepts: Array, default: []
|
13
15
|
end
|
14
16
|
|
15
17
|
def self.build(feature_set_attributes)
|