shopify-cli 2.10.1 → 2.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE.md +18 -0
  3. data/CHANGELOG.md +5 -0
  4. data/Gemfile.lock +1 -1
  5. data/lib/project_types/script/cli.rb +5 -0
  6. data/lib/project_types/script/config/extension_points.yml +12 -0
  7. data/lib/project_types/script/graphql/module_upload_url_generate.graphql +5 -1
  8. data/lib/project_types/script/layers/application/build_script.rb +6 -2
  9. data/lib/project_types/script/layers/application/project_dependencies.rb +1 -1
  10. data/lib/project_types/script/layers/application/push_script.rb +38 -30
  11. data/lib/project_types/script/layers/domain/errors.rb +7 -1
  12. data/lib/project_types/script/layers/domain/extension_point.rb +2 -2
  13. data/lib/project_types/script/layers/infrastructure/errors.rb +9 -0
  14. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +2 -8
  15. data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +1 -0
  16. data/lib/project_types/script/layers/infrastructure/languages/task_runner.rb +1 -0
  17. data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +2 -8
  18. data/lib/project_types/script/layers/infrastructure/languages/wasm_project_creator.rb +15 -0
  19. data/lib/project_types/script/layers/infrastructure/languages/wasm_task_runner.rb +36 -0
  20. data/lib/project_types/script/layers/infrastructure/metadata_repository.rb +18 -0
  21. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +1 -1
  22. data/lib/project_types/script/layers/infrastructure/script_service.rb +10 -6
  23. data/lib/project_types/script/layers/infrastructure/script_uploader.rb +22 -9
  24. data/lib/project_types/script/messages/messages.rb +10 -3
  25. data/lib/project_types/script/ui/error_handler.rb +6 -1
  26. data/lib/shopify_cli/version.rb +1 -1
  27. data/vendor/deps/cli-kit/lib/cli/kit/system.rb +10 -5
  28. data/vendor/deps/cli-ui/lib/cli/ui/os.rb +6 -4
  29. metadata +5 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39a23d6414281b45d36b3508a09f88b629300733e5a3177ce9923905ce26e0ee
4
- data.tar.gz: 38483662a8c42d1463f1b157262a2cec3cf8c4fda0cb5ccfa74a207a3687be33
3
+ metadata.gz: 0cd807b7755484c50b506a5b4af90072b08ac0f9fc2aaff6c684f0fe5e6b63cc
4
+ data.tar.gz: 76aaf43ba5f6af3a6c9ed5f2f73b0d79cb03261d544602996b9563cd45f4b572
5
5
  SHA512:
6
- metadata.gz: 58b6b7aa28665cf1107c83ffa6f553eb4cca1661ff8d66d3ef47c9a4d9a3edb46a73e8f38bb5f0f6976699a4a94b58d408e11c2622718be1a554575048c844c3
7
- data.tar.gz: e060cfe1fc4c2917f096b9c0c48f9562f441fb005b6669c1ad93ac8c0a6121ae8c2fac0759fd8f591f4700b0c717f993286b67911cfa133d5cab605a600d69c8
6
+ metadata.gz: 407ad8f61eebbfcfbf4c6099eef78a41544ed95002cf7f91fbd9cd56aa473cc1ab6ea323812032c3f21d09760bdcd824908ce9ba1f069ed492997b0cdf3d5853
7
+ data.tar.gz: 91ae64882ee0e7969bf93697dda900fb812009df58eeff176833e3e609e51f37fa67f418c1b80be670f852a6594308fc0e89e43a477105b316943827f80ad780
@@ -1,3 +1,21 @@
1
+ <!--
2
+
3
+ Hi! 👋 Thanks for taking the time to open an issue.
4
+
5
+ BEFORE SUBMITTING YOUR ISSUE, please ensure that:
6
+
7
+ 1. You've searched the existing issues to see if someone else has already submitted the same thing. You can access the list at: https://github.com/Shopify/shopify-cli/issues (and feel free to add any additional information in a comment!)
8
+ 2. You've given as much detail as reasonably possible
9
+ 3. You're working with the latest CLI version (check the badge at https://github.com/Shopify/shopify-cli)
10
+
11
+ This is important because:
12
+
13
+ 1. We will notice and prioritize 1 popular issue more quickly than many small duplicates
14
+ 2. More details = faster, higher-quality response
15
+ 3. We might have fixed your issue already!
16
+
17
+ -->
18
+
1
19
  # Issue summary
