shopify-cli 1.8.0 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/PULL_REQUEST_TEMPLATE.md +1 -0
- data/.github/workflows/build.yml +28 -0
- data/.rubocop_todo.yml +15 -2
- data/CHANGELOG.md +24 -1
- data/Gemfile.lock +4 -4
- data/README.md +2 -1
- data/dev.yml +3 -0
- data/lib/graphql/extension_create.graphql +17 -2
- data/lib/project_types/extension/cli.rb +8 -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 +62 -28
- data/lib/project_types/extension/commands/tunnel.rb +3 -1
- data/lib/project_types/extension/extension_project.rb +16 -4
- data/lib/project_types/extension/extension_project_keys.rb +2 -1
- data/lib/project_types/extension/features/argo.rb +19 -44
- data/lib/project_types/extension/features/argo_runtime.rb +84 -0
- data/lib/project_types/extension/features/argo_serve.rb +80 -0
- data/lib/project_types/extension/features/argo_serve_options.rb +41 -0
- data/lib/project_types/extension/features/argo_setup.rb +1 -1
- data/lib/project_types/extension/messages/message_loading.rb +3 -1
- data/lib/project_types/extension/messages/messages.rb +5 -4
- data/lib/project_types/extension/models/npm_package.rb +14 -0
- data/lib/project_types/extension/models/registration.rb +1 -0
- data/lib/project_types/extension/models/specification.rb +3 -0
- data/lib/project_types/extension/models/specification_handlers/checkout_argo_extension.rb +18 -0
- data/lib/project_types/extension/models/specification_handlers/default.rb +49 -1
- data/lib/project_types/extension/models/version.rb +1 -1
- data/lib/project_types/extension/tasks/choose_next_available_port.rb +36 -0
- data/lib/project_types/extension/tasks/configure_features.rb +4 -0
- data/lib/project_types/extension/tasks/converters/registration_converter.rb +2 -0
- data/lib/project_types/extension/tasks/find_npm_packages.rb +106 -0
- data/lib/project_types/node/commands/generate.rb +0 -22
- data/lib/project_types/node/messages/messages.rb +4 -4
- data/lib/project_types/rails/messages/messages.rb +4 -4
- data/lib/project_types/script/cli.rb +7 -8
- data/lib/project_types/script/commands/create.rb +0 -7
- data/lib/project_types/script/commands/push.rb +3 -3
- data/lib/project_types/script/config/extension_points.yml +4 -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 +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/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 +5 -5
- data/lib/project_types/script/layers/domain/errors.rb +0 -2
- 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 +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 +15 -16
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +13 -7
- data/lib/project_types/script/layers/infrastructure/command_runner.rb +19 -0
- data/lib/project_types/script/layers/infrastructure/errors.rb +40 -11
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +12 -13
- data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +9 -10
- data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +6 -7
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +172 -0
- data/lib/project_types/script/layers/infrastructure/script_service.rb +21 -72
- data/lib/project_types/script/messages/messages.rb +20 -50
- data/lib/project_types/script/tasks/ensure_env.rb +85 -0
- data/lib/project_types/script/ui/error_handler.rb +32 -30
- data/lib/shopify-cli/context.rb +28 -0
- data/lib/shopify-cli/js_system.rb +2 -2
- data/lib/shopify-cli/messages/messages.rb +50 -45
- data/lib/shopify-cli/method_object.rb +4 -4
- data/lib/shopify-cli/oauth.rb +9 -3
- data/lib/shopify-cli/packager.rb +1 -1
- data/lib/shopify-cli/partners_api/organizations.rb +3 -3
- data/lib/shopify-cli/resolve_constant.rb +1 -1
- data/lib/shopify-cli/resources/env_file.rb +1 -1
- data/lib/shopify-cli/shopifolk.rb +1 -1
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +6 -4
- data/lib/shopify-cli/transform_data_structure.rb +1 -1
- data/lib/shopify-cli/tunnel.rb +22 -1
- 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 +16 -12
- 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/layers/infrastructure/config_ui_repository.rb +0 -46
- data/lib/project_types/script/script_project.rb +0 -64
@@ -9,7 +9,7 @@ module Extension
|
|
9
9
|
property! :last_user_interaction_at, accepts: Time
|
10
10
|
property :context, accepts: String
|
11
11
|
property :location, accepts: String
|
12
|
-
property :validation_errors, accepts: Models::ValidationError::IS_VALIDATION_ERROR_LIST, default: []
|
12
|
+
property :validation_errors, accepts: Models::ValidationError::IS_VALIDATION_ERROR_LIST, default: -> { [] }
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "shopify_cli"
|
3
|
+
require "socket"
|
4
|
+
|
5
|
+
module Extension
|
6
|
+
module Tasks
|
7
|
+
class ChooseNextAvailablePort
|
8
|
+
include ShopifyCli::MethodObject
|
9
|
+
|
10
|
+
property! :from
|
11
|
+
property! :to, default: -> { from + 10 }
|
12
|
+
property! :host, default: "localhost"
|
13
|
+
|
14
|
+
def call
|
15
|
+
available_port = port_range(from: from, to: to).find { |p| available?(host, p) }
|
16
|
+
raise ArgumentError, "Ports between #{from} and #{to} are unavailable" if available_port.nil?
|
17
|
+
available_port
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def port_range(from:, to:)
|
23
|
+
(from..to)
|
24
|
+
end
|
25
|
+
|
26
|
+
def available?(host, port)
|
27
|
+
Socket.tcp(host, port, connect_timeout: 1) do |socket|
|
28
|
+
socket.close
|
29
|
+
false
|
30
|
+
end
|
31
|
+
rescue Errno::ECONNREFUSED
|
32
|
+
true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -40,10 +40,14 @@ module Extension
|
|
40
40
|
admin: {
|
41
41
|
git_template: "https://github.com/Shopify/argo-admin-template.git",
|
42
42
|
renderer_package_name: "@shopify/argo-admin",
|
43
|
+
required_fields: [:shop, :api_key],
|
44
|
+
required_shop_beta_flags: [:argo_admin_beta],
|
45
|
+
cli_package_name: "@shopify/argo-admin-cli",
|
43
46
|
},
|
44
47
|
checkout: {
|
45
48
|
git_template: "https://github.com/Shopify/argo-checkout-template.git",
|
46
49
|
renderer_package_name: "@shopify/argo-checkout",
|
50
|
+
cli_package_name: "@shopify/argo-run",
|
47
51
|
},
|
48
52
|
}
|
49
53
|
end
|
@@ -6,6 +6,7 @@ module Extension
|
|
6
6
|
module Converters
|
7
7
|
module RegistrationConverter
|
8
8
|
ID_FIELD = "id"
|
9
|
+
UUID_FIELD = "uuid"
|
9
10
|
TYPE_FIELD = "type"
|
10
11
|
TITLE_FIELD = "title"
|
11
12
|
DRAFT_VERSION_FIELD = "draftVersion"
|
@@ -15,6 +16,7 @@ module Extension
|
|
15
16
|
|
16
17
|
Models::Registration.new(
|
17
18
|
id: hash[ID_FIELD].to_i,
|
19
|
+
uuid: hash[UUID_FIELD],
|
18
20
|
type: hash[TYPE_FIELD],
|
19
21
|
title: hash[TITLE_FIELD],
|
20
22
|
draft_version: VersionConverter.from_hash(context, hash[DRAFT_VERSION_FIELD])
|
@@ -0,0 +1,106 @@
|
|
1
|
+
module Extension
|
2
|
+
module Tasks
|
3
|
+
class FindNpmPackages
|
4
|
+
include ShopifyCli::MethodObject
|
5
|
+
|
6
|
+
property! :js_system, accepts: ShopifyCli::JsSystem
|
7
|
+
property! :production_only, accepts: [true, false], default: false, reader: :production_only?
|
8
|
+
|
9
|
+
def self.at_least_one_of(*package_names, **config)
|
10
|
+
new(**config).at_least_one_of(*package_names)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.all(*package_names, **config)
|
14
|
+
new(**config).all(*package_names)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.exactly_one_of(*package_names, **config)
|
18
|
+
new(**config).exactly_one_of(*package_names)
|
19
|
+
end
|
20
|
+
|
21
|
+
def all(*package_names)
|
22
|
+
call(*package_names) do |found_packages|
|
23
|
+
found_package_names = found_packages.map(&:name)
|
24
|
+
next found_packages if Set.new(found_package_names) == Set.new(package_names)
|
25
|
+
raise PackageResolutionFailed, format(
|
26
|
+
"Missing packages: %s",
|
27
|
+
(package_names - found_package_names).join(", ")
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def at_least_one_of(*package_names)
|
33
|
+
call(*package_names) do |found_packages|
|
34
|
+
found_package_names = found_packages.map(&:name)
|
35
|
+
next found_packages unless (found_package_names & package_names).empty?
|
36
|
+
raise PackageResolutionFailed, format(
|
37
|
+
"Expected at least one of the following packages: %s",
|
38
|
+
package_names.join(", ")
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def exactly_one_of(*package_names)
|
44
|
+
call(*package_names) do |found_packages|
|
45
|
+
case found_packages.count
|
46
|
+
when 0
|
47
|
+
raise PackageResolutionFailed, format(
|
48
|
+
"Expected one of the following packages: %s",
|
49
|
+
package_names.join(", ")
|
50
|
+
)
|
51
|
+
when 1
|
52
|
+
found_packages.first.tap do |found_package|
|
53
|
+
next found_package if package_names.include?(found_package.name)
|
54
|
+
raise PackageResolutionFailed, format(
|
55
|
+
"Expected the following package: %s",
|
56
|
+
found_package.name
|
57
|
+
)
|
58
|
+
end
|
59
|
+
else
|
60
|
+
raise PackageResolutionFailed, "Found more than one package"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def call(*package_names, &validate)
|
66
|
+
validate ||= ->(found_packages) { found_packages }
|
67
|
+
|
68
|
+
unless package_names.all? { |name| name.is_a?(String) }
|
69
|
+
raise ArgumentError, "Expected a list of package names"
|
70
|
+
end
|
71
|
+
|
72
|
+
ShopifyCli::Result
|
73
|
+
.call(&method(:list_packages))
|
74
|
+
.then(&method(:search_packages).curry[package_names])
|
75
|
+
.then(&method(:filter_duplicates))
|
76
|
+
.then(&validate)
|
77
|
+
end
|
78
|
+
|
79
|
+
def list_packages
|
80
|
+
result, error, status =
|
81
|
+
js_system.call(yarn: yarn_list, npm: npm_list, capture_response: true)
|
82
|
+
raise error unless status.success?
|
83
|
+
result
|
84
|
+
end
|
85
|
+
|
86
|
+
def yarn_list
|
87
|
+
production_only? ? %w[list --production] : %w[list]
|
88
|
+
end
|
89
|
+
|
90
|
+
def npm_list
|
91
|
+
production_only? ? %w[list --prod --depth=1] : %w[list --depth=1]
|
92
|
+
end
|
93
|
+
|
94
|
+
def search_packages(packages, package_list)
|
95
|
+
pattern = /(#{packages.join("|")})@(\d.*)$/
|
96
|
+
package_list.scan(pattern).map do |(name, version)|
|
97
|
+
Models::NpmPackage.new(name: name, version: version.strip)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def filter_duplicates(packages)
|
102
|
+
packages.reject { |p| p.version.match(/deduped/) }.uniq
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -4,10 +4,6 @@ require "shopify_cli"
|
|
4
4
|
module Node
|
5
5
|
module Commands
|
6
6
|
class Generate < ShopifyCli::Command
|
7
|
-
subcommand :Page, "page", Project.project_filepath("commands/generate/page")
|
8
|
-
subcommand :Billing, "billing", Project.project_filepath("commands/generate/billing")
|
9
|
-
subcommand :Webhook, "webhook", Project.project_filepath("commands/generate/webhook")
|
10
|
-
|
11
7
|
def call(*)
|
12
8
|
@ctx.puts(self.class.help)
|
13
9
|
end
|
@@ -19,24 +15,6 @@ module Node
|
|
19
15
|
def self.extended_help
|
20
16
|
help
|
21
17
|
end
|
22
|
-
|
23
|
-
def self.run_generate(script, name, ctx)
|
24
|
-
stat = ctx.system(script)
|
25
|
-
unless stat.success?
|
26
|
-
ctx.abort(response(stat.exitstatus, name, ctx))
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.response(code, name, ctx)
|
31
|
-
case code
|
32
|
-
when 1
|
33
|
-
ctx.message("node.generate.error.generic", name)
|
34
|
-
when 2
|
35
|
-
ctx.message("node.generate.error.name_exists", name)
|
36
|
-
else
|
37
|
-
ctx.message("node.error.generic")
|
38
|
-
end
|
39
|
-
end
|
40
18
|
end
|
41
19
|
end
|
42
20
|
end
|
@@ -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",
|
@@ -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",
|
@@ -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,13 +24,15 @@ 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
|
@@ -45,6 +43,7 @@ module Script
|
|
45
43
|
autoload :PushPackage, Project.project_filepath("layers/domain/push_package")
|
46
44
|
autoload :Metadata, Project.project_filepath("layers/domain/metadata")
|
47
45
|
autoload :ExtensionPoint, Project.project_filepath("layers/domain/extension_point")
|
46
|
+
autoload :ScriptProject, Project.project_filepath("layers/domain/script_project")
|
48
47
|
end
|
49
48
|
|
50
49
|
module Infrastructure
|
@@ -55,14 +54,15 @@ module Script
|
|
55
54
|
Project.project_filepath("layers/infrastructure/assemblyscript_project_creator")
|
56
55
|
autoload :AssemblyScriptTaskRunner, Project.project_filepath("layers/infrastructure/assemblyscript_task_runner")
|
57
56
|
autoload :AssemblyScriptTsConfig, Project.project_filepath("layers/infrastructure/assemblyscript_tsconfig")
|
57
|
+
autoload :CommandRunner, Project.project_filepath("layers/infrastructure/command_runner")
|
58
58
|
autoload :RustProjectCreator,
|
59
59
|
Project.project_filepath("layers/infrastructure/rust_project_creator.rb")
|
60
60
|
autoload :RustTaskRunner, Project.project_filepath("layers/infrastructure/rust_task_runner")
|
61
61
|
|
62
|
-
autoload :ConfigUiRepository, Project.project_filepath("layers/infrastructure/config_ui_repository")
|
63
62
|
autoload :PushPackageRepository, Project.project_filepath("layers/infrastructure/push_package_repository")
|
64
63
|
autoload :ExtensionPointRepository, Project.project_filepath("layers/infrastructure/extension_point_repository")
|
65
64
|
autoload :ProjectCreator, Project.project_filepath("layers/infrastructure/project_creator")
|
65
|
+
autoload :ScriptProjectRepository, Project.project_filepath("layers/infrastructure/script_project_repository")
|
66
66
|
autoload :ScriptService, Project.project_filepath("layers/infrastructure/script_service")
|
67
67
|
autoload :TaskRunner, Project.project_filepath("layers/infrastructure/task_runner")
|
68
68
|
end
|
@@ -74,7 +74,6 @@ module Script
|
|
74
74
|
autoload :StrictSpinner, Project.project_filepath("ui/strict_spinner")
|
75
75
|
end
|
76
76
|
|
77
|
-
autoload :ScriptProject, Project.project_filepath("script_project")
|
78
77
|
autoload :Errors, Project.project_filepath("errors")
|
79
78
|
|
80
79
|
class ScriptProjectError < StandardError; end
|
@@ -5,7 +5,6 @@ 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 }
|
@@ -13,8 +12,6 @@ module Script
|
|
13
12
|
end
|
14
13
|
|
15
14
|
def call(args, _name)
|
16
|
-
cur_dir = @ctx.root
|
17
|
-
|
18
15
|
form = Forms::Create.ask(@ctx, args, options.flags)
|
19
16
|
return @ctx.puts(self.class.help) if form.nil?
|
20
17
|
|
@@ -27,14 +24,10 @@ module Script
|
|
27
24
|
language: form.language,
|
28
25
|
script_name: form.name,
|
29
26
|
extension_point_type: form.extension_point,
|
30
|
-
description: form.description,
|
31
27
|
no_config_ui: options.flags.key?(:no_config_ui)
|
32
28
|
)
|
33
29
|
@ctx.puts(@ctx.message("script.create.change_directory_notice", project.script_name))
|
34
|
-
rescue Script::Errors::ScriptProjectAlreadyExistsError => e
|
35
|
-
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.create.error.operation_failed"))
|
36
30
|
rescue StandardError => e
|
37
|
-
ScriptProject.cleanup(ctx: @ctx, script_name: form.name, root_dir: cur_dir) if form
|
38
31
|
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.create.error.operation_failed"))
|
39
32
|
end
|
40
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
|
|
@@ -5,11 +5,13 @@ discount:
|
|
5
5
|
sdk-version: "^9.0.0"
|
6
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
11
|
sdk-version: "^9.0.0"
|
11
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
17
|
sdk-version: "^9.0.0"
|
@@ -18,11 +20,13 @@ payment_filter:
|
|
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
26
|
sdk-version: "^9.0.0"
|
24
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
32
|
sdk-version: "^9.0.0"
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
module Script
|
4
4
|
module Errors
|
5
|
-
class InvalidContextError < ScriptProjectError; end
|
6
5
|
class InvalidScriptNameError < ScriptProjectError; end
|
7
6
|
|
8
7
|
class NoExistingAppsError < ScriptProjectError; end
|
@@ -16,7 +15,6 @@ module Script
|
|
16
15
|
end
|
17
16
|
end
|
18
17
|
|
19
|
-
class ScriptProjectAlreadyExistsError < ScriptProjectError; end
|
20
18
|
class InvalidConfigProps < ScriptProjectError; end
|
21
19
|
|
22
20
|
class InvalidConfigYAMLError < ScriptProjectError
|
@@ -26,22 +24,5 @@ module Script
|
|
26
24
|
@config_file = config_file
|
27
25
|
end
|
28
26
|
end
|
29
|
-
|
30
|
-
class InvalidLanguageError < ScriptProjectError
|
31
|
-
attr_reader :language, :extension_point_type
|
32
|
-
def initialize(language, extension_point_type)
|
33
|
-
super()
|
34
|
-
@language = language
|
35
|
-
@extension_point_type = extension_point_type
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
class DeprecatedEPError < ScriptProjectError
|
40
|
-
attr_reader :ep
|
41
|
-
def initialize(ep)
|
42
|
-
super()
|
43
|
-
@ep = ep
|
44
|
-
end
|
45
|
-
end
|
46
27
|
end
|
47
28
|
end
|