shopify-cli 1.7.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +28 -0
  3. data/.rubocop_todo.yml +15 -2
  4. data/CHANGELOG.md +21 -0
  5. data/Gemfile.lock +14 -14
  6. data/README.md +2 -1
  7. data/dev.yml +3 -0
  8. data/lib/docgen/markdown.rb +1 -1
  9. data/lib/graphql/extension_create.graphql +17 -2
  10. data/lib/graphql/fetch_specifications.graphql +14 -0
  11. data/lib/project_types/extension/cli.rb +4 -10
  12. data/lib/project_types/extension/commands/create.rb +2 -2
  13. data/lib/project_types/extension/commands/extension_command.rb +10 -6
  14. data/lib/project_types/extension/commands/push.rb +2 -2
  15. data/lib/project_types/extension/commands/register.rb +6 -5
  16. data/lib/project_types/extension/commands/serve.rb +1 -7
  17. data/lib/project_types/extension/extension_project.rb +19 -4
  18. data/lib/project_types/extension/extension_project_keys.rb +2 -1
  19. data/lib/project_types/extension/features/argo.rb +18 -34
  20. data/lib/project_types/extension/features/argo_renderer_package.rb +47 -0
  21. data/lib/project_types/extension/features/argo_serve.rb +69 -0
  22. data/lib/project_types/extension/features/argo_setup.rb +1 -1
  23. data/lib/project_types/extension/forms/questions/ask_type.rb +16 -5
  24. data/lib/project_types/extension/messages/message_loading.rb +3 -1
  25. data/lib/project_types/extension/messages/messages.rb +6 -6
  26. data/lib/project_types/extension/models/registration.rb +1 -0
  27. data/lib/project_types/extension/models/specification.rb +6 -2
  28. data/lib/project_types/extension/models/specification_handlers/default.rb +9 -1
  29. data/lib/project_types/extension/models/specifications.rb +12 -1
  30. data/lib/project_types/extension/models/version.rb +1 -1
  31. data/lib/project_types/extension/tasks/configure_features.rb +3 -1
  32. data/lib/project_types/extension/tasks/converters/registration_converter.rb +2 -0
  33. data/lib/project_types/extension/tasks/fetch_specifications.rb +8 -28
  34. data/lib/project_types/node/commands/generate.rb +0 -22
  35. data/lib/project_types/node/forms/create.rb +10 -1
  36. data/lib/project_types/node/messages/messages.rb +5 -4
  37. data/lib/project_types/rails/forms/create.rb +11 -1
  38. data/lib/project_types/rails/messages/messages.rb +5 -4
  39. data/lib/project_types/script/cli.rb +7 -7
  40. data/lib/project_types/script/commands/create.rb +2 -7
  41. data/lib/project_types/script/commands/push.rb +3 -3
  42. data/lib/project_types/script/config/extension_points.yml +27 -10
  43. data/lib/project_types/script/errors.rb +0 -35
  44. data/lib/project_types/script/forms/create.rb +3 -14
  45. data/lib/project_types/script/graphql/app_script_update_or_create.graphql +5 -5
  46. data/lib/project_types/script/graphql/get_app_scripts.graphql +6 -0
  47. data/lib/project_types/script/graphql/script_service_proxy.graphql +1 -2
  48. data/lib/project_types/script/layers/application/create_script.rb +32 -22
  49. data/lib/project_types/script/layers/application/extension_points.rb +3 -2
  50. data/lib/project_types/script/layers/application/push_script.rb +6 -3
  51. data/lib/project_types/script/layers/domain/config_ui.rb +16 -0
  52. data/lib/project_types/script/layers/domain/errors.rb +16 -0
  53. data/lib/project_types/script/layers/domain/extension_point.rb +60 -45
  54. data/lib/project_types/script/layers/domain/metadata.rb +18 -25
  55. data/lib/project_types/script/layers/domain/push_package.rb +4 -4
  56. data/lib/project_types/script/layers/domain/script_project.rb +54 -0
  57. data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +37 -8
  58. data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +5 -40
  59. data/lib/project_types/script/layers/infrastructure/errors.rb +50 -19
  60. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +8 -9
  61. data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +1 -1
  62. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +198 -0
  63. data/lib/project_types/script/layers/infrastructure/script_service.rb +27 -66
  64. data/lib/project_types/script/messages/messages.rb +28 -51
  65. data/lib/project_types/script/tasks/ensure_env.rb +77 -0
  66. data/lib/project_types/script/ui/error_handler.rb +63 -47
  67. data/lib/shopify-cli/context.rb +28 -0
  68. data/lib/shopify-cli/js_system.rb +2 -2
  69. data/lib/shopify-cli/messages/messages.rb +3 -2
  70. data/lib/shopify-cli/method_object.rb +1 -1
  71. data/lib/shopify-cli/oauth.rb +2 -2
  72. data/lib/shopify-cli/packager.rb +1 -1
  73. data/lib/shopify-cli/resolve_constant.rb +1 -1
  74. data/lib/shopify-cli/resources/env_file.rb +1 -1
  75. data/lib/shopify-cli/result.rb +3 -3
  76. data/lib/shopify-cli/tasks/ensure_dev_store.rb +1 -1
  77. data/lib/shopify-cli/transform_data_structure.rb +2 -2
  78. data/lib/shopify-cli/version.rb +1 -1
  79. data/lib/shopify_cli.rb +0 -1
  80. data/vendor/deps/smart_properties/REVISION +1 -1
  81. data/vendor/deps/smart_properties/lib/smart_properties/property.rb +7 -1
  82. data/vendor/deps/smart_properties/lib/smart_properties/version.rb +1 -1
  83. metadata +11 -10
  84. data/.travis.yml +0 -14
  85. data/lib/project_types/script/commands/disable.rb +0 -25
  86. data/lib/project_types/script/commands/enable.rb +0 -80
  87. data/lib/project_types/script/graphql/shop_script_delete.graphql +0 -14
  88. data/lib/project_types/script/graphql/shop_script_update_or_create.graphql +0 -28
  89. data/lib/project_types/script/layers/application/disable_script.rb +0 -21
  90. data/lib/project_types/script/layers/application/enable_script.rb +0 -23
  91. data/lib/project_types/script/script_project.rb +0 -85
