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.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.github/PULL_REQUEST_TEMPLATE.md +1 -0
  3. data/.github/workflows/build.yml +28 -0
  4. data/.rubocop_todo.yml +15 -2
  5. data/CHANGELOG.md +24 -1
  6. data/Gemfile.lock +4 -4
  7. data/README.md +2 -1
  8. data/dev.yml +3 -0
  9. data/lib/graphql/extension_create.graphql +17 -2
  10. data/lib/project_types/extension/cli.rb +8 -0
  11. data/lib/project_types/extension/commands/extension_command.rb +4 -4
  12. data/lib/project_types/extension/commands/push.rb +2 -2
  13. data/lib/project_types/extension/commands/register.rb +4 -3
  14. data/lib/project_types/extension/commands/serve.rb +62 -28
  15. data/lib/project_types/extension/commands/tunnel.rb +3 -1
  16. data/lib/project_types/extension/extension_project.rb +16 -4
  17. data/lib/project_types/extension/extension_project_keys.rb +2 -1
  18. data/lib/project_types/extension/features/argo.rb +19 -44
  19. data/lib/project_types/extension/features/argo_runtime.rb +84 -0
  20. data/lib/project_types/extension/features/argo_serve.rb +80 -0
  21. data/lib/project_types/extension/features/argo_serve_options.rb +41 -0
  22. data/lib/project_types/extension/features/argo_setup.rb +1 -1
  23. data/lib/project_types/extension/messages/message_loading.rb +3 -1
  24. data/lib/project_types/extension/messages/messages.rb +5 -4
  25. data/lib/project_types/extension/models/npm_package.rb +14 -0
  26. data/lib/project_types/extension/models/registration.rb +1 -0
  27. data/lib/project_types/extension/models/specification.rb +3 -0
  28. data/lib/project_types/extension/models/specification_handlers/checkout_argo_extension.rb +18 -0
  29. data/lib/project_types/extension/models/specification_handlers/default.rb +49 -1
  30. data/lib/project_types/extension/models/version.rb +1 -1
  31. data/lib/project_types/extension/tasks/choose_next_available_port.rb +36 -0
  32. data/lib/project_types/extension/tasks/configure_features.rb +4 -0
  33. data/lib/project_types/extension/tasks/converters/registration_converter.rb +2 -0
  34. data/lib/project_types/extension/tasks/find_npm_packages.rb +106 -0
  35. data/lib/project_types/node/commands/generate.rb +0 -22
  36. data/lib/project_types/node/messages/messages.rb +4 -4
  37. data/lib/project_types/rails/messages/messages.rb +4 -4
  38. data/lib/project_types/script/cli.rb +7 -8
  39. data/lib/project_types/script/commands/create.rb +0 -7
  40. data/lib/project_types/script/commands/push.rb +3 -3
  41. data/lib/project_types/script/config/extension_points.yml +4 -0
  42. data/lib/project_types/script/errors.rb +0 -19
  43. data/lib/project_types/script/forms/create.rb +3 -14
  44. data/lib/project_types/script/graphql/app_script_update_or_create.graphql +5 -5
  45. data/lib/project_types/script/graphql/get_app_scripts.graphql +6 -0
  46. data/lib/project_types/script/graphql/script_service_proxy.graphql +1 -2
  47. data/lib/project_types/script/layers/application/build_script.rb +1 -2
  48. data/lib/project_types/script/layers/application/create_script.rb +30 -51
  49. data/lib/project_types/script/layers/application/extension_points.rb +3 -2
  50. data/lib/project_types/script/layers/application/push_script.rb +5 -5
  51. data/lib/project_types/script/layers/domain/errors.rb +0 -2
  52. data/lib/project_types/script/layers/domain/extension_point.rb +56 -46
  53. data/lib/project_types/script/layers/domain/metadata.rb +18 -25
  54. data/lib/project_types/script/layers/domain/push_package.rb +4 -4
  55. data/lib/project_types/script/layers/domain/script_project.rb +54 -0
  56. data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +15 -16
  57. data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +13 -7
  58. data/lib/project_types/script/layers/infrastructure/command_runner.rb +19 -0
  59. data/lib/project_types/script/layers/infrastructure/errors.rb +40 -11
  60. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +12 -13
  61. data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +9 -10
  62. data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +6 -7
  63. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +172 -0
  64. data/lib/project_types/script/layers/infrastructure/script_service.rb +21 -72
  65. data/lib/project_types/script/messages/messages.rb +20 -50
  66. data/lib/project_types/script/tasks/ensure_env.rb +85 -0
  67. data/lib/project_types/script/ui/error_handler.rb +32 -30
  68. data/lib/shopify-cli/context.rb +28 -0
  69. data/lib/shopify-cli/js_system.rb +2 -2
  70. data/lib/shopify-cli/messages/messages.rb +50 -45
  71. data/lib/shopify-cli/method_object.rb +4 -4
  72. data/lib/shopify-cli/oauth.rb +9 -3
  73. data/lib/shopify-cli/packager.rb +1 -1
  74. data/lib/shopify-cli/partners_api/organizations.rb +3 -3
  75. data/lib/shopify-cli/resolve_constant.rb +1 -1
  76. data/lib/shopify-cli/resources/env_file.rb +1 -1
  77. data/lib/shopify-cli/shopifolk.rb +1 -1
  78. data/lib/shopify-cli/tasks/select_org_and_shop.rb +6 -4
  79. data/lib/shopify-cli/transform_data_structure.rb +1 -1
  80. data/lib/shopify-cli/tunnel.rb +22 -1
  81. data/lib/shopify-cli/version.rb +1 -1
  82. data/lib/shopify_cli.rb +0 -1
  83. data/vendor/deps/smart_properties/REVISION +1 -1
  84. data/vendor/deps/smart_properties/lib/smart_properties/property.rb +7 -1
  85. data/vendor/deps/smart_properties/lib/smart_properties/version.rb +1 -1
  86. metadata +16 -12
  87. data/.travis.yml +0 -14
  88. data/lib/project_types/script/commands/disable.rb +0 -25
  89. data/lib/project_types/script/commands/enable.rb +0 -80
  90. data/lib/project_types/script/graphql/shop_script_delete.graphql +0 -14
  91. data/lib/project_types/script/graphql/shop_script_update_or_create.graphql +0 -28
  92. data/lib/project_types/script/layers/application/disable_script.rb +0 -21
  93. data/lib/project_types/script/layers/application/enable_script.rb +0 -23
  94. data/lib/project_types/script/layers/infrastructure/config_ui_repository.rb +0 -46
  95. data/lib/project_types/script/script_project.rb +0 -64
