shopify-cli 2.6.0 → 2.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.github/PULL_REQUEST_TEMPLATE.md +15 -4
  3. data/.github/workflows/shopify.yml +3 -6
  4. data/CHANGELOG.md +77 -94
  5. data/Dockerfile +12 -2
  6. data/Gemfile +1 -0
  7. data/Gemfile.lock +5 -3
  8. data/README.md +1 -1
  9. data/RELEASING.md +17 -30
  10. data/Rakefile +0 -5
  11. data/bin/shopify +1 -0
  12. data/ext/shopify-cli/extconf.rb +0 -1
  13. data/lib/project_types/extension/features/argo.rb +8 -2
  14. data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +1 -1
  15. data/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +1 -1
  16. data/lib/project_types/node/commands/serve.rb +7 -16
  17. data/lib/project_types/node/messages/messages.rb +0 -5
  18. data/lib/project_types/php/commands/serve.rb +6 -9
  19. data/lib/project_types/php/messages/messages.rb +1 -4
  20. data/lib/project_types/rails/commands/serve.rb +7 -8
  21. data/lib/project_types/rails/messages/messages.rb +1 -4
  22. data/lib/project_types/script/commands/create.rb +3 -1
  23. data/lib/project_types/script/config/extension_points.yml +7 -0
  24. data/lib/project_types/script/graphql/app_script_set.graphql +2 -0
  25. data/lib/project_types/script/layers/application/build_script.rb +2 -1
  26. data/lib/project_types/script/layers/application/push_script.rb +15 -1
  27. data/lib/project_types/script/layers/domain/push_package.rb +5 -2
  28. data/lib/project_types/script/layers/infrastructure/errors.rb +17 -0
  29. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +10 -13
  30. data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +4 -13
  31. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +4 -2
  32. data/lib/project_types/script/layers/infrastructure/script_service.rb +6 -1
  33. data/lib/project_types/script/messages/messages.rb +6 -0
  34. data/lib/project_types/script/ui/error_handler.rb +16 -0
  35. data/lib/project_types/theme/commands/serve.rb +1 -0
  36. data/lib/project_types/theme/messages/messages.rb +5 -0
  37. data/lib/shopify_cli/api.rb +4 -0
  38. data/lib/shopify_cli/app_type_detector.rb +32 -0
  39. data/lib/shopify_cli/command.rb +6 -1
  40. data/lib/shopify_cli/command_options/command_serve_options.rb +43 -0
  41. data/lib/shopify_cli/command_options.rb +7 -0
  42. data/lib/shopify_cli/commands/login.rb +3 -3
  43. data/lib/shopify_cli/commands/reporting.rb +38 -0
  44. data/lib/shopify_cli/commands/switch.rb +1 -1
  45. data/lib/shopify_cli/commands.rb +1 -0
  46. data/lib/shopify_cli/constants.rb +7 -3
  47. data/lib/shopify_cli/core/monorail.rb +9 -20
  48. data/lib/shopify_cli/environment.rb +15 -1
  49. data/lib/shopify_cli/exception_reporter.rb +25 -14
  50. data/lib/shopify_cli/messages/messages.rb +48 -19
  51. data/lib/shopify_cli/migrator/migration.rb +1 -1
  52. data/lib/shopify_cli/migrator/migrations/1631709766_noop.rb +1 -1
  53. data/lib/shopify_cli/migrator/migrations/1633691650_merge_reporting_configuration.rb +41 -0
  54. data/lib/shopify_cli/reporting_configuration_controller.rb +64 -0
  55. data/lib/shopify_cli/services/base_service.rb +13 -0
  56. data/lib/shopify_cli/services/reporting_service.rb +16 -0
  57. data/lib/shopify_cli/services.rb +6 -0
  58. data/lib/shopify_cli/theme/dev_server/watcher.rb +2 -2
  59. data/lib/shopify_cli/theme/dev_server.rb +2 -2
  60. data/lib/shopify_cli/version.rb +1 -1
  61. data/lib/shopify_cli.rb +4 -0
  62. data/shopify-cli.gemspec +1 -8
  63. data/utilities/docker/container.rb +76 -0
  64. data/utilities/docker.rb +44 -3
  65. metadata +14 -5
  66. data/lib/shopify_cli/exception_reporter/permission_controller.rb +0 -54
data/utilities/docker.rb CHANGED
@@ -1,10 +1,43 @@
1
1
  require "open3"
