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
@@ -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,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Script
|
4
|
-
module Layers
|
5
|
-
module Infrastructure
|
6
|
-
class ConfigUiRepository
|
7
|
-
include SmartProperties
|
8
|
-
property! :ctx, accepts: ShopifyCli::Context
|
9
|
-
|
10
|
-
def create_config_ui(filename, content)
|
11
|
-
File.write(filename, content)
|
12
|
-
|
13
|
-
Domain::ConfigUi.new(
|
14
|
-
filename: filename,
|
15
|
-
content: content,
|
16
|
-
)
|
17
|
-
end
|
18
|
-
|
19
|
-
def get_config_ui(filename)
|
20
|
-
return nil unless filename
|
21
|
-
|
22
|
-
path = File.join(ctx.root, filename)
|
23
|
-
raise Domain::Errors::MissingSpecifiedConfigUiDefinitionError, filename unless File.exist?(path)
|
24
|
-
|
25
|
-
content = File.read(path)
|
26
|
-
raise Domain::Errors::InvalidConfigUiDefinitionError, filename unless valid_config_ui?(content)
|
27
|
-
|
28
|
-
Domain::ConfigUi.new(
|
29
|
-
filename: filename,
|
30
|
-
content: content,
|
31
|
-
)
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def valid_config_ui?(raw_yaml)
|
37
|
-
require "yaml" # takes 20ms, so deferred as late as possible.
|
38
|
-
YAML.safe_load(raw_yaml)
|
39
|
-
true
|
40
|
-
rescue Psych::SyntaxError
|
41
|
-
false
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,64 +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_file
|
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_file = lookup_config("config_ui_file")
|
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_language
|
43
|
-
lang = lookup_config("language")&.downcase || Layers::Domain::ExtensionPointAssemblyScriptSDK.language
|
44
|
-
if Layers::Application::ExtensionPoints.supported_language?(type: extension_point_type, language: lang)
|
45
|
-
lang
|
46
|
-
else
|
47
|
-
raise Errors::InvalidLanguageError.new(lang, extension_point_type)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
class << self
|
52
|
-
def create(ctx, dir)
|
53
|
-
raise Errors::ScriptProjectAlreadyExistsError, dir if ctx.dir_exist?(dir)
|
54
|
-
ctx.mkdir_p(dir)
|
55
|
-
ctx.chdir(dir)
|
56
|
-
end
|
57
|
-
|
58
|
-
def cleanup(ctx:, script_name:, root_dir:)
|
59
|
-
ctx.chdir(root_dir)
|
60
|
-
ctx.rm_r("#{root_dir}/#{script_name}") if ctx.dir_exist?("#{root_dir}/#{script_name}")
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|