shopify-cli 2.12.0 → 2.15.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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +5 -0
  3. data/.github/CONTRIBUTING.md +1 -1
  4. data/.github/PULL_REQUEST_TEMPLATE.md +1 -1
  5. data/.github/workflows/shopify.yml +2 -1
  6. data/.github/workflows/stale.yml +41 -0
  7. data/.rubocop.yml +1 -1
  8. data/.ruby-version +1 -1
  9. data/CHANGELOG.md +36 -0
  10. data/Gemfile.lock +18 -18
  11. data/Rakefile +16 -0
  12. data/bin/shopify +4 -4
  13. data/dev.yml +1 -1
  14. data/ext/javy/hashes/javy-arm-macos-v0.2.0.gz.sha256 +1 -0
  15. data/ext/javy/hashes/javy-arm-macos-v0.2.1.gz.sha256 +1 -0
  16. data/ext/javy/hashes/javy-x86_64-linux-v0.2.0.gz.sha256 +1 -0
  17. data/ext/javy/hashes/javy-x86_64-linux-v0.2.1.gz.sha256 +1 -0
  18. data/ext/javy/hashes/javy-x86_64-macos-v0.2.0.gz.sha256 +1 -0
  19. data/ext/javy/hashes/javy-x86_64-macos-v0.2.1.gz.sha256 +1 -0
  20. data/ext/javy/hashes/javy-x86_64-windows-v0.2.0.gz.sha256 +1 -0
  21. data/ext/javy/hashes/javy-x86_64-windows-v0.2.1.gz.sha256 +1 -0
  22. data/ext/javy/version +1 -1
  23. data/lib/project_types/extension/features/argo_setup_steps.rb +4 -6
  24. data/lib/project_types/extension/models/npm_package.rb +19 -1
  25. data/lib/project_types/extension/models/server_config/development_renderer.rb +4 -3
  26. data/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +13 -0
  27. data/lib/project_types/extension/tasks/configure_features.rb +15 -2
  28. data/lib/project_types/extension/tasks/convert_server_config.rb +2 -1
  29. data/lib/project_types/script/cli.rb +0 -4
  30. data/lib/project_types/script/commands/create.rb +4 -4
  31. data/lib/project_types/script/config/extension_points.yml +0 -6
  32. data/lib/project_types/script/errors.rb +1 -1
  33. data/lib/project_types/script/forms/create.rb +7 -7
  34. data/lib/project_types/script/layers/application/build_script.rb +9 -26
  35. data/lib/project_types/script/layers/application/create_script.rb +9 -10
  36. data/lib/project_types/script/layers/application/project_dependencies.rb +12 -14
  37. data/lib/project_types/script/layers/application/push_script.rb +14 -10
  38. data/lib/project_types/script/layers/domain/errors.rb +3 -3
  39. data/lib/project_types/script/layers/domain/push_package.rb +6 -0
  40. data/lib/project_types/script/layers/domain/script_config.rb +2 -4
  41. data/lib/project_types/script/layers/domain/script_project.rb +3 -2
  42. data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +0 -16
  43. data/lib/project_types/script/layers/infrastructure/languages/task_runner.rb +0 -1
  44. data/lib/project_types/script/layers/infrastructure/languages/typescript_project_creator.rb +19 -4
  45. data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +2 -10
  46. data/lib/project_types/script/layers/infrastructure/languages/wasm_project_creator.rb +0 -3
  47. data/lib/project_types/script/layers/infrastructure/languages/wasm_task_runner.rb +1 -1
  48. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +3 -21
  49. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +14 -26
  50. data/lib/project_types/script/layers/infrastructure/script_service.rb +4 -2
  51. data/lib/project_types/script/messages/messages.rb +9 -9
  52. data/lib/project_types/script/ui/error_handler.rb +4 -4
  53. data/lib/project_types/script/ui/strict_spinner.rb +4 -6
  54. data/lib/project_types/theme/cli.rb +2 -0
  55. data/lib/project_types/theme/commands/common/root_helper.rb +11 -5
  56. data/lib/project_types/theme/commands/list.rb +34 -0
  57. data/lib/project_types/theme/commands/open.rb +65 -0
  58. data/lib/project_types/theme/commands/package.rb +1 -0
  59. data/lib/project_types/theme/commands/pull.rb +4 -4
  60. data/lib/project_types/theme/commands/push.rb +4 -4
  61. data/lib/project_types/theme/conversions/base_glob.rb +20 -5
  62. data/lib/project_types/theme/forms/select.rb +11 -39
  63. data/lib/project_types/theme/messages/messages.rb +33 -2
  64. data/lib/project_types/theme/presenters/theme_presenter.rb +48 -0
  65. data/lib/project_types/theme/presenters/themes_presenter.rb +32 -0
  66. data/lib/shopify_cli/api.rb +1 -1
  67. data/lib/shopify_cli/command.rb +1 -7
  68. data/lib/shopify_cli/commands/app/deploy.rb +0 -1
  69. data/lib/shopify_cli/constants.rb +2 -2
  70. data/lib/shopify_cli/context.rb +13 -15
  71. data/lib/shopify_cli/core/entry_point.rb +1 -1
  72. data/lib/shopify_cli/core/monorail.rb +14 -6
  73. data/lib/shopify_cli/environment.rb +19 -11
  74. data/lib/shopify_cli/exception_reporter.rb +2 -0
  75. data/lib/shopify_cli/messages/messages.rb +5 -5
  76. data/lib/shopify_cli/packager.rb +1 -1
  77. data/lib/shopify_cli/result.rb +14 -0
  78. data/lib/shopify_cli/services/app/create/node_service.rb +2 -14
  79. data/lib/shopify_cli/services/app/create/php_service.rb +1 -6
  80. data/lib/shopify_cli/services/app/create/rails_service.rb +5 -13
  81. data/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_reloader.rb +5 -5
  82. data/lib/shopify_cli/theme/dev_server/watcher.rb +10 -2
  83. data/lib/shopify_cli/theme/development_theme.rb +2 -5
  84. data/lib/shopify_cli/theme/syncer.rb +27 -32
  85. data/lib/shopify_cli/theme/theme.rb +16 -27
  86. data/lib/shopify_cli/theme/theme_admin_api.rb +72 -0
  87. data/lib/shopify_cli/transform_data_structure.rb +3 -2
  88. data/lib/shopify_cli/version.rb +1 -1
  89. data/shipit.yml +3 -0
  90. data/shopify-cli.gemspec +9 -2
  91. data/shopify-dev +9 -11
  92. metadata +21 -9
  93. data/lib/project_types/rails/ruby.rb +0 -17
  94. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_project_creator.rb +0 -21
  95. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +0 -109
