shopify-cli 2.12.0 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/shopify.yml +2 -1
  3. data/.rubocop.yml +1 -1
  4. data/.ruby-version +1 -1
  5. data/CHANGELOG.md +10 -0
  6. data/Gemfile.lock +14 -14
  7. data/bin/shopify +4 -4
  8. data/dev.yml +1 -1
  9. data/ext/javy/hashes/javy-arm-macos-v0.2.0.gz.sha256 +1 -0
  10. data/ext/javy/hashes/javy-x86_64-linux-v0.2.0.gz.sha256 +1 -0
  11. data/ext/javy/hashes/javy-x86_64-macos-v0.2.0.gz.sha256 +1 -0
  12. data/ext/javy/hashes/javy-x86_64-windows-v0.2.0.gz.sha256 +1 -0
  13. data/ext/javy/version +1 -1
  14. data/lib/project_types/extension/features/argo_setup_steps.rb +4 -6
  15. data/lib/project_types/extension/tasks/configure_features.rb +15 -2
  16. data/lib/project_types/extension/tasks/convert_server_config.rb +2 -1
  17. data/lib/project_types/script/commands/create.rb +4 -4
  18. data/lib/project_types/script/errors.rb +1 -1
  19. data/lib/project_types/script/forms/create.rb +7 -7
  20. data/lib/project_types/script/layers/application/build_script.rb +22 -24
  21. data/lib/project_types/script/layers/application/create_script.rb +9 -10
  22. data/lib/project_types/script/layers/application/project_dependencies.rb +12 -14
  23. data/lib/project_types/script/layers/application/push_script.rb +2 -0
  24. data/lib/project_types/script/layers/domain/errors.rb +3 -3
  25. data/lib/project_types/script/layers/domain/push_package.rb +6 -0
  26. data/lib/project_types/script/layers/domain/script_config.rb +2 -4
  27. data/lib/project_types/script/layers/domain/script_project.rb +3 -2
  28. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_project_creator.rb +19 -4
  29. data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +0 -15
  30. data/lib/project_types/script/layers/infrastructure/languages/typescript_project_creator.rb +19 -4
  31. data/lib/project_types/script/layers/infrastructure/languages/wasm_project_creator.rb +0 -3
  32. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +4 -0
  33. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +13 -25
  34. data/lib/project_types/script/layers/infrastructure/script_service.rb +4 -2
  35. data/lib/project_types/script/messages/messages.rb +7 -7
  36. data/lib/project_types/script/ui/error_handler.rb +4 -4
  37. data/lib/project_types/script/ui/strict_spinner.rb +4 -6
  38. data/lib/project_types/theme/cli.rb +2 -0
  39. data/lib/project_types/theme/commands/common/root_helper.rb +11 -5
  40. data/lib/project_types/theme/commands/list.rb +34 -0
  41. data/lib/project_types/theme/commands/open.rb +65 -0
  42. data/lib/project_types/theme/commands/pull.rb +2 -2
  43. data/lib/project_types/theme/commands/push.rb +2 -2
  44. data/lib/project_types/theme/forms/select.rb +11 -39
  45. data/lib/project_types/theme/messages/messages.rb +31 -2
  46. data/lib/project_types/theme/presenters/theme_presenter.rb +48 -0
  47. data/lib/project_types/theme/presenters/themes_presenter.rb +32 -0
  48. data/lib/shopify_cli/api.rb +1 -1
  49. data/lib/shopify_cli/constants.rb +2 -2
  50. data/lib/shopify_cli/context.rb +11 -13
  51. data/lib/shopify_cli/services/app/create/rails_service.rb +1 -1
  52. data/lib/shopify_cli/theme/syncer.rb +7 -7
  53. data/lib/shopify_cli/version.rb +1 -1
  54. data/shopify-dev +9 -11
  55. metadata +10 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee0786bedc79f0e7fb3646adc5161faeb0fb2f4f15c6147394782db33236f425
4
- data.tar.gz: 13d805804c7764151bfdd80747e879bd480ffcf85ba91fa280b776b93f784855
3
+ metadata.gz: e54fd77e2aa3b1721ea02cd7cad4a84afdae67a3c73510e6ee8b01e44bfc5949
4
+ data.tar.gz: a92380f94b7a33cea4eae04d2d528ef09a51d161a5b77a900a294e7176ee89e9
5
5
  SHA512:
6
- metadata.gz: 8347252541e765517a6bc485cc7bc1b811771a55610543549d676d5321944185e9a446bed4c8a3909f21f336fd56ae76b91ede2e3731f30ea66c0916d1a3e591
7
- data.tar.gz: 930367d81adf351b66aa7365daaf9f4406067db80a4959409e68ddd5ab7041ed10db4f983f81d1af3d8f2457b8d79543cbf33c927e69bfbde027a31da4b166a8
6
+ metadata.gz: 3a55cc0e5a57ab4a842411667dfca871140ef324d17c537157e3913cce383c84ae70ebd26cbf8f14a020b94283c9d6264ab71af5f55c37255fbe7966ee8f46f5
7
+ data.tar.gz: 24328c051c6795d7c4778fdaea861cc77d3337a886126074bce4ae3073b635b6bcd878457e8cad4399c5982b0be5d168a3f6f3c86c5e3bbbe7b7b2ce192e4d58
@@ -17,6 +17,7 @@ jobs:
17
17
  strategy:
18
18
  matrix:
19
19
  version:
20
+ - 3.1.0
20
21
  - 3.0.2
21
22
  - 2.6.6
22
23
  - 2.7.5
@@ -82,7 +83,7 @@ jobs:
82
83
  strategy:
83
84
  matrix:
84
85
  version:
85
- - 3.0.2
86
+ - 3.1.0
86
87
  os:
87
88
  - macos-latest
88
89
  steps:
data/.rubocop.yml CHANGED
@@ -46,7 +46,7 @@ AllCops:
46
46
  - "vendor/**/*"
47
47
  - "docs/**/*"
48
48
  - "packaging/**/*"
49
- TargetRubyVersion: 2.4
49
+ TargetRubyVersion: 2.6
50
50
 
51
51
  Layout/EmptyLines:
52
52
  Exclude:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.5