2
+ require "securerandom"
2
3
 
3
4
  module Utilities
4
5
  module Docker
6
+ autoload :Container, "docker/container"
7
+
5
8
  Error = Class.new(StandardError)
6
9
 
7
10
  class << self
11
+ def create_container(env: {})
12
+ id = SecureRandom.hex
13
+ cwd = "/tmp/#{SecureRandom.hex}"
14
+
15
+ build_image_if_needed
16
+
17
+ _, stderr, stat = Open3.capture3(
18
+ "docker", "run",
19
+ "-t", "-d",
20
+ "--name", id,
21
+ "--volume", "#{Shellwords.escape(root_dir)}:/usr/src/app",
22
+ image_tag,
23
+ "tail", "-f", "/dev/null"
24
+ )
25
+ raise Error, stderr unless stat.success?
26
+
27
+ _, stderr, stat = Open3.capture3(
28
+ "docker", "exec",
29
+ id,
30
+ "mkdir", "-p", cwd
31
+ )
32
+ raise Error, stderr unless stat.success?
33
+
34
+ Container.new(
35
+ id: id,
36
+ cwd: cwd,
37
+ env: env
38
+ )
39
+ end
40
+
8
41
  def run_and_rm_container(*args)
9
42
  build_image_if_needed
10
43
  system(
@@ -24,18 +57,26 @@ module Utilities
24
57
 
25
58
  def build_image_if_needed
26
59
  unless image_exists?(image_tag)
27
- system("docker", "build", root_dir, "-t", image_tag) || abort
60
+ _, err, stat = Open3.capture3(
61
+ "docker", "build", root_dir, "-t", image_tag
62
+ )
63
+ raise Error, err unless stat.success?
28
64
  end
29
65
  end
30
66
 
31
67
  def image_tag
32
68
  gemfile_lock_path = File.expand_path("./Gemfile.lock", root_dir)
33
- image_sha = Digest::SHA256.hexdigest(File.read(gemfile_lock_path))
69
+ dockerfile_path = File.expand_path("./Dockerfile", root_dir)
70
+ fingerprintable_strings = [
71
+ File.read(gemfile_lock_path),
72
+ File.read(dockerfile_path),
73
+ ]
74
+ image_sha = Digest::SHA256.hexdigest(fingerprintable_strings.join("-"))
34
75
  "shopify-cli-#{image_sha}"
35
76
  end
36
77
 
37
78
  def image_exists?(tag)
38
- _, stat = Open3.capture2(
79
+ _, stat = Open3.capture2e(
39
80
  "docker", "inspect",
40
81
  "--type=image",
41
82
  tag
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.6.0
4
+ version: 2.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-06 00:00:00.000000000 Z
11
+ date: 2021-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '1.7'
95
+ version: 1.7.2
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '1.7'
102
+ version: 1.7.2
103
103
  description: |
104
104
  Shopify CLI helps you build Shopify apps faster. It quickly scaffolds Node.js
105
105
  and Ruby on Rails embedded apps. It also automates many common tasks in the
@@ -356,8 +356,11 @@ files:
356
356
  - lib/shopify_cli/admin_api/populate_resource_command.rb
357
357
  - lib/shopify_cli/admin_api/schema.rb
358
358
  - lib/shopify_cli/api.rb
359
+ - lib/shopify_cli/app_type_detector.rb
359
360
  - lib/shopify_cli/command.rb
360
361
  - lib/shopify_cli/command/app_sub_command.rb
362
+ - lib/shopify_cli/command_options.rb
363
+ - lib/shopify_cli/command_options/command_serve_options.rb
361
364
  - lib/shopify_cli/commands.rb
362
365
  - lib/shopify_cli/commands/config.rb
363
366
  - lib/shopify_cli/commands/help.rb
@@ -367,6 +370,7 @@ files:
367
370
  - lib/shopify_cli/commands/populate/customer.rb
368
371
  - lib/shopify_cli/commands/populate/draft_order.rb
369
372
  - lib/shopify_cli/commands/populate/product.rb
373
+ - lib/shopify_cli/commands/reporting.rb
370
374
  - lib/shopify_cli/commands/store.rb
371
375
  - lib/shopify_cli/commands/switch.rb
372
376
  - lib/shopify_cli/commands/system.rb
@@ -384,7 +388,6 @@ files:
384
388
  - lib/shopify_cli/db.rb
385
389
  - lib/shopify_cli/environment.rb
386
390
  - lib/shopify_cli/exception_reporter.rb
387
- - lib/shopify_cli/exception_reporter/permission_controller.rb
388
391
  - lib/shopify_cli/feature.rb
389
392
  - lib/shopify_cli/form.rb
390
393
  - lib/shopify_cli/git.rb
@@ -402,6 +405,7 @@ files:
402
405
  - lib/shopify_cli/migrator.rb
403
406
  - lib/shopify_cli/migrator/migration.rb
404
407
  - lib/shopify_cli/migrator/migrations/1631709766_noop.rb
408
+ - lib/shopify_cli/migrator/migrations/1633691650_merge_reporting_configuration.rb
405
409
  - lib/shopify_cli/options.rb
406
410
  - lib/shopify_cli/packager.rb
407
411
  - lib/shopify_cli/partners_api.rb
@@ -411,10 +415,14 @@ files:
411
415
  - lib/shopify_cli/project.rb
412
416
  - lib/shopify_cli/project_commands.rb
413
417
  - lib/shopify_cli/project_type.rb
418
+ - lib/shopify_cli/reporting_configuration_controller.rb
414
419
  - lib/shopify_cli/resolve_constant.rb
415
420
  - lib/shopify_cli/resources.rb
416
421
  - lib/shopify_cli/resources/env_file.rb
417
422
  - lib/shopify_cli/result.rb
423
+ - lib/shopify_cli/services.rb
424
+ - lib/shopify_cli/services/base_service.rb
425
+ - lib/shopify_cli/services/reporting_service.rb
418
426
  - lib/shopify_cli/shopifolk.rb
419
427
  - lib/shopify_cli/sub_command.rb
420
428
  - lib/shopify_cli/task.rb
@@ -451,6 +459,7 @@ files:
451
459
  - shopify.fish
452
460
  - shopify.sh
453
461
  - utilities/docker.rb
462
+ - utilities/docker/container.rb
454
463
  - utilities/utilities.rb
455
464
  - vendor/deps/cli-kit/REVISION
456
465
  - vendor/deps/cli-kit/lib/cli/kit.rb
@@ -1,54 +0,0 @@
1
- module ShopifyCLI
2
- module ExceptionReporter
3
- module PermissionController
4
- def self.report_error?(context: ShopifyCLI::Context.new)
5
- CLI::UI::Prompt.ask(context.message("core.error_reporting.report_error.question")) do |handler|
6
- handler.option(context.message("core.error_reporting.report_error.yes")) { |_| true }
7
- handler.option(context.message("core.error_reporting.report_error.no")) { |_| false }
8
- end
9
- end
10
-
11
- def self.automatic_reporting_prompted?
12
- ShopifyCLI::Config.get_section(Constants::Config::Sections::ErrorTracking::NAME).key?(
13
- Constants::Config::Sections::ErrorTracking::Fields::AUTOMATIC_REPORTING
14
- )
15
- end
16
-
17
- def self.can_report_automatically?(context: ShopifyCLI::Context.new)
18
- # If the terminal is not interactive we can't prompt the user.
19
- return false unless ShopifyCLI::Environment.interactive?
20
-
21
- if automatic_reporting_prompted?
22
- automatic_reporting_enabled?
23
- else
24
- prompt_user(context: context)
25
- end
26
- end
27
-
28
- def self.prompt_user(context:)
29
- enable_automatic_tracking = CLI::UI::Prompt.ask(
30
- context.message("core.error_reporting.enable_automatic_reporting_prompt.question")
31
- ) do |handler|
32
- handler.option(context.message("core.error_reporting.enable_automatic_reporting_prompt.yes")) { |_| true }
33
- handler.option(context.message("core.error_reporting.enable_automatic_reporting_prompt.no")) { |_| false }
34
- end
35
-
36
- ShopifyCLI::Config.set(
37
- Constants::Config::Sections::ErrorTracking::NAME,
38
- Constants::Config::Sections::ErrorTracking::Fields::AUTOMATIC_REPORTING,
39
- enable_automatic_tracking
40
- )
41
-
42
- enable_automatic_tracking
43
- end
44
-
45
- def self.automatic_reporting_enabled?
46
- ShopifyCLI::Config.get_bool(
47
- Constants::Config::Sections::ErrorTracking::NAME,
48
- Constants::Config::Sections::ErrorTracking::Fields::AUTOMATIC_REPORTING,
49
- default: false
50
- )
51
- end
52
- end
53
- end
54
- end