@@ -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
@@ -21,33 +21,37 @@ module Script
21
21
  api: script_project.extension_point_type
22
22
  ) if library.nil? && (script_project.language != "wasm")
23
23
 
24
- library_name = library&.package
25
- library_data = {
26
- language: script_project.language,
27
- version: task_runner.library_version(library_name),
28
- } if library_name
29
-
30
24
  ProjectDependencies.install(ctx: ctx, task_runner: task_runner)
31
- BuildScript.call(ctx: ctx, task_runner: task_runner, script_project: script_project, library: library_data)
32
-
33
- metadata_file_location = task_runner.metadata_file_location
34
- metadata = Infrastructure::MetadataRepository.new(ctx: ctx).get_metadata(metadata_file_location)
25
+ BuildScript.call(ctx: ctx, task_runner: task_runner)
35
26
 
36
27
  CLI::UI::Frame.open(ctx.message("script.application.pushing")) do
37
28
  UI::PrintingSpinner.spin(ctx, ctx.message("script.application.pushing_script")) do |p_ctx, spinner|
29
+ library_name = library&.package
30
+ library_data = {
31
+ language: script_project.language,
32
+ version: task_runner.library_version(library_name),
33
+ } if library_name
34
+
35
+ metadata_file_location = task_runner.metadata_file_location
36
+ metadata = Infrastructure::MetadataRepository.new(ctx: ctx).get_metadata(metadata_file_location)
37
+
38
38
  package = Infrastructure::PushPackageRepository.new(ctx: p_ctx).get_push_package(
39
39
  script_project: script_project,
40
40
  metadata: metadata,
41
41
  library: library_data,
42
42
  )
