shopify-cli 2.7.4 → 2.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/Gemfile.lock +1 -1
  4. data/RELEASING.md +4 -3
  5. data/ext/javy/javy.rb +1 -1
  6. data/lib/project_types/extension/commands/push.rb +2 -2
  7. data/lib/project_types/extension/messages/messages.rb +1 -1
  8. data/lib/project_types/extension/models/development_server.rb +2 -4
  9. data/lib/project_types/rails/gem.rb +1 -2
  10. data/lib/project_types/script/cli.rb +5 -0
  11. data/lib/project_types/script/commands/connect.rb +1 -1
  12. data/lib/project_types/script/commands/create.rb +8 -2
  13. data/lib/project_types/script/commands/push.rb +35 -12
  14. data/lib/project_types/script/graphql/app_script_set.graphql +2 -0
  15. data/lib/project_types/script/layers/application/build_script.rb +0 -1
  16. data/lib/project_types/script/layers/application/connect_app.rb +11 -5
  17. data/lib/project_types/script/layers/application/extension_points.rb +50 -26
  18. data/lib/project_types/script/layers/application/push_script.rb +6 -3
  19. data/lib/project_types/script/layers/domain/errors.rb +3 -2
  20. data/lib/project_types/script/layers/domain/extension_point.rb +14 -0
  21. data/lib/project_types/script/layers/domain/push_package.rb +0 -3
  22. data/lib/project_types/script/layers/domain/script_config.rb +6 -4
  23. data/lib/project_types/script/layers/domain/script_project.rb +1 -0
  24. data/lib/project_types/script/layers/infrastructure/errors.rb +38 -23
  25. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +0 -4
  26. data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +0 -4
  27. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +6 -7
  28. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +45 -54
  29. data/lib/project_types/script/layers/infrastructure/script_service.rb +25 -6
  30. data/lib/project_types/script/loaders/project.rb +44 -0
  31. data/lib/project_types/script/loaders/specification_handler.rb +22 -0
  32. data/lib/project_types/script/messages/messages.rb +28 -16
  33. data/lib/project_types/script/ui/error_handler.rb +46 -29
  34. data/lib/project_types/theme/commands/pull.rb +45 -17
  35. data/lib/project_types/theme/commands/push.rb +62 -27
  36. data/lib/project_types/theme/commands/serve.rb +5 -0
  37. data/lib/project_types/theme/messages/messages.rb +33 -18
  38. data/lib/shopify_cli/commands/login.rb +1 -1
  39. data/lib/shopify_cli/commands/switch.rb +1 -1
  40. data/lib/shopify_cli/constants.rb +7 -2
  41. data/lib/shopify_cli/context.rb +66 -12
  42. data/lib/shopify_cli/core/executor.rb +4 -4
  43. data/lib/shopify_cli/environment.rb +50 -20
  44. data/lib/shopify_cli/identity_auth.rb +4 -3
  45. data/lib/shopify_cli/messages/messages.rb +2 -0
  46. data/lib/shopify_cli/method_object.rb +21 -9
  47. data/lib/shopify_cli/resources/env_file.rb +5 -1
  48. data/lib/shopify_cli/result.rb +61 -59
  49. data/lib/shopify_cli/task.rb +5 -3
  50. data/lib/shopify_cli/theme/dev_server/hot-reload.js +19 -1
  51. data/lib/shopify_cli/theme/dev_server/hot_reload.rb +18 -2
  52. data/lib/shopify_cli/theme/dev_server/proxy.rb +1 -0
  53. data/lib/shopify_cli/theme/dev_server/reload_mode.rb +34 -0
  54. data/lib/shopify_cli/theme/dev_server.rb +6 -21
  55. data/lib/shopify_cli/theme/file.rb +2 -2
  56. data/lib/shopify_cli/theme/filter/path_matcher.rb +38 -0
  57. data/lib/shopify_cli/theme/ignore_filter.rb +14 -18
  58. data/lib/shopify_cli/theme/include_filter.rb +43 -0
  59. data/lib/shopify_cli/theme/syncer.rb +17 -2
  60. data/lib/shopify_cli/theme/theme.rb +26 -4
  61. data/lib/shopify_cli/version.rb +1 -1
  62. data/lib/shopify_cli.rb +6 -1
  63. data/vendor/deps/ruby2_keywords/LICENSE +22 -0
  64. data/vendor/deps/ruby2_keywords/README.md +67 -0
  65. data/vendor/deps/ruby2_keywords/Rakefile +54 -0
  66. data/vendor/deps/ruby2_keywords/lib/ruby2_keywords.rb +57 -0
  67. data/vendor/deps/ruby2_keywords/ruby2_keywords.gemspec +18 -0
  68. data/vendor/deps/ruby2_keywords/test/test_keyword.rb +41 -0
  69. metadata +13 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '068a38773a84e132b2b1dd435d4e369a2100d2fca4cccb539699e6033f816fb7'
