shopify-cli 1.7.0 → 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/.rubocop_todo.yml +15 -2
- data/CHANGELOG.md +21 -0
- data/Gemfile.lock +14 -14
- data/README.md +2 -1
- data/dev.yml +3 -0
- data/lib/docgen/markdown.rb +1 -1
- data/lib/graphql/extension_create.graphql +17 -2
- data/lib/graphql/fetch_specifications.graphql +14 -0
- data/lib/project_types/extension/cli.rb +4 -10
- data/lib/project_types/extension/commands/create.rb +2 -2
- data/lib/project_types/extension/commands/extension_command.rb +10 -6
- data/lib/project_types/extension/commands/push.rb +2 -2
- data/lib/project_types/extension/commands/register.rb +6 -5
- data/lib/project_types/extension/commands/serve.rb +1 -7
- data/lib/project_types/extension/extension_project.rb +19 -4
- data/lib/project_types/extension/extension_project_keys.rb +2 -1
- data/lib/project_types/extension/features/argo.rb +18 -34
- 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 +1 -1
- data/lib/project_types/extension/forms/questions/ask_type.rb +16 -5
- data/lib/project_types/extension/messages/message_loading.rb +3 -1
- data/lib/project_types/extension/messages/messages.rb +6 -6
- 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/default.rb +9 -1
- data/lib/project_types/extension/models/specifications.rb +12 -1
- data/lib/project_types/extension/models/version.rb +1 -1
- data/lib/project_types/extension/tasks/configure_features.rb +3 -1
- data/lib/project_types/extension/tasks/converters/registration_converter.rb +2 -0
- data/lib/project_types/extension/tasks/fetch_specifications.rb +8 -28
- data/lib/project_types/node/commands/generate.rb +0 -22
- data/lib/project_types/node/forms/create.rb +10 -1
- data/lib/project_types/node/messages/messages.rb +5 -4
- data/lib/project_types/rails/forms/create.rb +11 -1
- data/lib/project_types/rails/messages/messages.rb +5 -4
- data/lib/project_types/script/cli.rb +7 -7
- data/lib/project_types/script/commands/create.rb +2 -7
- data/lib/project_types/script/commands/push.rb +3 -3
- data/lib/project_types/script/config/extension_points.yml +27 -10
- data/lib/project_types/script/errors.rb +0 -35
- data/lib/project_types/script/forms/create.rb +3 -14
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +5 -5
- data/lib/project_types/script/graphql/get_app_scripts.graphql +6 -0
- data/lib/project_types/script/graphql/script_service_proxy.graphql +1 -2
- data/lib/project_types/script/layers/application/create_script.rb +32 -22
- data/lib/project_types/script/layers/application/extension_points.rb +3 -2
- data/lib/project_types/script/layers/application/push_script.rb +6 -3
- 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 +4 -4
- data/lib/project_types/script/layers/domain/script_project.rb +54 -0
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +37 -8
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +5 -40
- data/lib/project_types/script/layers/infrastructure/errors.rb +50 -19
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +8 -9
- data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +198 -0
- data/lib/project_types/script/layers/infrastructure/script_service.rb +27 -66
- data/lib/project_types/script/messages/messages.rb +28 -51
- data/lib/project_types/script/tasks/ensure_env.rb +77 -0
- data/lib/project_types/script/ui/error_handler.rb +63 -47
- data/lib/shopify-cli/context.rb +28 -0
- data/lib/shopify-cli/js_system.rb +2 -2
- data/lib/shopify-cli/messages/messages.rb +3 -2
- data/lib/shopify-cli/method_object.rb +1 -1
- data/lib/shopify-cli/oauth.rb +2 -2
- data/lib/shopify-cli/packager.rb +1 -1
- data/lib/shopify-cli/resolve_constant.rb +1 -1
- data/lib/shopify-cli/resources/env_file.rb +1 -1
- data/lib/shopify-cli/result.rb +3 -3
- data/lib/shopify-cli/tasks/ensure_dev_store.rb +1 -1
- data/lib/shopify-cli/transform_data_structure.rb +2 -2
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +0 -1
- 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
- metadata +11 -10
- data/.travis.yml +0 -14
- 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/script_project.rb +0 -85
@@ -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,85 +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, :config_ui
|
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
|
-
@config_ui = lookup_config_ui
|
14
|
-
@language = lookup_language
|
15
|
-
ShopifyCli::Core::Monorail.metadata = {
|
16
|
-
"script_name" => @script_name,
|
17
|
-
"extension_point_type" => @extension_point_type,
|
18
|
-
"language" => @language,
|
19
|
-
}
|
20
|
-
end
|
21
|
-
|
22
|
-
def api_key
|
23
|
-
env[:api_key]
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def deprecated?(ep)
|
29
|
-
Script::Layers::Application::ExtensionPoints.deprecated_types.include?(ep)
|
30
|
-
end
|
31
|
-
|
32
|
-
def lookup_config(key)
|
33
|
-
return nil unless config.key?(key)
|
34
|
-
config[key]
|
35
|
-
end
|
36
|
-
|
37
|
-
def lookup_config!(key)
|
38
|
-
raise Errors::InvalidContextError, key unless config.key?(key)
|
39
|
-
config[key]
|
40
|
-
end
|
41
|
-
|
42
|
-
def lookup_config_ui
|
43
|
-
filename = lookup_config("config_ui_file")
|
44
|
-
return nil unless filename
|
45
|
-
|
46
|
-
path = File.join(directory, filename)
|
47
|
-
raise Errors::MissingSpecifiedConfigUiDefinitionError, filename unless File.exist?(path)
|
48
|
-
|
49
|
-
contents = File.read(path)
|
50
|
-
raise Errors::InvalidConfigUiDefinitionError, filename unless valid_config_ui?(contents)
|
51
|
-
|
52
|
-
contents
|
53
|
-
end
|
54
|
-
|
55
|
-
def lookup_language
|
56
|
-
lang = lookup_config("language")&.downcase || Layers::Domain::ExtensionPointAssemblyScriptSDK.language
|
57
|
-
if Layers::Application::ExtensionPoints.supported_language?(type: extension_point_type, language: lang)
|
58
|
-
lang
|
59
|
-
else
|
60
|
-
raise Errors::InvalidLanguageError.new(lang, extension_point_type)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def valid_config_ui?(raw_yaml)
|
65
|
-
require "yaml" # takes 20ms, so deferred as late as possible.
|
66
|
-
YAML.safe_load(raw_yaml)
|
67
|
-
true
|
68
|
-
rescue Psych::SyntaxError
|
69
|
-
false
|
70
|
-
end
|
71
|
-
|
72
|
-
class << self
|
73
|
-
def create(ctx, dir)
|
74
|
-
raise Errors::ScriptProjectAlreadyExistsError, dir if ctx.dir_exist?(dir)
|
75
|
-
ctx.mkdir_p(dir)
|
76
|
-
ctx.chdir(dir)
|
77
|
-
end
|
78
|
-
|
79
|
-
def cleanup(ctx:, script_name:, root_dir:)
|
80
|
-
ctx.chdir(root_dir)
|
81
|
-
ctx.rm_r("#{root_dir}/#{script_name}") if ctx.dir_exist?("#{root_dir}/#{script_name}")
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|