43
+
43
44
  script_service = Infrastructure::ServiceLocator.script_service(
44
45
  ctx: p_ctx,
45
46
  api_key: script_project.api_key
46
47
  )
47
48
  module_upload_url = Infrastructure::ScriptUploader.new(script_service).upload(package.script_content)
49
+
48
50
  uuid = script_service.set_app_script(
49
51
  uuid: package.uuid,
50
52
  extension_point_type: package.extension_point_type,
53
+ title: package.title,
54
+ description: package.description,
51
55
  force: force,
52
56
  metadata: package.metadata,
53
57
  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
  }
@@ -26,7 +26,6 @@ module Script
26
26
  )
27
27
 
28
28
  project_creators = {
29
- "assemblyscript" => AssemblyScriptProjectCreator,
30
29
  "typescript" => TypeScriptProjectCreator,
31
30
  "wasm" => WasmProjectCreator,
32
31
  }
@@ -43,15 +42,10 @@ module Script
43
42
  )
44
43
  end
45
44
 
46
- def self.config_file
47
- raise NotImplementedError
48
- end
49
-
50
45
  # the sparse checkout process is common to all script types
51
46
  def setup_dependencies
52
47
  setup_sparse_checkout
53
48
  clean
54
- update_project_name(File.join(path_to_project, self.class.config_file))
55
49
  end
56
50
 
57
51
  private
@@ -72,16 +66,6 @@ module Script
72
66
  ctx.rm_rf(".git")
73
67
  end
74
68
 
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
69
  def command_runner
86
70
  @command_runner ||= CommandRunner.new(ctx: ctx)
87
71
  end
@@ -9,7 +9,6 @@ module Script
9
9
 
10
10
  def self.for(ctx, language)
11
11
  task_runners = {
12
- "assemblyscript" => AssemblyScriptTaskRunner,
13
12
  "typescript" => TypeScriptTaskRunner,
14
13
  "wasm" => WasmTaskRunner,
15
14
  }
@@ -5,10 +5,6 @@ module Script
5
5
  module Infrastructure
6
6
  module Languages
7
7
  class TypeScriptProjectCreator < ProjectCreator
8
- def self.config_file
9
- "package.json"
10
- end
11
-
12
8
  def setup_dependencies
13
9
  task_runner = Infrastructure::Languages::TypeScriptTaskRunner.new(ctx)
14
10
  task_runner.set_npm_config
@@ -22,6 +18,25 @@ module Script
22
18
  if ctx.file_exist?("package-lock.json")
23
19
  ctx.rm("package-lock.json")
24
20
  end
21
+
22
+ update_package_json_name
23
+ end
24
+
25
+ private
26
+
27
+ def update_package_json_name
28
+ file_content = ctx.read("package.json")
29
+ hash = file_content_to_hash(file_content)
30
+ hash["name"] = project_name
31
+ ctx.write("package.json", hash_to_file_content(hash))
32
+ end
33
+
34
+ def file_content_to_hash(content)
35
+ JSON.parse(content)
36
+ end
37
+
38
+ def hash_to_file_content(hash)
39
+ JSON.pretty_generate(hash)
25
40
  end
26
41
  end
27
42
  end
@@ -18,7 +18,8 @@ module Script
18
18
 
19
19
  def build
20
20
  compile
21
- bytecode
21
+ rescue Errors::SystemCallFailureError => e
22
+ raise Errors::BuildError, e.out
22
23
  end
23
24
 
24
25
  def install_dependencies
@@ -95,15 +96,6 @@ module Script
95
96
  raise Errors::BuildScriptNotFoundError,
96
97
  "Build script not found" if build_script.nil?
97
98
  end
