shopify-cli 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/CHANGELOG.md +20 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +13 -13
- data/bin/load_shopify.rb +3 -1
- data/bin/shopify +2 -0
- data/docs/Gemfile.lock +23 -13
- data/docs/getting-started/install/index.md +37 -1
- data/docs/getting-started/migrate/index.md +34 -1
- data/ext/shopify-cli/extconf.rb +40 -20
- data/lib/project_types/extension/cli.rb +1 -1
- data/lib/project_types/extension/commands/build.rb +1 -1
- data/lib/project_types/extension/models/type.rb +1 -0
- data/lib/project_types/extension/tasks/create_extension.rb +1 -1
- data/lib/project_types/extension/tasks/get_app.rb +1 -1
- data/lib/project_types/extension/tasks/update_draft.rb +1 -1
- data/lib/project_types/node/commands/create.rb +4 -4
- data/lib/project_types/node/commands/deploy/heroku.rb +6 -1
- data/lib/project_types/node/commands/generate/billing.rb +6 -5
- data/lib/project_types/node/commands/generate/page.rb +8 -5
- data/lib/project_types/node/commands/generate/webhook.rb +4 -1
- data/lib/project_types/node/messages/messages.rb +3 -2
- data/lib/project_types/rails/cli.rb +0 -1
- data/lib/project_types/rails/commands/create.rb +52 -4
- data/lib/project_types/rails/commands/generate.rb +1 -0
- data/lib/project_types/rails/commands/generate/webhook.rb +3 -2
- data/lib/project_types/rails/commands/serve.rb +6 -2
- data/lib/project_types/rails/gem.rb +61 -6
- data/lib/project_types/rails/messages/messages.rb +29 -13
- data/lib/project_types/script/cli.rb +2 -3
- data/lib/project_types/script/commands/create.rb +5 -9
- data/lib/project_types/script/commands/disable.rb +4 -15
- data/lib/project_types/script/commands/enable.rb +37 -13
- data/lib/project_types/script/commands/push.rb +8 -13
- data/lib/project_types/script/config/extension_points.yml +9 -3
- data/lib/project_types/script/errors.rb +8 -0
- data/lib/project_types/script/forms/create.rb +1 -1
- data/lib/project_types/script/layers/application/create_script.rb +7 -6
- data/lib/project_types/script/layers/application/disable_script.rb +9 -7
- data/lib/project_types/script/layers/application/enable_script.rb +11 -9
- data/lib/project_types/script/layers/application/push_script.rb +6 -4
- data/lib/project_types/script/layers/domain/errors.rb +2 -0
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/errors.rb +2 -0
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/script_repository.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/script_service.rb +2 -0
- data/lib/project_types/script/messages/messages.rb +25 -31
- data/lib/project_types/script/script_project.rb +8 -4
- data/lib/project_types/script/templates/ts/as-pect.config.js +6 -0
- data/lib/project_types/script/ui/error_handler.rb +8 -0
- data/lib/project_types/script/ui/printing_spinner.rb +75 -0
- data/lib/rubygems_plugin.rb +18 -10
- data/lib/shopify-cli/admin_api/populate_resource_command.rb +1 -1
- data/lib/shopify-cli/admin_api/schema.rb +20 -8
- data/lib/shopify-cli/command.rb +14 -11
- data/lib/shopify-cli/commands.rb +1 -0
- data/lib/shopify-cli/commands/config.rb +44 -0
- data/lib/shopify-cli/commands/connect.rb +8 -69
- data/lib/shopify-cli/commands/create.rb +2 -2
- data/lib/shopify-cli/commands/help.rb +1 -1
- data/lib/shopify-cli/commands/system.rb +22 -13
- data/lib/shopify-cli/context.rb +38 -1
- data/lib/shopify-cli/core.rb +0 -1
- data/lib/shopify-cli/core/entry_point.rb +1 -1
- data/lib/shopify-cli/core/executor.rb +3 -5
- data/lib/shopify-cli/core/monorail.rb +1 -1
- data/lib/shopify-cli/db.rb +1 -1
- data/lib/shopify-cli/feature.rb +97 -0
- data/lib/shopify-cli/heroku.rb +21 -5
- data/lib/shopify-cli/js_deps.rb +2 -2
- data/lib/shopify-cli/js_system.rb +2 -2
- data/lib/shopify-cli/messages/messages.rb +37 -12
- data/lib/shopify-cli/partners_api/organizations.rb +7 -7
- data/lib/shopify-cli/process_supervision.rb +60 -21
- data/lib/shopify-cli/project.rb +14 -6
- data/lib/shopify-cli/project_type.rb +5 -7
- data/lib/shopify-cli/sub_command.rb +1 -0
- data/lib/shopify-cli/task.rb +2 -2
- data/lib/shopify-cli/tasks.rb +11 -4
- data/lib/shopify-cli/tasks/ensure_env.rb +72 -16
- data/lib/shopify-cli/tasks/update_dashboard_urls.rb +4 -3
- data/lib/shopify-cli/tunnel.rb +44 -14
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +36 -9
- data/shopify-cli.gemspec +4 -1
- data/vendor/deps/cli-kit/REVISION +1 -1
- data/vendor/deps/cli-kit/lib/cli/kit.rb +1 -1
- data/vendor/deps/cli-kit/lib/cli/kit/autocall.rb +2 -2
- data/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +12 -6
- data/vendor/deps/cli-kit/lib/cli/kit/executor.rb +9 -11
- data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +8 -2
- data/vendor/deps/cli-kit/lib/cli/kit/support/test_helper.rb +7 -7
- data/vendor/deps/cli-kit/lib/cli/kit/system.rb +48 -17
- data/vendor/deps/cli-ui/REVISION +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui.rb +5 -4
- data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +9 -3
- data/vendor/deps/cli-ui/lib/cli/ui/color.rb +1 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +3 -2
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +1 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +13 -5
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +29 -2
- data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +21 -10
- data/vendor/deps/cli-ui/lib/cli/ui/os.rb +63 -0
- data/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +11 -2
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +1 -0
- data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +3 -3
- data/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +6 -8
- data/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +2 -0
- data/vendor/gen/lib/gen.rb +39 -0
- data/vendor/gen/lib/gen/commands.rb +18 -0
- data/vendor/gen/lib/gen/commands/help.rb +20 -0
- data/vendor/gen/lib/gen/commands/new.rb +21 -0
- data/vendor/gen/lib/gen/entry_point.rb +10 -0
- data/vendor/gen/lib/gen/generator.rb +165 -0
- data/vendor/gen/template/.gitignore +2 -0
- data/vendor/gen/template/Gemfile +10 -0
- data/vendor/gen/template/README.md +1 -0
- data/vendor/gen/template/bin/testunit +23 -0
- data/vendor/gen/template/bin/update-deps +97 -0
- data/vendor/gen/template/dev-gems.yml +3 -0
- data/vendor/gen/template/dev-vendor.yml +4 -0
- data/vendor/gen/template/exe/__app__-gems +17 -0
- data/vendor/gen/template/exe/__app__-vendor +18 -0
- data/vendor/gen/template/lib/__app__.rb +33 -0
- data/vendor/gen/template/lib/__app__/commands.rb +18 -0
- data/vendor/gen/template/lib/__app__/commands/example.rb +19 -0
- data/vendor/gen/template/lib/__app__/commands/help.rb +21 -0
- data/vendor/gen/template/lib/__app__/entry_point.rb +10 -0
- data/vendor/gen/template/test/example_test.rb +17 -0
- data/vendor/gen/template/test/test_helper.rb +22 -0
- metadata +28 -6
- data/Vagrantfile +0 -17
- data/lib/project_types/script/forms/enable.rb +0 -24
- data/lib/project_types/script/forms/push.rb +0 -19
- data/lib/project_types/script/forms/script_form.rb +0 -66
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Script
|
4
4
|
class Project < ShopifyCli::ProjectType
|
5
|
-
|
5
|
+
hidden_feature(feature_set: :script_project)
|
6
6
|
creator 'Script', 'Script::Commands::Create'
|
7
7
|
|
8
8
|
register_command('Script::Commands::Push', 'push')
|
@@ -24,8 +24,6 @@ module Script
|
|
24
24
|
# define/autoload project specific Forms
|
25
25
|
module Forms
|
26
26
|
autoload :Create, Project.project_filepath('forms/create')
|
27
|
-
autoload :Push, Project.project_filepath('forms/push')
|
28
|
-
autoload :Enable, Project.project_filepath('forms/enable')
|
29
27
|
autoload :ScriptForm, Project.project_filepath('forms/script_form')
|
30
28
|
end
|
31
29
|
|
@@ -66,6 +64,7 @@ module Script
|
|
66
64
|
|
67
65
|
module UI
|
68
66
|
autoload :ErrorHandler, Project.project_filepath('ui/error_handler')
|
67
|
+
autoload :PrintingSpinner, Project.project_filepath('ui/printing_spinner')
|
69
68
|
autoload :StrictSpinner, Project.project_filepath('ui/strict_spinner')
|
70
69
|
end
|
71
70
|
|
@@ -19,27 +19,23 @@ module Script
|
|
19
19
|
return @ctx.puts(self.class.help)
|
20
20
|
end
|
21
21
|
|
22
|
-
Layers::Application::CreateScript.call(
|
22
|
+
project = 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
|
-
project
|
29
|
-
|
30
|
-
|
28
|
+
@ctx.puts(@ctx.message('script.create.change_directory_notice', project.script_name))
|
29
|
+
rescue Script::Errors::ScriptProjectAlreadyExistsError => e
|
30
|
+
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.create.error.operation_failed'))
|
31
31
|
rescue StandardError => e
|
32
32
|
ScriptProject.cleanup(ctx: @ctx, script_name: form.name, root_dir: cur_dir) if form
|
33
33
|
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.create.error.operation_failed'))
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.help
|
37
|
-
ShopifyCli::Context.message('script.create.help', ShopifyCli::TOOL_NAME)
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.extended_help
|
41
37
|
allowed_values = Script::Layers::Application::ExtensionPoints.types.map { |type| "{{cyan:#{type}}}" }
|
42
|
-
ShopifyCli::Context.message('script.create.
|
38
|
+
ShopifyCli::Context.message('script.create.help', ShopifyCli::TOOL_NAME, allowed_values.join(', '))
|
43
39
|
end
|
44
40
|
end
|
45
41
|
end
|
@@ -3,20 +3,13 @@
|
|
3
3
|
module Script
|
4
4
|
module Commands
|
5
5
|
class Disable < ShopifyCli::Command
|
6
|
-
|
7
|
-
|
8
|
-
parser.on('--shop_domain=MYSHOPIFYDOMAIN') { |t| flags[:shop_domain] = t }
|
9
|
-
end
|
10
|
-
|
11
|
-
def call(args, _name)
|
12
|
-
form = Forms::Enable.ask(@ctx, args, options.flags)
|
13
|
-
return @ctx.puts(self.class.help) unless form
|
14
|
-
|
6
|
+
def call(_args, _name)
|
7
|
+
ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop])
|
15
8
|
project = ScriptProject.current
|
16
9
|
Layers::Application::DisableScript.call(
|
17
10
|
ctx: @ctx,
|
18
|
-
api_key:
|
19
|
-
shop_domain:
|
11
|
+
api_key: project.env[:api_key],
|
12
|
+
shop_domain: project.env[:shop],
|
20
13
|
extension_point_type: project.extension_point_type
|
21
14
|
)
|
22
15
|
@ctx.puts(@ctx.message('script.disable.script_disabled'))
|
@@ -27,10 +20,6 @@ module Script
|
|
27
20
|
def self.help
|
28
21
|
ShopifyCli::Context.message('script.disable.help', ShopifyCli::TOOL_NAME)
|
29
22
|
end
|
30
|
-
|
31
|
-
def self.extended_help
|
32
|
-
ShopifyCli::Context.message('script.disable.extended_help', ShopifyCli::TOOL_NAME)
|
33
|
-
end
|
34
23
|
end
|
35
24
|
end
|
36
25
|
end
|
@@ -4,32 +4,36 @@ module Script
|
|
4
4
|
module Commands
|
5
5
|
class Enable < ShopifyCli::Command
|
6
6
|
options do |parser, flags|
|
7
|
-
parser.on('--
|
8
|
-
|
7
|
+
parser.on('--config_props=KEYVALUEPAIRS', Array) do |t|
|
8
|
+
flags[:config_props] = Hash[t.map { |s| s.split(':') }]
|
9
|
+
end
|
10
|
+
parser.on('--config_file=CONFIGFILEPATH') { |t| flags[:config_file] = t }
|
9
11
|
end
|
10
12
|
|
11
|
-
def call(
|
12
|
-
|
13
|
-
return @ctx.puts(self.class.help) unless form
|
14
|
-
|
13
|
+
def call(_args, _name)
|
14
|
+
ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop])
|
15
15
|
project = ScriptProject.current
|
16
|
+
api_key = project.env[:api_key]
|
17
|
+
shop_domain = project.env[:shop]
|
16
18
|
|
17
19
|
Layers::Application::EnableScript.call(
|
18
20
|
ctx: @ctx,
|
19
|
-
api_key:
|
20
|
-
shop_domain:
|
21
|
-
configuration:
|
21
|
+
api_key: api_key,
|
22
|
+
shop_domain: shop_domain,
|
23
|
+
configuration: acquire_configuration(**slice(options.flags, :config_file, :config_props)),
|
22
24
|
extension_point_type: project.extension_point_type,
|
23
25
|
title: project.script_name
|
24
26
|
)
|
25
27
|
@ctx.puts(@ctx.message(
|
26
28
|
'script.enable.script_enabled',
|
27
|
-
api_key:
|
28
|
-
shop_domain:
|
29
|
+
api_key: api_key,
|
30
|
+
shop_domain: shop_domain,
|
29
31
|
type: project.extension_point_type.capitalize,
|
30
32
|
title: project.script_name
|
31
33
|
))
|
32
34
|
@ctx.puts(@ctx.message('script.enable.info'))
|
35
|
+
rescue Errors::InvalidConfigYAMLError => e
|
36
|
+
UI::ErrorHandler.pretty_print_and_raise(e)
|
33
37
|
rescue StandardError => e
|
34
38
|
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.enable.error.operation_failed'))
|
35
39
|
end
|
@@ -38,8 +42,28 @@ module Script
|
|
38
42
|
ShopifyCli::Context.message('script.enable.help', ShopifyCli::TOOL_NAME)
|
39
43
|
end
|
40
44
|
|
41
|
-
|
42
|
-
|
45
|
+
private
|
46
|
+
|
47
|
+
def acquire_configuration(config_file: nil, config_props: nil)
|
48
|
+
properties = {}
|
49
|
+
properties = YAML.load(File.read(config_file)) unless config_file.nil?
|
50
|
+
properties = properties.merge(config_props) unless config_props.nil?
|
51
|
+
|
52
|
+
configuration = { entries: [] }
|
53
|
+
properties.each do |key, value|
|
54
|
+
configuration[:entries].push({
|
55
|
+
key: key,
|
56
|
+
value: value,
|
57
|
+
})
|
58
|
+
end
|
59
|
+
configuration
|
60
|
+
rescue Errno::ENOENT, Psych::SyntaxError
|
61
|
+
raise Errors::InvalidConfigYAMLError, options.flags[:config_file]
|
62
|
+
end
|
63
|
+
|
64
|
+
# No slice pre Ruby 2.5 so roll our own
|
65
|
+
def slice(hash, *keys)
|
66
|
+
Hash[hash.to_a - hash.select { |key, _value| !keys.include?(key) }.to_a]
|
43
67
|
end
|
44
68
|
end
|
45
69
|
end
|
@@ -4,26 +4,25 @@ module Script
|
|
4
4
|
module Commands
|
5
5
|
class Push < ShopifyCli::Command
|
6
6
|
options do |parser, flags|
|
7
|
-
parser.on('--api_key=APIKEY') { |t| flags[:api_key] = t }
|
8
7
|
parser.on('--force') { |t| flags[:force] = t }
|
9
8
|
end
|
10
9
|
|
11
|
-
def call(
|
12
|
-
|
10
|
+
def call(_args, _name)
|
11
|
+
ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop])
|
13
12
|
project = ScriptProject.current
|
14
|
-
|
15
|
-
return @ctx.puts(self.class.help) unless
|
16
|
-
|
13
|
+
api_key = project.env[:api_key]
|
14
|
+
return @ctx.puts(self.class.help) unless api_key &&
|
15
|
+
ScriptProject::SUPPORTED_LANGUAGES.include?(project.language)
|
17
16
|
Layers::Application::PushScript.call(
|
18
17
|
ctx: @ctx,
|
19
18
|
language: project.language,
|
20
19
|
extension_point_type: project.extension_point_type,
|
21
20
|
script_name: project.script_name,
|
22
21
|
source_file: project.source_file,
|
23
|
-
api_key:
|
24
|
-
force:
|
22
|
+
api_key: api_key,
|
23
|
+
force: options.flags.key?(:force)
|
25
24
|
)
|
26
|
-
@ctx.puts(@ctx.message('script.push.script_pushed', api_key:
|
25
|
+
@ctx.puts(@ctx.message('script.push.script_pushed', api_key: api_key))
|
27
26
|
rescue StandardError => e
|
28
27
|
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.push.error.operation_failed'))
|
29
28
|
end
|
@@ -31,10 +30,6 @@ module Script
|
|
31
30
|
def self.help
|
32
31
|
ShopifyCli::Context.message('script.push.help', ShopifyCli::TOOL_NAME)
|
33
32
|
end
|
34
|
-
|
35
|
-
def self.extended_help
|
36
|
-
ShopifyCli::Context.message('script.push.extended_help', ShopifyCli::TOOL_NAME)
|
37
|
-
end
|
38
33
|
end
|
39
34
|
end
|
40
35
|
end
|
@@ -1,18 +1,24 @@
|
|
1
1
|
discount:
|
2
2
|
assemblyscript:
|
3
3
|
package: "@shopify/extension-point-as-discount"
|
4
|
-
version: "^0.2.
|
4
|
+
version: "^0.2.6"
|
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.8"
|
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.
|
16
|
+
version: "^0.2.4"
|
17
|
+
sdk-version: "^6.0.0"
|
18
|
+
toolchain-version: "^1.1.0"
|
19
|
+
shipping_filter:
|
20
|
+
assemblyscript:
|
21
|
+
package: "@shopify/extension-point-as-shipping-filter"
|
22
|
+
version: "^0.2.6"
|
17
23
|
sdk-version: "^6.0.0"
|
18
24
|
toolchain-version: "^1.1.0"
|
@@ -9,9 +9,17 @@ module Script
|
|
9
9
|
class NoExistingStoresError < ScriptProjectError
|
10
10
|
attr_reader :organization_id
|
11
11
|
def initialize(organization_id)
|
12
|
+
super()
|
12
13
|
@organization_id = organization_id
|
13
14
|
end
|
14
15
|
end
|
15
16
|
class ScriptProjectAlreadyExistsError < ScriptProjectError; end
|
17
|
+
class InvalidConfigYAMLError < ScriptProjectError
|
18
|
+
attr_reader :config_file
|
19
|
+
def initialize(config_file)
|
20
|
+
super()
|
21
|
+
@config_file = config_file
|
22
|
+
end
|
23
|
+
end
|
16
24
|
end
|
17
25
|
end
|
@@ -12,8 +12,9 @@ module Script
|
|
12
12
|
project = setup_project(ctx, script_name, extension_point)
|
13
13
|
project_creator = Infrastructure::ProjectCreator
|
14
14
|
.for(ctx, language, extension_point, script_name, project.directory)
|
15
|
-
install_dependencies(ctx, language, script_name, project, project_creator)
|
16
|
-
bootstrap(ctx, project_creator)
|
15
|
+
install_dependencies(ctx, language, script_name, project.source_file, project_creator)
|
16
|
+
bootstrap(ctx, project.source_path, project_creator)
|
17
|
+
project
|
17
18
|
end
|
18
19
|
|
19
20
|
private
|
@@ -30,16 +31,16 @@ module Script
|
|
30
31
|
ScriptProject.current
|
31
32
|
end
|
32
33
|
|
33
|
-
def install_dependencies(ctx, language, script_name,
|
34
|
-
task_runner = Infrastructure::TaskRunner.for(ctx, language, script_name,
|
34
|
+
def install_dependencies(ctx, language, script_name, source_file, project_creator)
|
35
|
+
task_runner = Infrastructure::TaskRunner.for(ctx, language, script_name, source_file)
|
35
36
|
project_creator.setup_dependencies
|
36
37
|
ProjectDependencies.install(ctx: ctx, task_runner: task_runner)
|
37
38
|
end
|
38
39
|
|
39
|
-
def bootstrap(ctx, project_creator)
|
40
|
+
def bootstrap(ctx, source_path, project_creator)
|
40
41
|
UI::StrictSpinner.spin(ctx.message('script.create.creating')) do |spinner|
|
41
42
|
project_creator.bootstrap
|
42
|
-
spinner.update_title(ctx.message('script.create.created'))
|
43
|
+
spinner.update_title(ctx.message('script.create.created', source_path))
|
43
44
|
end
|
44
45
|
end
|
45
46
|
end
|
@@ -5,13 +5,15 @@ module Script
|
|
5
5
|
module Application
|
6
6
|
class DisableScript
|
7
7
|
def self.call(ctx:, api_key:, shop_domain:, extension_point_type:)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
UI::PrintingSpinner.spin(ctx, ctx.message('script.application.disabling')) do |p_ctx, spinner|
|
9
|
+
script_service = Infrastructure::ScriptService.new(ctx: p_ctx)
|
10
|
+
script_service.disable(
|
11
|
+
api_key: api_key,
|
12
|
+
shop_domain: shop_domain,
|
13
|
+
extension_point_type: extension_point_type,
|
14
|
+
)
|
15
|
+
spinner.update_title(p_ctx.message('script.application.disabled'))
|
16
|
+
end
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
@@ -5,15 +5,17 @@ module Script
|
|
5
5
|
module Application
|
6
6
|
class EnableScript
|
7
7
|
def self.call(ctx:, api_key:, shop_domain:, configuration:, extension_point_type:, title:)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
UI::PrintingSpinner.spin(ctx, ctx.message('script.application.enabling')) do |p_ctx, spinner|
|
9
|
+
script_service = Infrastructure::ScriptService.new(ctx: p_ctx)
|
10
|
+
script_service.enable(
|
11
|
+
api_key: api_key,
|
12
|
+
shop_domain: shop_domain,
|
13
|
+
configuration: configuration,
|
14
|
+
extension_point_type: extension_point_type,
|
15
|
+
title: title
|
16
|
+
)
|
17
|
+
spinner.update_title(p_ctx.message('script.application.enabled'))
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -20,10 +20,12 @@ module Script
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def push_script(ctx, task_runner, script, api_key, force)
|
23
|
-
|
24
|
-
.
|
25
|
-
|
26
|
-
|
23
|
+
UI::PrintingSpinner.spin(ctx, ctx.message('script.application.pushing')) do |p_ctx, spinner|
|
24
|
+
Infrastructure::PushPackageRepository.new(ctx: p_ctx)
|
25
|
+
.get_push_package(script, task_runner.compiled_type)
|
26
|
+
.push(Infrastructure::ScriptService.new(ctx: p_ctx), api_key, force)
|
27
|
+
spinner.update_title(p_ctx.message('script.application.pushed'))
|
28
|
+
end
|
27
29
|
end
|
28
30
|
end
|
29
31
|
end
|
@@ -8,12 +8,14 @@ module Script
|
|
8
8
|
class InvalidExtensionPointError < ScriptProjectError
|
9
9
|
attr_reader :type
|
10
10
|
def initialize(type)
|
11
|
+
super()
|
11
12
|
@type = type
|
12
13
|
end
|
13
14
|
end
|
14
15
|
class ScriptNotFoundError < ScriptProjectError
|
15
16
|
attr_reader :script_name, :extension_point_type
|
16
17
|
def initialize(extension_point_type, script_name)
|
18
|
+
super()
|
17
19
|
@script_name = script_name
|
18
20
|
@extension_point_type = extension_point_type
|
19
21
|
end
|
@@ -86,14 +86,14 @@ module Script
|
|
86
86
|
"@shopify/scripts-toolchain-as": "#{extension_point.sdks[:ts].toolchain_version}",
|
87
87
|
"#{extension_point.sdks[:ts].package}": "#{extension_point.sdks[:ts].version}",
|
88
88
|
"@as-pect/cli": "4.0.0",
|
89
|
-
"as-wasi": "^0.0
|
89
|
+
"as-wasi": "^0.2.0",
|
90
90
|
"assemblyscript": "^0.12.0"
|
91
91
|
},
|
92
92
|
"scripts": {
|
93
93
|
"test": "asp --config test/as-pect.config.js --summary --verbose"
|
94
94
|
},
|
95
95
|
"engines": {
|
96
|
-
"node": ">=
|
96
|
+
"node": ">=14.5"
|
97
97
|
}
|
98
98
|
}
|
99
99
|
HERE
|
@@ -6,7 +6,7 @@ module Script
|
|
6
6
|
class AssemblyScriptTaskRunner
|
7
7
|
BYTECODE_FILE = "%{name}.wasm"
|
8
8
|
SCRIPT_SDK_BUILD = "npx --no-install shopify-scripts-build --src=../%{source} --binary=#{BYTECODE_FILE} "\
|
9
|
-
"-- --lib=../node_modules --
|
9
|
+
"-- --lib=../node_modules --optimize --use Date="
|
10
10
|
|
11
11
|
attr_reader :ctx, :script_name, :script_source_file
|
12
12
|
|
@@ -34,7 +34,7 @@ module Script
|
|
34
34
|
|
35
35
|
def dependencies_installed?
|
36
36
|
# Assuming if node_modules folder exist at root of script folder, all deps are installed
|
37
|
-
ctx.
|
37
|
+
ctx.dir_exist?("node_modules")
|
38
38
|
end
|
39
39
|
|
40
40
|
private
|
@@ -5,6 +5,7 @@ module Script
|
|
5
5
|
module Infrastructure
|
6
6
|
module Errors
|
7
7
|
class AppNotInstalledError < ScriptProjectError; end
|
8
|
+
class AppScriptNotPushedError < ScriptProjectError; end
|
8
9
|
class AppScriptUndefinedError < ScriptProjectError; end
|
9
10
|
class BuildError < ScriptProjectError; end
|
10
11
|
class DependencyInstallError < ScriptProjectError; end
|
@@ -20,6 +21,7 @@ module Script
|
|
20
21
|
class ScriptRepushError < ScriptProjectError
|
21
22
|
attr_reader :api_key
|
22
23
|
def initialize(api_key)
|
24
|
+
super()
|
23
25
|
@api_key = api_key
|
24
26
|
end
|
25
27
|
end
|