4
- data.tar.gz: d4f356f9f4bf9f0e43733da4f223f7e02917d8c29e4193c90eb276ac80a73c5b
3
+ metadata.gz: 39a23d6414281b45d36b3508a09f88b629300733e5a3177ce9923905ce26e0ee
4
+ data.tar.gz: 38483662a8c42d1463f1b157262a2cec3cf8c4fda0cb5ccfa74a207a3687be33
5
5
  SHA512:
6
- metadata.gz: a163a0878650fbf8c846fa9d510240c3b4f938a621e14558a63788ce56e63a8fe39e6254ef4cc83107cd6b241d2d66e2fe935cd207d47a88c20182ceb7d59d5c
7
- data.tar.gz: db35b09603e3ccb0c7a526da096a76663b4ab5f952cb37e1bde4b71fba3509d87c3e8626929e8d20e316a4c04097d3430da98e252b9634d5a0e53586b06ec2a9
6
+ metadata.gz: 58b6b7aa28665cf1107c83ffa6f553eb4cca1661ff8d66d3ef47c9a4d9a3edb46a73e8f38bb5f0f6976699a4a94b58d408e11c2622718be1a554575048c844c3
7
+ data.tar.gz: e060cfe1fc4c2917f096b9c0c48f9562f441fb005b6669c1ad93ac8c0a6121ae8c2fac0759fd8f591f4700b0c717f993286b67911cfa133d5cab605a600d69c8
data/CHANGELOG.md CHANGED
@@ -2,6 +2,39 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## Version 2.10.1
6
+ ### Fixed
7
+ * [#1985](https://github.com/Shopify/shopify-cli/pull/1985): Revert "Fix CORS (Cross-origin resource sharing) errors (#1952)"
8
+
9
+ ## Version 2.10.0
10
+ ### Fixed
11
+ * [#1937](https://github.com/Shopify/shopify-cli/pull/1937): Fix `theme pull` to no longer add empty lines on Windows
12
+ * [#1952](https://github.com/Shopify/shopify-cli/pull/1952): Fix CORS (cross-origin resource sharing) errors
13
+ * [#1965](https://github.com/Shopify/shopify-cli/pull/1965): Revert: Fix partners ability to login to external shops. (#1873)
14
+
15
+ ### Added
16
+ * [#1892](https://github.com/Shopify/shopify-cli/pull/1892): Add `-o`/`--only` parameter to filter files on `theme push`/`theme pull` commands
17
+
18
+ ## Version 2.9.0
19
+ ### Fixed
20
+ * [#1922](https://github.com/Shopify/shopify-cli/pull/1922): Respect RUBY_BINDIR from Homebrew for installing gem
21
+ * [#1906](https://github.com/Shopify/shopify-cli/pull/1906): Fix Ngrok incompatibility with some Apple ARM environments
22
+ * [#1873](https://github.com/Shopify/shopify-cli/pull/1873): Fix partners ability to login to external shops.
23
+ * [#1909](https://github.com/Shopify/shopify-cli/pull/1909): Fix `theme serve` on Safari
24
+
25
+ ### Added
26
+ * [#1900](https://github.com/Shopify/shopify-cli/pull/1900): Add `-d`/`--development` flag to Shopify theme pull command
27
+ * [#1891](https://github.com/Shopify/shopify-cli/pull/1891): Allow for additional arguments in `shopify push script` on CI.
28
+ * [#1877](https://github.com/Shopify/shopify-cli/pull/1877): Add theme (`-t`/`--theme=NAME_OR_ID`) parameter to `theme push`/`theme pull` commands
29
+ * [#1871](https://github.com/Shopify/shopify-cli/pull/1871): Add a new `--live-reload` parameter to the `theme serve` command
30
+
31
+ ### Changed
32
+ - [#1929](https://github.com/Shopify/shopify-cli/pull/1929): Rename `--registration-id` to `--extension-id` in `shopify extension push`.
33
+
34
+ ## Version 2.8.0
35
+ ### Fixed
36
+ * [#1879](https://github.com/Shopify/shopify-cli/pull/1879): Disambiguate -s as store option
37
+
5
38
  ## Version 2.7.4
6
39
  ### Added
7
40
  * [#1825](https://github.com/Shopify/shopify-cli/pull/1825): Support passing the connection information through arguments
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.7.4)
4
+ shopify-cli (2.10.1)
5
5
  bugsnag (~> 6.22)
6
6
  listen (~> 3.7.0)
7
7
  theme-check (~> 1.9.0)
data/RELEASING.md CHANGED
@@ -23,21 +23,22 @@
23
23
  ```
24
24
 
25
25
  9. Open a PR for the branch, get necessary approvals from code owners and merge into main branch. Note that the PR title will be the release note in Shipit, so make sure it mentions the release
26
- 10. Deploy using Shipit
26
+ 10. Deploy to RubyGems using [Shipit](https://shipit.shopify.io/shopify/shopify-cli/rubygems)
27
27
  11. Update your `main` branch to the latest version
28
28
  ```
29
29
  $ git checkout main
30
30
  $ git pull
31
31
  ```
32
32
 
33
- 12. On local machine and _AFTER_ gem has been published to https://rubygems.org, run
33
+ 12. On local machine and _AFTER_ gem has been published to https://rubygems.org/gems/shopify-cli, run
34
34
  ```
35
35
  $ rake package
36
36
  ```
37
37
  This will generate the `.deb`, `.rpm` and brew formula files, which will be located in `packaging/builds/X.Y.Z/`.
38
38
 
39
39
  13. Clone the `Shopify/homebrew-shopify` repository (if not already cloned), and then
40
- * create a branch named `release_X_Y_Z_of_shopify-cli`
40
+ * update your `master` branch to the latest version: `git checkout master && git pull`
41
+ * create a new branch: `git checkout -b release_X_Y_Z_of_shopify-cli`
41
42
  * update the brew formula in `shopify-cli.rb` with the generated formula in `packaging/builds/X.Y.Z/` in the `Shopify/shopify-cli` repo (from the `rake package` step above)
42
43
  * commit the change and create a PR on the [Shopify Homebrew repository](https://github.com/Shopify/homebrew-shopify)
43
44
  * when PR is approved, merge into main branch
data/ext/javy/javy.rb CHANGED
@@ -5,7 +5,7 @@ require "digest/sha2"
5
5
 
6
6
  module Javy
7
7
  ROOT = __dir__
8
- BIN_FOLDER = File.join(ROOT, "bin")
8
+ BIN_FOLDER = File.join(ShopifyCLI.cache_dir, "javy", "bin")
9
9
  HASH_FOLDER = File.join(ROOT, "hashes")
10
10
  VERSION = File.read(File.join(ROOT, "version")).strip
11
11
  TARGET = File.join(BIN_FOLDER, "javy-#{VERSION}")
@@ -9,7 +9,7 @@ module Extension
9
9
  options do |parser, flags|
10
10
  parser.on("--api-key=API_KEY") { |api_key| flags[:api_key] = api_key.gsub('"', "") }
11
11
  parser.on("--api-secret=API_SECRET") { |api_secret| flags[:api_secret] = api_secret.gsub('"', "") }
12
- parser.on("--registration-id=REGISTRATION_ID") do |registration_id|
12
+ parser.on("--extension-id=EXTENSION_ID") do |registration_id|
13
13
  flags[:registration_id] = registration_id.gsub('"', "")
14
14
  end
15
15
  end
@@ -35,7 +35,7 @@ module Extension
35
35
  end
36
36
 
37
37
  def register_if_necessary(project:, args:, name:)
38
- if @ctx.tty? && !project.registered?
38
+ if ShopifyCLI::Environment.interactive? && !project.registered?
39
39
  Command::Register.new(@ctx).call(args, name)
40
40
  end
41
41
  end
@@ -91,7 +91,7 @@ module Extension
91
91
  Usage: {{command:%s extension push}}
92
92
  Options:
93
93
  {{command:--api-key=API_KEY}} Connect your extension and app by inserting your app's API key (which you can get from your app setup page on shopify.dev).
94
- {{command:--registration-id=REGISTRATION_ID}} The id of the extension's registration.
94
+ {{command:--extension-id=EXTENSION_ID}} The id of the extension's registration.
95
95
  HELP
96
96
  frame_title: "Pushing your extension to Shopify",
97
97
  waiting_text: "Pushing code to Shopify…",
@@ -40,7 +40,7 @@ module Extension
40
40
 
41
41
  def serve(context, server_config)
42
42
  CLI::Kit::System.popen3(executable, "serve", "-") do |input, out, err, status|
43
- context.puts("Sending configuration data …")
43
+ context.debug("Sending configuration data to extension development server …")
44
44
  input << server_config.to_yaml
45
45
  input.close
46
46
 
@@ -57,17 +57,15 @@ module Extension
57
57
  private
58
58
 
59
59
  def forward_output_to_user(out, err, ctx)
60
- ctx.puts("Starting monitoring threads …")
60
+ ctx.debug("Starting message processing threads to relay output produced by the extension development server …")
61
61
 
62
62
  Thread.new do
63
- ctx.puts("Ready to process standard output")
64
63
  while (line = out.gets)
65
64
  ctx.puts(line)
66
65
  end
67
66
  end
68
67
 
69
68
  Thread.new do
70
- ctx.puts("Ready to process standard error")
71
69
  while (error = err.gets)
72
70
  ctx.puts(error)
73
71
  end
@@ -79,8 +79,7 @@ module Rails
79
79
  def install!
80
80
  spin = CLI::UI::SpinGroup.new
81
81
  spin.add(ctx.message("rails.gem.installing", name)) do |spinner|
82
- args = %w(gem install)
83
- args.push(name)
82
+ args = ["#{ENV["RUBY_BINDIR"]}gem", "install", name]
84
83
  unless version.nil?
85
84
  if ctx.windows? && version.include?("~")
86
85
  args.push("-v", "\"#{version}\"")
@@ -92,5 +92,10 @@ module Script
92
92
 
93
93
  autoload :Errors, Project.project_filepath("errors")
94
94
 
95
+ module Loaders
96
+ autoload :Project, Script::Project.project_filepath("loaders/project")
97
+ autoload :SpecificationHandler, Script::Project.project_filepath("loaders/specification_handler")
98
+ end
99
+
95
100
  class ScriptProjectError < StandardError; end
96
101
  end
@@ -6,7 +6,7 @@ module Script
6
6
  prerequisite_task ensure_project_type: :script
7
7
 
8
8
  def call(_args, _)
9
- Layers::Application::ConnectApp.call(ctx: @ctx, force: true, strict: true)
9
+ Layers::Application::ConnectApp.call(ctx: @ctx, force: true)
10
10
  rescue StandardError => e
11
11
  UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.connect.error.operation_failed"))
12
12
  end
@@ -33,8 +33,14 @@ module Script
33
33
  end
34
34
 
35
35
  def self.help
36
- allowed_values = Script::Layers::Application::ExtensionPoints.available_types.map { |type| "{{cyan:#{type}}}" }
37
- ShopifyCLI::Context.message("script.create.help", ShopifyCLI::TOOL_NAME, allowed_values.join(", "))
36
+ allowed_apis = Layers::Application::ExtensionPoints.available_types.map { |type| "{{cyan:#{type}}}" }
37
+ allowed_languages = Layers::Application::ExtensionPoints.all_languages.map { |lang| "{{cyan:#{lang}}}" }
38
+ ShopifyCLI::Context.message(
39
+ "script.create.help",
40
+ ShopifyCLI::TOOL_NAME,
41
+ allowed_apis.join(", "),
42
+ allowed_languages.join(", ")
43
+ )
38
44
  end
39
45
  end
40
46
  end
@@ -7,25 +7,48 @@ module Script
7
7
 
8
8
  options do |parser, flags|
9
9
  parser.on("--force") { |t| flags[:force] = t }
10
+ parser.on("--api-key=API_KEY") { |api_key| flags[:api_key] = api_key.gsub('"', "") }
11
+ parser.on("--api-secret=API_SECRET") { |api_secret| flags[:api_secret] = api_secret.gsub('"', "") }
12
+ parser.on("--uuid=UUID") do |uuid|
13
+ flags[:uuid] = uuid.gsub('""', "")
14
+ end
10
15
  end
11
16
 
12
17
  def call(_args, _name)
13
- fresh_env = Layers::Application::ConnectApp.call(ctx: @ctx)
14
-
15
- force = options.flags.key?(:force) || !!fresh_env
18
+ connect_to_app
19
+ project = load_project
20
+ push(project: project)
21
+ rescue StandardError => e
22
+ UI::ErrorHandler.pretty_print_and_raise(e,
23
+ failed_op: @ctx.message("script.push.error.operation_failed_no_api_key"))
24
+ end
16
25
 
17
- api_key = Layers::Infrastructure::ScriptProjectRepository.new(ctx: @ctx).get.api_key
18
- return @ctx.puts(self.class.help) unless api_key
26
+ def push(project:)
27
+ force = options.flags.key?(:force)
28
+ api_key = project.env[:api_key]
29
+ uuid = project.env[:extra]["UUID"]
19
30
 
20
- Layers::Application::PushScript.call(ctx: @ctx, force: force)
21
- @ctx.puts(@ctx.message("script.push.script_pushed", api_key: api_key))
22
- rescue StandardError => e
23
- msg = if api_key
24
- @ctx.message("script.push.error.operation_failed_with_api_key", api_key: api_key)
31
+ if ShopifyCLI::Environment.interactive? || (uuid && !uuid.empty?)
32
+ Layers::Application::PushScript.call(ctx: @ctx, force: force, project: project)
33
+ @ctx.puts(@ctx.message("script.push.script_pushed", api_key: api_key))
25
34
  else
26
- @ctx.message("script.push.error.operation_failed_no_api_key")
35
+ raise ShopifyCLI::Abort, @ctx.message("script.push.error.operation_failed_no_uuid")
36
+ end
37
+ end
38
+
39
+ def load_project
40
+ Script::Loaders::Project.load(
41
+ directory: Dir.pwd,
42
+ api_key: options.flags[:api_key],
43
+ api_secret: options.flags[:api_secret],
44
+ uuid: options.flags[:uuid]
45
+ )
46
+ end
47
+
48
+ def connect_to_app
49
+ if ShopifyCLI::Environment.interactive?
50
+ Layers::Application::ConnectApp.call(ctx: @ctx)
27
51
  end
28
- UI::ErrorHandler.pretty_print_and_raise(e, failed_op: msg)
29
52
  end
30
53
 
31
54
  def self.help
@@ -11,6 +11,7 @@ mutation AppScriptSet(
11
11
  $configurationDefinition: String!,
12
12
  $moduleUploadUrl: String!,
13
13
  $library: LibraryInput,
14
+ $inputQuery: String,
14
15
  ) {
15
16
  appScriptSet(
16
17
  uuid: $uuid
@@ -25,6 +26,7 @@ mutation AppScriptSet(
25
26
  configurationDefinition: $configurationDefinition,
26
27
  moduleUploadUrl: $moduleUploadUrl,
27
28
  library: $library,
29
+ inputQuery: $inputQuery,
28
30
  ) {
29
31
  userErrors {
30
32
  field
@@ -12,7 +12,6 @@ module Script
12
12
  Infrastructure::PushPackageRepository.new(ctx: ctx).create_push_package(
13
13
  script_project: script_project,
14
14
  script_content: task_runner.build,
15
- compiled_type: task_runner.compiled_type,
16
15
  metadata: task_runner.metadata,
17
16
  library: library,
18
17
  )
@@ -7,7 +7,7 @@ module Script
7
7
  module Application
8
8
  class ConnectApp
9
9
  class << self
10
- def call(ctx:, force: false, strict: false)
10
+ def call(ctx:, force: false)
11
11
  script_project_repo = Layers::Infrastructure::ScriptProjectRepository.new(ctx: ctx)
12
12
  script_project = script_project_repo.get
13
13
 
@@ -40,10 +40,6 @@ module Script
40
40
 
41
41
  uuid = Forms::AskScriptUuid.ask(ctx, scripts, nil)&.uuid
42
42
 
43
- if strict && uuid.nil?
44
- ctx.abort(ctx.message("script.connect.missing_script"))
45
- end
46
-
47
43
  script_project_repo.create_env(
48
44
  api_key: app["apiKey"],
49
45
  secret: app["apiSecretKeys"].first["secret"],
@@ -52,6 +48,16 @@ module Script
52
48
  ctx.done(ctx.message("script.connect.connected", app["title"]))
53
49
 
54
50
  true
51
+ rescue SmartProperties::InitializationError, SmartProperties::InvalidValueError => error
52
+ handle_error(error, context: ctx)
53
+ end
54
+
55
+ def handle_error(error, context:)
56
+ properties_hash = { api_key: "SHOPIFY_API_KEY", secret: "SHOPIFY_API_SECRET" }
57
+ missing_env_variables = error.properties.map { |p| properties_hash[p.name] }.compact.join(", ")
58
+ raise ShopifyCLI::Abort,
59
+ context.message("script.connect.error.missing_env_file_variables", missing_env_variables,
60
+ ShopifyCLI::TOOL_NAME)
55
61
  end
56
62
 
57
63
  private
@@ -4,37 +4,61 @@ module Script
4
4
  module Layers
5
5
  module Application
6
6
  class ExtensionPoints
7
- def self.get(type:)
8
- Infrastructure::ExtensionPointRepository.new.get_extension_point(type)
9
- end
7
+ class << self
8
+ def get(type:)
9
+ extension_point_repository.get_extension_point(type)
10
+ end
10
11
 
11
- def self.types
12
- Infrastructure::ExtensionPointRepository.new.extension_point_types
13
- end
12
+ def types
13
+ extension_point_repository.extension_point_types
14
+ end
14
15
 
15
- def self.available_types
16
- Infrastructure::ExtensionPointRepository.new.extension_points.select do |ep|
17
- next false if ep.deprecated?
18
- !ep.beta? || ShopifyCLI::Feature.enabled?(:scripts_beta_extension_points)
19
- end.map(&:type)
20
- end
16
+ def available_types
17
+ available_extension_points.map(&:type)
18
+ end
21
19
 
22
- def self.deprecated_types
23
- Infrastructure::ExtensionPointRepository.new
24
- .extension_points
25
- .select(&:deprecated?)
26
- .map(&:type)
27
- end
20
+ def deprecated_types
21
+ extension_point_repository
22
+ .extension_points
23
+ .select(&:deprecated?)
24
+ .map(&:type)
25
+ end
28
26
 
29
- def self.languages(type:)
30
- get(type: type).libraries.all.map do |library|
31
- next nil if library.beta? && !ShopifyCLI::Feature.enabled?(:scripts_beta_languages)
32
- library.language
33
- end.compact
34
- end
27
+ def all_languages
28
+ available_extension_points
29
+ .map { |ep| ep.library_languages(include_betas: include_beta_languages?) }
30
+ .flatten
31
+ .uniq
32
+ end
33
+
34
+ def languages(type:)
35
+ get(type: type).library_languages(include_betas: include_beta_languages?)
36
+ end
37
+
38
+ def supported_language?(type:, language:)
39
+ languages(type: type).include?(language.downcase)
40
+ end
41
+
42
+ private
43
+
44
+ def available_extension_points
45
+ extension_point_repository.extension_points.select do |ep|
46
+ next false if ep.deprecated?
47
+ ep.stable? || include_beta_extension_points?
48
+ end
49
+ end
50
+
51
+ def extension_point_repository
52
+ Infrastructure::ExtensionPointRepository.new
53
+ end
54
+
55
+ def include_beta_languages?
56
+ ShopifyCLI::Feature.enabled?(:scripts_beta_languages)
57
+ end
35
58
 
36
- def self.supported_language?(type:, language:)
37
- languages(type: type).include?(language.downcase)
59
+ def include_beta_extension_points?
60
+ ShopifyCLI::Feature.enabled?(:scripts_beta_extension_points)
61
+ end
38
62
  end
39
63
  end
40
64
  end
@@ -5,9 +5,10 @@ module Script
5
5
  module Application
6
6
  class PushScript
7
7
  class << self
8
- def call(ctx:, force:)
8
+ def call(ctx:, force:, project:)
9
9
  script_project_repo = Infrastructure::ScriptProjectRepository.new(ctx: ctx)
10
10
  script_project = script_project_repo.get
11
+ script_project.env = project.env
11
12
  task_runner = Infrastructure::Languages::TaskRunner
12
13
  .for(ctx, script_project.language, script_project.script_name)
13
14
 
@@ -29,7 +30,6 @@ module Script
29
30
  UI::PrintingSpinner.spin(ctx, ctx.message("script.application.pushing")) do |p_ctx, spinner|
30
31
  package = Infrastructure::PushPackageRepository.new(ctx: p_ctx).get_push_package(
31
32
  script_project: script_project,
32
- compiled_type: task_runner.compiled_type,
33
33
  metadata: task_runner.metadata,
34
34
  library: library,
35
35
  )
@@ -46,8 +46,11 @@ module Script
46
46
  script_config: package.script_config,
47
47
  module_upload_url: module_upload_url,
48
48
  library: package.library,
49
+ input_query: script_project.input_query,
49
50
  )
50
- script_project_repo.update_env(uuid: uuid)
51
+ if ShopifyCLI::Environment.interactive?
52
+ script_project_repo.update_env(uuid: uuid)
53
+ end
51
54
  spinner.update_title(p_ctx.message("script.application.pushed"))
52
55
  end
53
56
  end
@@ -15,10 +15,11 @@ module Script
15
15
  end
16
16
 
17
17
  class MissingScriptConfigFieldError < ScriptProjectError
18
- attr_reader :field
19
- def initialize(field)
18
+ attr_reader :field, :filename
19
+ def initialize(field:, filename:)
20
20
  super()
21
21
  @field = field
22
+ @filename = filename
22
23
  end
23
24
  end
24
25
 
@@ -18,6 +18,10 @@ module Script
18
18
  @beta
19
19
  end
20
20
 
21
+ def stable?
22
+ !beta?
23
+ end
24
+
21
25
  def deprecated?
22
26
  @deprecated
23
27
  end
@@ -26,6 +30,12 @@ module Script
26
30
  @type.gsub("_", "-")
27
31
  end
28
32
 
33
+ def library_languages(include_betas: false)
34
+ @libraries.all.map do |library|
35
+ include_betas || library.stable? ? library.language : nil
36
+ end.compact
37
+ end
38
+
29
39
  class ExtensionPointLibraries
30
40
  def initialize(config)
31
41
  @config = config
@@ -57,6 +67,10 @@ module Script
57
67
  @beta
58
68
  end
59
69
 
70
+ def stable?
71
+ !beta?
72
+ end
73
+
60
74
  def versioned?
61
75
  @version
62
76
  end
@@ -9,7 +9,6 @@ module Script
9
9
  :extension_point_type,
10
10
  :script_config,
11
11
  :script_content,
12
- :compiled_type,
13
12
  :metadata,
14
13
  :library
15
14
 
@@ -18,7 +17,6 @@ module Script
18
17
  uuid:,
19
18
  extension_point_type:,
20
19
  script_content:,
21
- compiled_type: nil,
22
20
  metadata:,
23
21
  script_config:,
24
22
  library:
@@ -27,7 +25,6 @@ module Script
27
25
  @uuid = uuid
28
26
  @extension_point_type = extension_point_type
29
27
  @script_content = script_content
30
- @compiled_type = compiled_type
31
28
  @metadata = metadata
32
29
  @script_config = script_config
33
30
  @library = library
@@ -4,13 +4,13 @@ module Script
4
4
  module Layers
5
5
  module Domain
6
6
  class ScriptConfig
7
- attr_reader :content, :version, :title, :description, :configuration_ui, :configuration
7
+ attr_reader :content, :version, :title, :description, :configuration_ui, :configuration, :filename
8
8
 
9
9
  REQUIRED_FIELDS = %w(version title)
10
10
 
11
- def initialize(content:)
11
+ def initialize(content:, filename:)
12
+ @filename = filename
12
13
  validate_content!(content)
13
-
14
14
  @content = content
15
15
  @version = @content["version"].to_s
16
16
  @title = @content["title"]
@@ -23,7 +23,9 @@ module Script
23
23
 
24
24
  def validate_content!(content)
25
25
  REQUIRED_FIELDS.each do |field|
26
- raise Errors::MissingScriptConfigFieldError, field if content[field].nil?
26
+ if content[field].nil?
27
+ raise Errors::MissingScriptConfigFieldError.new(field: field, filename: filename)
28
+ end
27
29
  end
28
30
  end
29
31
  end
@@ -16,6 +16,7 @@ module Script
16
16
  property! :language, accepts: String
17
17
 
18
18
  property :script_config, accepts: ScriptConfig
19
+ property :input_query, accepts: String
19
20
 
20
21
  def initialize(*)
21
22
  super