shopify-cli 0.9.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +3 -0
- data/CHANGELOG.md +24 -2
- data/RELEASING.md +4 -4
- data/docs/_config.yml +3 -0
- data/docs/_data/nav.yml +9 -0
- data/docs/getting-started/index.md +5 -40
- data/docs/getting-started/install/index.md +75 -0
- data/docs/getting-started/migrate/index.md +96 -0
- data/docs/getting-started/uninstall/index.md +37 -0
- data/docs/getting-started/upgrade/index.md +37 -0
- data/docs/index.md +5 -6
- data/lib/project_types/extension/cli.rb +2 -1
- data/lib/project_types/extension/commands/tunnel.rb +1 -1
- data/lib/project_types/extension/forms/register.rb +2 -3
- data/lib/project_types/extension/graphql/get_app_by_api_key.graphql +9 -0
- data/lib/project_types/extension/tasks/converters/app_converter.rb +27 -0
- data/lib/project_types/extension/tasks/get_app.rb +22 -0
- data/lib/project_types/extension/tasks/get_apps.rb +1 -6
- data/lib/project_types/node/forms/create.rb +3 -54
- data/lib/project_types/node/messages/messages.rb +3 -14
- data/lib/project_types/rails/forms/create.rb +3 -52
- data/lib/project_types/rails/messages/messages.rb +2 -13
- data/lib/project_types/script/cli.rb +5 -5
- data/lib/project_types/script/commands/create.rb +5 -4
- data/lib/project_types/script/commands/push.rb +1 -0
- data/lib/project_types/script/config/extension_points.yml +3 -3
- data/lib/project_types/script/errors.rb +1 -0
- data/lib/project_types/script/forms/create.rb +8 -4
- data/lib/project_types/script/layers/application/build_script.rb +7 -10
- data/lib/project_types/script/layers/application/create_script.rb +16 -14
- data/lib/project_types/script/layers/application/project_dependencies.rb +3 -9
- data/lib/project_types/script/layers/application/push_script.rb +13 -11
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +106 -0
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +64 -0
- data/lib/project_types/script/layers/infrastructure/errors.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/project_creator.rb +23 -0
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +6 -3
- data/lib/project_types/script/layers/infrastructure/script_repository.rb +8 -38
- data/lib/project_types/script/layers/infrastructure/task_runner.rb +18 -0
- data/lib/project_types/script/messages/messages.rb +5 -6
- data/lib/project_types/script/script_project.rb +22 -9
- data/lib/project_types/script/templates/ts/as-pect.d.ts +1 -0
- data/lib/project_types/script/ui/error_handler.rb +5 -0
- data/lib/shopify-cli/admin_api.rb +1 -2
- data/lib/shopify-cli/admin_api/populate_resource_command.rb +10 -1
- data/lib/shopify-cli/admin_api/schema.rb +11 -1
- data/lib/shopify-cli/api.rb +2 -0
- data/lib/shopify-cli/context.rb +60 -0
- data/lib/shopify-cli/core/entry_point.rb +6 -0
- data/lib/shopify-cli/core/finalize.rb +13 -0
- data/lib/shopify-cli/git.rb +14 -10
- data/lib/shopify-cli/messages/messages.rb +22 -2
- data/lib/shopify-cli/tasks.rb +1 -0
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +77 -0
- data/lib/shopify-cli/tunnel.rb +33 -1
- data/lib/shopify-cli/version.rb +1 -1
- data/vendor/deps/cli-ui/REVISION +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui.rb +52 -11
- data/vendor/deps/cli-ui/lib/cli/ui/color.rb +11 -7
- data/vendor/deps/cli-ui/lib/cli/ui/formatter.rb +34 -21
- data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +107 -149
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +99 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +119 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +158 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +112 -0
- data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +9 -15
- data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +47 -0
- data/vendor/deps/cli-ui/lib/cli/ui/progress.rb +9 -7
- data/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +39 -14
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +62 -44
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/options_handler.rb +7 -2
- data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +23 -3
- data/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +34 -10
- data/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb +12 -7
- data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +26 -16
- data/vendor/deps/cli-ui/lib/cli/ui/truncater.rb +3 -3
- data/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +75 -0
- data/vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb +27 -0
- data/vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb +61 -0
- metadata +24 -9
- data/lib/project_types/extension/features/tunnel_url.rb +0 -20
- data/lib/project_types/script/layers/infrastructure/assemblyscript_dependency_manager.rb +0 -73
- data/lib/project_types/script/layers/infrastructure/assemblyscript_wasm_builder.rb +0 -39
- data/lib/project_types/script/layers/infrastructure/dependency_manager.rb +0 -36
- data/lib/project_types/script/layers/infrastructure/script_builder.rb +0 -34
- data/lib/project_types/script/layers/infrastructure/test_suite_repository.rb +0 -59
- data/vendor/deps/cli-ui/lib/cli/ui/box.rb +0 -15
@@ -16,13 +16,12 @@ module Extension
|
|
16
16
|
attr_writer :app
|
17
17
|
|
18
18
|
def ask_app
|
19
|
-
apps = load_apps
|
20
|
-
|
21
19
|
if !api_key.nil?
|
22
|
-
found_app =
|
20
|
+
found_app = Tasks::GetApp.call(context: ctx, api_key: api_key)
|
23
21
|
ctx.abort(ctx.message('register.invalid_api_key', api_key)) if found_app.nil?
|
24
22
|
found_app
|
25
23
|
else
|
24
|
+
apps = load_apps
|
26
25
|
CLI::UI::Prompt.ask(ctx.message('register.ask_app')) do |handler|
|
27
26
|
apps.each do |app|
|
28
27
|
handler.option("#{app.title} by #{app.business_name}") { app }
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'shopify_cli'
|
3
|
+
|
4
|
+
module Extension
|
5
|
+
module Tasks
|
6
|
+
module Converters
|
7
|
+
module AppConverter
|
8
|
+
API_KEY_FIELD = 'apiKey'
|
9
|
+
API_SECRET_KEYS_FIELD = 'apiSecretKeys'
|
10
|
+
API_SECRET_FIELD = 'secret'
|
11
|
+
TITLE_FIELD = 'title'
|
12
|
+
ORGANIZATION_NAME_FIELD = 'businessName'
|
13
|
+
|
14
|
+
def self.from_hash(hash, organization = {})
|
15
|
+
return nil if hash.nil?
|
16
|
+
|
17
|
+
Models::App.new(
|
18
|
+
api_key: hash[API_KEY_FIELD],
|
19
|
+
secret: hash[API_SECRET_KEYS_FIELD].first[API_SECRET_FIELD],
|
20
|
+
title: hash[TITLE_FIELD],
|
21
|
+
business_name: organization[ORGANIZATION_NAME_FIELD]
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'shopify_cli'
|
3
|
+
|
4
|
+
module Extension
|
5
|
+
module Tasks
|
6
|
+
class GetApp < ShopifyCli::Task
|
7
|
+
GRAPHQL_FILE = 'get_app_by_api_key'
|
8
|
+
|
9
|
+
RESPONSE_FIELD = %w(data)
|
10
|
+
APP_FIELD = 'app'
|
11
|
+
|
12
|
+
def call(context:, api_key:)
|
13
|
+
input = { api_key: api_key }
|
14
|
+
|
15
|
+
response = ShopifyCli::PartnersAPI.query(context, GRAPHQL_FILE, input).dig(*RESPONSE_FIELD)
|
16
|
+
context.abort(context.message('tasks.errors.parse_error')) if response.nil?
|
17
|
+
|
18
|
+
Converters::AppConverter.from_hash(response.dig(APP_FIELD))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -21,12 +21,7 @@ module Extension
|
|
21
21
|
return [] unless organization.key?('apps') && organization['apps'].any?
|
22
22
|
|
23
23
|
organization['apps'].map do |app|
|
24
|
-
|
25
|
-
api_key: app['apiKey'],
|
26
|
-
secret: app["apiSecretKeys"].first["secret"],
|
27
|
-
title: app['title'],
|
28
|
-
business_name: organization['businessName']
|
29
|
-
)
|
24
|
+
Converters::AppConverter.from_hash(app, organization)
|
30
25
|
end
|
31
26
|
end
|
32
27
|
end
|
@@ -10,8 +10,9 @@ module Node
|
|
10
10
|
self.title ||= CLI::UI::Prompt.ask(ctx.message('node.forms.create.app_name'))
|
11
11
|
self.type = ask_type
|
12
12
|
self.name = self.title.downcase.split(" ").join("_")
|
13
|
-
|
14
|
-
self.
|
13
|
+
res = ShopifyCli::Tasks::SelectOrgAndShop.call(ctx, organization_id: organization_id, shop_domain: shop_domain)
|
14
|
+
self.organization_id = res[:organization_id]
|
15
|
+
self.shop_domain = res[:shop_domain]
|
15
16
|
end
|
16
17
|
|
17
18
|
private
|
@@ -30,58 +31,6 @@ module Node
|
|
30
31
|
ctx.puts(ctx.message('node.forms.create.app_type.selected', type))
|
31
32
|
type
|
32
33
|
end
|
33
|
-
|
34
|
-
def organizations
|
35
|
-
@organizations ||= ShopifyCli::PartnersAPI::Organizations.fetch_all(ctx)
|
36
|
-
end
|
37
|
-
|
38
|
-
def organization
|
39
|
-
@organization ||= if !organization_id.nil?
|
40
|
-
org = ShopifyCli::PartnersAPI::Organizations.fetch(ctx, id: organization_id)
|
41
|
-
if org.nil?
|
42
|
-
ctx.puts(ctx.message('node.forms.create.authentication_issue', ShopifyCli::TOOL_NAME))
|
43
|
-
ctx.abort(ctx.message('node.forms.create.error.organization_not_found'))
|
44
|
-
end
|
45
|
-
org
|
46
|
-
elsif organizations.count == 0
|
47
|
-
ctx.puts(ctx.message('node.forms.create.partners_notice'))
|
48
|
-
ctx.puts(ctx.message('node.forms.create.authentication_issue', ShopifyCli::TOOL_NAME))
|
49
|
-
ctx.abort(ctx.message('node.forms.create.error.no_organizations'))
|
50
|
-
elsif organizations.count == 1
|
51
|
-
org = organizations.first
|
52
|
-
ctx.puts(ctx.message('node.forms.create.organization',
|
53
|
-
ctx.message('core.partners_api.org_name_and_id', org['businessName'], org['id'])))
|
54
|
-
org
|
55
|
-
else
|
56
|
-
org_id = CLI::UI::Prompt.ask(ctx.message('node.forms.create.organization_select')) do |handler|
|
57
|
-
organizations.each do |o|
|
58
|
-
handler.option(ctx.message('core.partners_api.org_name_and_id', o['businessName'], o['id'])) { o['id'] }
|
59
|
-
end
|
60
|
-
end
|
61
|
-
organizations.find { |o| o['id'] == org_id }
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def ask_shop_domain
|
66
|
-
valid_stores = organization['stores'].select do |store|
|
67
|
-
store['transferDisabled'] == true || store['convertableToPartnerTest'] == true
|
68
|
-
end
|
69
|
-
|
70
|
-
if valid_stores.count == 0
|
71
|
-
ctx.puts(ctx.message('node.forms.create.no_development_stores'))
|
72
|
-
ctx.puts(ctx.message('node.forms.create.create_store', organization['id']))
|
73
|
-
ctx.puts(ctx.message('node.forms.create.authentication_issue', ShopifyCli::TOOL_NAME))
|
74
|
-
elsif valid_stores.count == 1
|
75
|
-
domain = valid_stores.first['shopDomain']
|
76
|
-
ctx.puts(ctx.message('node.forms.create.development_store', domain))
|
77
|
-
domain
|
78
|
-
else
|
79
|
-
CLI::UI::Prompt.ask(
|
80
|
-
ctx.message('node.forms.create.development_store_select'),
|
81
|
-
options: valid_stores.map { |s| s['shopDomain'] }
|
82
|
-
)
|
83
|
-
end
|
84
|
-
end
|
85
34
|
end
|
86
35
|
end
|
87
36
|
end
|
@@ -28,8 +28,8 @@ module Node
|
|
28
28
|
},
|
29
29
|
info: {
|
30
30
|
created: "{{v}} {{green:%s}} was created in your Partner Dashboard {{underline:%s}}",
|
31
|
-
serve: "{{*}} Change
|
32
|
-
"local server",
|
31
|
+
serve: "{{*}} Change directories to your new project folder {{green:%s}} and run {{command:%s serve}} " \
|
32
|
+
"to start a local server",
|
33
33
|
install: "{{*}} Then, visit {{underline:%s/test}} to install {{green:%s}} on your Dev Store",
|
34
34
|
},
|
35
35
|
node_version: "node %s",
|
@@ -233,25 +233,14 @@ module Node
|
|
233
233
|
create: {
|
234
234
|
error: {
|
235
235
|
invalid_app_type: "Invalid app type %s",
|
236
|
-
organization_not_found: "Cannot find a partner organization with that ID",
|
237
|
-
no_organizations: "No partner organizations available.",
|
238
236
|
},
|
239
|
-
|
240
|
-
authentication_issue: "For authentication issues, run {{command:%s logout}} to clear invalid credentials",
|
241
|
-
partners_notice: "Please visit https://partners.shopify.com/ to create a partners account",
|
242
|
-
no_development_stores: "{{x}} No Development Stores available.",
|
243
|
-
create_store: "Visit {{underline:https://partners.shopify.com/%s/stores}} to create one",
|
244
|
-
app_name: "App Name",
|
237
|
+
app_name: "App name",
|
245
238
|
app_type: {
|
246
239
|
select: "What type of app are you building?",
|
247
240
|
select_public: "Public: An app built for a wide merchant audience.",
|
248
241
|
select_custom: "Custom: An app custom built for a single client.",
|
249
242
|
selected: "App type {{green:%s}}",
|
250
243
|
},
|
251
|
-
organization_select: "Select partner organization",
|
252
|
-
organization: "Partner organization {{green:%s}}",
|
253
|
-
development_store_select: "Select a development store",
|
254
|
-
development_store: "Using development store {{green:%s}}",
|
255
244
|
},
|
256
245
|
},
|
257
246
|
},
|
@@ -22,8 +22,9 @@ module Rails
|
|
22
22
|
self.title ||= CLI::UI::Prompt.ask(ctx.message('rails.forms.create.app_name'))
|
23
23
|
self.type = ask_type
|
24
24
|
self.name = self.title.downcase.split(" ").join("_")
|
25
|
-
|
26
|
-
self.
|
25
|
+
res = ShopifyCli::Tasks::SelectOrgAndShop.call(ctx, organization_id: organization_id, shop_domain: shop_domain)
|
26
|
+
self.organization_id = res[:organization_id]
|
27
|
+
self.shop_domain = res[:shop_domain]
|
27
28
|
self.db = ask_db
|
28
29
|
end
|
29
30
|
|
@@ -44,56 +45,6 @@ module Rails
|
|
44
45
|
type
|
45
46
|
end
|
46
47
|
|
47
|
-
def organizations
|
48
|
-
@organizations ||= ShopifyCli::PartnersAPI::Organizations.fetch_all(ctx)
|
49
|
-
end
|
50
|
-
|
51
|
-
def organization
|
52
|
-
@organization ||= if !organization_id.nil?
|
53
|
-
org = ShopifyCli::PartnersAPI::Organizations.fetch(ctx, id: organization_id)
|
54
|
-
if org.nil?
|
55
|
-
ctx.puts(ctx.message('rails.forms.create.authentication_issue', ShopifyCli::TOOL_NAME))
|
56
|
-
ctx.abort(ctx.message('rails.forms.create.error.organization_not_found'))
|
57
|
-
end
|
58
|
-
org
|
59
|
-
elsif organizations.count == 0
|
60
|
-
ctx.puts(ctx.message('rails.forms.create.partners_notice'))
|
61
|
-
ctx.puts(ctx.message('rails.forms.create.authentication_issue', ShopifyCli::TOOL_NAME))
|
62
|
-
ctx.abort(ctx.message('rails.forms.create.error.no_organizations'))
|
63
|
-
elsif organizations.count == 1
|
64
|
-
org = organizations.first
|
65
|
-
ctx.puts(ctx.message('rails.forms.create.organization',
|
66
|
-
ctx.message('core.partners_api.org_name_and_id', org['businessName'], org['id'])))
|
67
|
-
org
|
68
|
-
else
|
69
|
-
org_id = CLI::UI::Prompt.ask(ctx.message('rails.forms.create.organization_select')) do |handler|
|
70
|
-
organizations.each { |o| handler.option(o['businessName']) { o['id'] } }
|
71
|
-
end
|
72
|
-
organizations.find { |o| o['id'] == org_id }
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def ask_shop_domain
|
77
|
-
valid_stores = organization['stores'].select do |store|
|
78
|
-
store['transferDisabled'] == true || store['convertableToPartnerTest'] == true
|
79
|
-
end
|
80
|
-
|
81
|
-
if valid_stores.count == 0
|
82
|
-
ctx.puts(ctx.message('rails.forms.create.no_development_stores'))
|
83
|
-
ctx.puts(ctx.message('rails.forms.create.create_store', organization['id']))
|
84
|
-
ctx.puts(ctx.message('rails.forms.create.authentication_issue', ShopifyCli::TOOL_NAME))
|
85
|
-
elsif valid_stores.count == 1
|
86
|
-
domain = valid_stores.first['shopDomain']
|
87
|
-
ctx.puts(ctx.message('rails.forms.create.development_store', domain))
|
88
|
-
domain
|
89
|
-
else
|
90
|
-
CLI::UI::Prompt.ask(
|
91
|
-
ctx.message('rails.forms.create.development_store_select'),
|
92
|
-
options: valid_stores.map { |s| s['shopDomain'] }
|
93
|
-
)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
48
|
def ask_db
|
98
49
|
if db.nil?
|
99
50
|
return 'sqlite3' unless CLI::UI::Prompt.confirm(ctx.message('rails.forms.create.db.want_select'),
|
@@ -37,8 +37,8 @@ module Rails
|
|
37
37
|
|
38
38
|
info: {
|
39
39
|
created: "{{v}} {{green:%s}} was created in your Partner Dashboard {{underline:%s}}",
|
40
|
-
serve: "{{*}} Change
|
41
|
-
"local server",
|
40
|
+
serve: "{{*}} Change directories to your new project folder {{green:%s}} and run {{command:%s serve}} " \
|
41
|
+
"to start a local server",
|
42
42
|
install: "{{*}} Then, visit {{underline:%s/test}} to install {{green:%s}} on your Dev Store",
|
43
43
|
},
|
44
44
|
installing_bundler: "Installing bundler…",
|
@@ -236,14 +236,7 @@ module Rails
|
|
236
236
|
error: {
|
237
237
|
invalid_app_type: "Invalid app type %s",
|
238
238
|
invalid_db_type: "Invalid database type %s",
|
239
|
-
organization_not_found: "Cannot find a partner organization with that ID",
|
240
|
-
no_organizations: "No partner organizations available.",
|
241
239
|
},
|
242
|
-
|
243
|
-
authentication_issue: "For authentication issues, run {{command:%s logout}} to clear invalid credentials",
|
244
|
-
partners_notice: "Please visit https://partners.shopify.com/ to create a partners account",
|
245
|
-
no_development_stores: "{{x}} No development stores available.",
|
246
|
-
create_store: "Visit {{underline:https://partners.shopify.com/%s/stores}} to create one",
|
247
240
|
app_name: "App name",
|
248
241
|
app_type: {
|
249
242
|
select: "What type of app are you building?",
|
@@ -271,10 +264,6 @@ module Rails
|
|
271
264
|
select_jdbc: "JDBC",
|
272
265
|
selected: "Database Type {{green:%s}}",
|
273
266
|
},
|
274
|
-
organization_select: "Select partner organization",
|
275
|
-
organization: "Partner organization {{green:%s}}",
|
276
|
-
development_store_select: "Select a development store",
|
277
|
-
development_store: "Using development store {{green:%s}}",
|
278
267
|
},
|
279
268
|
},
|
280
269
|
},
|
@@ -51,16 +51,16 @@ module Script
|
|
51
51
|
autoload :Errors, Project.project_filepath('layers/infrastructure/errors')
|
52
52
|
autoload :AssemblyScriptDependencyManager,
|
53
53
|
Project.project_filepath('layers/infrastructure/assemblyscript_dependency_manager')
|
54
|
+
autoload :AssemblyScriptProjectCreator,
|
55
|
+
Project.project_filepath('layers/infrastructure/assemblyscript_project_creator')
|
56
|
+
autoload :AssemblyScriptTaskRunner, Project.project_filepath('layers/infrastructure/assemblyscript_task_runner')
|
54
57
|
autoload :AssemblyScriptTsConfig, Project.project_filepath('layers/infrastructure/assemblyscript_tsconfig')
|
55
|
-
autoload :AssemblyScriptWasmBuilder,
|
56
|
-
Project.project_filepath('layers/infrastructure/assemblyscript_wasm_builder')
|
57
|
-
autoload :DependencyManager, Project.project_filepath('layers/infrastructure/dependency_manager')
|
58
58
|
autoload :PushPackageRepository, Project.project_filepath('layers/infrastructure/push_package_repository')
|
59
59
|
autoload :ExtensionPointRepository, Project.project_filepath('layers/infrastructure/extension_point_repository')
|
60
|
-
autoload :
|
60
|
+
autoload :ProjectCreator, Project.project_filepath('layers/infrastructure/project_creator')
|
61
61
|
autoload :ScriptRepository, Project.project_filepath('layers/infrastructure/script_repository')
|
62
62
|
autoload :ScriptService, Project.project_filepath('layers/infrastructure/script_service')
|
63
|
-
autoload :
|
63
|
+
autoload :TaskRunner, Project.project_filepath('layers/infrastructure/task_runner')
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -19,16 +19,17 @@ module Script
|
|
19
19
|
return @ctx.puts(self.class.help)
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
Layers::Application::CreateScript.call(
|
23
23
|
ctx: @ctx,
|
24
24
|
language: language,
|
25
25
|
script_name: form.name,
|
26
26
|
extension_point_type: form.extension_point
|
27
27
|
)
|
28
|
-
|
29
|
-
@ctx.puts(@ctx.message('script.create.
|
28
|
+
project = ScriptProject.current
|
29
|
+
@ctx.puts(@ctx.message('script.create.script_path', folder: project.script_name))
|
30
|
+
@ctx.puts(@ctx.message('script.create.script_created', script_id: project.source_file))
|
30
31
|
rescue StandardError => e
|
31
|
-
ScriptProject.cleanup(ctx: @ctx, script_name: form.name, root_dir: cur_dir)
|
32
|
+
ScriptProject.cleanup(ctx: @ctx, script_name: form.name, root_dir: cur_dir) if form
|
32
33
|
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.create.error.operation_failed'))
|
33
34
|
end
|
34
35
|
|
@@ -1,18 +1,18 @@
|
|
1
1
|
discount:
|
2
2
|
assemblyscript:
|
3
3
|
package: "@shopify/extension-point-as-discount"
|
4
|
-
version: "^0.2.
|
4
|
+
version: "^0.2.3"
|
5
5
|
sdk-version: "^6.0.0"
|
6
6
|
toolchain-version: "^1.1.0"
|
7
7
|
unit_limit_per_order:
|
8
8
|
assemblyscript:
|
9
9
|
package: "@shopify/extension-point-as-unit-limit-per-order"
|
10
|
-
version: "^0.1.
|
10
|
+
version: "^0.1.4"
|
11
11
|
sdk-version: "^6.0.0"
|
12
12
|
toolchain-version: "^1.1.0"
|
13
13
|
payment_filter:
|
14
14
|
assemblyscript:
|
15
15
|
package: "@shopify/extension-point-as-payment-filter"
|
16
|
-
version: "^0.1
|
16
|
+
version: "^0.2.1"
|
17
17
|
sdk-version: "^6.0.0"
|
18
18
|
toolchain-version: "^1.1.0"
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module Script
|
4
4
|
module Errors
|
5
5
|
class InvalidContextError < ScriptProjectError; end
|
6
|
+
class InvalidScriptNameError < ScriptProjectError; end
|
6
7
|
class NoExistingAppsError < ScriptProjectError; end
|
7
8
|
class NoExistingOrganizationsError < ScriptProjectError; end
|
8
9
|
class NoExistingStoresError < ScriptProjectError
|
@@ -6,7 +6,7 @@ module Script
|
|
6
6
|
flag_arguments :extension_point, :name
|
7
7
|
|
8
8
|
def ask
|
9
|
-
self.name =
|
9
|
+
self.name = valid_name
|
10
10
|
self.extension_point ||= ask_extension_point
|
11
11
|
end
|
12
12
|
|
@@ -20,9 +20,13 @@ module Script
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def ask_name
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
CLI::UI::Prompt.ask(@ctx.message('script.forms.create.script_name'))
|
24
|
+
end
|
25
|
+
|
26
|
+
def valid_name
|
27
|
+
n = (name || ask_name).downcase.gsub(' ', '_')
|
28
|
+
return n if n.match?(/^[0-9A-Za-z_-]*$/)
|
29
|
+
raise Errors::InvalidScriptNameError
|
26
30
|
end
|
27
31
|
end
|
28
32
|
end
|
@@ -5,11 +5,11 @@ module Script
|
|
5
5
|
module Application
|
6
6
|
class BuildScript
|
7
7
|
class << self
|
8
|
-
def call(ctx:, script:)
|
8
|
+
def call(ctx:, task_runner:, script:)
|
9
9
|
return if 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
|
-
build(script)
|
12
|
+
build(ctx, task_runner, script)
|
13
13
|
spinner.update_title(ctx.message('script.application.built'))
|
14
14
|
end
|
15
15
|
true
|
@@ -25,16 +25,13 @@ module Script
|
|
25
25
|
|
26
26
|
private
|
27
27
|
|
28
|
-
def build(script)
|
29
|
-
script_repo = Infrastructure::ScriptRepository.new
|
30
|
-
script_builder = Infrastructure::ScriptBuilder.for(script)
|
31
|
-
compiled_type = script_builder.compiled_type
|
28
|
+
def build(ctx, task_runner, script)
|
29
|
+
script_repo = Infrastructure::ScriptRepository.new(ctx: ctx)
|
32
30
|
script_content = script_repo.with_temp_build_context do
|
33
|
-
|
31
|
+
task_runner.build
|
34
32
|
end
|
35
|
-
|
36
|
-
|
37
|
-
.create_push_package(script, script_content, compiled_type)
|
33
|
+
Infrastructure::PushPackageRepository.new(ctx: ctx)
|
34
|
+
.create_push_package(script, script_content, task_runner.compiled_type)
|
38
35
|
end
|
39
36
|
end
|
40
37
|
end
|