shopify-cli 1.5.0 → 1.6.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/.travis.yml +1 -0
- data/CHANGELOG.md +9 -0
- data/README.md +39 -7
- data/Rakefile +2 -0
- data/dev.yml +2 -2
- data/docs/_config.yml +1 -18
- data/docs/app/node/commands/index.md +2 -80
- data/docs/app/node/index.md +2 -33
- data/docs/app/rails/commands/index.md +2 -78
- data/docs/app/rails/index.md +2 -34
- data/docs/core/index.md +2 -84
- data/docs/getting-started/index.md +2 -25
- data/docs/getting-started/install/index.md +1 -118
- data/docs/getting-started/migrate/index.md +2 -94
- data/docs/getting-started/uninstall/index.md +2 -35
- data/docs/getting-started/upgrade/index.md +2 -39
- data/docs/help/start-app/index.md +2 -4
- data/docs/index.md +2 -24
- data/install.sh +1 -1
- data/lib/project_types/extension/cli.rb +19 -10
- data/lib/project_types/extension/commands/extension_command.rb +2 -2
- data/lib/project_types/extension/features/argo.rb +117 -0
- data/lib/project_types/extension/forms/create.rb +2 -2
- data/lib/project_types/extension/models/specification.rb +35 -0
- data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +19 -0
- data/lib/project_types/extension/models/specification_handlers/default.rb +67 -0
- data/lib/project_types/extension/models/specifications.rb +77 -0
- data/lib/project_types/extension/tasks/configure_features.rb +52 -0
- data/lib/project_types/extension/tasks/fetch_specifications.rb +38 -0
- data/lib/project_types/node/commands/create.rb +3 -1
- data/lib/project_types/node/commands/generate.rb +2 -11
- data/lib/project_types/node/messages/messages.rb +9 -44
- data/lib/project_types/rails/commands/create.rb +8 -9
- data/lib/project_types/rails/forms/create.rb +1 -1
- data/lib/project_types/rails/gem.rb +1 -1
- data/lib/project_types/rails/messages/messages.rb +1 -1
- data/lib/project_types/script/cli.rb +7 -4
- data/lib/project_types/script/commands/create.rb +6 -4
- data/lib/project_types/script/commands/push.rb +5 -13
- data/lib/project_types/script/config/extension_points.yml +9 -5
- data/lib/project_types/script/errors.rb +17 -0
- data/lib/project_types/script/forms/create.rb +26 -2
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +10 -1
- data/lib/project_types/script/layers/application/build_script.rb +9 -4
- data/lib/project_types/script/layers/application/create_script.rb +12 -10
- data/lib/project_types/script/layers/application/extension_points.rb +24 -0
- data/lib/project_types/script/layers/application/push_script.rb +18 -16
- data/lib/project_types/script/layers/domain/errors.rb +4 -0
- data/lib/project_types/script/layers/domain/extension_point.rb +62 -6
- data/lib/project_types/script/layers/domain/metadata.rb +55 -0
- data/lib/project_types/script/layers/domain/push_package.rb +25 -6
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +6 -6
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +16 -6
- data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +10 -4
- data/lib/project_types/script/layers/infrastructure/project_creator.rb +2 -1
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +25 -13
- data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +72 -0
- data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +59 -0
- data/lib/project_types/script/layers/infrastructure/script_service.rb +7 -1
- data/lib/project_types/script/layers/infrastructure/task_runner.rb +4 -3
- data/lib/project_types/script/messages/messages.rb +39 -8
- data/lib/project_types/script/script_project.rb +25 -16
- data/lib/project_types/script/ui/error_handler.rb +34 -1
- data/lib/project_types/theme/cli.rb +40 -0
- data/lib/project_types/theme/commands/connect.rb +54 -0
- data/lib/project_types/theme/commands/create.rb +48 -0
- data/lib/project_types/theme/commands/deploy.rb +38 -0
- data/lib/project_types/theme/commands/generate.rb +20 -0
- data/lib/project_types/theme/commands/generate/env.rb +79 -0
- data/lib/project_types/theme/commands/push.rb +55 -0
- data/lib/project_types/theme/commands/serve.rb +31 -0
- data/lib/project_types/theme/forms/connect.rb +34 -0
- data/lib/project_types/theme/forms/create.rb +22 -0
- data/lib/project_types/theme/messages/messages.rb +147 -0
- data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +78 -0
- data/lib/project_types/theme/themekit.rb +113 -0
- data/lib/shopify-cli/admin_api.rb +42 -2
- data/lib/shopify-cli/api.rb +27 -24
- data/lib/shopify-cli/commands/system.rb +1 -1
- data/lib/shopify-cli/context.rb +23 -2
- data/lib/shopify-cli/feature.rb +0 -2
- data/lib/shopify-cli/http_request.rb +20 -8
- data/lib/shopify-cli/messages/messages.rb +6 -3
- data/lib/shopify-cli/method_object.rb +104 -0
- data/lib/shopify-cli/partners_api.rb +8 -2
- data/lib/shopify-cli/project_type.rb +1 -1
- data/lib/shopify-cli/resolve_constant.rb +25 -0
- data/lib/shopify-cli/result.rb +432 -0
- data/lib/shopify-cli/shopifolk.rb +3 -2
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +6 -5
- data/lib/shopify-cli/tunnel.rb +7 -1
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +4 -1
- data/shopify.fish +1 -1
- data/shopify.sh +1 -1
- data/vendor/deps/cli-kit/REVISION +1 -1
- data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +2 -2
- data/vendor/deps/cli-kit/lib/cli/kit/system.rb +3 -3
- data/vendor/deps/cli-ui/REVISION +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui.rb +26 -22
- data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +4 -6
- data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +3 -3
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +8 -9
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +1 -0
- data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +15 -3
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +4 -11
- data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +3 -5
- data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +10 -10
- data/vendor/deps/cli-ui/lib/cli/ui/version.rb +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +56 -0
- data/vendor/deps/webrick/.gitignore +9 -0
- data/vendor/deps/webrick/Gemfile +3 -0
- data/vendor/deps/webrick/LICENSE.txt +22 -0
- data/vendor/deps/webrick/README.md +61 -0
- data/vendor/deps/webrick/Rakefile +10 -0
- data/vendor/deps/webrick/lib/webrick.rb +232 -0
- data/vendor/deps/webrick/lib/webrick/accesslog.rb +157 -0
- data/vendor/deps/webrick/lib/webrick/cgi.rb +313 -0
- data/vendor/deps/webrick/lib/webrick/compat.rb +36 -0
- data/vendor/deps/webrick/lib/webrick/config.rb +158 -0
- data/vendor/deps/webrick/lib/webrick/cookie.rb +172 -0
- data/vendor/deps/webrick/lib/webrick/htmlutils.rb +30 -0
- data/vendor/deps/webrick/lib/webrick/httpauth.rb +96 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +117 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +116 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +395 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +132 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +97 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +158 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +53 -0
- data/vendor/deps/webrick/lib/webrick/httpproxy.rb +354 -0
- data/vendor/deps/webrick/lib/webrick/httprequest.rb +636 -0
- data/vendor/deps/webrick/lib/webrick/httpresponse.rb +564 -0
- data/vendor/deps/webrick/lib/webrick/https.rb +152 -0
- data/vendor/deps/webrick/lib/webrick/httpserver.rb +294 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet.rb +23 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +152 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +47 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +126 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +88 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +552 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +47 -0
- data/vendor/deps/webrick/lib/webrick/httpstatus.rb +194 -0
- data/vendor/deps/webrick/lib/webrick/httputils.rb +512 -0
- data/vendor/deps/webrick/lib/webrick/httpversion.rb +76 -0
- data/vendor/deps/webrick/lib/webrick/log.rb +156 -0
- data/vendor/deps/webrick/lib/webrick/server.rb +381 -0
- data/vendor/deps/webrick/lib/webrick/ssl.rb +215 -0
- data/vendor/deps/webrick/lib/webrick/utils.rb +265 -0
- data/vendor/deps/webrick/lib/webrick/version.rb +18 -0
- data/vendor/deps/webrick/webrick.gemspec +74 -0
- metadata +70 -26
- data/docs/Gemfile +0 -5
- data/docs/Gemfile.lock +0 -258
- data/docs/_data/nav.yml +0 -35
- data/docs/_includes/footer.html +0 -15
- data/docs/_includes/head.html +0 -19
- data/docs/_includes/sidebar_nav.html +0 -22
- data/docs/_includes/toc.html +0 -112
- data/docs/_layouts/default.html +0 -79
- data/docs/css/docs.css +0 -157
- data/docs/images/header.png +0 -0
- data/docs/installing-ruby.md +0 -28
- data/lib/project_types/extension/features/argo/admin.rb +0 -20
- data/lib/project_types/extension/features/argo/base.rb +0 -129
- data/lib/project_types/extension/features/argo/checkout.rb +0 -20
- data/lib/project_types/extension/models/type.rb +0 -81
- data/lib/project_types/extension/models/types/checkout_post_purchase.rb +0 -23
- data/lib/project_types/extension/models/types/product_subscription.rb +0 -24
- data/lib/project_types/node/commands/generate/billing.rb +0 -39
- data/lib/project_types/node/commands/generate/page.rb +0 -59
- data/lib/project_types/node/commands/generate/webhook.rb +0 -37
- data/lib/project_types/script/layers/domain/script.rb +0 -18
- data/lib/project_types/script/layers/infrastructure/script_repository.rb +0 -47
- data/lib/project_types/script/templates/ts/as-pect.config.js +0 -27
- data/lib/project_types/script/templates/ts/as-pect.d.ts +0 -1
@@ -83,52 +83,17 @@ module Node
|
|
83
83
|
|
84
84
|
generate: {
|
85
85
|
help: <<~HELP,
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
{{bold:Examples:}}
|
91
|
-
{{cyan:%s generate webhook PRODUCTS_CREATE}}
|
92
|
-
Generate and register a new webhook that will be called every time a new product is created on your store.
|
93
|
-
EXAMPLES
|
94
|
-
|
95
|
-
error: {
|
96
|
-
name_exists: "%s already exists!",
|
97
|
-
generic: "Error generating %s",
|
98
|
-
},
|
99
|
-
|
100
|
-
billing: {
|
101
|
-
help: <<~HELP,
|
102
|
-
Enable charging for your app. This command generates the necessary code to call Shopify’s billing API.
|
103
|
-
Usage: {{command:%s generate billing [ one-time-billing | recurring-billing ]}}
|
104
|
-
HELP
|
105
|
-
type_select: "How would you like to charge for your app?",
|
106
|
-
generating: "Generating %s code ...",
|
107
|
-
generated: "{{green:%s}} generated in server/server.js",
|
108
|
-
},
|
86
|
+
{{red:The {{command:generate}} command is no longer supported.}}
|
87
|
+
You can complete any tasks previously supported by {{command:generate}} with these guides:
|
88
|
+
{{green:page}}
|
89
|
+
Create a page with Polaris design components: {{green:https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react/build-your-user-interface-with-polaris}}
|
109
90
|
|
110
|
-
|
111
|
-
|
112
|
-
Generate a new page in your app with the specified name. New files are generated inside the project’s “/pages” directory.
|
113
|
-
Usage: {{command:%s generate page <pagename>}}
|
114
|
-
HELP
|
115
|
-
error: {
|
116
|
-
invalid_page_type: "Invalid page type.",
|
117
|
-
},
|
118
|
-
type_select: "Which template would you like to use?",
|
119
|
-
generating: "Generating %s page...",
|
120
|
-
generated: "{{green: %s}} generated in pages/%s",
|
121
|
-
},
|
91
|
+
{{green:webhook}}
|
92
|
+
Register and process webhooks: {{green:https://github.com/Shopify/shopify-node-api/blob/main/docs/usage/webhooks.md}}
|
122
93
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
Usage: {{command:%s generate webhook <type>}}
|
127
|
-
HELP
|
128
|
-
type_select: "What type of webhook would you like to create?",
|
129
|
-
generating: "Generating webhook: %s",
|
130
|
-
generated: "{{green:%s}} generated in server/server.js",
|
131
|
-
},
|
94
|
+
{{green:billing}}
|
95
|
+
Create and manage app billing models: {{green:https://shopify.dev/tutorials/bill-for-your-app-using-graphql-admin-api}}
|
96
|
+
HELP
|
132
97
|
},
|
133
98
|
|
134
99
|
open: {
|
@@ -27,8 +27,9 @@ module Rails
|
|
27
27
|
form = Forms::Create.ask(@ctx, args, options.flags)
|
28
28
|
return @ctx.puts(self.class.help) if form.nil?
|
29
29
|
|
30
|
+
ruby_version = Ruby.version(@ctx)
|
30
31
|
@ctx.abort(@ctx.message('rails.create.error.invalid_ruby_version')) unless
|
31
|
-
|
32
|
+
ruby_version.satisfies?('~>2.5') || ruby_version.satisfies?('~>3.0.0')
|
32
33
|
|
33
34
|
check_node
|
34
35
|
check_yarn
|
@@ -59,7 +60,9 @@ module Rails
|
|
59
60
|
|
60
61
|
@ctx.puts(@ctx.message('apps.create.info.created', form.title, partners_url))
|
61
62
|
@ctx.puts(@ctx.message('apps.create.info.serve', form.name, ShopifyCli::TOOL_NAME))
|
62
|
-
|
63
|
+
unless ShopifyCli::Shopifolk.acting_as_shopify_organization?
|
64
|
+
@ctx.puts(@ctx.message('apps.create.info.install', partners_url, form.title))
|
65
|
+
end
|
63
66
|
end
|
64
67
|
|
65
68
|
def self.help
|
@@ -110,7 +113,7 @@ module Rails
|
|
110
113
|
end
|
111
114
|
|
112
115
|
def build(name, db)
|
113
|
-
@ctx.abort(@ctx.message('rails.create.error.install_failure', 'rails')) unless install_gem('rails')
|
116
|
+
@ctx.abort(@ctx.message('rails.create.error.install_failure', 'rails')) unless install_gem('rails', '<6.1')
|
114
117
|
@ctx.abort(@ctx.message('rails.create.error.install_failure', 'bundler ~>2.0')) unless
|
115
118
|
install_gem('bundler', '~>2.0')
|
116
119
|
|
@@ -133,18 +136,14 @@ module Rails
|
|
133
136
|
|
134
137
|
@ctx.puts(@ctx.message('rails.create.adding_shopify_gem'))
|
135
138
|
File.open(File.join(@ctx.root, 'Gemfile'), 'a') do |f|
|
136
|
-
f.puts "\ngem 'shopify_app', '>=
|
139
|
+
f.puts "\ngem 'shopify_app', '>=17.0.3'"
|
137
140
|
end
|
138
141
|
CLI::UI::Frame.open(@ctx.message('rails.create.running_bundle_install')) do
|
139
142
|
syscall(%w(bundle install))
|
140
143
|
end
|
141
144
|
|
142
145
|
CLI::UI::Frame.open(@ctx.message('rails.create.running_generator')) do
|
143
|
-
|
144
|
-
syscall(%w(spring stop))
|
145
|
-
rescue
|
146
|
-
end
|
147
|
-
syscall(%w(rails generate shopify_app))
|
146
|
+
syscall(%w(rails generate shopify_app --new-shopify-cli-app))
|
148
147
|
end
|
149
148
|
|
150
149
|
CLI::UI::Frame.open(@ctx.message('rails.create.running_migrations')) do
|
@@ -48,7 +48,7 @@ module Rails
|
|
48
48
|
def ask_db
|
49
49
|
if db.nil?
|
50
50
|
return 'sqlite3' unless CLI::UI::Prompt.confirm(ctx.message('rails.forms.create.db.want_select'),
|
51
|
-
|
51
|
+
default: false)
|
52
52
|
@db = CLI::UI::Prompt.ask(ctx.message('rails.forms.create.db.select')) do |handler|
|
53
53
|
VALID_DB_TYPES.each do |db_type|
|
54
54
|
handler.option(ctx.message("rails.forms.create.db.select_#{db_type}")) { db_type }
|
@@ -99,7 +99,7 @@ module Rails
|
|
99
99
|
# there was a specific version given during new(), so
|
100
100
|
# check version of gem found to determine match
|
101
101
|
require 'semantic/semantic'
|
102
|
-
found_version, _ = path.match(%r{/#{Regexp.quote(name)}-(
|
102
|
+
found_version, _ = path.match(%r{/#{Regexp.quote(name)}-(\d\.\d\.\d)})&.captures
|
103
103
|
found_version.nil? ? false : Semantic::Version.new(found_version).satisfies?(version)
|
104
104
|
else
|
105
105
|
# otherwise ignore the actual version number,
|
@@ -39,7 +39,7 @@ module Rails
|
|
39
39
|
|
40
40
|
error: {
|
41
41
|
invalid_ruby_version: <<~MSG,
|
42
|
-
This project requires a
|
42
|
+
This project requires a Ruby version ~> 2.5 or Ruby 3.0
|
43
43
|
See {{underline:https://github.com/Shopify/shopify-app-cli/blob/master/docs/installing-ruby.md}}
|
44
44
|
for our recommended method of installing ruby.
|
45
45
|
MSG
|
@@ -42,22 +42,25 @@ module Script
|
|
42
42
|
module Domain
|
43
43
|
autoload :Errors, Project.project_filepath('layers/domain/errors')
|
44
44
|
autoload :PushPackage, Project.project_filepath('layers/domain/push_package')
|
45
|
+
autoload :Metadata, Project.project_filepath('layers/domain/metadata')
|
45
46
|
autoload :ExtensionPoint, Project.project_filepath('layers/domain/extension_point')
|
46
|
-
autoload :Script, Project.project_filepath('layers/domain/script')
|
47
47
|
end
|
48
48
|
|
49
49
|
module Infrastructure
|
50
50
|
autoload :Errors, Project.project_filepath('layers/infrastructure/errors')
|
51
51
|
autoload :AssemblyScriptDependencyManager,
|
52
|
-
|
52
|
+
Project.project_filepath('layers/infrastructure/assemblyscript_dependency_manager')
|
53
53
|
autoload :AssemblyScriptProjectCreator,
|
54
|
-
|
54
|
+
Project.project_filepath('layers/infrastructure/assemblyscript_project_creator')
|
55
55
|
autoload :AssemblyScriptTaskRunner, Project.project_filepath('layers/infrastructure/assemblyscript_task_runner')
|
56
56
|
autoload :AssemblyScriptTsConfig, Project.project_filepath('layers/infrastructure/assemblyscript_tsconfig')
|
57
|
+
autoload :RustProjectCreator,
|
58
|
+
Project.project_filepath('layers/infrastructure/rust_project_creator.rb')
|
59
|
+
autoload :RustTaskRunner, Project.project_filepath('layers/infrastructure/rust_task_runner')
|
60
|
+
|
57
61
|
autoload :PushPackageRepository, Project.project_filepath('layers/infrastructure/push_package_repository')
|
58
62
|
autoload :ExtensionPointRepository, Project.project_filepath('layers/infrastructure/extension_point_repository')
|
59
63
|
autoload :ProjectCreator, Project.project_filepath('layers/infrastructure/project_creator')
|
60
|
-
autoload :ScriptRepository, Project.project_filepath('layers/infrastructure/script_repository')
|
61
64
|
autoload :ScriptService, Project.project_filepath('layers/infrastructure/script_service')
|
62
65
|
autoload :TaskRunner, Project.project_filepath('layers/infrastructure/task_runner')
|
63
66
|
end
|
@@ -5,25 +5,27 @@ 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 }
|
8
9
|
parser.on('--extension_point=EP_NAME') { |ep_name| flags[:extension_point] = ep_name }
|
10
|
+
parser.on('--language=LANGUAGE') { |language| flags[:language] = language }
|
9
11
|
end
|
10
12
|
|
11
13
|
def call(args, _name)
|
12
|
-
language = 'ts'
|
13
14
|
cur_dir = @ctx.root
|
14
15
|
|
15
16
|
form = Forms::Create.ask(@ctx, args, options.flags)
|
16
17
|
return @ctx.puts(self.class.help) if form.nil?
|
17
18
|
|
18
|
-
unless !form.name.empty? && form.extension_point &&
|
19
|
+
unless !form.name.empty? && form.extension_point && form.language
|
19
20
|
return @ctx.puts(self.class.help)
|
20
21
|
end
|
21
22
|
|
22
23
|
project = Layers::Application::CreateScript.call(
|
23
24
|
ctx: @ctx,
|
24
|
-
language: language,
|
25
|
+
language: form.language,
|
25
26
|
script_name: form.name,
|
26
|
-
extension_point_type: form.extension_point
|
27
|
+
extension_point_type: form.extension_point,
|
28
|
+
description: form.description
|
27
29
|
)
|
28
30
|
@ctx.puts(@ctx.message('script.create.change_directory_notice', project.script_name))
|
29
31
|
rescue Script::Errors::ScriptProjectAlreadyExistsError => e
|
@@ -9,19 +9,11 @@ module Script
|
|
9
9
|
|
10
10
|
def call(_args, _name)
|
11
11
|
ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop])
|
12
|
-
|
13
|
-
api_key =
|
14
|
-
return @ctx.puts(self.class.help) unless api_key
|
15
|
-
|
16
|
-
Layers::Application::PushScript.call(
|
17
|
-
ctx: @ctx,
|
18
|
-
language: project.language,
|
19
|
-
extension_point_type: project.extension_point_type,
|
20
|
-
script_name: project.script_name,
|
21
|
-
source_file: project.source_file,
|
22
|
-
api_key: api_key,
|
23
|
-
force: options.flags.key?(:force)
|
24
|
-
)
|
12
|
+
|
13
|
+
api_key = ScriptProject.current.api_key
|
14
|
+
return @ctx.puts(self.class.help) unless api_key
|
15
|
+
|
16
|
+
Layers::Application::PushScript.call(ctx: @ctx, force: options.flags.key?(:force))
|
25
17
|
@ctx.puts(@ctx.message('script.push.script_pushed', api_key: api_key))
|
26
18
|
rescue StandardError => e
|
27
19
|
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.push.error.operation_failed'))
|
@@ -1,25 +1,29 @@
|
|
1
1
|
discount:
|
2
|
+
deprecated: true
|
2
3
|
assemblyscript:
|
3
4
|
package: "@shopify/extension-point-as-discount"
|
4
5
|
sdk-version: "^7.0.0"
|
5
|
-
toolchain-version: "^
|
6
|
+
toolchain-version: "^4.0.0"
|
6
7
|
unit_limit_per_order:
|
7
8
|
assemblyscript:
|
8
9
|
package: "@shopify/extension-point-as-unit-limit-per-order"
|
9
10
|
sdk-version: "^7.0.0"
|
10
|
-
toolchain-version: "^
|
11
|
+
toolchain-version: "^4.0.0"
|
11
12
|
payment_filter:
|
12
13
|
assemblyscript:
|
13
14
|
package: "@shopify/extension-point-as-payment-filter"
|
14
15
|
sdk-version: "^7.0.0"
|
15
|
-
toolchain-version: "^
|
16
|
+
toolchain-version: "^4.0.0"
|
17
|
+
rust:
|
18
|
+
beta: true
|
19
|
+
package: "https://github.com/Shopify/scripts-apis-rs"
|
16
20
|
shipping_filter:
|
17
21
|
assemblyscript:
|
18
22
|
package: "@shopify/extension-point-as-shipping-filter"
|
19
23
|
sdk-version: "^7.0.0"
|
20
|
-
toolchain-version: "^
|
24
|
+
toolchain-version: "^4.0.0"
|
21
25
|
tax_filter:
|
22
26
|
assemblyscript:
|
23
27
|
package: "@shopify/extension-point-as-tax-filter"
|
24
28
|
sdk-version: "^7.0.0"
|
25
|
-
toolchain-version: "^
|
29
|
+
toolchain-version: "^4.0.0"
|
@@ -25,5 +25,22 @@ module Script
|
|
25
25
|
@config_file = config_file
|
26
26
|
end
|
27
27
|
end
|
28
|
+
|
29
|
+
class InvalidLanguageError < ScriptProjectError
|
30
|
+
attr_reader :language, :extension_point_type
|
31
|
+
def initialize(language, extension_point_type)
|
32
|
+
super()
|
33
|
+
@language = language
|
34
|
+
@extension_point_type = extension_point_type
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class DeprecatedEPError < ScriptProjectError
|
39
|
+
attr_reader :ep
|
40
|
+
def initialize(ep)
|
41
|
+
super()
|
42
|
+
@ep = ep
|
43
|
+
end
|
44
|
+
end
|
28
45
|
end
|
29
46
|
end
|
@@ -3,11 +3,13 @@
|
|
3
3
|
module Script
|
4
4
|
module Forms
|
5
5
|
class Create < ShopifyCli::Form
|
6
|
-
flag_arguments :extension_point, :name
|
6
|
+
flag_arguments :extension_point, :name, :language, :description
|
7
7
|
|
8
8
|
def ask
|
9
9
|
self.name = valid_name
|
10
|
+
self.description ||= ask_description
|
10
11
|
self.extension_point ||= ask_extension_point
|
12
|
+
self.language = ask_language
|
11
13
|
end
|
12
14
|
|
13
15
|
private
|
@@ -15,7 +17,7 @@ module Script
|
|
15
17
|
def ask_extension_point
|
16
18
|
CLI::UI::Prompt.ask(
|
17
19
|
@ctx.message('script.forms.create.select_extension_point'),
|
18
|
-
options:
|
20
|
+
options: Layers::Application::ExtensionPoints.non_deprecated_types
|
19
21
|
)
|
20
22
|
end
|
21
23
|
|
@@ -23,11 +25,33 @@ module Script
|
|
23
25
|
CLI::UI::Prompt.ask(@ctx.message('script.forms.create.script_name'))
|
24
26
|
end
|
25
27
|
|
28
|
+
def ask_description
|
29
|
+
CLI::UI::Prompt.ask(@ctx.message('script.forms.create.description'))
|
30
|
+
end
|
31
|
+
|
26
32
|
def valid_name
|
27
33
|
n = (name || ask_name).downcase.gsub(' ', '_')
|
28
34
|
return n if n.match?(/^[0-9A-Za-z_-]*$/)
|
29
35
|
raise Errors::InvalidScriptNameError
|
30
36
|
end
|
37
|
+
|
38
|
+
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
|
46
|
+
|
47
|
+
all_languages = Layers::Application::ExtensionPoints.languages(type: extension_point)
|
48
|
+
return all_languages.first if all_languages.count == 1
|
49
|
+
|
50
|
+
CLI::UI::Prompt.ask(
|
51
|
+
ctx.message('script.forms.create.select_language'),
|
52
|
+
options: all_languages
|
53
|
+
)
|
54
|
+
end
|
31
55
|
end
|
32
56
|
end
|
33
57
|
end
|
@@ -1,16 +1,24 @@
|
|
1
1
|
mutation AppScriptUpdateOrCreate(
|
2
2
|
$extensionPointName: ExtensionPointName!,
|
3
3
|
$title: String,
|
4
|
+
$description: String,
|
4
5
|
$sourceCode: String,
|
5
6
|
$language: String,
|
6
|
-
$force: Boolean
|
7
|
+
$force: Boolean,
|
8
|
+
$schemaMajorVersion: String,
|
9
|
+
$schemaMinorVersion: String,
|
10
|
+
$useMsgpack: Boolean
|
7
11
|
) {
|
8
12
|
appScriptUpdateOrCreate(
|
9
13
|
extensionPointName: $extensionPointName
|
10
14
|
title: $title
|
15
|
+
description: $description
|
11
16
|
sourceCode: $sourceCode
|
12
17
|
language: $language
|
13
18
|
force: $force
|
19
|
+
schemaMajorVersion: $schemaMajorVersion
|
20
|
+
schemaMinorVersion: $schemaMinorVersion
|
21
|
+
useMsgpack: $useMsgpack
|
14
22
|
) {
|
15
23
|
userErrors {
|
16
24
|
field
|
@@ -22,6 +30,7 @@ mutation AppScriptUpdateOrCreate(
|
|
22
30
|
configSchema
|
23
31
|
extensionPointName
|
24
32
|
title
|
33
|
+
description
|
25
34
|
}
|
26
35
|
}
|
27
36
|
}
|
@@ -5,13 +5,18 @@ module Script
|
|
5
5
|
module Application
|
6
6
|
class BuildScript
|
7
7
|
class << self
|
8
|
-
def call(ctx:, task_runner:,
|
8
|
+
def call(ctx:, task_runner:, script_name:, description:, extension_point_type:)
|
9
9
|
CLI::UI::Frame.open(ctx.message('script.application.building')) do
|
10
10
|
begin
|
11
11
|
UI::StrictSpinner.spin(ctx.message('script.application.building_script')) do |spinner|
|
12
|
-
Infrastructure::PushPackageRepository
|
13
|
-
|
14
|
-
|
12
|
+
Infrastructure::PushPackageRepository.new(ctx: ctx).create_push_package(
|
13
|
+
extension_point_type: extension_point_type,
|
14
|
+
script_name: script_name,
|
15
|
+
description: description,
|
16
|
+
script_content: task_runner.build,
|
17
|
+
compiled_type: task_runner.compiled_type,
|
18
|
+
metadata: task_runner.metadata
|
19
|
+
)
|
15
20
|
spinner.update_title(ctx.message('script.application.built'))
|
16
21
|
end
|
17
22
|
rescue StandardError => e
|
@@ -7,40 +7,42 @@ module Script
|
|
7
7
|
module Application
|
8
8
|
class CreateScript
|
9
9
|
class << self
|
10
|
-
def call(ctx:, language:, script_name:, extension_point_type:)
|
10
|
+
def call(ctx:, language:, script_name:, extension_point_type:, description:)
|
11
11
|
extension_point = ExtensionPoints.get(type: extension_point_type)
|
12
|
-
project = setup_project(ctx, script_name, extension_point)
|
12
|
+
project = setup_project(ctx, language, script_name, extension_point, description)
|
13
13
|
project_creator = Infrastructure::ProjectCreator
|
14
14
|
.for(ctx, language, extension_point, script_name, project.directory)
|
15
|
-
install_dependencies(ctx, language, script_name,
|
16
|
-
bootstrap(ctx,
|
15
|
+
install_dependencies(ctx, language, script_name, project_creator)
|
16
|
+
bootstrap(ctx, project_creator)
|
17
17
|
project
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
def setup_project(ctx, script_name, extension_point)
|
22
|
+
def setup_project(ctx, language, script_name, extension_point, description)
|
23
23
|
ScriptProject.create(ctx, script_name)
|
24
24
|
ScriptProject.write(
|
25
25
|
ctx,
|
26
26
|
project_type: :script,
|
27
27
|
organization_id: nil, # TODO: can you provide this at creation
|
28
28
|
extension_point_type: extension_point.type,
|
29
|
-
script_name: script_name
|
29
|
+
script_name: script_name,
|
30
|
+
language: language,
|
31
|
+
description: description
|
30
32
|
)
|
31
33
|
ScriptProject.current
|
32
34
|
end
|
33
35
|
|
34
|
-
def install_dependencies(ctx, language, script_name,
|
35
|
-
task_runner = Infrastructure::TaskRunner.for(ctx, language, script_name
|
36
|
+
def install_dependencies(ctx, language, script_name, project_creator)
|
37
|
+
task_runner = Infrastructure::TaskRunner.for(ctx, language, script_name)
|
36
38
|
project_creator.setup_dependencies
|
37
39
|
ProjectDependencies.install(ctx: ctx, task_runner: task_runner)
|
38
40
|
end
|
39
41
|
|
40
|
-
def bootstrap(ctx,
|
42
|
+
def bootstrap(ctx, project_creator)
|
41
43
|
UI::StrictSpinner.spin(ctx.message('script.create.creating')) do |spinner|
|
42
44
|
project_creator.bootstrap
|
43
|
-
spinner.update_title(ctx.message('script.create.created'
|
45
|
+
spinner.update_title(ctx.message('script.create.created'))
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|