@@ -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,85 +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
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 = lookup_config_ui
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_config_ui
43
- filename = lookup_config("config_ui_file")
44
- return nil unless filename
45
-
46
- path = File.join(directory, filename)
47
- raise Errors::MissingSpecifiedConfigUiDefinitionError, filename unless File.exist?(path)
48
-
49
- contents = File.read(path)
50
- raise Errors::InvalidConfigUiDefinitionError, filename unless valid_config_ui?(contents)
51
-
52
- contents
53
- end
54
-
55
- def lookup_language
56
- lang = lookup_config("language")&.downcase || Layers::Domain::ExtensionPointAssemblyScriptSDK.language
57
- if Layers::Application::ExtensionPoints.supported_language?(type: extension_point_type, language: lang)
58
- lang
59
- else
60
- raise Errors::InvalidLanguageError.new(lang, extension_point_type)
61
- end
62
- end
63
-
64
- def valid_config_ui?(raw_yaml)
65
- require "yaml" # takes 20ms, so deferred as late as possible.
66
- YAML.safe_load(raw_yaml)
67
- true
68
- rescue Psych::SyntaxError
69
- false
70
- end
71
-
72
- class << self
73
- def create(ctx, dir)
74
- raise Errors::ScriptProjectAlreadyExistsError, dir if ctx.dir_exist?(dir)
75
- ctx.mkdir_p(dir)
76
- ctx.chdir(dir)
77
- end
78
-
79
- def cleanup(ctx:, script_name:, root_dir:)
80
- ctx.chdir(root_dir)
81
- ctx.rm_r("#{root_dir}/#{script_name}") if ctx.dir_exist?("#{root_dir}/#{script_name}")
82
- end
83
- end
84
- end
85
- end