shopify-cli 1.7.0 → 1.10.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/.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
|
@@ -8,8 +8,8 @@ module Node
|
|
|
8
8
|
|
|
9
9
|
def ask
|
|
10
10
|
self.title ||= CLI::UI::Prompt.ask(ctx.message("node.forms.create.app_name"))
|
|
11
|
+
self.name = format_name
|
|
11
12
|
self.type = ask_type
|
|
12
|
-
self.name = self.title.downcase.split(" ").join("_")
|
|
13
13
|
res = ShopifyCli::Tasks::SelectOrgAndShop.call(ctx, organization_id: organization_id, shop_domain: shop_domain)
|
|
14
14
|
self.organization_id = res[:organization_id]
|
|
15
15
|
self.shop_domain = res[:shop_domain]
|
|
@@ -17,6 +17,15 @@ module Node
|
|
|
17
17
|
|
|
18
18
|
private
|
|
19
19
|
|
|
20
|
+
def format_name
|
|
21
|
+
name = title.downcase.split(" ").join("_")
|
|
22
|
+
|
|
23
|
+
if name.include?("shopify")
|
|
24
|
+
ctx.abort(ctx.message("node.forms.create.error.invalid_app_name"))
|
|
25
|
+
end
|
|
26
|
+
name
|
|
27
|
+
end
|
|
28
|
+
|
|
20
29
|
def ask_type
|
|
21
30
|
if type.nil?
|
|
22
31
|
return CLI::UI::Prompt.ask(ctx.message("node.forms.create.app_type.select")) do |handler|
|
|
@@ -59,21 +59,21 @@ module Node
|
|
|
59
59
|
installed: "Installed Heroku CLI",
|
|
60
60
|
authenticating: "Authenticating with Heroku…",
|
|
61
61
|
authenticated: "{{v}} Authenticated with Heroku",
|
|
62
|
-
authenticated_with_account: "{{v}} Authenticated with Heroku as
|
|
62
|
+
authenticated_with_account: "{{v}} Authenticated with Heroku as {{green:%s}}",
|
|
63
63
|
deploying: "Deploying to Heroku…",
|
|
64
64
|
deployed: "{{v}} Deployed to Heroku",
|
|
65
65
|
git: {
|
|
66
66
|
checking: "Checking git repo…",
|
|
67
67
|
initialized: "Git repo initialized",
|
|
68
68
|
what_branch: "What branch would you like to deploy?",
|
|
69
|
-
branch_selected: "{{v}} Git branch
|
|
69
|
+
branch_selected: "{{v}} Git branch {{green:%s}} selected for deploy",
|
|
70
70
|
},
|
|
71
71
|
app: {
|
|
72
72
|
no_apps_found: "No existing Heroku app found. What would you like to do?",
|
|
73
73
|
name: "What is your Heroku app’s name?",
|
|
74
74
|
select: "Specify an existing Heroku app",
|
|
75
|
-
selecting: "Selecting Heroku app
|
|
76
|
-
selected: "{{v}} Heroku app
|
|
75
|
+
selecting: "Selecting Heroku app %s…",
|
|
76
|
+
selected: "{{v}} Heroku app {{green:%s}} selected",
|
|
77
77
|
create: "Create a new Heroku app",
|
|
78
78
|
creating: "Creating new Heroku app…",
|
|
79
79
|
created: "{{v}} New Heroku app created",
|
|
@@ -202,6 +202,7 @@ module Node
|
|
|
202
202
|
forms: {
|
|
203
203
|
create: {
|
|
204
204
|
error: {
|
|
205
|
+
invalid_app_name: "App name cannot contain 'Shopify'",
|
|
205
206
|
invalid_app_type: "Invalid app type %s",
|
|
206
207
|
},
|
|
207
208
|
app_name: "App name",
|
|
@@ -20,8 +20,8 @@ module Rails
|
|
|
20
20
|
|
|
21
21
|
def ask
|
|
22
22
|
self.title ||= CLI::UI::Prompt.ask(ctx.message("rails.forms.create.app_name"))
|
|
23
|
+
self.name = format_name
|
|
23
24
|
self.type = ask_type
|
|
24
|
-
self.name = self.title.downcase.split(" ").join("_")
|
|
25
25
|
res = ShopifyCli::Tasks::SelectOrgAndShop.call(ctx, organization_id: organization_id, shop_domain: shop_domain)
|
|
26
26
|
self.organization_id = res[:organization_id]
|
|
27
27
|
self.shop_domain = res[:shop_domain]
|
|
@@ -30,6 +30,16 @@ module Rails
|
|
|
30
30
|
|
|
31
31
|
private
|
|
32
32
|
|
|
33
|
+
def format_name
|
|
34
|
+
name = title.downcase.split(" ").join("_")
|
|
35
|
+
|
|
36
|
+
if name.include?("shopify")
|
|
37
|
+
ctx.abort(ctx.message("rails.forms.create.error.invalid_app_name"))
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
name
|
|
41
|
+
end
|
|
42
|
+
|
|
33
43
|
def ask_type
|
|
34
44
|
if type.nil?
|
|
35
45
|
return CLI::UI::Prompt.ask(ctx.message("rails.forms.create.app_type.select")) do |handler|
|
|
@@ -89,7 +89,7 @@ module Rails
|
|
|
89
89
|
downloaded: "Downloaded Heroku CLI",
|
|
90
90
|
installing: "Installing Heroku CLI...",
|
|
91
91
|
installed: "Installed Heroku CLI",
|
|
92
|
-
authenticated_with_account: "{{v}} Authenticated with Heroku as
|
|
92
|
+
authenticated_with_account: "{{v}} Authenticated with Heroku as {{green:%s}}",
|
|
93
93
|
authenticating: "Authenticating with Heroku...",
|
|
94
94
|
authenticated: "{{v}} Authenticated with Heroku",
|
|
95
95
|
deploying: "Deploying to Heroku...",
|
|
@@ -109,14 +109,14 @@ module Rails
|
|
|
109
109
|
checking: "Checking git repo...",
|
|
110
110
|
initialized: "Git repo initialized",
|
|
111
111
|
what_branch: "What branch would you like to deploy?",
|
|
112
|
-
branch_selected: "{{v}} Git branch
|
|
112
|
+
branch_selected: "{{v}} Git branch {{green:%s}} selected for deploy",
|
|
113
113
|
},
|
|
114
114
|
app: {
|
|
115
115
|
no_apps_found: "No existing Heroku app found. What would you like to do?",
|
|
116
116
|
name: "What is your Heroku app’s name?",
|
|
117
117
|
select: "Specify an existing Heroku app",
|
|
118
|
-
selecting: "Selecting Heroku app
|
|
119
|
-
selected: "{{v}} Heroku app
|
|
118
|
+
selecting: "Selecting Heroku app %s...",
|
|
119
|
+
selected: "{{v}} Heroku app {{green:%s}} selected",
|
|
120
120
|
create: "Create a new Heroku app",
|
|
121
121
|
creating: "Creating new Heroku app...",
|
|
122
122
|
created: "{{v}} New Heroku app created",
|
|
@@ -257,6 +257,7 @@ module Rails
|
|
|
257
257
|
forms: {
|
|
258
258
|
create: {
|
|
259
259
|
error: {
|
|
260
|
+
invalid_app_name: "App name cannot contain 'Shopify'",
|
|
260
261
|
invalid_app_type: "Invalid app type %s",
|
|
261
262
|
invalid_db_type: "Invalid database type %s",
|
|
262
263
|
},
|
|
@@ -7,8 +7,6 @@ module Script
|
|
|
7
7
|
creator("Script::Commands::Create")
|
|
8
8
|
|
|
9
9
|
register_command("Script::Commands::Push", "push")
|
|
10
|
-
register_command("Script::Commands::Disable", "disable")
|
|
11
|
-
register_command("Script::Commands::Enable", "enable")
|
|
12
10
|
|
|
13
11
|
require Project.project_filepath("messages/messages")
|
|
14
12
|
register_messages(Script::Messages::MESSAGES)
|
|
@@ -18,8 +16,6 @@ module Script
|
|
|
18
16
|
module Commands
|
|
19
17
|
autoload :Create, Project.project_filepath("commands/create")
|
|
20
18
|
autoload :Push, Project.project_filepath("commands/push")
|
|
21
|
-
autoload :Disable, Project.project_filepath("commands/disable")
|
|
22
|
-
autoload :Enable, Project.project_filepath("commands/enable")
|
|
23
19
|
end
|
|
24
20
|
|
|
25
21
|
# define/autoload project specific Forms
|
|
@@ -28,22 +24,26 @@ module Script
|
|
|
28
24
|
autoload :ScriptForm, Project.project_filepath("forms/script_form")
|
|
29
25
|
end
|
|
30
26
|
|
|
27
|
+
module Tasks
|
|
28
|
+
autoload :EnsureEnv, Project.project_filepath("tasks/ensure_env")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
31
|
module Layers
|
|
32
32
|
module Application
|
|
33
33
|
autoload :BuildScript, Project.project_filepath("layers/application/build_script")
|
|
34
34
|
autoload :CreateScript, Project.project_filepath("layers/application/create_script")
|
|
35
35
|
autoload :PushScript, Project.project_filepath("layers/application/push_script")
|
|
36
|
-
autoload :DisableScript, Project.project_filepath("layers/application/disable_script")
|
|
37
|
-
autoload :EnableScript, Project.project_filepath("layers/application/enable_script")
|
|
38
36
|
autoload :ExtensionPoints, Project.project_filepath("layers/application/extension_points")
|
|
39
37
|
autoload :ProjectDependencies, Project.project_filepath("layers/application/project_dependencies")
|
|
40
38
|
end
|
|
41
39
|
|
|
42
40
|
module Domain
|
|
43
41
|
autoload :Errors, Project.project_filepath("layers/domain/errors")
|
|
42
|
+
autoload :ConfigUi, Project.project_filepath("layers/domain/config_ui")
|
|
44
43
|
autoload :PushPackage, Project.project_filepath("layers/domain/push_package")
|
|
45
44
|
autoload :Metadata, Project.project_filepath("layers/domain/metadata")
|
|
46
45
|
autoload :ExtensionPoint, Project.project_filepath("layers/domain/extension_point")
|
|
46
|
+
autoload :ScriptProject, Project.project_filepath("layers/domain/script_project")
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
module Infrastructure
|
|
@@ -61,6 +61,7 @@ module Script
|
|
|
61
61
|
autoload :PushPackageRepository, Project.project_filepath("layers/infrastructure/push_package_repository")
|
|
62
62
|
autoload :ExtensionPointRepository, Project.project_filepath("layers/infrastructure/extension_point_repository")
|
|
63
63
|
autoload :ProjectCreator, Project.project_filepath("layers/infrastructure/project_creator")
|
|
64
|
+
autoload :ScriptProjectRepository, Project.project_filepath("layers/infrastructure/script_project_repository")
|
|
64
65
|
autoload :ScriptService, Project.project_filepath("layers/infrastructure/script_service")
|
|
65
66
|
autoload :TaskRunner, Project.project_filepath("layers/infrastructure/task_runner")
|
|
66
67
|
end
|
|
@@ -72,7 +73,6 @@ module Script
|
|
|
72
73
|
autoload :StrictSpinner, Project.project_filepath("ui/strict_spinner")
|
|
73
74
|
end
|
|
74
75
|
|
|
75
|
-
autoload :ScriptProject, Project.project_filepath("script_project")
|
|
76
76
|
autoload :Errors, Project.project_filepath("errors")
|
|
77
77
|
|
|
78
78
|
class ScriptProjectError < StandardError; end
|
|
@@ -5,15 +5,13 @@ module Script
|
|
|
5
5
|
class Create < ShopifyCli::SubCommand
|
|
6
6
|
options do |parser, flags|
|
|
7
7
|
parser.on("--name=NAME") { |name| flags[:name] = name }
|
|
8
|
-
parser.on("--description=DESCRIPTION") { |description| flags[:description] = description }
|
|
9
8
|
parser.on("--extension_point=EP_NAME") { |ep_name| flags[:extension_point] = ep_name }
|
|
10
9
|
parser.on("--extension-point=EP_NAME") { |ep_name| flags[:extension_point] = ep_name }
|
|
11
10
|
parser.on("--language=LANGUAGE") { |language| flags[:language] = language }
|
|
11
|
+
parser.on("--no-config-ui") { |no_config_ui| flags[:no_config_ui] = no_config_ui }
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def call(args, _name)
|
|
15
|
-
cur_dir = @ctx.root
|
|
16
|
-
|
|
17
15
|
form = Forms::Create.ask(@ctx, args, options.flags)
|
|
18
16
|
return @ctx.puts(self.class.help) if form.nil?
|
|
19
17
|
|
|
@@ -26,13 +24,10 @@ module Script
|
|
|
26
24
|
language: form.language,
|
|
27
25
|
script_name: form.name,
|
|
28
26
|
extension_point_type: form.extension_point,
|
|
29
|
-
|
|
27
|
+
no_config_ui: options.flags.key?(:no_config_ui)
|
|
30
28
|
)
|
|
31
29
|
@ctx.puts(@ctx.message("script.create.change_directory_notice", project.script_name))
|
|
32
|
-
rescue Script::Errors::ScriptProjectAlreadyExistsError => e
|
|
33
|
-
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.create.error.operation_failed"))
|
|
34
30
|
rescue StandardError => e
|
|
35
|
-
ScriptProject.cleanup(ctx: @ctx, script_name: form.name, root_dir: cur_dir) if form
|
|
36
31
|
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.create.error.operation_failed"))
|
|
37
32
|
end
|
|
38
33
|
|
|
@@ -8,15 +8,15 @@ module Script
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def call(_args, _name)
|
|
11
|
-
|
|
11
|
+
Tasks::EnsureEnv.call(@ctx)
|
|
12
12
|
|
|
13
|
-
api_key =
|
|
13
|
+
api_key = Layers::Infrastructure::ScriptProjectRepository.new(ctx: @ctx).get.api_key
|
|
14
14
|
return @ctx.puts(self.class.help) unless api_key
|
|
15
15
|
|
|
16
16
|
Layers::Application::PushScript.call(ctx: @ctx, force: options.flags.key?(:force))
|
|
17
17
|
@ctx.puts(@ctx.message("script.push.script_pushed", api_key: api_key))
|
|
18
18
|
rescue StandardError => e
|
|
19
|
-
msg = @ctx.message("script.push.error.operation_failed", api_key:
|
|
19
|
+
msg = @ctx.message("script.push.error.operation_failed", api_key: api_key)
|
|
20
20
|
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: msg)
|
|
21
21
|
end
|
|
22
22
|
|
|
@@ -2,28 +2,45 @@ discount:
|
|
|
2
2
|
deprecated: true
|
|
3
3
|
assemblyscript:
|
|
4
4
|
package: "@shopify/extension-point-as-discount"
|
|
5
|
-
sdk-version: "^
|
|
6
|
-
toolchain-version: "^
|
|
5
|
+
sdk-version: "^9.0.0"
|
|
6
|
+
toolchain-version: "^5.0.0"
|
|
7
7
|
unit_limit_per_order:
|
|
8
|
+
beta: true
|
|
8
9
|
assemblyscript:
|
|
9
10
|
package: "@shopify/extension-point-as-unit-limit-per-order"
|
|
10
|
-
sdk-version: "^
|
|
11
|
-
toolchain-version: "^
|
|
11
|
+
sdk-version: "^9.0.0"
|
|
12
|
+
toolchain-version: "^5.0.0"
|
|
12
13
|
payment_filter:
|
|
14
|
+
deprecated: true
|
|
13
15
|
assemblyscript:
|
|
14
16
|
package: "@shopify/extension-point-as-payment-filter"
|
|
15
|
-
sdk-version: "^
|
|
16
|
-
toolchain-version: "^
|
|
17
|
+
sdk-version: "^9.0.0"
|
|
18
|
+
toolchain-version: "^5.0.0"
|
|
17
19
|
rust:
|
|
18
20
|
beta: true
|
|
19
21
|
package: "https://github.com/Shopify/scripts-apis-rs"
|
|
20
22
|
shipping_filter:
|
|
23
|
+
deprecated: true
|
|
21
24
|
assemblyscript:
|
|
22
25
|
package: "@shopify/extension-point-as-shipping-filter"
|
|
23
|
-
sdk-version: "^
|
|
24
|
-
toolchain-version: "^
|
|
26
|
+
sdk-version: "^9.0.0"
|
|
27
|
+
toolchain-version: "^5.0.0"
|
|
25
28
|
tax_filter:
|
|
29
|
+
beta: true
|
|
26
30
|
assemblyscript:
|
|
27
31
|
package: "@shopify/extension-point-as-tax-filter"
|
|
28
|
-
sdk-version: "^
|
|
29
|
-
toolchain-version: "^
|
|
32
|
+
sdk-version: "^9.0.0"
|
|
33
|
+
toolchain-version: "^5.0.0"
|
|
34
|
+
payment_methods:
|
|
35
|
+
domain: 'checkout'
|
|
36
|
+
assemblyscript:
|
|
37
|
+
package: "@shopify/scripts-checkout-apis"
|
|
38
|
+
toolchain-version: "^5.0.0"
|
|
39
|
+
sdk-version: "^9.0.0"
|
|
40
|
+
shipping_methods:
|
|
41
|
+
domain: 'checkout'
|
|
42
|
+
assemblyscript:
|
|
43
|
+
package: "@shopify/scripts-checkout-apis"
|
|
44
|
+
sdk-version: "^9.0.0"
|
|
45
|
+
toolchain-version: "^5.0.0"
|
|
46
|
+
|
|
@@ -2,25 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
module Script
|
|
4
4
|
module Errors
|
|
5
|
-
class InvalidContextError < ScriptProjectError; end
|
|
6
5
|
class InvalidScriptNameError < ScriptProjectError; end
|
|
7
6
|
|
|
8
|
-
class InvalidConfigUiDefinitionError < ScriptProjectError
|
|
9
|
-
attr_reader :filename
|
|
10
|
-
def initialize(filename)
|
|
11
|
-
super()
|
|
12
|
-
@filename = filename
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
class MissingSpecifiedConfigUiDefinitionError < ScriptProjectError
|
|
17
|
-
attr_reader :filename
|
|
18
|
-
def initialize(filename)
|
|
19
|
-
super()
|
|
20
|
-
@filename = filename
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
7
|
class NoExistingAppsError < ScriptProjectError; end
|
|
25
8
|
class NoExistingOrganizationsError < ScriptProjectError; end
|
|
26
9
|
|
|
@@ -32,7 +15,6 @@ module Script
|
|
|
32
15
|
end
|
|
33
16
|
end
|
|
34
17
|
|
|
35
|
-
class ScriptProjectAlreadyExistsError < ScriptProjectError; end
|
|
36
18
|
class InvalidConfigProps < ScriptProjectError; end
|
|
37
19
|
|
|
38
20
|
class InvalidConfigYAMLError < ScriptProjectError
|
|
@@ -42,22 +24,5 @@ module Script
|
|
|
42
24
|
@config_file = config_file
|
|
43
25
|
end
|
|
44
26
|
end
|
|
45
|
-
|
|
46
|
-
class InvalidLanguageError < ScriptProjectError
|
|
47
|
-
attr_reader :language, :extension_point_type
|
|
48
|
-
def initialize(language, extension_point_type)
|
|
49
|
-
super()
|
|
50
|
-
@language = language
|
|
51
|
-
@extension_point_type = extension_point_type
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
class DeprecatedEPError < ScriptProjectError
|
|
56
|
-
attr_reader :ep
|
|
57
|
-
def initialize(ep)
|
|
58
|
-
super()
|
|
59
|
-
@ep = ep
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
27
|
end
|
|
63
28
|
end
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
module Script
|
|
4
4
|
module Forms
|
|
5
5
|
class Create < ShopifyCli::Form
|
|
6
|
-
flag_arguments :extension_point, :name, :language
|
|
6
|
+
flag_arguments :extension_point, :name, :language
|
|
7
7
|
|
|
8
8
|
def ask
|
|
9
9
|
self.name = valid_name
|
|
10
|
-
self.description ||= ask_description
|
|
11
10
|
self.extension_point ||= ask_extension_point
|
|
12
11
|
self.language = ask_language
|
|
13
12
|
end
|
|
@@ -17,7 +16,7 @@ module Script
|
|
|
17
16
|
def ask_extension_point
|
|
18
17
|
CLI::UI::Prompt.ask(
|
|
19
18
|
@ctx.message("script.forms.create.select_extension_point"),
|
|
20
|
-
options: Layers::Application::ExtensionPoints.
|
|
19
|
+
options: Layers::Application::ExtensionPoints.available_types
|
|
21
20
|
)
|
|
22
21
|
end
|
|
23
22
|
|
|
@@ -25,10 +24,6 @@ module Script
|
|
|
25
24
|
CLI::UI::Prompt.ask(@ctx.message("script.forms.create.script_name"))
|
|
26
25
|
end
|
|
27
26
|
|
|
28
|
-
def ask_description
|
|
29
|
-
CLI::UI::Prompt.ask(@ctx.message("script.forms.create.description"))
|
|
30
|
-
end
|
|
31
|
-
|
|
32
27
|
def valid_name
|
|
33
28
|
n = (name || ask_name).downcase.gsub(" ", "_")
|
|
34
29
|
return n if n.match?(/^[0-9A-Za-z_-]*$/)
|
|
@@ -36,13 +31,7 @@ module Script
|
|
|
36
31
|
end
|
|
37
32
|
|
|
38
33
|
def ask_language
|
|
39
|
-
if language
|
|
40
|
-
if Layers::Application::ExtensionPoints.supported_language?(type: extension_point, language: language)
|
|
41
|
-
return language.downcase
|
|
42
|
-
else
|
|
43
|
-
raise Errors::InvalidLanguageError.new(language, extension_point)
|
|
44
|
-
end
|
|
45
|
-
end
|
|
34
|
+
return language.downcase if language
|
|
46
35
|
|
|
47
36
|
all_languages = Layers::Application::ExtensionPoints.languages(type: extension_point)
|
|
48
37
|
return all_languages.first if all_languages.count == 1
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
mutation AppScriptUpdateOrCreate(
|
|
2
2
|
$extensionPointName: ExtensionPointName!,
|
|
3
3
|
$title: String,
|
|
4
|
-
$description: String,
|
|
5
4
|
$configUi: String,
|
|
6
5
|
$sourceCode: String,
|
|
7
6
|
$language: String,
|
|
8
7
|
$force: Boolean,
|
|
9
8
|
$schemaMajorVersion: String,
|
|
10
9
|
$schemaMinorVersion: String,
|
|
11
|
-
$useMsgpack: Boolean
|
|
10
|
+
$useMsgpack: Boolean,
|
|
11
|
+
$uuid: String
|
|
12
12
|
) {
|
|
13
13
|
appScriptUpdateOrCreate(
|
|
14
14
|
extensionPointName: $extensionPointName
|
|
15
15
|
title: $title
|
|
16
|
-
description: $description
|
|
17
16
|
configUi: $configUi
|
|
18
17
|
sourceCode: $sourceCode
|
|
19
18
|
language: $language
|
|
20
19
|
force: $force
|
|
21
20
|
schemaMajorVersion: $schemaMajorVersion
|
|
22
21
|
schemaMinorVersion: $schemaMinorVersion
|
|
23
|
-
useMsgpack: $useMsgpack
|
|
22
|
+
useMsgpack: $useMsgpack,
|
|
23
|
+
uuid: $uuid
|
|
24
24
|
) {
|
|
25
25
|
userErrors {
|
|
26
26
|
field
|
|
@@ -28,11 +28,11 @@ mutation AppScriptUpdateOrCreate(
|
|
|
28
28
|
tag
|
|
29
29
|
}
|
|
30
30
|
appScript {
|
|
31
|
+
uuid
|
|
31
32
|
appKey
|
|
32
33
|
configSchema
|
|
33
34
|
extensionPointName
|
|
34
35
|
title
|
|
35
|
-
description
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|