98
-
99
- def bytecode
100
- raise Errors::WebAssemblyBinaryNotFoundError unless ctx.file_exist?(BYTECODE_FILE)
101
-
102
- contents = ctx.binread(BYTECODE_FILE)
103
- ctx.rm(BYTECODE_FILE)
104
-
105
- contents
106
- end
107
99
  end
108
100
  end
109
101
  end
@@ -5,9 +5,6 @@ module Script
5
5
  module Infrastructure
6
6
  module Languages
7
7
  class WasmProjectCreator < ProjectCreator
8
- def self.config_file
9
- "script.config.yml"
10
- end
11
8
  end
12
9
  end
13
10
  end
@@ -5,7 +5,7 @@ module Script
5
5
  module Infrastructure
6
6
  module Languages
7
7
  class WasmTaskRunner < TaskRunner
8
- BYTECODE_FILE = "script.wasm"
8
+ BYTECODE_FILE = "build/index.wasm"
9
9
 
10
10
  def dependencies_installed?
11
11
  true
@@ -7,21 +7,6 @@ module Script
7
7
  include SmartProperties
8
8
  property! :ctx, accepts: ShopifyCLI::Context
9
9
 
10
- def create_push_package(script_project:, script_content:, metadata:, library:)
11
- build_file_path = file_path(script_project.id)
12
- write_to_path(build_file_path, script_content)
13
-
14
- Domain::PushPackage.new(
15
- id: build_file_path,
16
- uuid: script_project.uuid,
17
- extension_point_type: script_project.extension_point_type,
18
- script_content: script_content,
19
- metadata: metadata,
20
- script_config: script_project.script_config,
21
- library: library
22
- )
23
- end
24
-
25
10
  def get_push_package(script_project:, metadata:, library:)
26
11
  build_file_path = file_path(script_project.id)
27
12
  raise Domain::Errors::PushPackageNotFoundError unless ctx.file_exist?(build_file_path)
@@ -31,6 +16,8 @@ module Script
31
16
  id: build_file_path,
32
17
  uuid: script_project.uuid,
33
18
  extension_point_type: script_project.extension_point_type,
19
+ title: script_project.title,
20
+ description: script_project.description,
34
21
  script_content: script_content,
35
22
  metadata: metadata,
36
23
  script_config: script_project.script_config,
@@ -40,13 +27,8 @@ module Script
40
27
 
41
28
  private
42
29
 
43
- def write_to_path(path, content)
44
- ctx.mkdir_p(File.dirname(path))
45
- ctx.binwrite(path, content)
46
- end
47
-
48
30
  def file_path(path_to_script)
49
- "#{path_to_script}/build/script.wasm"
31
+ "#{path_to_script}/build/index.wasm"
50
32
  end
51
33
  end
52
34
  end
@@ -27,7 +27,7 @@ module Script
27
27
  change_directory(directory: initial_directory)
28
28
  end
29
29
 
30
- def create(script_name:, extension_point_type:, language:)
30
+ def create(title:, extension_point_type:, language:)
31
31
  validate_metadata!(extension_point_type, language)
32
32
 
33
33
  ShopifyCLI::Project.write(
@@ -35,7 +35,8 @@ module Script
35
35
  project_type: :script,
36
36
  organization_id: nil,
37
37
  extension_point_type: extension_point_type,
38
- script_name: script_name,
38
+ title: title,
39
+ description: nil,
39
40
  language: language
40
41
  )
41
42
 
