shopify-cli 1.6.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +15 -2
- data/CHANGELOG.md +21 -0
- data/Gemfile +12 -12
- data/Gemfile.lock +14 -14
- data/Rakefile +32 -30
- data/bin/load_shopify.rb +6 -6
- data/bin/shopify +2 -2
- data/dev.yml +3 -0
- data/ext/shopify-cli/extconf.rb +7 -7
- data/lib/docgen/markdown.rb +12 -12
- data/lib/graphql/extension_create.graphql +17 -2
- data/lib/graphql/fetch_specifications.graphql +14 -0
- data/lib/{project_types/extension/graphql → graphql}/get_app_by_api_key.graphql +0 -0
- data/lib/project_types/extension/cli.rb +56 -55
- data/lib/project_types/extension/commands/build.rb +3 -3
- data/lib/project_types/extension/commands/create.rb +17 -10
- data/lib/project_types/extension/commands/extension_command.rb +14 -7
- data/lib/project_types/extension/commands/push.rb +10 -10
- data/lib/project_types/extension/commands/register.rb +22 -32
- data/lib/project_types/extension/commands/serve.rb +1 -7
- data/lib/project_types/extension/commands/tunnel.rb +12 -12
- data/lib/project_types/extension/extension_project.rb +22 -7
- data/lib/project_types/extension/extension_project_keys.rb +5 -4
- data/lib/project_types/extension/features/argo.rb +26 -42
- data/lib/project_types/extension/features/argo_config.rb +5 -5
- data/lib/project_types/extension/features/argo_dependencies.rb +5 -5
- data/lib/project_types/extension/features/argo_renderer_package.rb +47 -0
- data/lib/project_types/extension/features/argo_serve.rb +69 -0
- data/lib/project_types/extension/features/argo_setup.rb +3 -3
- data/lib/project_types/extension/features/argo_setup_steps.rb +4 -4
- data/lib/project_types/extension/forms/create.rb +28 -34
- data/lib/project_types/extension/forms/questions/ask_app.rb +53 -0
- data/lib/project_types/extension/forms/questions/ask_name.rb +40 -0
- data/lib/project_types/extension/forms/questions/ask_type.rb +47 -0
- data/lib/project_types/extension/messages/message_loading.rb +3 -1
- data/lib/project_types/extension/messages/messages.rb +55 -55
- data/lib/project_types/extension/models/lazy_specification_handler.rb +12 -0
- data/lib/project_types/extension/models/registration.rb +1 -0
- data/lib/project_types/extension/models/specification.rb +6 -2
- data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +1 -1
- data/lib/project_types/extension/models/specification_handlers/default.rb +10 -2
- data/lib/project_types/extension/models/specifications.rb +14 -3
- data/lib/project_types/extension/models/version.rb +1 -1
- data/lib/project_types/extension/tasks/configure_features.rb +7 -5
- data/lib/project_types/extension/tasks/converters/app_converter.rb +6 -6
- data/lib/project_types/extension/tasks/converters/registration_converter.rb +8 -6
- data/lib/project_types/extension/tasks/converters/validation_error_converter.rb +4 -4
- data/lib/project_types/extension/tasks/converters/version_converter.rb +7 -7
- data/lib/project_types/extension/tasks/create_extension.rb +4 -4
- data/lib/project_types/extension/tasks/fetch_specifications.rb +8 -28
- data/lib/project_types/extension/tasks/get_app.rb +4 -4
- data/lib/project_types/extension/tasks/get_apps.rb +3 -3
- data/lib/project_types/extension/tasks/update_draft.rb +4 -4
- data/lib/project_types/extension/tasks/user_errors.rb +4 -4
- data/lib/project_types/node/cli.rb +19 -19
- data/lib/project_types/node/commands/connect.rb +3 -3
- data/lib/project_types/node/commands/create.rb +40 -38
- data/lib/project_types/node/commands/deploy.rb +4 -4
- data/lib/project_types/node/commands/deploy/heroku.rb +24 -24
- data/lib/project_types/node/commands/generate.rb +2 -24
- data/lib/project_types/node/commands/open.rb +2 -2
- data/lib/project_types/node/commands/populate.rb +6 -6
- data/lib/project_types/node/commands/populate/customer.rb +5 -5
- data/lib/project_types/node/commands/populate/draft_order.rb +5 -5
- data/lib/project_types/node/commands/populate/product.rb +5 -5
- data/lib/project_types/node/commands/serve.rb +9 -9
- data/lib/project_types/node/commands/tunnel.rb +7 -7
- data/lib/project_types/node/forms/create.rb +17 -8
- data/lib/project_types/node/messages/messages.rb +8 -7
- data/lib/project_types/rails/cli.rb +21 -21
- data/lib/project_types/rails/commands/connect.rb +3 -3
- data/lib/project_types/rails/commands/create.rb +51 -48
- data/lib/project_types/rails/commands/deploy.rb +4 -4
- data/lib/project_types/rails/commands/deploy/heroku.rb +30 -30
- data/lib/project_types/rails/commands/generate.rb +7 -7
- data/lib/project_types/rails/commands/generate/webhook.rb +6 -6
- data/lib/project_types/rails/commands/open.rb +2 -2
- data/lib/project_types/rails/commands/populate.rb +6 -6
- data/lib/project_types/rails/commands/populate/customer.rb +5 -5
- data/lib/project_types/rails/commands/populate/draft_order.rb +5 -5
- data/lib/project_types/rails/commands/populate/product.rb +5 -5
- data/lib/project_types/rails/commands/serve.rb +11 -11
- data/lib/project_types/rails/commands/tunnel.rb +7 -7
- data/lib/project_types/rails/forms/create.rb +34 -24
- data/lib/project_types/rails/gem.rb +23 -23
- data/lib/project_types/rails/messages/messages.rb +9 -8
- data/lib/project_types/rails/ruby.rb +2 -2
- data/lib/project_types/script/cli.rb +36 -40
- data/lib/project_types/script/commands/create.rb +9 -13
- data/lib/project_types/script/commands/push.rb +6 -5
- data/lib/project_types/script/config/extension_points.yml +25 -10
- data/lib/project_types/script/errors.rb +1 -19
- data/lib/project_types/script/forms/create.rb +7 -18
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +7 -5
- data/lib/project_types/script/graphql/script_service_proxy.graphql +1 -2
- data/lib/project_types/script/layers/application/build_script.rb +6 -8
- data/lib/project_types/script/layers/application/create_script.rb +34 -24
- data/lib/project_types/script/layers/application/extension_points.rb +3 -2
- data/lib/project_types/script/layers/application/project_dependencies.rb +4 -4
- data/lib/project_types/script/layers/application/push_script.rb +10 -15
- data/lib/project_types/script/layers/domain/config_ui.rb +16 -0
- data/lib/project_types/script/layers/domain/errors.rb +16 -0
- data/lib/project_types/script/layers/domain/extension_point.rb +60 -45
- data/lib/project_types/script/layers/domain/metadata.rb +18 -25
- data/lib/project_types/script/layers/domain/push_package.rb +9 -5
- data/lib/project_types/script/layers/domain/script_project.rb +38 -0
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +39 -10
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +9 -44
- data/lib/project_types/script/layers/infrastructure/errors.rb +50 -19
- data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +16 -21
- data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +4 -4
- data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +179 -0
- data/lib/project_types/script/layers/infrastructure/script_service.rb +35 -78
- data/lib/project_types/script/messages/messages.rb +33 -57
- data/lib/project_types/script/ui/error_handler.rb +116 -88
- data/lib/project_types/script/ui/printing_spinner.rb +1 -1
- data/lib/project_types/script/ui/strict_spinner.rb +1 -1
- data/lib/project_types/theme/cli.rb +19 -19
- data/lib/project_types/theme/commands/connect.rb +12 -12
- data/lib/project_types/theme/commands/create.rb +11 -11
- data/lib/project_types/theme/commands/deploy.rb +8 -8
- data/lib/project_types/theme/commands/generate.rb +3 -3
- data/lib/project_types/theme/commands/generate/env.rb +15 -15
- data/lib/project_types/theme/commands/push.rb +15 -15
- data/lib/project_types/theme/commands/serve.rb +5 -5
- data/lib/project_types/theme/forms/connect.rb +4 -4
- data/lib/project_types/theme/forms/create.rb +5 -5
- data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +22 -22
- data/lib/project_types/theme/themekit.rb +15 -15
- data/lib/rubygems_plugin.rb +3 -3
- data/lib/shopify-cli/admin_api.rb +11 -11
- data/lib/shopify-cli/admin_api/populate_resource_command.rb +17 -17
- data/lib/shopify-cli/admin_api/schema.rb +3 -3
- data/lib/shopify-cli/api.rb +10 -10
- data/lib/shopify-cli/command.rb +1 -1
- data/lib/shopify-cli/commands.rb +9 -9
- data/lib/shopify-cli/commands/config.rb +28 -52
- data/lib/shopify-cli/commands/connect.rb +10 -10
- data/lib/shopify-cli/commands/create.rb +5 -5
- data/lib/shopify-cli/commands/help.rb +6 -6
- data/lib/shopify-cli/commands/logout.rb +3 -3
- data/lib/shopify-cli/commands/system.rb +32 -32
- data/lib/shopify-cli/commands/version.rb +2 -2
- data/lib/shopify-cli/context.rb +51 -23
- data/lib/shopify-cli/core.rb +4 -4
- data/lib/shopify-cli/core/entry_point.rb +5 -5
- data/lib/shopify-cli/core/executor.rb +1 -1
- data/lib/shopify-cli/core/help_resolver.rb +2 -2
- data/lib/shopify-cli/core/monorail.rb +16 -16
- data/lib/shopify-cli/db.rb +2 -2
- data/lib/shopify-cli/feature.rb +1 -1
- data/lib/shopify-cli/form.rb +1 -1
- data/lib/shopify-cli/git.rb +17 -17
- data/lib/shopify-cli/helpers.rb +1 -1
- data/lib/shopify-cli/helpers/haikunator.rb +1 -1
- data/lib/shopify-cli/heroku.rb +28 -28
- data/lib/shopify-cli/http_request.rb +2 -2
- data/lib/shopify-cli/js_deps.rb +12 -12
- data/lib/shopify-cli/js_system.rb +7 -7
- data/lib/shopify-cli/lazy_delegator.rb +55 -0
- data/lib/shopify-cli/messages/messages.rb +7 -16
- data/lib/shopify-cli/method_object.rb +1 -1
- data/lib/shopify-cli/oauth.rb +27 -27
- data/lib/shopify-cli/oauth/servlet.rb +9 -9
- data/lib/shopify-cli/options.rb +3 -3
- data/lib/shopify-cli/packager.rb +25 -25
- data/lib/shopify-cli/partners_api.rb +16 -16
- data/lib/shopify-cli/partners_api/organizations.rb +10 -10
- data/lib/shopify-cli/process_supervision.rb +7 -7
- data/lib/shopify-cli/project.rb +16 -16
- data/lib/shopify-cli/project_type.rb +3 -3
- data/lib/shopify-cli/resolve_constant.rb +1 -1
- data/lib/shopify-cli/resources.rb +1 -1
- data/lib/shopify-cli/resources/env_file.rb +10 -10
- data/lib/shopify-cli/result.rb +11 -11
- data/lib/shopify-cli/shopifolk.rb +6 -9
- data/lib/shopify-cli/sub_command.rb +1 -1
- data/lib/shopify-cli/task.rb +3 -3
- data/lib/shopify-cli/tasks.rb +7 -7
- data/lib/shopify-cli/tasks/create_api_client.rb +5 -5
- data/lib/shopify-cli/tasks/ensure_dev_store.rb +12 -12
- data/lib/shopify-cli/tasks/ensure_env.rb +15 -15
- data/lib/shopify-cli/tasks/ensure_loopback_url.rb +4 -4
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +19 -19
- data/lib/shopify-cli/tasks/update_dashboard_urls.rb +10 -10
- data/lib/shopify-cli/transform_data_structure.rb +86 -0
- data/lib/shopify-cli/tunnel.rb +30 -30
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +56 -54
- data/shopify-cli.gemspec +6 -6
- data/vendor/deps/smart_properties/REVISION +1 -1
- data/vendor/deps/smart_properties/lib/smart_properties/property.rb +7 -1
- data/vendor/deps/smart_properties/lib/smart_properties/version.rb +1 -1
- data/vendor/gen/template/bin/update-deps +9 -9
- metadata +15 -11
- data/lib/project_types/extension/forms/register.rb +0 -47
- data/lib/project_types/script/commands/disable.rb +0 -25
- data/lib/project_types/script/commands/enable.rb +0 -78
- 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/script_project.rb +0 -63
@@ -1,78 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Script
|
4
|
-
module Commands
|
5
|
-
class Enable < ShopifyCli::Command
|
6
|
-
options do |parser, flags|
|
7
|
-
parser.on('--config_props=KEYVALUEPAIRS', Array) { |t| flags[:config_props] = t }
|
8
|
-
parser.on('--config_file=CONFIGFILEPATH') { |t| flags[:config_file] = t }
|
9
|
-
end
|
10
|
-
|
11
|
-
def call(_args, _name)
|
12
|
-
ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop])
|
13
|
-
project = ScriptProject.current
|
14
|
-
api_key = project.env[:api_key]
|
15
|
-
shop_domain = project.env[:shop]
|
16
|
-
|
17
|
-
Layers::Application::EnableScript.call(
|
18
|
-
ctx: @ctx,
|
19
|
-
api_key: api_key,
|
20
|
-
shop_domain: shop_domain,
|
21
|
-
configuration: acquire_configuration(**slice(options.flags, :config_file, :config_props)),
|
22
|
-
extension_point_type: project.extension_point_type,
|
23
|
-
title: project.script_name
|
24
|
-
)
|
25
|
-
@ctx.puts(@ctx.message(
|
26
|
-
'script.enable.script_enabled',
|
27
|
-
api_key: api_key,
|
28
|
-
shop_domain: shop_domain,
|
29
|
-
type: project.extension_point_type.capitalize,
|
30
|
-
title: project.script_name
|
31
|
-
))
|
32
|
-
@ctx.puts(@ctx.message('script.enable.info'))
|
33
|
-
rescue Errors::InvalidConfigYAMLError => e
|
34
|
-
UI::ErrorHandler.pretty_print_and_raise(e)
|
35
|
-
rescue StandardError => e
|
36
|
-
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.enable.error.operation_failed'))
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.help
|
40
|
-
ShopifyCli::Context.message('script.enable.help', ShopifyCli::TOOL_NAME)
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def acquire_configuration(config_file: nil, config_props: nil)
|
46
|
-
properties = {}
|
47
|
-
properties = YAML.load(File.read(config_file)) unless config_file.nil?
|
48
|
-
properties = properties.merge(parse_config_props(config_props)) unless config_props.nil?
|
49
|
-
|
50
|
-
configuration = { entries: [] }
|
51
|
-
properties.each do |key, value|
|
52
|
-
configuration[:entries].push({
|
53
|
-
key: key,
|
54
|
-
value: value,
|
55
|
-
})
|
56
|
-
end
|
57
|
-
configuration
|
58
|
-
rescue Errno::ENOENT, Psych::SyntaxError
|
59
|
-
raise Errors::InvalidConfigYAMLError, options.flags[:config_file]
|
60
|
-
end
|
61
|
-
|
62
|
-
def parse_config_props(config_props)
|
63
|
-
Hash[
|
64
|
-
config_props.map do |s|
|
65
|
-
args = s.split(':').map(&:strip)
|
66
|
-
raise Errors::InvalidConfigProps unless args.size == 2
|
67
|
-
args
|
68
|
-
end
|
69
|
-
]
|
70
|
-
end
|
71
|
-
|
72
|
-
# No slice pre Ruby 2.5 so roll our own
|
73
|
-
def slice(hash, *keys)
|
74
|
-
Hash[hash.to_a - hash.select { |key, _value| !keys.include?(key) }.to_a]
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
mutation ShopScriptUpdateOrCreate(
|
2
|
-
$extensionPointName: ExtensionPointName!,
|
3
|
-
$configuration: ConfigurationInput,
|
4
|
-
$title: String
|
5
|
-
) {
|
6
|
-
shopScriptUpdateOrCreate(
|
7
|
-
extensionPointName: $extensionPointName,
|
8
|
-
configuration: $configuration,
|
9
|
-
title: $title
|
10
|
-
) {
|
11
|
-
userErrors {
|
12
|
-
field
|
13
|
-
message
|
14
|
-
tag
|
15
|
-
}
|
16
|
-
shopScript {
|
17
|
-
extensionPointName
|
18
|
-
shopId
|
19
|
-
title
|
20
|
-
configuration {
|
21
|
-
entries {
|
22
|
-
key,
|
23
|
-
value
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Script
|
4
|
-
module Layers
|
5
|
-
module Application
|
6
|
-
class DisableScript
|
7
|
-
def self.call(ctx:, api_key:, shop_domain:, extension_point_type:)
|
8
|
-
UI::PrintingSpinner.spin(ctx, ctx.message('script.application.disabling')) do |p_ctx, spinner|
|
9
|
-
script_service = Infrastructure::ScriptService.new(ctx: p_ctx)
|
10
|
-
script_service.disable(
|
11
|
-
api_key: api_key,
|
12
|
-
shop_domain: shop_domain,
|
13
|
-
extension_point_type: extension_point_type,
|
14
|
-
)
|
15
|
-
spinner.update_title(p_ctx.message('script.application.disabled'))
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Script
|
4
|
-
module Layers
|
5
|
-
module Application
|
6
|
-
class EnableScript
|
7
|
-
def self.call(ctx:, api_key:, shop_domain:, configuration:, extension_point_type:, title:)
|
8
|
-
UI::PrintingSpinner.spin(ctx, ctx.message('script.application.enabling')) do |p_ctx, spinner|
|
9
|
-
script_service = Infrastructure::ScriptService.new(ctx: p_ctx)
|
10
|
-
script_service.enable(
|
11
|
-
api_key: api_key,
|
12
|
-
shop_domain: shop_domain,
|
13
|
-
configuration: configuration,
|
14
|
-
extension_point_type: extension_point_type,
|
15
|
-
title: title
|
16
|
-
)
|
17
|
-
spinner.update_title(p_ctx.message('script.application.enabled'))
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Script
|
4
|
-
class ScriptProject < ShopifyCli::Project
|
5
|
-
attr_reader :extension_point_type, :script_name, :language, :description
|
6
|
-
|
7
|
-
def initialize(*args)
|
8
|
-
super
|
9
|
-
@extension_point_type = lookup_config!('extension_point_type')
|
10
|
-
raise Errors::DeprecatedEPError, @extension_point_type if deprecated?(@extension_point_type)
|
11
|
-
@script_name = lookup_config!('script_name')
|
12
|
-
@description = lookup_config('description')
|
13
|
-
@language = lookup_language
|
14
|
-
ShopifyCli::Core::Monorail.metadata = {
|
15
|
-
"script_name" => @script_name,
|
16
|
-
"extension_point_type" => @extension_point_type,
|
17
|
-
"language" => @language,
|
18
|
-
}
|
19
|
-
end
|
20
|
-
|
21
|
-
def api_key
|
22
|
-
env[:api_key]
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def deprecated?(ep)
|
28
|
-
Script::Layers::Application::ExtensionPoints.deprecated_types.include?(ep)
|
29
|
-
end
|
30
|
-
|
31
|
-
def lookup_config(key)
|
32
|
-
return nil unless config.key?(key)
|
33
|
-
config[key]
|
34
|
-
end
|
35
|
-
|
36
|
-
def lookup_config!(key)
|
37
|
-
raise Errors::InvalidContextError, key unless config.key?(key)
|
38
|
-
config[key]
|
39
|
-
end
|
40
|
-
|
41
|
-
def lookup_language
|
42
|
-
lang = lookup_config('language')&.downcase || Layers::Domain::ExtensionPointAssemblyScriptSDK.language
|
43
|
-
if Layers::Application::ExtensionPoints.supported_language?(type: extension_point_type, language: lang)
|
44
|
-
lang
|
45
|
-
else
|
46
|
-
raise Errors::InvalidLanguageError.new(lang, extension_point_type)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
class << self
|
51
|
-
def create(ctx, dir)
|
52
|
-
raise Errors::ScriptProjectAlreadyExistsError, dir if ctx.dir_exist?(dir)
|
53
|
-
ctx.mkdir_p(dir)
|
54
|
-
ctx.chdir(dir)
|
55
|
-
end
|
56
|
-
|
57
|
-
def cleanup(ctx:, script_name:, root_dir:)
|
58
|
-
ctx.chdir(root_dir)
|
59
|
-
ctx.rm_r("#{root_dir}/#{script_name}") if ctx.dir_exist?("#{root_dir}/#{script_name}")
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|