@@ -1,14 +0,0 @@
1
- mutation ShopScriptDelete($extensionPointName: ExtensionPointName!) {
2
- shopScriptDelete(extensionPointName: $extensionPointName) {
3
- userErrors {
4
- field
5
- message
6
- tag
7
- }
8
- shopScript {
9
- extensionPointName
10
- shopId
11
- title
12
- }
13
- }
14
- }
@@ -1,28 +0,0 @@
1
- mutation ShopScriptUpdateOrCreate(
2
- $extensionPointName: ExtensionPointName!,
3
- $configuration: ConfigurationInput,
4
- $title: String
5
- ) {
6
- shopScriptUpdateOrCreate(
7
- extensionPointName: $extensionPointName,
8
- configuration: $configuration,
9
- title: $title
10
- ) {
11
- userErrors {
12
- field
13
- message
14
- tag
15
- }
16
- shopScript {
17
- extensionPointName
18
- shopId
19
- title
20
- configuration {
21
- entries {
22
- key,
23
- value
24
- }
25
- }
26
- }
27
- }
28
- }
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Script
4
- module Layers
5
- module Application
6
- class DisableScript
7
- def self.call(ctx:, api_key:, shop_domain:, extension_point_type:)
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
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Script
4
- module Layers
5
- module Application
6
- class EnableScript
7
- def self.call(ctx:, api_key:, shop_domain:, configuration:, extension_point_type:, title:)
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
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Script
4
- module Layers
5
- module Infrastructure
6
- class ConfigUiRepository
7
- include SmartProperties
8
- property! :ctx, accepts: ShopifyCli::Context
9
-
10
- def create_config_ui(filename, content)
11
- File.write(filename, content)
12
-
13
- Domain::ConfigUi.new(
14
- filename: filename,
15
- content: content,
16
- )
17
- end
18
-
19
- def get_config_ui(filename)
20
- return nil unless filename
21
-
22
- path = File.join(ctx.root, filename)
23
- raise Domain::Errors::MissingSpecifiedConfigUiDefinitionError, filename unless File.exist?(path)
24
-
25
- content = File.read(path)
26
- raise Domain::Errors::InvalidConfigUiDefinitionError, filename unless valid_config_ui?(content)
27
-
28
- Domain::ConfigUi.new(
29
- filename: filename,
30
- content: content,
31
- )
32
- end
33
-
34
- private
35
-
36
- def valid_config_ui?(raw_yaml)
37
- require "yaml" # takes 20ms, so deferred as late as possible.
38
- YAML.safe_load(raw_yaml)
39
- true
40
- rescue Psych::SyntaxError
41
- false
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Script
4
- class ScriptProject < ShopifyCli::Project
5
- attr_reader :extension_point_type, :script_name, :language, :description, :config_ui_file
6
-
7
- def initialize(*args)
8
- super
9
- @extension_point_type = lookup_config!("extension_point_type")
10
- raise Errors::DeprecatedEPError, @extension_point_type if deprecated?(@extension_point_type)
11
- @script_name = lookup_config!("script_name")
12
- @description = lookup_config("description")
13
- @config_ui_file = lookup_config("config_ui_file")
14
- @language = lookup_language
15
- ShopifyCli::Core::Monorail.metadata = {
16
- "script_name" => @script_name,
17
- "extension_point_type" => @extension_point_type,
18
- "language" => @language,
19
- }
20
- end
21
-
22
- def api_key
23
- env[:api_key]
24
- end
25
-
26
- private
27
-
28
- def deprecated?(ep)
29
- Script::Layers::Application::ExtensionPoints.deprecated_types.include?(ep)
30
- end
31
-
32
- def lookup_config(key)
33
- return nil unless config.key?(key)
34
- config[key]
35
- end
36
-
37
- def lookup_config!(key)
38
- raise Errors::InvalidContextError, key unless config.key?(key)
39
- config[key]
40
- end
41
-
42
- def lookup_language
43
- lang = lookup_config("language")&.downcase || Layers::Domain::ExtensionPointAssemblyScriptSDK.language
44
- if Layers::Application::ExtensionPoints.supported_language?(type: extension_point_type, language: lang)
45
- lang
46
- else
47
- raise Errors::InvalidLanguageError.new(lang, extension_point_type)
48
- end
49
- end
50
-
51
- class << self
52
- def create(ctx, dir)
53
- raise Errors::ScriptProjectAlreadyExistsError, dir if ctx.dir_exist?(dir)
54
- ctx.mkdir_p(dir)
55
- ctx.chdir(dir)
56
- end
57
-
58
- def cleanup(ctx:, script_name:, root_dir:)
59
- ctx.chdir(root_dir)
60
- ctx.rm_r("#{root_dir}/#{script_name}") if ctx.dir_exist?("#{root_dir}/#{script_name}")
61
- end
62
- end
63
- end
64
- end