@@ -48,7 +49,8 @@ module Script
48
49
  Domain::ScriptProject.new(
49
50
  id: project.directory,
50
51
  env: project.env,
51
- script_name: script_name,
52
+ title: title,
53
+ description: description,
52
54
  extension_point_type: extension_point_type,
53
55
  language: language,
54
56
  script_config: script_config_repository.get!,
@@ -79,11 +81,6 @@ module Script
79
81
  build_script_project
80
82
  end
81
83
 
82
- def update_script_config(title:)
83
- script_config = script_config_repository.update!(title: title)
84
- build_script_project(script_config: script_config)
85
- end
86
-
87
84
  private
88
85
 
89
86
  def build_script_project(
@@ -92,7 +89,8 @@ module Script
92
89
  Domain::ScriptProject.new(
93
90
  id: ctx.root,
94
91
  env: project.env,
95
- script_name: script_name,
92
+ title: title,
93
+ description: description,
96
94
  extension_point_type: extension_point_type,
97
95
  language: language,
98
96
  script_config: script_config,
@@ -111,8 +109,12 @@ module Script
111
109
  project_config_value!("extension_point_type")
112
110
  end
113
111
 
114
- def script_name
115
- project_config_value!("script_name")
112
+ def title
113
+ project_config_value!("title")
114
+ end
115
+
116
+ def description
117
+ project_config_value("description")
116
118
  end
117
119
 
118
120
  def language
@@ -134,7 +136,7 @@ module Script
134
136
  end
135
137
 
136
138
  def default_language
137
- "assemblyscript"
139
+ "wasm"
138
140
  end
139
141
 
140
142
  def validate_metadata!(extension_point_type, language)
@@ -181,26 +183,12 @@ module Script
181
183
  from_h(hash)
182
184
  end
183
185
 
184
- def update!(title:)
185
- hash = get!.content
186
- update_hash(hash: hash, title: title)
187
-
188
- ctx.write(filename, hash_to_file_content(hash))
189
-
190
- from_h(hash)
191
- end
192
-
193
186
  def filename
194
187
  raise NotImplementedError
195
188
  end
196
189
 
197
190
  private
198
191
 
199
- def update_hash(hash:, title:)
200
- hash["version"] ||= "2"
201
- hash["title"] = title
202
- end
203
-
204
192
  def from_h(hash)
205
193
  Domain::ScriptConfig.new(content: hash, filename: filename)
206
194
  end
@@ -15,6 +15,8 @@ module Script
15
15
  def set_app_script(
16
16
  uuid:,
17
17
  extension_point_type:,
18
+ title:,
19
+ description:,
18
20
  force: false,
19
21
  metadata:,
20
22
  script_config:,
@@ -26,8 +28,8 @@ module Script
26
28
  variables = {
27
29
  uuid: uuid,
28
30
  extensionPointName: extension_point_type.upcase,
29
- title: script_config.title,
30
- description: script_config.description,
31
+ title: title,
32
+ description: description,
31
33
  force: force,
32
34
  schemaMajorVersion: metadata.schema_major_version.to_s, # API expects string value
33
35
  schemaMinorVersion: metadata.schema_minor_version.to_s, # API expects string value
@@ -24,11 +24,11 @@ module Script
24
24
  oauth_help: "Wait a few minutes and try again.",
25
25
 
26
26
  invalid_context_cause: "Your .shopify-cli.yml is formatted incorrectly. It's missing values for "\
27
- "extension_point_type or script_name.",
27
+ "extension_point_type or title.",
28
28
  invalid_context_help: "Add these values.",
29
29
 
30
- invalid_script_name_cause: "Script name contains unsupported characters.",
31
- invalid_script_name_help: "Use only numbers, letters, hyphens, or underscores.",
30
+ invalid_script_title_cause: "Script title contains unsupported characters.",
31
+ invalid_script_title_help: "Use only numbers, letters, hyphens, or underscores.",
32
32
 
33
33
  no_existing_apps_cause: "Your script can't be pushed to an app because your Partner account "\
34
34
  "doesn't have any apps.",
@@ -37,8 +37,8 @@ module Script
37
37
  no_existing_orgs_cause: "Your account doesn't belong to a Partner Organization.",
38
38
  no_existing_orgs_help: "Visit https://partners.shopify.com/ to create an account.",
39
39
 
40
- project_exists_cause: "A directory with this same name already exists.",
41
- project_exists_help: "Choose a different name for your script.",
40
+ project_exists_cause: "A directory with this same title already exists.",
41
+ project_exists_help: "Choose a different title for your script.",
42
42
 
43
43
  invalid_extension_cause: "The name of the Script API is incorrect: %s.",
44
44
  invalid_extension_help: "Choose a supported API: %s.",
@@ -135,8 +135,8 @@ module Script
135
135
  "\nbuild: npx shopify-scripts-toolchain-as build --src src/shopify_main.ts --binary build/<script_name>.wasm --metadata build/metadata.json -- --lib node_modules --optimize --use Date=",
136
136
 
137
137
  web_assembly_binary_not_found: "Wasm binary not found.",
138
- web_assembly_binary_not_found_suggestion: "Check that there is a valid Wasm binary in the root directory" \
139
- "Your Wasm binary should match the script name: <script_name>.wasm",
138
+ web_assembly_binary_not_found_suggestion: "Check that a valid Wasm binary is present. " \
139
+ "The Wasm binary's filepath must be 'build/index.wasm'.",
140
140
 
141
141
  project_config_not_found: "Internal error - Script can't be created because the project's config file is missing from the repository.",
142
142
 
@@ -168,7 +168,7 @@ module Script
168
168
  {{command:%1$s script create}}: Creates a script project.
169
169
  Usage: {{command:%1$s script create}}
170
170
  Options:
171
- {{command:--name=NAME}} Script project name.
171
+ {{command:--title=TITLE}} Script project title.
172
172
  {{command:--api=TYPE}} Script API name. Supported values: %2$s.
173
173
  {{command:--language=LANGUAGE}} Programming language. Defaults to wasm. Supported values: %3$s.
174
174
  HELP
@@ -235,7 +235,7 @@ module Script
235
235
  forms: {
236
236
  create: {
237
237
  select_extension_point: "Which Script API do you want to use?",
238
- script_name: "What do you want to name your script?",
238
+ script_title: "What do you want to title your script?",
239
239
  },
240
240
  },
241
241
 
@@ -59,10 +59,10 @@ module Script
59
59
  Script::Layers::Application::ExtensionPoints.languages(type: e.extension_point_type).join(", ")
60
60
  ),
61
61
  }
62
- when Errors::InvalidScriptNameError
62
+ when Errors::InvalidScriptTitleError
63
63
  {
64
- cause_of_error: ShopifyCLI::Context.message("script.error.invalid_script_name_cause"),
65
- help_suggestion: ShopifyCLI::Context.message("script.error.invalid_script_name_help"),
64
+ cause_of_error: ShopifyCLI::Context.message("script.error.invalid_script_title_cause"),
65
+ help_suggestion: ShopifyCLI::Context.message("script.error.invalid_script_title_help"),
66
66
  }
67
67
  when Errors::NoExistingAppsError
68
68
  {
@@ -96,7 +96,7 @@ module Script
96
96
  {
97
97
  cause_of_error: ShopifyCLI::Context.message(
98
98
  "script.error.script_not_found_cause",
99
- e.script_name,
99
+ e.title,
100
100
  e.extension_point_type
101
101
  ),
102
102
  }
@@ -8,12 +8,10 @@ module Script
8
8
  def self.spin(title, auto_debrief: false)
9
9
  exception = nil
10
10
  CLI::UI::Spinner.spin(title, auto_debrief: auto_debrief) do |*args|
11
- begin
12
- yield(*args)
13
- rescue StandardError => e
14
- exception = e
15
- CLI::UI::Spinner::TASK_FAILED
16
- end
11
+ yield(*args)
12
+ rescue StandardError => e
13
+ exception = e
14
+ CLI::UI::Spinner::TASK_FAILED
17
15
  end
18
16
  raise exception if exception
19
17
  end
@@ -14,6 +14,8 @@ module Theme
14
14
  subcommand :Check, "check", Project.project_filepath("commands/check")
15
15
  subcommand :Publish, "publish", Project.project_filepath("commands/publish")
16
16
  subcommand :Package, "package", Project.project_filepath("commands/package")
17
+ subcommand :Open, "open", Project.project_filepath("commands/open")
18
+ subcommand :List, "list", Project.project_filepath("commands/list")
17
19
  subcommand :LanguageServer, "language-server", Project.project_filepath("commands/language_server")
18
20
  end
19
21
  ShopifyCLI::Commands.register("Theme::Command", "theme")