2
20
 
3
21
  Write a short description of the issue here ↓
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@ 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.2
6
+ ### Fixed
7
+ * [#1983](https://github.com/Shopify/shopify-cli/pull/1983): Improve Windows compatibility
8
+ * [#1928](https://github.com/Shopify/shopify-cli/pull/1928): Ensure script Wasm file sizes don't exceed the limit
9
+
5
10
  ## Version 2.10.1
6
11
  ### Fixed
7
12
  * [#1985](https://github.com/Shopify/shopify-cli/pull/1985): Revert "Fix CORS (Cross-origin resource sharing) errors (#1952)"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.10.1)
4
+ shopify-cli (2.10.2)
5
5
  bugsnag (~> 6.22)
6
6
  listen (~> 3.7.0)
7
7
  theme-check (~> 1.9.0)
@@ -57,6 +57,7 @@ module Script
57
57
  autoload :CommandRunner, Project.project_filepath("layers/infrastructure/command_runner")
58
58
  autoload :PushPackageRepository, Project.project_filepath("layers/infrastructure/push_package_repository")
59
59
  autoload :ExtensionPointRepository, Project.project_filepath("layers/infrastructure/extension_point_repository")
60
+ autoload :MetadataRepository, Project.project_filepath("layers/infrastructure/metadata_repository")
60
61
  autoload :ScriptProjectRepository, Project.project_filepath("layers/infrastructure/script_project_repository")
61
62
  autoload :ScriptService, Project.project_filepath("layers/infrastructure/script_service")
62
63
  autoload :ScriptUploader, Project.project_filepath("layers/infrastructure/script_uploader")
@@ -73,6 +74,10 @@ module Script
73
74
  Project.project_filepath("layers/infrastructure/languages/typescript_project_creator.rb")
74
75
  autoload :TypeScriptTaskRunner,
75
76
  Project.project_filepath("layers/infrastructure/languages/typescript_task_runner.rb")
77
+ autoload :WasmProjectCreator,
78
+ Project.project_filepath("layers/infrastructure/languages/wasm_project_creator.rb")
79
+ autoload :WasmTaskRunner,
80
+ Project.project_filepath("layers/infrastructure/languages/wasm_task_runner.rb")
76
81
  end
77
82
 
78
83
  module ApiClients
@@ -8,6 +8,9 @@ payment_methods:
8
8
  beta: true
9
9
  package: "@shopify/scripts-checkout-apis"
10
10
  repo: "https://github.com/Shopify/scripts-apis-examples"
11
+ wasm:
12
+ beta: true
13
+ repo: "https://github.com/Shopify/scripts-apis-examples"
11
14
  shipping_methods:
12
15
  domain: 'checkout'
13
16
  libraries:
@@ -18,6 +21,9 @@ shipping_methods:
18
21
  beta: true
19
22
  package: "@shopify/scripts-checkout-apis"
20
23
  repo: "https://github.com/Shopify/scripts-apis-examples"
24
+ wasm:
25
+ beta: true
26
+ repo: "https://github.com/Shopify/scripts-apis-examples"
21
27
  merchandise_discount_types:
22
28
  beta: true
23
29
  domain: 'discounts'
@@ -26,6 +32,9 @@ merchandise_discount_types:
26
32
  beta: true
27
33
  package: "@shopify/scripts-discounts-apis"
28
34
  repo: "https://github.com/Shopify/scripts-apis-examples"
35
+ wasm:
36
+ beta: true
37
+ repo: "https://github.com/Shopify/scripts-apis-examples"
29
38
  delivery_discount_types:
30
39
  beta: true
31
40
  domain: 'discounts'
@@ -34,3 +43,6 @@ delivery_discount_types:
34
43
  beta: true
35
44
  package: "@shopify/scripts-discounts-apis"
36
45
  repo: "https://github.com/Shopify/scripts-apis-examples"
46
+ wasm:
47
+ beta: true
48
+ repo: "https://github.com/Shopify/scripts-apis-examples"
@@ -1,6 +1,10 @@
1
1
  mutation moduleUploadUrlGenerate {
2
2
  moduleUploadUrlGenerate {
3
- url
3
+ details {
4
+ url
5
+ headers
6
+ humanizedMaxSize
7
+ }
4
8
  userErrors {
5
9
  field
6
10
  message
@@ -9,10 +9,14 @@ module Script
9
9
  CLI::UI::Frame.open(ctx.message("script.application.building")) do
10
10
  begin
11
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)
15
+
12
16
  Infrastructure::PushPackageRepository.new(ctx: ctx).create_push_package(
13
17
  script_project: script_project,
14
- script_content: task_runner.build,
15
- metadata: task_runner.metadata,
18
+ script_content: script_content,
19
+ metadata: metadata,
16
20
  library: library,
17
21
  )
18
22
  spinner.update_title(ctx.message("script.application.built"))
@@ -3,7 +3,7 @@ module Script
3
3
  module Application
4
4
  class ProjectDependencies
5
5
  def self.install(ctx:, task_runner:)
6
- CLI::UI::Frame.open(ctx.message("script.project_deps.checking_with_npm")) do
6
+ CLI::UI::Frame.open(ctx.message("script.project_deps.checking")) do
7
7
  begin
8
8
  if task_runner.dependencies_installed?
9
9
  ctx.puts(ctx.message("script.project_deps.none_required"))
@@ -13,45 +13,53 @@ module Script
13
13
  .for(ctx, script_project.language, script_project.script_name)
14
14
 
15
15
  extension_point = ExtensionPoints.get(type: script_project.extension_point_type)
16
- library_name = extension_point.libraries.for(script_project.language)&.package
16
+
17
+ library = extension_point.libraries.for(script_project.language)
18
+
17
19
  raise Infrastructure::Errors::LanguageLibraryForAPINotFoundError.new(
18
20
  language: script_project.language,
19
21
  api: script_project.extension_point_type
20
- ) unless library_name
22
+ ) if library.nil? && (script_project.language != "wasm")
21
23
 
22
- library = {
24
+ library_name = library&.package
25
+ library_data = {
23
26
  language: script_project.language,
24
27
  version: task_runner.library_version(library_name),
25
- }
28
+ } if library_name
26
29
 
27
30
  ProjectDependencies.install(ctx: ctx, task_runner: task_runner)
28
- BuildScript.call(ctx: ctx, task_runner: task_runner, script_project: script_project, library: library)
29
-
30
- UI::PrintingSpinner.spin(ctx, ctx.message("script.application.pushing")) do |p_ctx, spinner|
31
- package = Infrastructure::PushPackageRepository.new(ctx: p_ctx).get_push_package(
32
- script_project: script_project,
33
- metadata: task_runner.metadata,
34
- library: library,
35
- )
36
- script_service = Infrastructure::ServiceLocator.script_service(
37
- ctx: p_ctx,
38
- api_key: script_project.api_key
39
- )
40
- module_upload_url = Infrastructure::ScriptUploader.new(script_service).upload(package.script_content)
41
- uuid = script_service.set_app_script(
42
- uuid: package.uuid,
43
- extension_point_type: package.extension_point_type,
44
- force: force,
45
- metadata: package.metadata,
46
- script_config: package.script_config,
47
- module_upload_url: module_upload_url,
48
- library: package.library,
49
- input_query: script_project.input_query,
50
- )
51
- if ShopifyCLI::Environment.interactive?
52
- script_project_repo.update_env(uuid: uuid)
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)
35
+
36
+ CLI::UI::Frame.open(ctx.message("script.application.pushing")) do
37
+ UI::PrintingSpinner.spin(ctx, ctx.message("script.application.pushing_script")) do |p_ctx, spinner|
38
+ package = Infrastructure::PushPackageRepository.new(ctx: p_ctx).get_push_package(
39
+ script_project: script_project,
40
+ metadata: metadata,
41
+ library: library_data,
42
+ )
43
+ script_service = Infrastructure::ServiceLocator.script_service(
44
+ ctx: p_ctx,
45
+ api_key: script_project.api_key
46
+ )
47
+ module_upload_url = Infrastructure::ScriptUploader.new(script_service).upload(package.script_content)
48
+ uuid = script_service.set_app_script(
49
+ uuid: package.uuid,
50
+ extension_point_type: package.extension_point_type,
51
+ force: force,
52
+ metadata: package.metadata,
53
+ script_config: package.script_config,
54
+ module_upload_url: module_upload_url,
55
+ library: package.library,
56
+ input_query: script_project.input_query,
57
+ )
58
+ if ShopifyCLI::Environment.interactive?
59
+ script_project_repo.update_env(uuid: uuid)
60
+ end
61
+ spinner.update_title(p_ctx.message("script.application.pushed"))
53
62
  end
54
- spinner.update_title(p_ctx.message("script.application.pushed"))
55
63
  end
56
64
  end
57
65
  end
@@ -32,7 +32,13 @@ module Script
32
32
  end
33
33
  end
34
34
 
35
- class MetadataNotFoundError < ScriptProjectError; end
35
+ class MetadataNotFoundError < ScriptProjectError
36
+ attr_reader :filename
37
+ def initialize(filename)
38
+ super()
39
+ @filename = filename
40
+ end
41
+ end
36
42
 
37
43
  class MetadataValidationError < ScriptProjectError; end
38
44
  end
@@ -42,8 +42,8 @@ module Script
42
42
  end
43
43
 
44
44
  def all
45
- @all ||= @config.map do |language, libray_config|
46
- ExtensionPointLibrary.new(language, libray_config)
45
+ @all ||= @config.map do |language, library_config|
46
+ ExtensionPointLibrary.new(language, library_config)
47
47
  end
48
48
  end
49
49
 
@@ -159,6 +159,15 @@ module Script
159
159
  class ScriptUploadError < ScriptProjectError; end
160
160
  class ProjectConfigNotFoundError < ScriptProjectError; end
161
161
  class InvalidProjectConfigError < ScriptProjectError; end
162
+
163
+ class ScriptTooLargeError < ScriptProjectError
164
+ attr_reader :max_size
165
+
166
+ def initialize(max_size)
167
+ super()
168
+ @max_size = max_size
169
+ end
170
+ end
162
171
  end
163
172
  end
164
173
  end
@@ -33,14 +33,8 @@ module Script
33
33
  ctx.dir_exist?("node_modules")
34
34
  end
35
35
 
36
- def metadata
37
- unless @ctx.file_exist?(METADATA_FILE)
38
- msg = @ctx.message("script.error.metadata_not_found_cause", METADATA_FILE)
39
- raise Domain::Errors::MetadataNotFoundError, msg
40
- end
41
-
42
- raw_contents = File.read(METADATA_FILE)
43
- Domain::Metadata.create_from_json(@ctx, raw_contents)
36
+ def metadata_file_location
37
+ METADATA_FILE
44
38
  end
45
39
 
46
40
  def library_version(library_name)
@@ -28,6 +28,7 @@ module Script
28
28
  project_creators = {
29
29
  "assemblyscript" => AssemblyScriptProjectCreator,
30
30
  "typescript" => TypeScriptProjectCreator,
31
+ "wasm" => WasmProjectCreator,
31
32
  }
32
33
 
33
34
  raise Errors::ProjectCreatorNotFoundError unless project_creators[language]
@@ -8,6 +8,7 @@ module Script
8
8
  TASK_RUNNERS = {
9
9
  "assemblyscript" => AssemblyScriptTaskRunner,
10
10
  "typescript" => TypeScriptTaskRunner,
11
+ "wasm" => WasmTaskRunner,
11
12
  }
12
13
 
13
14
  def self.for(ctx, language, script_name)
@@ -34,14 +34,8 @@ module Script
34
34
  ctx.dir_exist?("node_modules")
35
35
  end
36
36
 
37
- def metadata
38
- unless @ctx.file_exist?(METADATA_FILE)
39
- msg = @ctx.message("script.error.metadata_not_found_cause", METADATA_FILE)
40
- raise Domain::Errors::MetadataNotFoundError, msg
41
- end
42
-
43
- raw_contents = File.read(METADATA_FILE)
44
- Domain::Metadata.create_from_json(@ctx, raw_contents)
37
+ def metadata_file_location
38
+ METADATA_FILE
45
39
  end
46
40
 
47
41
  def library_version(library_name)
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Script
4
+ module Layers
5
+ module Infrastructure
6
+ module Languages
7
+ class WasmProjectCreator < ProjectCreator
8
+ def self.config_file
9
+ "script.config.yml"
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Script
4
+ module Layers
5
+ module Infrastructure
6
+ module Languages
7
+ class WasmTaskRunner
8
+ BYTECODE_FILE = "script.wasm"
9
+ attr_reader :ctx, :script_name
10
+
11
+ def initialize(ctx, script_name)
12
+ @ctx = ctx
13
+ @script_name = script_name
14
+ end
15
+
16
+ def dependencies_installed?
17
+ true
18
+ end
19
+
20
+ def library_version(_library_name)
21
+ nil
22
+ end
23
+
24
+ def metadata_file_location
25
+ "metadata.json"
26
+ end
27
+
28
+ def build
29
+ raise Errors::WebAssemblyBinaryNotFoundError unless ctx.file_exist?(BYTECODE_FILE)
30
+ ctx.binread(BYTECODE_FILE)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,18 @@
1
+
2
+ module Script
3
+ module Layers
4
+ module Infrastructure
5
+ class MetadataRepository
6
+ include SmartProperties
7
+ property! :ctx, accepts: ShopifyCLI::Context
8
+
9
+ def get_metadata(file_location)
10
+ raise Domain::Errors::MetadataNotFoundError, file_location unless ctx.file_exist?(file_location)
11
+
12
+ raw_contents = File.read(file_location)
13
+ Domain::Metadata.create_from_json(ctx, raw_contents)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -24,7 +24,7 @@ module Script
24
24
 
25
25
  def get_push_package(script_project:, metadata:, library:)
26
26
  build_file_path = file_path(script_project.id)
27
- raise Domain::PushPackageNotFoundError unless ctx.file_exist?(build_file_path)
27
+ raise Domain::Errors::PushPackageNotFoundError unless ctx.file_exist?(build_file_path)
28
28
 
29
29
  script_content = ctx.binread(build_file_path)
30
30
  Domain::PushPackage.new(
@@ -35,12 +35,14 @@ module Script
35
35
  configurationUi: script_config.configuration_ui,
36
36
  configurationDefinition: script_config.configuration&.to_json,
37
37
  moduleUploadUrl: module_upload_url,
38
- library: {
39
- language: library[:language],
40
- version: library[:version],
41
- },
42
38
  inputQuery: input_query,
43
39
  }
40
+
41
+ variables[:library] = {
42
+ language: library[:language],
43
+ version: library[:version],
44
+ } if library
45
+
44
46
  resp_hash = make_request(query_name: query_name, variables: variables)
45
47
  user_errors = resp_hash["data"]["appScriptSet"]["userErrors"]
46
48
 
@@ -93,14 +95,16 @@ module Script
93
95
  response["data"]["appScripts"]
94
96
  end
95
97
 
96
- def generate_module_upload_url
98
+ def generate_module_upload_details
97
99
  query_name = "module_upload_url_generate"
98
100
  variables = {}
99
101
  response = make_request(query_name: query_name, variables: variables)
100
102
  user_errors = response["data"]["moduleUploadUrlGenerate"]["userErrors"]
101
103
 
102
104
  raise Errors::GraphqlError, user_errors if user_errors.any?
103
- response["data"]["moduleUploadUrlGenerate"]["url"]
105
+
106
+ data = response["data"]["moduleUploadUrlGenerate"]["details"]
107
+ { url: data["url"], headers: data["headers"], max_size: data["humanizedMaxSize"] }
104
108
  end
105
109
 
106
110
  private
@@ -7,19 +7,32 @@ module Script
7
7
  end
8
8
 
9
9
  def upload(script_content)
10
- @script_service.generate_module_upload_url.tap do |url|
11
- url = URI(url)
10
+ upload_details = @script_service.generate_module_upload_details
11
+ url = URI(upload_details[:url])
12
12
 
13
- https = Net::HTTP.new(url.host, url.port)
14
- https.use_ssl = true
13
+ https = Net::HTTP.new(url.host, url.port)
14
+ https.use_ssl = true
15
15
 
16
- request = Net::HTTP::Put.new(url)
17
- request["Content-Type"] = "application/wasm"
18
- request.body = script_content
16
+ request = Net::HTTP::Put.new(url)
17
+ request["Content-Type"] = "application/wasm"
19
18
 
20
- response = https.request(request)
21
- raise Errors::ScriptUploadError unless response.code == "200"
19
+ upload_details[:headers].each do |header, value|
20
+ request[header] = value
22
21
  end
22
+
23
+ request.body = script_content
24
+
25
+ response = https.request(request)
26
+ raise Errors::ScriptTooLargeError, upload_details[:max_size] if script_too_large?(response)
27
+ raise Errors::ScriptUploadError unless response.code == "200"
28
+
29
+ upload_details[:url]
30
+ end
31
+
32
+ private
33
+
34
+ def script_too_large?(response)
35
+ response.code == "400" && response.body.include?("EntityTooLarge")
23
36
  end
24
37
  end
25
38
  end
@@ -129,8 +129,8 @@ module Script
129
129
  "\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=",
130
130
 
131
131
  web_assembly_binary_not_found: "WebAssembly binary not found.",
132
- web_assembly_binary_not_found_suggestion: "No WebAssembly binary found." \
133
- "Check that your build npm script outputs the generated binary to the root of the directory." \
132
+ web_assembly_binary_not_found_suggestion: "No WebAssembly binary found. " \
133
+ "Check that your build script outputs the generated binary to the root of the directory. " \
134
134
  "Generated binary should match the script name: <script_name>.wasm",
135
135
 
136
136
  project_config_not_found: "Internal error - Script can't be created because the project's config file is missing from the repository.",
@@ -140,6 +140,9 @@ module Script
140
140
  script_upload_cause: "Fail to upload script.",
141
141
  script_upload_help: "Try again.",
142
142
 
143
+ script_too_large_cause: "The size of your Wasm binary file is too large.",
144
+ script_too_large_help: "It must be less than %{max_size}.",
145
+
143
146
  api_library_not_found_cause: "Script can't be created because API library %{library_name} is missing from the dependencies",
144
147
  api_library_not_found_help: "This error can occur because the API library was removed from your system or there is a problem with dependencies in the repository.",
145
148
 
@@ -170,6 +173,9 @@ module Script
170
173
  change_directory_notice: "{{*}} Change directories to {{green:%s}} to run script commands",
171
174
  creating: "Creating script",
172
175
  created: "Created script",
176
+ preparing_project: "Preparing script project structure",
177
+ creating_wasm: "Creating configuration files",
178
+ created_wasm: "Configuration files created",
173
179
  },
174
180
 
175
181
  push: {
@@ -218,7 +224,7 @@ module Script
218
224
 
219
225
  project_deps: {
220
226
  none_required: "{{v}} None required",
221
- checking_with_npm: "Checking dependencies with npm",
227
+ checking: "Checking dependencies",
222
228
  installing: "Dependencies installing",
223
229
  installed: "Missing dependencies installed",
224
230
  },
@@ -236,6 +242,7 @@ module Script
236
242
  building_script: "Building script",
237
243
  built: "Built",
238
244
  pushing: "Pushing",
245
+ pushing_script: "Pushing script",
239
246
  pushed: "Pushed",
240
247
  ensure_env: {
241
248
  organization: "Partner organization {{green:%s (%s)}}.",
@@ -100,7 +100,7 @@ module Script
100
100
  }
101
101
  when Layers::Domain::Errors::MetadataNotFoundError
102
102
  {
103
- cause_of_error: ShopifyCLI::Context.message("script.error.metadata_not_found_cause"),
103
+ cause_of_error: ShopifyCLI::Context.message("script.error.metadata_not_found_cause", e.filename),
104
104
  help_suggestion: ShopifyCLI::Context.message("script.error.metadata_not_found_help"),
105
105
  }
106
106
  when Layers::Domain::Errors::MissingScriptConfigFieldError
@@ -251,6 +251,11 @@ module Script
251
251
  cause_of_error: ShopifyCLI::Context.message("script.error.script_upload_cause"),
252
252
  help_suggestion: ShopifyCLI::Context.message("script.error.script_upload_help"),
253
253
  }
254
+ when Layers::Infrastructure::Errors::ScriptTooLargeError
255
+ {
256
+ cause_of_error: ShopifyCLI::Context.message("script.error.script_too_large_cause"),
257
+ help_suggestion: ShopifyCLI::Context.message("script.error.script_too_large_help", max_size: e.max_size),
258
+ }
254
259
  when Layers::Infrastructure::Errors::APILibraryNotFoundError
255
260
  {
256
261
  cause_of_error: ShopifyCLI::Context
@@ -1,3 +1,3 @@
1
1
  module ShopifyCLI
2
- VERSION = "2.10.1"
2
+ VERSION = "2.10.2"
3
3
  end
@@ -174,11 +174,16 @@ module CLI
174
174
  end
175
175
 
176
176
  def os
177
- return :mac if /darwin/.match(RUBY_PLATFORM)
178
- return :linux if /linux/.match(RUBY_PLATFORM)
179
- return :windows if /mingw32/.match(RUBY_PLATFORM)
180
-
181
- raise "Could not determine OS from platform #{RUBY_PLATFORM}"
177
+ @current_os ||= case RbConfig::CONFIG['host_os']
178
+ when /darwin/ then :mac
179
+ when /linux/ then :linux
180
+ else
181
+ if RUBY_PLATFORM !~ /cygwin/ && ENV['OS'] == 'Windows_NT'
182
+ :windows
183
+ else
184
+ raise "Could not determine OS from host_os #{RbConfig::CONFIG["host_os"]}"
185
+ end
186
+ end
182
187
  end
183
188
 
184
189
  private
@@ -4,15 +4,17 @@ module CLI
4
4
  # Determines which OS is currently running the UI, to make it easier to
5
5
  # adapt its behaviour to the features of the OS.
6
6
  def self.current
7
- @current_os ||= case RUBY_PLATFORM
7
+ @current_os ||= case RbConfig::CONFIG['host_os']
8
8
  when /darwin/
9
9
  Mac
10
10
  when /linux/
11
11
  Linux
12
- when /mingw32/
13
- Windows
14
12
  else
15
- raise "Could not determine OS from platform #{RUBY_PLATFORM}"
13
+ if RUBY_PLATFORM !~ /cygwin/ && ENV['OS'] == 'Windows_NT'
14
+ Windows
15
+ else
16
+ raise "Could not determine OS from host_os #{RbConfig::CONFIG["host_os"]}"
17
+ end
16
18
  end
17
19
  end
18
20
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.1
4
+ version: 2.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-28 00:00:00.000000000 Z
11
+ date: 2022-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -317,6 +317,9 @@ files:
317
317
  - lib/project_types/script/layers/infrastructure/languages/task_runner.rb
318
318
  - lib/project_types/script/layers/infrastructure/languages/typescript_project_creator.rb
319
319
  - lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb
320
+ - lib/project_types/script/layers/infrastructure/languages/wasm_project_creator.rb
321
+ - lib/project_types/script/layers/infrastructure/languages/wasm_task_runner.rb
322
+ - lib/project_types/script/layers/infrastructure/metadata_repository.rb
320
323
  - lib/project_types/script/layers/infrastructure/push_package_repository.rb
321
324
  - lib/project_types/script/layers/infrastructure/script_project_repository.rb
322
325
  - lib/project_types/script/layers/infrastructure/script_service.rb