shopify-cli 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +11 -0
  4. data/Dockerfile +0 -2
  5. data/Gemfile.lock +22 -16
  6. data/Rakefile +7 -16
  7. data/bin/console +11 -0
  8. data/bin/shopify +15 -3
  9. data/dev.yml +3 -0
  10. data/ext/shopify-cli/extconf.rb +2 -0
  11. data/lib/project_types/extension/cli.rb +2 -0
  12. data/lib/project_types/extension/commands/build.rb +2 -1
  13. data/lib/project_types/extension/features/argo.rb +1 -1
  14. data/lib/project_types/extension/features/argo_serve.rb +1 -0
  15. data/lib/project_types/extension/models/development_server.rb +4 -0
  16. data/lib/project_types/extension/models/development_server_requirements.rb +1 -2
  17. data/lib/project_types/extension/models/specification_handlers/default.rb +4 -0
  18. data/lib/project_types/extension/tasks/converters/server_config_converter.rb +31 -0
  19. data/lib/project_types/extension/tasks/find_npm_packages.rb +2 -2
  20. data/lib/project_types/extension/tasks/load_server_config.rb +23 -0
  21. data/lib/project_types/extension/tasks/run_extension_command.rb +26 -10
  22. data/lib/project_types/node/commands/serve.rb +9 -1
  23. data/lib/project_types/node/messages/messages.rb +3 -0
  24. data/lib/project_types/script/cli.rb +4 -3
  25. data/lib/project_types/script/commands/create.rb +2 -0
  26. data/lib/project_types/script/config/extension_points.yml +30 -29
  27. data/lib/project_types/script/layers/application/create_script.rb +32 -12
  28. data/lib/project_types/script/layers/application/extension_points.rb +3 -3
  29. data/lib/project_types/script/layers/domain/extension_point.rb +13 -45
  30. data/lib/project_types/script/layers/infrastructure/api_clients/partners_proxy_api_client.rb +4 -2
  31. data/lib/project_types/script/layers/infrastructure/api_clients/script_service_api_client.rb +1 -1
  32. data/lib/project_types/script/layers/infrastructure/errors.rb +5 -0
  33. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_project_creator.rb +10 -90
  34. data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +76 -11
  35. data/lib/project_types/script/layers/infrastructure/languages/task_runner.rb +1 -1
  36. data/lib/project_types/script/layers/infrastructure/languages/typescript_project_creator.rb +33 -0
  37. data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +105 -0
  38. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +1 -1
  39. data/lib/project_types/script/messages/messages.rb +4 -0
  40. data/lib/project_types/script/ui/error_handler.rb +8 -0
  41. data/lib/shopify_cli/command/app_sub_command.rb +16 -0
  42. data/lib/shopify_cli/constants.rb +33 -5
  43. data/lib/shopify_cli/core/executor.rb +5 -1
  44. data/lib/shopify_cli/environment.rb +35 -4
  45. data/lib/shopify_cli/exception_reporter/permission_controller.rb +54 -0
  46. data/lib/shopify_cli/exception_reporter.rb +55 -0
  47. data/lib/shopify_cli/git.rb +30 -0
  48. data/lib/shopify_cli/messages/messages.rb +27 -1
  49. data/lib/shopify_cli/method_object.rb +11 -4
  50. data/lib/shopify_cli/migrator/migration.rb +27 -0
  51. data/lib/shopify_cli/migrator/migrations/1631709766_noop.rb +13 -0
  52. data/lib/shopify_cli/migrator.rb +48 -0
  53. data/lib/shopify_cli/version.rb +1 -1
  54. data/lib/shopify_cli.rb +11 -3
  55. data/shopify-cli.gemspec +9 -1
  56. data/utilities/docker.rb +47 -0
  57. data/utilities/utilities.rb +5 -0
  58. metadata +31 -6
  59. data/lib/project_types/script/layers/infrastructure/languages/rust_project_creator.rb +0 -73
  60. data/lib/project_types/script/layers/infrastructure/languages/rust_task_runner.rb +0 -60
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60163978b05868670c0b5535cc49060ba5f55c9e127d6f97232970751caeb4d8
4
- data.tar.gz: b3993bcef0bd4d5488f4b4d7f3e8b6f219a0322279159a512a12cc3986f2e63a
3
+ metadata.gz: c9bf62139d7f6ea0c4e88417521bd981c28c0823950768c3350410f2c8666e35
4
+ data.tar.gz: a15af494f4dbbcb6e2b8c276e34fb1347e3142f59d5646e80370199ddc6d0bce
5
5
  SHA512:
6
- metadata.gz: cd65b86469afbc40117f58257840588dea0fd07141e899ac9273e0eee9da4bcaef119c4df14921777d3ae88932fd053771392154658704294b59afd9656b00f8
7
- data.tar.gz: 2d199c2d96954b9d2c666fc4822f845f1a176115eb90a28078af42ceaf0cf691b3b2e21896485afe4c42b2ec43e7c5af576ba18a86188bf01a22f7ff32ffb8f0
6
+ metadata.gz: f4dbceb0f0d41f605bb3be605e54eae58868d83e86fe7cd0476dc0193c7e2cf7369fa86a8d5d2a2070711f54dd03b02b2200bc844f02b42be9297178095f2106
7
+ data.tar.gz: 2c75055724e3fce904caca22f974f9cbc87bf10bfb9388f5227a227799f8b6c7e33aece62d7301cfde366d69fcc27832256e1da791e2dc4ca7f85d02f7c41191
data/.gitignore CHANGED
@@ -21,3 +21,4 @@ packaging/rpm/build
21
21
  packaging/rpm/shopify-cli.spec
22
22
  .byebug_history
23
23
  ext/shopify-extensions/shopify-extensions
24
+ .console_history
data/CHANGELOG.md CHANGED
@@ -1,6 +1,17 @@
1
1
  Unreleased
2
2
  ------
3
3
 