1
+ 3.1.0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@ 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.13.0
6
+
7
+ ### Added
8
+ * [#2087](https://github.com/Shopify/shopify-cli/pull/2087): Add new Theme CLI commands: `theme list` and `theme open`
9
+ * [#2035](https://github.com/Shopify/shopify-cli/pull/2035): Support Ruby 3.1
10
+
11
+ ### Fixed
12
+ * [#2092](https://github.com/Shopify/shopify-cli/pull/2092): Fix `RootHelper` parse logic to support options with an equal (e.g.: `option=value`)
13
+ * [#2089](https://github.com/Shopify/shopify-cli/pull/2089): Use javy version 0.2.0
14
+
5
15
  ## Version 2.12.0
6
16
  ### Added
7
17
  * [#1866](https://github.com/Shopify/shopify-cli/pull/1866): Enforce git dependency
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.12.0)
4
+ shopify-cli (2.13.0)
5
5
  bugsnag (~> 6.22)
6
6
  listen (~> 3.7.0)
7
7
  theme-check (~> 1.9.0)
@@ -66,7 +66,7 @@ GEM
66
66
  mime-types (3.3.1)
67
67
  mime-types-data (~> 3.2015)
68
68
  mime-types-data (3.2021.0901)
69
- mini_portile2 (2.6.1)
69
+ mini_portile2 (2.8.0)
70
70
  minitest (5.14.4)
71
71
  minitest-fail-fast (0.1.0)
72
72
  minitest (~> 5)
@@ -77,11 +77,11 @@ GEM
77
77
  ruby-progressbar
78
78
  mocha (1.13.0)
79
79
  multi_test (0.1.2)
80
- nokogiri (1.12.5)
81
- mini_portile2 (~> 2.6.1)
80
+ nokogiri (1.13.3)
81
+ mini_portile2 (~> 2.8.0)
82
82
  racc (~> 1.4)
83
83
  parallel (1.21.0)
84
- parser (3.0.3.1)
84
+ parser (3.1.0.0)
85
85
  ast (~> 2.4.1)
86
86
  pry (0.13.1)
87
87
  coderay (~> 1.1)
@@ -92,24 +92,24 @@ GEM
92
92
  public_suffix (4.0.6)
93
93
  racc (1.6.0)
94
94
  rack (2.2.3)
95
- rainbow (3.0.0)
95
+ rainbow (3.1.1)
96
96
  rake (13.0.6)
97
97
  rb-fsevent (0.11.0)
98
98
  rb-inotify (0.10.1)
99
99
  ffi (~> 1.0)
100
- regexp_parser (2.1.1)
100
+ regexp_parser (2.2.0)
101
101
  rexml (3.2.5)
102
- rubocop (1.12.1)
102
+ rubocop (1.25.1)
103
103
  parallel (~> 1.10)
104
- parser (>= 3.0.0.0)
104
+ parser (>= 3.1.0.0)
105
105
  rainbow (>= 2.2.2, < 4.0)
106
106
  regexp_parser (>= 1.8, < 3.0)
107
107
  rexml
108
- rubocop-ast (>= 1.2.0, < 2.0)
108
+ rubocop-ast (>= 1.15.1, < 2.0)
109
109
  ruby-progressbar (~> 1.7)
110
110
  unicode-display_width (>= 1.4.0, < 3.0)
111
- rubocop-ast (1.4.1)
112
- parser (>= 2.7.1.5)
111
+ rubocop-ast (1.15.1)
112
+ parser (>= 3.0.1.1)
113
113
  rubocop-minitest (0.10.1)
114
114
  rubocop (>= 0.87)
115
115
  rubocop-rake (0.5.1)
@@ -123,8 +123,8 @@ GEM
123
123
  liquid (>= 5.1.0)
124
124
  nokogiri (>= 1.12)
125
125
  parser (~> 3)
126
- timecop (0.9.2)
127
- unicode-display_width (2.0.0)
126
+ timecop (0.9.4)
127
+ unicode-display_width (2.1.0)
128
128
  webmock (3.9.3)
129
129
  addressable (>= 2.3.6)
130
130
  crack (>= 0.3.2)
data/bin/shopify CHANGED
@@ -44,8 +44,8 @@ end
44
44
 
45
45
  require_relative "./load_shopify"
46
46
 
47
- exit(proc do
48
- begin
47
+ exit(
48
+ proc do
49
49
  ShopifyCLI::ErrorHandler.call do
50
50
  ShopifyCLI::Core::EntryPoint.call(ARGV.dup)
51
51
  end
@@ -56,5 +56,5 @@ exit(proc do
56
56
  else
57
57
  1
58
58
  end
59
- end
60
- end.call)
59
+ end.call
60
+ )
data/dev.yml CHANGED
@@ -6,7 +6,7 @@ env:
6
6
  SHOPIFY_CLI_DEVELOPMENT: "1"
7
7
 
8
8
  up:
9
- - ruby: 2.7.5
9
+ - ruby: 3.1.0
10
10
  - homebrew:
11
11
  - dpkg:
12
12
  version: 1.21.1
@@ -0,0 +1 @@
1
+ 69ac26fd99a41aa1839cdf8fc8a734874370947ef79e88b90f661c2e58485ae0
@@ -0,0 +1 @@
1
+ 9d2686f5caccc34e30baff614ccfc487e90c5d1220e515ca4e47337a0b6a2daf
@@ -0,0 +1 @@
1
+ a68b5cbfce2b4b6c1a7e89e50d41dfc63f083e73f846547232897e06345e9ca3
@@ -0,0 +1 @@
1
+ 786e417716969fcac4e97d9c0c701966c54a49152f9f57fa164f916cf14ae5f3
data/ext/javy/version CHANGED
@@ -1 +1 @@
1
- v0.1.0
1
+ v0.2.0
@@ -17,12 +17,10 @@ module Extension
17
17
 
18
18
  def self.clone_template(git_template)
19
19
  ArgoSetupStep.default do |context, _identifier, directory_name, _js_system|
20
- begin
21
- ShopifyCLI::Git.clone(git_template, directory_name, ctx: context)
22
- context.root = File.join(context.root, directory_name)
23
- rescue StandardError
24
- context.puts("{{x}} Unable to clone the repository.")
25
- end
20
+ ShopifyCLI::Git.clone(git_template, directory_name, ctx: context)
21
+ context.root = File.join(context.root, directory_name)
22
+ rescue StandardError
23
+ context.puts("{{x}} Unable to clone the repository.")
26
24
  end
27
25
  end
28
26
 
@@ -12,13 +12,21 @@ module Extension
12
12
  argo_configuration = extract_argo_configuration(attributes)
13
13
  next if argo_configuration.nil?
14
14
  surface_area = extract_surface_area(argo_configuration)
15
- surface_area_configuration = fetch_surface_area_configuration(surface_area)
16
- argo_configuration.merge!(surface_area_configuration)
15
+ if known_surface_area?(surface_area)
16
+ surface_area_configuration = fetch_surface_area_configuration(surface_area)
17
+ argo_configuration.merge!(surface_area_configuration)
18
+ else
19
+ clear_argo_configuration(attributes)
20
+ end
17
21
  end
18
22
  end
19
23
 
20
24
  private
21
25
 
26
+ def known_surface_area?(surface_area)
27
+ surface_area_configurations.keys.include?(surface_area.to_sym)
28
+ end
29
+
22
30
  def extract_argo_configuration(attributes)
23
31
  attributes.dig(:features, :argo)
24
32
  end
@@ -35,6 +43,11 @@ module Extension
35
43
  end
36
44
  end
37
45
 
46
+ def clear_argo_configuration(attributes)
47
+ attributes[:name] = "#{attributes[:name]} (Warning: surface area not configured properly)"
48
+ attributes[:features][:argo] = nil
49
+ end
50
+
38
51
  def surface_area_configurations
39
52
  {
40
53
  admin: {
@@ -18,6 +18,7 @@ module Extension
18
18
  property! :type, accepts: String
19
19
 
20
20
  DEFAULT_BUILD_DIR = "build"
21
+ DEFAULT_MAIN = Dir["src/*"].lazy.grep(/index.[jt]sx?/).first
21
22
 
22
23
  def self.call(*args)
23
24
  new(*args).call
@@ -36,7 +37,7 @@ module Extension
36
37
  build_dir: hash.dig("development", "build_dir") || DEFAULT_BUILD_DIR,
37
38
  renderer: renderer,
38
39
  entries: Models::ServerConfig::DevelopmentEntries.new(
39
- main: hash.dig("development", "entries", "main")
40
+ main: hash.dig("development", "entries", "main") || DEFAULT_MAIN
40
41
  )
41
42
  ),
42
43
  extension_points: hash.dig("extension_points"),
@@ -8,7 +8,7 @@ module Script
8
8
  recommend_default_ruby_range
9
9
 
10
10
  options do |parser, flags|
11
- parser.on("--name=NAME") { |name| flags[:name] = name }
11
+ parser.on("--title=TITLE") { |title| flags[:title] = title }
12
12
  parser.on("--api=API_NAME") { |ep_name| flags[:extension_point] = ep_name }
13
13
  parser.on("--language=LANGUAGE") { |language| flags[:language] = language }
14
14
  parser.on("--branch=BRANCH") { |branch| flags[:branch] = branch }
@@ -18,7 +18,7 @@ module Script
18
18
  form = Forms::Create.ask(@ctx, args, options.flags)
19
19
  return @ctx.puts(self.class.help) if form.nil?
20
20
 
21
- unless !form.name.empty? && form.extension_point
21
+ unless !form.title.empty? && form.extension_point
22
22
  return @ctx.puts(self.class.help)
23
23
  end
24
24
 
@@ -26,10 +26,10 @@ module Script
26
26
  ctx: @ctx,
27
27
  language: options.flags[:language]&.downcase || "wasm",
28
28
  sparse_checkout_branch: options.flags[:branch] || "master",
29
- script_name: form.name,
29
+ title: form.title,
30
30
  extension_point_type: form.extension_point,
31
31
  )
32
- @ctx.puts(@ctx.message("script.create.change_directory_notice", project.script_name))
32
+ @ctx.puts(@ctx.message("script.create.change_directory_notice", project.title))
33
33
  rescue StandardError => e
34
34
  UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.create.error.operation_failed"))
35
35
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Script
4
4
  module Errors
5
- class InvalidScriptNameError < ScriptProjectError; end
5
+ class InvalidScriptTitleError < ScriptProjectError; end
6
6
 
7
7
  class NoExistingAppsError < ScriptProjectError; end
8
8
  class NoExistingOrganizationsError < ScriptProjectError; end
@@ -3,10 +3,10 @@
3
3
  module Script
4
4
  module Forms
5
5
  class Create < ShopifyCLI::Form
6
- flag_arguments :extension_point, :name
6
+ flag_arguments :extension_point, :title
7
7
 
8
8
  def ask
9
- self.name = valid_name
9
+ self.title = valid_name
10
10
  self.extension_point ||= ask_extension_point
11
11
  end
12
12
 
@@ -19,14 +19,14 @@ module Script
19
19
  )
20
20
  end
21
21
 
22
- def ask_name
23
- CLI::UI::Prompt.ask(@ctx.message("script.forms.create.script_name"))
22
+ def ask_title
23
+ CLI::UI::Prompt.ask(@ctx.message("script.forms.create.script_title"))
24
24
  end
25
25
 
26
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
27
+ normalized_title = (title || ask_title).downcase.gsub(" ", "_")
28
+ return normalized_title if normalized_title.match?(/^[0-9A-Za-z_-]*$/)
29
+ raise Errors::InvalidScriptTitleError
30
30
  end
31
31
  end
32
32
  end
@@ -7,32 +7,30 @@ module Script
7
7
  class << self
8
8
  def call(ctx:, task_runner:, script_project:, library:)
9
9
  CLI::UI::Frame.open(ctx.message("script.application.building")) do
10
- begin
11
- UI::StrictSpinner.spin(ctx.message("script.application.building_script")) do |spinner|
12
- script_content = task_runner.build
13
- metadata_file_location = task_runner.metadata_file_location
14
- metadata = Infrastructure::MetadataRepository.new(ctx: ctx).get_metadata(metadata_file_location)
10
+ UI::StrictSpinner.spin(ctx.message("script.application.building_script")) do |spinner|
11
+ script_content = task_runner.build
12
+ metadata_file_location = task_runner.metadata_file_location
13
+ metadata = Infrastructure::MetadataRepository.new(ctx: ctx).get_metadata(metadata_file_location)
15
14
 
16
- Infrastructure::PushPackageRepository.new(ctx: ctx).create_push_package(
17
- script_project: script_project,
18
- script_content: script_content,
19
- metadata: metadata,
20
- library: library,
21
- )
22
- spinner.update_title(ctx.message("script.application.built"))
23
- end
24
- rescue StandardError => e
25
- CLI::UI::Frame.with_frame_color_override(:red) do
26
- ctx.puts("\n{{red:#{e.message}}}")
27
- end
28
- errors = [
29
- Infrastructure::Errors::BuildScriptNotFoundError,
30
- Infrastructure::Errors::WebAssemblyBinaryNotFoundError,
31
- ]
32
-
33
- raise Infrastructure::Errors::BuildError unless errors.any? { |err| e.is_a?(err) }
34
- raise
15
+ Infrastructure::PushPackageRepository.new(ctx: ctx).create_push_package(
16
+ script_project: script_project,
17
+ script_content: script_content,
18
+ metadata: metadata,
19
+ library: library,
20
+ )
21
+ spinner.update_title(ctx.message("script.application.built"))
22
+ end
23
+ rescue StandardError => e
24
+ CLI::UI::Frame.with_frame_color_override(:red) do
25
+ ctx.puts("\n{{red:#{e.message}}}")
35
26
  end
27
+ errors = [
28
+ Infrastructure::Errors::BuildScriptNotFoundError,
29
+ Infrastructure::Errors::WebAssemblyBinaryNotFoundError,
30
+ ]
31
+
32
+ raise Infrastructure::Errors::BuildError unless errors.any? { |err| e.is_a?(err) }
33
+ raise
36
34
  end
37
35
  end
38
36
  end
@@ -7,17 +7,17 @@ module Script
7
7
  module Application
8
8
  class CreateScript
9
9
  class << self
10
- def call(ctx:, language:, sparse_checkout_branch:, script_name:, extension_point_type:)
10
+ def call(ctx:, language:, sparse_checkout_branch:, title:, extension_point_type:)
11
11
  script_project_repo = Infrastructure::ScriptProjectRepository.new(
12
12
  ctx: ctx,
13
- directory: script_name,
13
+ directory: title,
14
14
  initial_directory: ctx.root
15
15
  )
16
16
 
17
17
  in_new_directory_context(script_project_repo) do
18
18
  extension_point = ExtensionPoints.get(type: extension_point_type)
19
19
  project = script_project_repo.create(
20
- script_name: script_name,
20
+ title: title,
21
21
  extension_point_type: extension_point_type,
22
22
  language: language
23
23
  )
@@ -31,35 +31,34 @@ module Script
31
31
  ctx: ctx,
32
32
  language: language,
33
33
  type: type,
34
- project_name: script_name,
34
+ project_name: title,
35
35
  path_to_project: project.id,
36
36
  sparse_checkout_repo: sparse_checkout_repo,
37
37
  sparse_checkout_branch: sparse_checkout_branch,
38
38
  sparse_checkout_set_path: "#{domain}/#{language}/#{type}/default"
39
39
  )
40
40
 
41
- install_dependencies(ctx, language, script_name, project_creator)
42
- script_project_repo.update_script_config(title: script_name)
41
+ install_dependencies(ctx, language, title, project_creator)
43
42
  project
44
43
  end
45
44
  end
46
45
 
47
46
  private
48
47
 
49
- def install_dependencies(ctx, language, script_name, project_creator)
48
+ def install_dependencies(ctx, language, title, project_creator)
50
49
  task_runner = Infrastructure::Languages::TaskRunner.for(ctx, language)
51
50
  CLI::UI::Frame.open(ctx.message(
52
51
  "core.git.pulling_from_to",
53
52
  project_creator.sparse_checkout_repo,
54
- script_name,
53
+ title,
55
54
  )) do
56
55
  UI::StrictSpinner.spin(ctx.message(
57
56
  "core.git.pulling",
58
57
  project_creator.sparse_checkout_repo,
59
- script_name,
58
+ title,
60
59
  )) do |spinner|
61
60
  project_creator.setup_dependencies
62
- spinner.update_title(ctx.message("core.git.pulled", script_name))
61
+ spinner.update_title(ctx.message("core.git.pulled", title))
63
62
  end
64
63
  end
65
64
  ProjectDependencies.install(ctx: ctx, task_runner: task_runner)
@@ -4,22 +4,20 @@ module Script
4
4
  class ProjectDependencies
5
5
  def self.install(ctx:, task_runner:)
6
6
  CLI::UI::Frame.open(ctx.message("script.project_deps.checking")) do
7
- begin
8
- if task_runner.dependencies_installed?
9
- ctx.puts(ctx.message("script.project_deps.none_required"))
10
- else
11
- UI::StrictSpinner.spin(ctx.message("script.project_deps.installing")) do |spinner|
12
- task_runner.install_dependencies
13
- spinner.update_title(ctx.message("script.project_deps.installed"))
14
- end
7
+ if task_runner.dependencies_installed?
8
+ ctx.puts(ctx.message("script.project_deps.none_required"))
9
+ else
10
+ UI::StrictSpinner.spin(ctx.message("script.project_deps.installing")) do |spinner|
11
+ task_runner.install_dependencies
12
+ spinner.update_title(ctx.message("script.project_deps.installed"))
15
13
  end
16
- true
17
- rescue Infrastructure::Errors::DependencyInstallError => e
18
- CLI::UI::Frame.with_frame_color_override(:red) do
19
- ctx.puts("\n#{e.message}")
20
- end
21
- raise e
22
14
  end
15
+ true
16
+ rescue Infrastructure::Errors::DependencyInstallError => e
17
+ CLI::UI::Frame.with_frame_color_override(:red) do
18
+ ctx.puts("\n#{e.message}")
19
+ end
20
+ raise e
23
21
  end
24
22
  end
25
23
  end
@@ -48,6 +48,8 @@ module Script
48
48
  uuid = script_service.set_app_script(
49
49
  uuid: package.uuid,
50
50
  extension_point_type: package.extension_point_type,
51
+ title: package.title,
52
+ description: package.description,
51
53
  force: force,
52
54
  metadata: package.metadata,
53
55
  script_config: package.script_config,
@@ -24,10 +24,10 @@ module Script
24
24
  end
25
25
 
26
26
  class ScriptNotFoundError < ScriptProjectError
27
- attr_reader :script_name, :extension_point_type
28
- def initialize(extension_point_type, script_name)
27
+ attr_reader :title, :extension_point_type
28
+ def initialize(extension_point_type, title)
29
29
  super()
30
- @script_name = script_name
30
+ @title = title
31
31
  @extension_point_type = extension_point_type
32
32
  end
33
33
  end
@@ -7,6 +7,8 @@ module Script
7
7
  attr_reader :id,
8
8
  :uuid,
9
9
  :extension_point_type,
10
+ :title,
11
+ :description,
10
12
  :script_config,
11
13
  :script_content,
12
14
  :metadata,
@@ -16,6 +18,8 @@ module Script
16
18
  id:,
17
19
  uuid:,
18
20
  extension_point_type:,
21
+ title:,
22
+ description:,
19
23
  script_content:,
20
24
  metadata:,
21
25
  script_config:,
@@ -24,6 +28,8 @@ module Script
24
28
  @id = id
25
29
  @uuid = uuid
26
30
  @extension_point_type = extension_point_type
31
+ @title = title
32
+ @description = description
27
33
  @script_content = script_content
28
34
  @metadata = metadata
29
35
  @script_config = script_config
@@ -4,17 +4,15 @@ module Script
4
4
  module Layers
5
5
  module Domain
6
6
  class ScriptConfig
7
- attr_reader :content, :version, :title, :description, :configuration_ui, :configuration, :filename
7
+ attr_reader :content, :version, :configuration_ui, :configuration, :filename
8
8
 
9
- REQUIRED_FIELDS = %w(version title)
9
+ REQUIRED_FIELDS = %w(version)
10
10
 
11
11
  def initialize(content:, filename:)
12
12
  @filename = filename
13
13
  validate_content!(content)
14
14
  @content = content
15
15
  @version = @content["version"].to_s
16
- @title = @content["title"]
17
- @description = @content["description"]
18
16
  @configuration_ui = @content.fetch("configurationUi", true)
19
17
  @configuration = @content["configuration"]
20
18
  end
@@ -12,7 +12,8 @@ module Script
12
12
  property :env, accepts: ShopifyCLI::Resources::EnvFile
13
13
 
14
14
  property! :extension_point_type, accepts: String
15
- property! :script_name, accepts: String
15
+ property! :title, accepts: String
16
+ property :description, accepts: String
16
17
  property! :language, accepts: String
17
18
 
18
19
  property :script_config, accepts: ScriptConfig
@@ -22,7 +23,7 @@ module Script
22
23
  super
23
24
 
24
25
  ShopifyCLI::Core::Monorail.metadata = {
25
- "script_name" => script_name,
26
+ "script_name" => title,
26
27
  "extension_point_type" => extension_point_type,
27
28
  "language" => language,
28
29
  }
@@ -5,14 +5,29 @@ module Script
5
5
  module Infrastructure
6
6
  module Languages
7
7
  class AssemblyScriptProjectCreator < ProjectCreator
8
- def self.config_file
9
- "package.json"
10
- end
11
-
12
8
  def setup_dependencies
13
9
  task_runner = Infrastructure::Languages::AssemblyScriptTaskRunner.new(ctx)
14
10
  task_runner.set_npm_config
15
11
  super
12
+
13
+ update_package_json_name
14
+ end
15
+
16
+ private
17
+
18
+ def update_package_json_name
19
+ file_content = ctx.read("package.json")
20
+ hash = file_content_to_hash(file_content)
21
+ hash["name"] = project_name
22
+ ctx.write("package.json", hash_to_file_content(hash))
23
+ end
24
+
25
+ def file_content_to_hash(content)
26
+ JSON.parse(content)
27
+ end
28
+
29
+ def hash_to_file_content(hash)
30
+ JSON.pretty_generate(hash)
16
31
  end
17
32
  end
18
33
  end
@@ -43,15 +43,10 @@ module Script
43
43
  )
44
44
  end
45
45
 
46
- def self.config_file
47
- raise NotImplementedError
48
- end
49
-
50
46
  # the sparse checkout process is common to all script types
51
47
  def setup_dependencies
52
48
  setup_sparse_checkout
53
49
  clean
54
- update_project_name(File.join(path_to_project, self.class.config_file))
55
50
  end
56
51
 
57
52
  private
@@ -72,16 +67,6 @@ module Script
72
67
  ctx.rm_rf(".git")
73
68
  end
74
69
 
75
- def update_project_name(config_file)
76
- raise Errors::ProjectConfigNotFoundError unless File.exist?(config_file)
77
- upstream_name = "#{type.gsub("_", "-")}-default"
78
- contents = File.read(config_file)
79
-
80
- raise Errors::InvalidProjectConfigError unless contents.include?(upstream_name)
81
- new_contents = contents.gsub(upstream_name, project_name)
82
- File.write(config_file, new_contents)
83
- end
84
-
85
70
  def command_runner
86
71
  @command_runner ||= CommandRunner.new(ctx: ctx)
87
72
  end