4
+ Version 2.6.0
5
+ ------
6
+
7
+ * [#1574](https://github.com/Shopify/shopify-cli/pull/1574): Hide LoadError for ${RUBY_MAJOR}/ffi_c.
8
+ * [#1567](https://github.com/Shopify/shopify-cli/pull/1567): Add ability to set custom port for ngrok tunnel in node serve.
9
+ * [#1584](https://github.com/Shopify/shopify-cli/issues/1584): Fixed extended help message not showing.
10
+ * [#1566](https://github.com/Shopify/shopify-cli/pull/1566): Fix bug when running `npm | yarn list` for extension package resolution.
11
+ * [#1524](https://github.com/Shopify/shopify-cli/pull/1524): Add automatic error-reporting.
12
+ * [#1528](https://github.com/Shopify/shopify-cli/pull/1528): Bump theme-check version to 1.7
13
+ * [#1566](https://github.com/Shopify/shopify-cli/pull/1566): Fix bug when running `npm | yarn list` for extension package resolution
14
+
4
15
  Version 2.5.0
5
16
  ------
6
17
 
data/Dockerfile CHANGED
@@ -14,6 +14,4 @@ WORKDIR /usr/src/app
14
14
  COPY Gemfile Gemfile.lock ./
15
15
  COPY shopify-cli.gemspec shopify-cli.gemspec
16
16
  COPY lib/shopify_cli/version.rb lib/shopify_cli/version.rb
17
- COPY . .
18
-
19
17
  RUN bundle install
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.5.0)
4
+ shopify-cli (2.6.0)
5
+ bugsnag (~> 6.22)
5
6
  listen (~> 3.7.0)
6
- theme-check (~> 1.4.0)
7
+ theme-check (~> 1.7)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
@@ -12,10 +13,14 @@ GEM
12
13
  public_suffix (>= 2.0.2, < 5.0)
13
14
  ansi (1.5.0)
14
15
  ast (2.4.2)
16
+ bugsnag (6.23.0)
17
+ concurrent-ruby (~> 1.0)
15
18
  builder (3.2.4)
16
19
  byebug (11.1.3)
17
20
  coderay (1.1.3)
18
- crack (0.4.4)
21
+ concurrent-ruby (1.1.9)
22
+ crack (0.4.5)
23
+ rexml
19
24
  cucumber (7.0.0)
20
25
  builder (~> 3.2, >= 3.2.4)
21
26
  cucumber-core (~> 10.0, >= 10.0.1)
@@ -41,17 +46,17 @@ GEM
41
46
  cucumber-messages (~> 17.0, >= 17.0.1)
42
47
  cucumber-html-formatter (16.0.1)
43
48
  cucumber-messages (~> 17.0, >= 17.0.1)
44
- cucumber-messages (17.1.0)
49
+ cucumber-messages (17.1.1)
45
50
  cucumber-tag-expressions (3.0.1)
46
51
  cucumber-wire (6.1.1)
47
52
  cucumber-core (~> 10.0, >= 10.0.1)
48
53
  cucumber-cucumber-expressions (~> 12.1, >= 12.1.2)
49
54
  cucumber-messages (~> 17.0, >= 17.0.1)
50
55
  diff-lcs (1.4.4)
51
- fakefs (1.2.2)
52
- ffi (1.15.3)
56
+ fakefs (1.3.2)
57
+ ffi (1.15.4)
53
58
  hashdiff (1.0.1)
54
- liquid (5.0.1)
59
+ liquid (5.1.0)
55
60
  listen (3.7.0)
56
61
  rb-fsevent (~> 0.10, >= 0.10.3)
57
62
  rb-inotify (~> 0.9, >= 0.9.10)
@@ -60,21 +65,21 @@ GEM
60
65
  mime-types-data (~> 3.2015)
61
66
  mime-types-data (3.2021.0901)
62
67
  mini_portile2 (2.6.1)
63
- minitest (5.14.2)
68
+ minitest (5.14.4)
64
69
  minitest-fail-fast (0.1.0)
65
70
  minitest (~> 5)
66
- minitest-reporters (1.4.2)
71
+ minitest-reporters (1.4.3)
67
72
  ansi
68
73
  builder
69
74
  minitest (>= 5.0)
70
75
  ruby-progressbar
71
- mocha (1.11.2)
76
+ mocha (1.13.0)
72
77
  multi_test (0.1.2)
73
- nokogiri (1.12.4)
78
+ nokogiri (1.12.5)
74
79
  mini_portile2 (~> 2.6.1)
75
80
  racc (~> 1.4)
76
- parallel (1.20.1)
77
- parser (3.0.1.0)
81
+ parallel (1.21.0)
82
+ parser (3.0.2.0)
78
83
  ast (~> 2.4.1)
79
84
  pry (0.13.1)
80
85
  coderay (~> 1.1)
@@ -86,7 +91,7 @@ GEM
86
91
  racc (1.5.2)
87
92
  rack (2.2.3)
88
93
  rainbow (3.0.0)
89
- rake (13.0.1)
94
+ rake (13.0.6)
90
95
  rb-fsevent (0.11.0)
91
96
  rb-inotify (0.10.1)
92
97
  ffi (~> 1.0)
@@ -112,9 +117,10 @@ GEM
112
117
  ruby-progressbar (1.11.0)
113
118
  sys-uname (1.2.2)
114
119
  ffi (~> 1.1)
115
- theme-check (1.4.0)
116
- liquid (>= 5.0.1)
120
+ theme-check (1.7.2)
121
+ liquid (>= 5.1.0)
117
122
  nokogiri (>= 1.12)
123
+ parser (~> 3)
118
124
  timecop (0.9.2)
119
125
  unicode-display_width (2.0.0)
120
126
  webmock (3.9.3)
data/Rakefile CHANGED
@@ -1,8 +1,13 @@
1
+ ENV["SHOPIFY_CLI_TEST"] = "1"
2
+
1
3
  require_relative "bin/load_shopify"
4
+ require_relative "utilities/utilities"
2
5
  require "rake/testtask"
3
6
  require "rubocop/rake_task"
4
7
  require "bundler/gem_tasks"
5
8
  require "shellwords"
9
+ require "digest"
10
+ require "open3"
6
11
 
7
12
  Rake::TestTask.new do |t|
8
13
  t.libs += %w(test)
@@ -15,26 +20,12 @@ desc "A set of tasks that run in Linux environments"
15
20
  namespace :linux do
16
21
  desc "Runs the test suite in a Linux Docker environment"
17
22
  task :test do
18
- system("docker", "build", __dir__, "-t", "shopify-cli") || abort
19
- system(
20
- "docker", "run",
21
- "-t", "--rm",
22
- "--volume", "#{Shellwords.escape(__dir__)}:/usr/src/app",
23
- "shopify-cli",
24
- "bundle", "exec", "rake", "test"
25
- ) || abort
23
+ Utilities::Docker.run_and_rm_container("bundle", "exec", "rake", "test")
26
24
  end
27
25
 
28
26
  desc "Runs the acceptance tests suite in a Linux Docker environment"
29
27
  task :features do
30
- system("docker", "build", __dir__, "-t", "shopify-cli") || abort
31
- system(
32
- "docker", "run",
33
- "-t", "--rm",
34
- "--volume", "#{Shellwords.escape(__dir__)}:/usr/src/app",
35
- "shopify-cli",
36
- "bundle", "exec", "cucumber"
37
- ) || abort
28
+ Utilities::Docker.run_and_rm_container("bundle", "exec", "cucumber")
38
29
  end
39
30
  end
40
31
 
data/bin/console ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "load_shopify"
5
+ require "irb"
6
+ require "irb/completion"
7
+ require "irb/ext/save-history"
8
+
9
+ IRB.conf[:SAVE_HISTORY] = 100
10
+ IRB.conf[:HISTORY_FILE] = File.expand_path("../../.console_history", __FILE__)
11
+ IRB.start
data/bin/shopify CHANGED
@@ -12,6 +12,8 @@ module Kernel
12
12
  raise if (name == "readline.so") && ShopifyCLI::Context.new.windows?
13
13
  # Special case for psych (yaml), which rescues this itself
14
14
  raise if name == "#{RUBY_VERSION[/\d+\.\d+/]}/psych.so"
15
+ # Special case for ffi, which rescues this itself
16
+ raise if name == "#{RUBY_VERSION.split(".")[0, 2].join(".")}/ffi_c"
15
17
  STDERR.puts "[Note] You cannot use gems with Shopify CLI."
16
18
  STDERR.puts "[LoadError] #{e.message}"
17
19
  if ENV["DEBUG"]
@@ -29,6 +31,16 @@ end
29
31
 
30
32
  require_relative "./load_shopify"
31
33
 
32
- exit(ShopifyCLI::ErrorHandler.call do
33
- ShopifyCLI::Core::EntryPoint.call(ARGV.dup)
34
- end)
34
+ exit(proc do
35
+ begin
36
+ ShopifyCLI::ErrorHandler.call do
37
+ ShopifyCLI::Core::EntryPoint.call(ARGV.dup)
38
+ end
39
+ rescue StandardError => error
40
+ if ShopifyCLI::Environment.print_stacktrace?
41
+ raise error
42
+ else
43
+ 1
44
+ end
45
+ end
46
+ end.call)
data/dev.yml CHANGED
@@ -2,6 +2,9 @@ name: dev
2
2
  type:
3
3
  - ruby
4
4
 
5
+ env:
6
+ SHOPIFY_CLI_DEVELOPMENT: "1"
7
+
5
8
  up:
6
9
  - ruby: 2.7.1
7
10
  - homebrew:
@@ -1,5 +1,6 @@
1
1
  require "rbconfig"
2
2
  require "fileutils"
3
+ require "date"
3
4
 
4
5
  gem = File.expand_path("../../../", __FILE__)
5
6
  exe = File.join(gem, "bin", "shopify")
@@ -56,4 +57,5 @@ else
56
57
  MAKEFILE
57
58
  end
58
59
 
60
+ File.write(installation_date_path, Time.now.to_i.to_s)
59
61
  File.write("Makefile", makefile_content)
@@ -42,6 +42,7 @@ module Extension
42
42
  autoload :GetExtensions, Project.project_filepath("tasks/get_extensions")
43
43
  autoload :GetProduct, Project.project_filepath("tasks/get_product")
44
44
  autoload :RunExtensionCommand, Project.project_filepath("tasks/run_extension_command")
45
+ autoload :LoadServerConfig, Project.project_filepath("tasks/load_server_config")
45
46
 
46
47
  module Converters
47
48
  autoload :RegistrationConverter, Project.project_filepath("tasks/converters/registration_converter")
@@ -49,6 +50,7 @@ module Extension
49
50
  autoload :ValidationErrorConverter, Project.project_filepath("tasks/converters/validation_error_converter")
50
51
  autoload :AppConverter, Project.project_filepath("tasks/converters/app_converter")
51
52
  autoload :ProductConverter, Project.project_filepath("tasks/converters/product_converter")
53
+ autoload :ServerConfigConverter, Project.project_filepath("tasks/converters/server_config_converter")
52
54
  end
53
55
  end
54
56
 
@@ -26,7 +26,8 @@ module Extension
26
26
  def run_new_flow(project)
27
27
  Tasks::RunExtensionCommand.new(
28
28
  type: project.specification_identifier.downcase,
29
- command: "build"
29
+ command: "build",
30
+ config_file_name: specification_handler.server_config_file,
30
31
  ).call
31
32
 
32
33
  @ctx.puts(@ctx.message("build.build_success_message"))
@@ -44,7 +44,7 @@ module Extension
44
44
  def renderer_package(context)
45
45
  js_system = ShopifyCLI::JsSystem.new(ctx: context)
46
46
  Tasks::FindNpmPackages
47
- .exactly_one_of(renderer_package_name, js_system: js_system)
47
+ .exactly_one_of(renderer_package_name, js_system: js_system, production_only: true)
48
48
  .unwrap { |err| raise err }
49
49
  rescue Extension::PackageResolutionFailed
50
50
  context.abort(
@@ -116,6 +116,7 @@ module Extension
116
116
  command: "serve",
117
117
  context: context,
118
118
  port: port,
119
+ config_file_name: specification_handler.server_config_file,
119
120
  ).call
120
121
  end
121
122
 
@@ -22,6 +22,10 @@ module Extension
22
22
  end
23
23
  end
24
24
 
25
+ def executable_installed?
26
+ File.exist?(executable)
27
+ end
28
+
25
29
  def create(server_config)
26
30
  CLI::Kit::System.capture3(executable, "create", "-", stdin_data: server_config.to_yaml)
27
31
  rescue StandardError => error
@@ -19,8 +19,7 @@ module Extension
19
19
  private
20
20
 
21
21
  def binary_installed?
22
- extension_dir = File.join(ShopifyCLI::ROOT, "ext", "shopify-extensions")
23
- File.exist?(File.join(extension_dir, UNIX_NAME)) || File.exist?(File.join(extension_dir, WINDOWS_NAME))
22
+ Models::DevelopmentServer.new.executable_installed?
24
23
  end
25
24
 
26
25
  def type_supported?(type)
@@ -103,6 +103,10 @@ module Extension
103
103
  raise NotImplementedError
104
104
  end
105
105
 
106
+ def server_config_file
107
+ "shopifile.yml"
108
+ end
109
+
106
110
  protected
107
111
 
108
112
  def argo
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+ require "shopify_cli"
3
+
4
+ module Extension
5
+ module Tasks
6
+ module Converters
7
+ module ServerConfigConverter
8
+ def self.from_hash(hash, type)
9
+ context.abort(context.message("tasks.errors.parse_error")) if hash.nil?
10
+
11
+ project = ExtensionProject.current
12
+
13
+ extension = Models::ServerConfig::Extension.new(
14
+ uuid: project.registration_uuid,
15
+ type: type.upcase,
16
+ user: Models::ServerConfig::User.new,
17
+ development: Models::ServerConfig::Development.new(
18
+ build_dir: hash.dig("development", "build_dir"),
19
+ renderer: Models::ServerConfig::DevelopmentRenderer.find(type),
20
+ entries: Models::ServerConfig::DevelopmentEntries.new(
21
+ main: hash.dig("development", "entries", "main")
22
+ )
23
+ )
24
+ )
25
+
26
+ Models::ServerConfig::Root.new(extensions: [extension])
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -84,11 +84,11 @@ module Extension
84
84
  end
85
85
 
86
86
  def yarn_list
87
- production_only? ? %w[list --production] : %w[list]
87
+ production_only? ? %w[list --production --depth=0] : %w[list]
88
88
  end
89
89
 
90
90
  def npm_list
91
- production_only? ? %w[list --prod --depth=1] : %w[list --depth=1]
91
+ production_only? ? %w[list --prod --depth=0] : %w[list]
92
92
  end
93
93
 
94
94
  def search_packages(packages, package_list)
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+ require "shopify_cli"
3
+ require "yaml"
4
+
5
+ module Extension
6
+ module Tasks
7
+ class LoadServerConfig < ShopifyCLI::Task
8
+ include SmartProperties
9
+
10
+ class << self
11
+ def call(file_name:, type:)
12
+ config = YAML.load_file(file_name)
13
+ Tasks::Converters::ServerConfigConverter.from_hash(config, type)
14
+ rescue Psych::SyntaxError => e
15
+ raise(
16
+ ShopifyCLI::Abort,
17
+ ShopifyCLI::Context.message("core.yaml.error.invalid", file_name, e.message)
18
+ )
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -17,17 +17,17 @@ module Extension
17
17
  "serve",
18
18
  ]
19
19
 
20
- property :root_dir, accepts: String
21
- property :template, accepts: Models::ServerConfig::Development::VALID_TEMPLATES
22
- property! :type, accepts: SUPPORTED_EXTENSION_TYPES
23
20
  property! :command, accepts: SUPPORTED_COMMANDS
21
+ property! :type, accepts: SUPPORTED_EXTENSION_TYPES
24
22
  property :context, accepts: ShopifyCLI::Context
23
+ property :config_file_name, accepts: String
25
24
  property :port, accepts: Integer, default: 39351
25
+ property :root_dir, accepts: String
26
+ property :template, accepts: Models::ServerConfig::Development::VALID_TEMPLATES
26
27
 
27
28
  def call
28
- ShopifyCLI::Result
29
- .call(&method(:build_extension))
30
- .then(&method(:build_server_config))
29
+ ShopifyCLI::Result.success(config_file_exists?)
30
+ .then(&method(:load_or_build_server_config))
31
31
  .then(&method(:run_command))
32
32
  .unwrap do |error|
33
33
  raise error unless error.nil?
@@ -36,15 +36,31 @@ module Extension
36
36
 
37
37
  private
38
38
 
39
- def build_extension
40
- Models::ServerConfig::Extension.build(
39
+ def config_file_exists?
40
+ return false if config_file_name.nil?
41
+ project = ExtensionProject.current
42
+ File.exist?(File.join(project.directory, config_file_name))
43
+ end
44
+
45
+ def load_or_build_server_config(config_file_exists)
46
+ return load_server_config if config_file_exists
47
+ build_server_config
48
+ end
49
+
50
+ def load_server_config
51
+ Tasks::LoadServerConfig.call(
52
+ file_name: config_file_name,
53
+ type: type,
54
+ )
55
+ end
56
+
57
+ def build_server_config
58
+ extension = Models::ServerConfig::Extension.build(
41
59
  template: template,
42
60
  type: type,
43
61
  root_dir: root_dir,
44
62
  )
45
- end
46
63
 
47
- def build_server_config(extension)
48
64
  Models::ServerConfig::Root.new(port: port, extensions: [extension])
49
65
  end
50
66
 
@@ -9,6 +9,7 @@ module Node
9
9
  parser.on("--host=HOST") do |h|
10
10
  flags[:host] = h.gsub('"', "")
11
11
  end
12
+ parser.on("--port=PORT") { |port| flags[:port] = port }
12
13
  end
13
14
 
14
15
  def call(*)
@@ -29,11 +30,18 @@ module Node
29
30
 
30
31
  CLI::UI::Frame.open(@ctx.message("node.serve.running_server")) do
31
32
  env = project.env.to_h
32
- env["PORT"] = ShopifyCLI::Tunnel::PORT.to_s
33
+ env["PORT"] = port.to_s
33
34
  @ctx.system("npm run dev", env: env)
34
35
  end
35
36
  end
36
37
 
38
+ def port
39
+ return ShopifyCLI::Tunnel::PORT.to_s unless options.flags.key?(:port)
40
+ port = options.flags[:port].to_i
41
+ @ctx.abort(@ctx.message("node.serve.error.invalid_port", options.flags[:port])) unless port > 0
42
+ port
43
+ end
44
+
37
45
  def self.help
38
46
  ShopifyCLI::Context.message("node.serve.help", ShopifyCLI::TOOL_NAME)
39
47
  end
@@ -119,10 +119,12 @@ module Node
119
119
  extended_help: <<~HELP,
120
120
  {{bold:Options:}}
121
121
  {{cyan:--host=HOST}}: Bypass running tunnel and use custom host. HOST must be HTTPS url.
122
+ {{cyan:--port=PORT}}: Use custom port.
122
123
  HELP
123
124
 
124
125
  error: {
125
126
  host_must_be_https: "HOST must be a HTTPS url.",
127
+ invalid_port: "%s is not a valid port.",
126
128
  },
127
129
 
128
130
  open_info: <<~MESSAGE,
@@ -154,6 +156,7 @@ module Node
154
156
  error: {
155
157
  token_argument_missing: "{{x}} {{red:auth requires a token argument}}\n\n",
156
158
  },
159
+
157
160
  },
158
161
 
159
162
  forms: {
@@ -60,10 +60,11 @@ module Script
60
60
  autoload :AssemblyScriptTaskRunner,
61
61
  Project.project_filepath("layers/infrastructure/languages/assemblyscript_task_runner")
62
62
  autoload :ProjectCreator, Project.project_filepath("layers/infrastructure/languages/project_creator")
63
- autoload :RustProjectCreator,
64
- Project.project_filepath("layers/infrastructure/languages/rust_project_creator.rb")
65
- autoload :RustTaskRunner, Project.project_filepath("layers/infrastructure/languages/rust_task_runner")
66
63
  autoload :TaskRunner, Project.project_filepath("layers/infrastructure/languages/task_runner")
64
+ autoload :TypeScriptProjectCreator,
65
+ Project.project_filepath("layers/infrastructure/languages/typescript_project_creator.rb")
66
+ autoload :TypeScriptTaskRunner,
67
+ Project.project_filepath("layers/infrastructure/languages/typescript_task_runner.rb")
67
68
  end
68
69
 
69
70
  module ApiClients
@@ -10,6 +10,7 @@ module Script
10
10
  parser.on("--extension_point=EP_NAME") { |ep_name| flags[:extension_point] = ep_name }
11
11
  parser.on("--extension-point=EP_NAME") { |ep_name| flags[:extension_point] = ep_name }
12
12
  parser.on("--language=LANGUAGE") { |language| flags[:language] = language }
13
+ parser.on("--branch=BRANCH") { |branch| flags[:branch] = branch }
13
14
  parser.on("--no-config-ui") { |no_config_ui| flags[:no_config_ui] = no_config_ui }
14
15
  end
15
16
 
@@ -24,6 +25,7 @@ module Script
24
25
  project = Layers::Application::CreateScript.call(
25
26
  ctx: @ctx,
26
27
  language: form.language,
28
+ sparse_checkout_branch: options.flags[:branch] || "master",
27
29
  script_name: form.name,
28
30
  extension_point_type: form.extension_point,
29
31
  no_config_ui: options.flags.key?(:no_config_ui)
@@ -1,43 +1,44 @@
1
1
  discount:
2
2
  deprecated: true
3
- assemblyscript:
4
- package: "@shopify/extension-point-as-discount"
5
- sdk-version: "^9.0.0"
6
- toolchain-version: "^5.0.0"
3
+ libraries:
4
+ assemblyscript:
5
+ package: "@shopify/extension-point-as-discount"
7
6
  unit_limit_per_order:
8
7
  beta: true
9
- assemblyscript:
10
- package: "@shopify/extension-point-as-unit-limit-per-order"
11
- sdk-version: "^9.0.0"
12
- toolchain-version: "^5.0.0"
8
+ libraries:
9
+ assemblyscript:
10
+ package: "@shopify/extension-point-as-unit-limit-per-order"
13
11
  payment_filter:
14
12
  deprecated: true
15
- assemblyscript:
16
- package: "@shopify/extension-point-as-payment-filter"
17
- sdk-version: "^9.0.0"
18
- toolchain-version: "^5.0.0"
19
- rust:
20
- beta: true
21
- package: "https://github.com/Shopify/scripts-apis-rs"
13
+ libraries:
14
+ assemblyscript:
15
+ package: "@shopify/extension-point-as-payment-filter"
22
16
  shipping_filter:
23
17
  deprecated: true
24
- assemblyscript:
25
- package: "@shopify/extension-point-as-shipping-filter"
26
- sdk-version: "^9.0.0"
27
- toolchain-version: "^5.0.0"
18
+ libraries:
19
+ assemblyscript:
20
+ package: "@shopify/extension-point-as-shipping-filter"
28
21
  tax_filter:
29
22
  beta: true
30
- assemblyscript:
31
- package: "@shopify/extension-point-as-tax-filter"
32
- sdk-version: "^9.0.0"
33
- toolchain-version: "^5.0.0"
23
+ libraries:
24
+ assemblyscript:
25
+ repo: "https://github.com/Shopify/extension-points.git"
26
+ package: "@shopify/extension-point-as-tax-filter"
34
27
  payment_methods:
35
28
  domain: 'checkout'
36
- assemblyscript:
37
- package: "@shopify/scripts-checkout-apis"
38
- toolchain-version: "^5.0.0"
29
+ libraries:
30
+ assemblyscript:
31
+ repo: "https://github.com/Shopify/scripts-apis-examples"
32
+ package: "@shopify/scripts-checkout-apis"
33
+ typescript:
34
+ beta: true
35
+ repo: "https://github.com/Shopify/scripts-apis-examples"
39
36
  shipping_methods:
40
37
  domain: 'checkout'
41
- assemblyscript:
42
- package: "@shopify/scripts-checkout-apis"
43
- toolchain-version: "^5.0.0"
38
+ libraries:
39
+ assemblyscript:
40
+ repo: "https://github.com/Shopify/scripts-apis-examples"
41
+ package: "@shopify/scripts-checkout-apis"
42
+ typescript:
43
+ beta: true
44
+ repo: "https://github.com/Shopify/scripts-apis-examples"