shopify-cli 2.13.0 → 2.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) 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/stale.yml +46 -0
  6. data/CHANGELOG.md +36 -0
  7. data/Gemfile +1 -0
  8. data/Gemfile.lock +43 -11
  9. data/Rakefile +43 -0
  10. data/ext/javy/hashes/javy-arm-macos-v0.2.1.gz.sha256 +1 -0
  11. data/ext/javy/hashes/javy-x86_64-linux-v0.2.1.gz.sha256 +1 -0
  12. data/ext/javy/hashes/javy-x86_64-macos-v0.2.1.gz.sha256 +1 -0
  13. data/ext/javy/hashes/javy-x86_64-windows-v0.2.1.gz.sha256 +1 -0
  14. data/ext/javy/version +1 -1
  15. data/ext/shopify-extensions/version +1 -1
  16. data/lib/project_types/extension/forms/questions/ask_template.rb +5 -8
  17. data/lib/project_types/extension/messages/messages.rb +10 -0
  18. data/lib/project_types/extension/models/development_server_requirements.rb +13 -7
  19. data/lib/project_types/extension/models/npm_package.rb +19 -1
  20. data/lib/project_types/extension/models/server_config/development_renderer.rb +4 -3
  21. data/lib/project_types/extension/models/server_config/root.rb +2 -0
  22. data/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +13 -0
  23. data/lib/project_types/script/cli.rb +0 -4
  24. data/lib/project_types/script/config/extension_points.yml +18 -6
  25. data/lib/project_types/script/layers/application/build_script.rb +3 -18
  26. data/lib/project_types/script/layers/application/push_script.rb +12 -10
  27. data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +0 -1
  28. data/lib/project_types/script/layers/infrastructure/languages/task_runner.rb +0 -1
  29. data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +2 -10
  30. data/lib/project_types/script/layers/infrastructure/languages/wasm_task_runner.rb +1 -1
  31. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +1 -23
  32. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +1 -1
  33. data/lib/project_types/script/messages/messages.rb +2 -2
  34. data/lib/project_types/theme/commands/package.rb +1 -0
  35. data/lib/project_types/theme/commands/pull.rb +2 -2
  36. data/lib/project_types/theme/commands/push.rb +2 -2
  37. data/lib/project_types/theme/conversions/base_glob.rb +20 -5
  38. data/lib/project_types/theme/messages/messages.rb +9 -0
  39. data/lib/shopify_cli/changelog.rb +76 -0
  40. data/lib/shopify_cli/command.rb +8 -7
  41. data/lib/shopify_cli/commands/app/deploy.rb +0 -1
  42. data/lib/shopify_cli/context.rb +2 -2
  43. data/lib/shopify_cli/core/entry_point.rb +1 -1
  44. data/lib/shopify_cli/core/monorail.rb +14 -6
  45. data/lib/shopify_cli/environment.rb +19 -11
  46. data/lib/shopify_cli/exception_reporter.rb +2 -0
  47. data/lib/shopify_cli/messages/messages.rb +11 -5
  48. data/lib/shopify_cli/packager.rb +1 -1
  49. data/lib/shopify_cli/release.rb +94 -0
  50. data/lib/shopify_cli/result.rb +14 -0
  51. data/lib/shopify_cli/sed.rb +19 -0
  52. data/lib/shopify_cli/services/app/create/node_service.rb +2 -14
  53. data/lib/shopify_cli/services/app/create/php_service.rb +1 -6
  54. data/lib/shopify_cli/services/app/create/rails_service.rb +4 -12
  55. data/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_reloader.rb +5 -5
  56. data/lib/shopify_cli/theme/dev_server/watcher.rb +10 -2
  57. data/lib/shopify_cli/theme/development_theme.rb +2 -5
  58. data/lib/shopify_cli/theme/syncer.rb +20 -25
  59. data/lib/shopify_cli/theme/theme.rb +28 -31
  60. data/lib/shopify_cli/theme/theme_admin_api.rb +72 -0
  61. data/lib/shopify_cli/transform_data_structure.rb +3 -2
  62. data/lib/shopify_cli/tunnel.rb +9 -0
  63. data/lib/shopify_cli/version.rb +1 -1
  64. data/shipit.yml +3 -0
  65. data/shopify-cli.gemspec +12 -3
  66. metadata +18 -10
  67. data/lib/project_types/rails/ruby.rb +0 -17
  68. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_project_creator.rb +0 -36
  69. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +0 -109
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e54fd77e2aa3b1721ea02cd7cad4a84afdae67a3c73510e6ee8b01e44bfc5949
4
- data.tar.gz: a92380f94b7a33cea4eae04d2d528ef09a51d161a5b77a900a294e7176ee89e9
3
+ metadata.gz: 141760dcf4bd3da2b9e92a238c72ee4612fc9e72ce4f522db84f190028439175
4
+ data.tar.gz: f16bc2db60656219f7f1484ce455380822fb7d7da4c65faeceeaf065953076c9
5
5
  SHA512:
6
- metadata.gz: 3a55cc0e5a57ab4a842411667dfca871140ef324d17c537157e3913cce383c84ae70ebd26cbf8f14a020b94283c9d6264ab71af5f55c37255fbe7966ee8f46f5
7
- data.tar.gz: 24328c051c6795d7c4778fdaea861cc77d3337a886126074bce4ae3073b635b6bcd878457e8cad4399c5982b0be5d168a3f6f3c86c5e3bbbe7b7b2ce192e4d58
6
+ metadata.gz: 1df93436fa11a84a2df90f354a59277fbf29bd2445b097da8c2ddd6d727dc9d2d4792602de476f3479329e58873dfd222ea185fd096271896bd4ee8533f5b242
7
+ data.tar.gz: ada360c3f4529d52a0315c70b1c4fea63ad69f0da1ca7aab384958adb8bf342003d4c4dced65ddc4984e5732fb5e2604f77ba82702908242b1d1427570362626
data/.github/CODEOWNERS CHANGED
@@ -3,3 +3,8 @@
3
3
 
4
4
  /lib/project_types/script/ @shopify/scripts-platform
5
5
  /test/project_types/script/ @shopify/scripts-platform
6
+
7
+ /lib/project_types/theme/ @shopify/theme-platform-dev-experience
8
+ /lib/shopify_cli/theme/ @shopify/theme-platform-dev-experience
9
+ /test/project_types/theme/ @shopify/theme-platform-dev-experience
10
+ /test/shopify-cli/theme/ @shopify/theme-platform-dev-experience
@@ -17,7 +17,7 @@ When contributing to the Shopify CLI, there are a set of [design guidelines](htt
17
17
 
18
18
  ### Where to find known issues
19
19
 
20
- We track all of our issues in GitHub and [bugs](https://github.com/Shopify/shopify-cli/labels/Bug) are labeled accordingly. If you are planning to work on an issue, avoid ones which already have an assignee, where someone has commented within the last two weeks they are working on it, or the issue is labeled with [fix in progress](https://github.com/Shopify/shopify-cli/labels/fix%20in%20progress). We will do our best to communicate when an issue is being worked on internally.
20
+ We track all of our issues in GitHub and [bugs](https://github.com/Shopify/shopify-cli/labels/type:bug) are labeled accordingly. If you are planning to work on an issue, avoid ones which already have an assignee, where someone has commented within the last two weeks they are working on it, or the issue is labeled with [fix in progress](https://github.com/Shopify/shopify-cli/labels/fix%20in%20progress). We will do our best to communicate when an issue is being worked on internally.
21
21
 
22
22
  ### Running against a local environment
23
23
 
@@ -40,4 +40,4 @@ Fixes #0000 <!-- link to issue if one exists -->
40
40
  - [ ] I've added a CHANGELOG entry for this PR (if the change is public-facing)
41
41
  - [ ] I've considered possible cross-platform impacts (Mac, Linux, Windows).
42
42
  - [ ] I've left the version number as is (we'll handle incrementing this when releasing).
43
- - [ ] I've included any post-release steps in the section above.
43
+ - [ ] I've included any post-release steps in the section above (if needed).
@@ -0,0 +1,46 @@
1
+ # This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
2
+ #
3
+ # You can adjust the behavior by modifying this file.
4
+ # For more information, see:
5
+ # https://github.com/actions/stale
6
+ name: Mark stale issues and pull requests
7
+
8
+ on:
9
+ schedule:
10
+ - cron: '31 3 * * *' # randomly chosen time of day
11
+ workflow_dispatch:
12
+
13
+ jobs:
14
+ stale:
15
+
16
+ runs-on: ubuntu-latest
17
+ permissions:
18
+ issues: write
19
+ pull-requests: write
20
+
21
+ steps:
22
+ - uses: actions/stale@v4
23
+ with:
24
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
25
+ days-before-issue-stale: 90
26
+ days-before-pr-stale: 30
27
+ days-before-close: 10
28
+ stale-issue-message: |-
29
+ This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action.
30
+
31
+ → If there's no activity within a week, then a bot will automatically close this.
32
+
33
+ Thanks for helping to improve Shopify's dev tooling and experience.
34
+ stale-pr-message: |-
35
+ This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action.
36
+
37
+ → If there's no activity within a week, then a bot will automatically close this.
38
+
39
+ Thanks for helping to improve Shopify's dev tooling and experience.
40
+ stale-issue-label: 'no-issue-activity'
41
+ stale-pr-label: 'no-pr-activity'
42
+ ascending: true
43
+ # The math seems a bit fuzzy, but this should amount to a max of 50 issues daily.
44
+ # But then the same issues get checked first so we don't end up progressing too quickly until we can close what we started.
45
+ # Hopefully https://github.com/actions/stale/issues/692 will be closed and fix some of this mess.
46
+ operations-per-run: 200
data/CHANGELOG.md CHANGED
@@ -2,6 +2,38 @@ 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.15.1
6
+
7
+ ### Added
8
+ * [#1934](https://github.com/Shopify/shopify-cli/pull/1934): Block directories in theme assets
9
+ * [#1880](https://github.com/Shopify/shopify-cli/pull/1880): Recognize attempts to pass a store name and suggest correction
10
+
11
+ ### Fixed
12
+ * [#1874](https://github.com/Shopify/shopify-cli/pull/1874): Make ngrok errors more robust and helpful
13
+ * [#2172](https://github.com/Shopify/shopify-cli/pull/2172): Fix Ruby check for Rails app creation
14
+
15
+ ## Version 2.15.0
16
+
17
+ ### Fixed
18
+ * [#2086](https://github.com/Shopify/shopify-cli/pull/2086): Improve check of dependency versions
19
+ * [#2149](https://github.com/Shopify/shopify-cli/pull/2149): Fix `ThemeAdminAPI` not to handle asset errors
20
+ * [#2122](https://github.com/Shopify/shopify-cli/pull/2122): Fix `--only`/`--ignore` flags parser to support multiple occurrences without quotes
21
+ * [#2146](https://github.com/Shopify/shopify-cli/pull/2146): Prevent duplicate locales for Checkout extension localization
22
+
23
+ ## Version 2.14.0
24
+
25
+ ### Changed
26
+ * [#2126](https://github.com/Shopify/shopify-cli/pull/2126): Use javy version 0.2.1
27
+
28
+ ### Added
29
+ * [#2103](https://github.com/Shopify/shopify-cli/pull/2103): Improve `shopify theme package` to include the `release-notes.md` file
30
+
31
+ ### Fixed
32
+ * [#2112](https://github.com/Shopify/shopify-cli/pull/2112): Fix intermittent error ("can't add a new key into hash during iteration") in the `theme push` command
33
+ * [#2088](https://github.com/Shopify/shopify-cli/pull/2088): Update theme-check to 1.10.1
34
+ * [#2130](https://github.com/Shopify/shopify-cli/pull/2130): Fix Homebrew installation.
35
+ * [#2133](https://github.com/Shopify/shopify-cli/pull/2133): Fix ignore file handling in DevServer::Watcher.
36
+
5
37
  ## Version 2.13.0
6
38
 
7
39
  ### Added
@@ -11,6 +43,10 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
11
43
  ### Fixed
12
44
  * [#2092](https://github.com/Shopify/shopify-cli/pull/2092): Fix `RootHelper` parse logic to support options with an equal (e.g.: `option=value`)
13
45
  * [#2089](https://github.com/Shopify/shopify-cli/pull/2089): Use javy version 0.2.0
46
+ * [#2114](https://github.com/Shopify/shopify-cli/pull/2114): Fix `theme` command error messaging with `ThemeAdminAPI` wrapper
47
+
48
+ ### Removed
49
+ * [#2102](https://github.com/Shopify/shopify-cli/pull/2102): Remove AssemblyScript as a supported script language.
14
50
 
15
51
  ## Version 2.12.0
16
52
  ### Added
data/Gemfile CHANGED
@@ -15,6 +15,7 @@ group :development, :test do
15
15
  gem "rubocop-rake", require: false
16
16
  gem "iniparse", "~> 1.5"
17
17
  gem "colorize", "~> 0.8.1"
18
+ gem "octokit", "~> 4.0"
18
19
  end
19
20
 
20
21
  group :test do
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.13.0)
4
+ shopify-cli (2.15.1)
5
5
  bugsnag (~> 6.22)
6
6
  listen (~> 3.7.0)
7
- theme-check (~> 1.9.0)
7
+ theme-check (~> 1.10.1)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
@@ -13,13 +13,13 @@ GEM
13
13
  public_suffix (>= 2.0.2, < 5.0)
14
14
  ansi (1.5.0)
15
15
  ast (2.4.2)
16
- bugsnag (6.23.0)
16
+ bugsnag (6.24.2)
17
17
  concurrent-ruby (~> 1.0)
18
18
  builder (3.2.4)
19
19
  byebug (11.1.3)
20
20
  coderay (1.1.3)
21
21
  colorize (0.8.1)
22
- concurrent-ruby (1.1.9)
22
+ concurrent-ruby (1.1.10)
23
23
  crack (0.4.5)
24
24
  rexml
25
25
  cucumber (7.0.0)
@@ -55,11 +55,34 @@ GEM
55
55
  cucumber-messages (~> 17.0, >= 17.0.1)
56
56
  diff-lcs (1.4.4)
57
57
  fakefs (1.3.2)
58
+ faraday (1.10.0)
59
+ faraday-em_http (~> 1.0)
60
+ faraday-em_synchrony (~> 1.0)
61
+ faraday-excon (~> 1.1)
62
+ faraday-httpclient (~> 1.0)
63
+ faraday-multipart (~> 1.0)
64
+ faraday-net_http (~> 1.0)
65
+ faraday-net_http_persistent (~> 1.0)
66
+ faraday-patron (~> 1.0)
67
+ faraday-rack (~> 1.0)
68
+ faraday-retry (~> 1.0)
69
+ ruby2_keywords (>= 0.0.4)
70
+ faraday-em_http (1.0.0)
71
+ faraday-em_synchrony (1.0.0)
72
+ faraday-excon (1.1.0)
73
+ faraday-httpclient (1.0.1)
74
+ faraday-multipart (1.0.3)
75
+ multipart-post (>= 1.2, < 3)
76
+ faraday-net_http (1.0.1)
77
+ faraday-net_http_persistent (1.2.0)
78
+ faraday-patron (1.0.0)
79
+ faraday-rack (1.0.0)
80
+ faraday-retry (1.0.3)
58
81
  ffi (1.15.4)
59
82
  hashdiff (1.0.1)
60
83
  iniparse (1.5.0)
61
- liquid (5.1.0)
62
- listen (3.7.0)
84
+ liquid (5.3.0)
85
+ listen (3.7.1)
63
86
  rb-fsevent (~> 0.10, >= 0.10.3)
64
87
  rb-inotify (~> 0.9, >= 0.9.10)
65
88
  method_source (1.0.0)
@@ -77,11 +100,15 @@ GEM
77
100
  ruby-progressbar
78
101
  mocha (1.13.0)
79
102
  multi_test (0.1.2)
103
+ multipart-post (2.1.1)
80
104
  nokogiri (1.13.3)
81
105
  mini_portile2 (~> 2.8.0)
82
106
  racc (~> 1.4)
107
+ octokit (4.22.0)
108
+ faraday (>= 0.9)
109
+ sawyer (~> 0.8.0, >= 0.5.3)
83
110
  parallel (1.21.0)
84
- parser (3.1.0.0)
111
+ parser (3.1.1.0)
85
112
  ast (~> 2.4.1)
86
113
  pry (0.13.1)
87
114
  coderay (~> 1.1)
@@ -94,7 +121,7 @@ GEM
94
121
  rack (2.2.3)
95
122
  rainbow (3.1.1)
96
123
  rake (13.0.6)
97
- rb-fsevent (0.11.0)
124
+ rb-fsevent (0.11.1)
98
125
  rb-inotify (0.10.1)
99
126
  ffi (~> 1.0)
100
127
  regexp_parser (2.2.0)
@@ -117,9 +144,13 @@ GEM
117
144
  rubocop-shopify (2.0.1)
118
145
  rubocop (~> 1.11)
119
146
  ruby-progressbar (1.11.0)
147
+ ruby2_keywords (0.0.5)
148
+ sawyer (0.8.2)
149
+ addressable (>= 2.3.5)
150
+ faraday (> 0.8, < 2.0)
120
151
  sys-uname (1.2.2)
121
152
  ffi (~> 1.1)
122
- theme-check (1.9.0)
153
+ theme-check (1.10.2)
123
154
  liquid (>= 5.1.0)
124
155
  nokogiri (>= 1.12)
125
156
  parser (~> 3)
@@ -134,7 +165,7 @@ PLATFORMS
134
165
  ruby
135
166
 
136
167
  DEPENDENCIES
137
- bundler (~> 2.2.2)
168
+ bundler (~> 2.3.8)
138
169
  byebug
139
170
  colorize (~> 0.8.1)
140
171
  cucumber (~> 7.0)
@@ -144,6 +175,7 @@ DEPENDENCIES
144
175
  minitest-fail-fast
145
176
  minitest-reporters
146
177
  mocha
178
+ octokit (~> 4.0)
147
179
  pry-byebug
148
180
  rack
149
181
  rake
@@ -155,4 +187,4 @@ DEPENDENCIES
155
187
  webmock
156
188
 
157
189
  BUNDLED WITH
158
- 2.2.29
190
+ 2.3.8
data/Rakefile CHANGED
@@ -2,6 +2,8 @@ ENV["SHOPIFY_CLI_TEST"] = "1"
2
2
 
3
3
  require_relative "bin/load_shopify"
4
4
  require_relative "utilities/utilities"
5
+ require_relative "lib/shopify_cli/constants"
6
+ require_relative "lib/shopify_cli/version"
5
7
  require "rake/testtask"
6
8
  require "rubocop/rake_task"
7
9
  require "bundler/gem_tasks"
@@ -33,6 +35,20 @@ task :console do
33
35
  exec("irb", "-r", "./bin/load_shopify.rb", "-r", "byebug")
34
36
  end
35
37
 
38
+ desc("Notifies a new version to Bugsnag")
39
+ task :notify_version_to_bugsnag do
40
+ # This task runs at deployment time to notify
41
+ # Bugsnag about new versions. Because the deployment
42
+ # environment has Node, we can run the Bugsnag CLI
43
+ # through npx.
44
+ system(
45
+ { "npm_config_yes" => "true" },
46
+ "npx", "-q", "bugsnag-build-reporter",
47
+ "-k", ShopifyCLI::Constants::Bugsnag::API_KEY,
48
+ "-v", ShopifyCLI::VERSION
49
+ ) || abort
50
+ end
51
+
36
52
  namespace :rdoc do
37
53
  repo = "https://github.com/Shopify/shopify-cli.wiki.git"
38
54
  intermediate = "markdown_intermediate"
@@ -113,6 +129,33 @@ end
113
129
  desc("Builds all distribution packages of the CLI")
114
130
  task(package: "package:all")
115
131
 
132
+ namespace :release do
133
+ require "shopify_cli/release"
134
+
135
+ task :prepare, [:new_version] do |_t, args|
136
+ new_version = args[:new_version]
137
+ unless new_version
138
+ raise <<~NO_NEW_VERSION
139
+ New version must be provided, e.g.:
140
+
141
+ $ GITHUB_ACCESS_TOKEN=abcdef rake "release:prepare[1.2.3]"
142
+
143
+ NO_NEW_VERSION
144
+ end
145
+ github_access_token = ENV["GITHUB_ACCESS_TOKEN"]
146
+ unless github_access_token
147
+ raise <<~NO_GITHUB_ACCESS_TOKEN
148
+ GitHub access token must be provided, e.g.:
149
+
150
+ $ GITHUB_ACCESS_TOKEN=abcdef rake "release:prepare[1.2.3]"
151
+ NO_GITHUB_ACCESS_TOKEN
152
+ end
153
+
154
+ ShopifyCLI::Release.new(new_version, github_access_token).prepare!
155
+ puts "Completed!"
156
+ end
157
+ end
158
+
116
159
  namespace :extensions do
117
160
  task :update do
118
161
  version = ENV.fetch("VERSION").strip
@@ -0,0 +1 @@
1
+ 80576fe617d6e093a72bc826f041207ddc57605381f0db6451ba27310e57e830
@@ -0,0 +1 @@
1
+ 6b7b6f6745594c2e8efcaf948c0ef367911446101d2b8a7c8138ce2aca868cbd
@@ -0,0 +1 @@
1
+ 4010c2d154f1ef7ebf1f8c49621a0742ab75c60fd77746a5fa175878d07f16ef
@@ -0,0 +1 @@
1
+ c12418f7b3e4edead87ade1f44bd7280626a92d8d1238d7f8eb91b1122f20f20
data/ext/javy/version CHANGED
@@ -1 +1 @@
1
- v0.2.0
1
+ v0.2.1
@@ -1 +1 @@
1
- v0.1.0
1
+ v0.2.0
@@ -11,21 +11,18 @@ module Extension
11
11
  default: -> { CLI::UI::Prompt.method(:ask) }
12
12
 
13
13
  def call(project_details)
14
- return project_details unless template_required?(project_details)
15
- project_details.template = template || choose_interactively
14
+ if template_required?(project_details)
15
+ project_details.template = template || choose_interactively
16
+ end
16
17
  project_details
17
18
  end
18
19
 
19
20
  private
20
21
 
21
22
  def template_required?(project_details)
22
- return false unless extension_server_beta?
23
23
  type = project_details&.type&.identifier
24
- Models::DevelopmentServerRequirements::SUPPORTED_EXTENSION_TYPES.include?(type.downcase)
25
- end
26
-
27
- def extension_server_beta?
28
- ShopifyCLI::Shopifolk.check && ShopifyCLI::Feature.enabled?(:extension_server_beta)
24
+ (Models::DevelopmentServerRequirements.beta_enabled? &&
25
+ Models::DevelopmentServerRequirements.type_supported?(type.downcase))
29
26
  end
30
27
 
31
28
  def choose_interactively
@@ -115,6 +115,16 @@ module Extension
115
115
  tunnel_already_running: "A tunnel running on another port has been detected. Close the tunnel and try again.",
116
116
  },
117
117
  tunnel: {
118
+ duplicate_session: <<~MESSAGE,
119
+ Another ngrok tunnel is currently running with your auth token, possibly on another machine.
120
+
121
+ Terminate that tunnel before opening a new one.
122
+ MESSAGE
123
+ invalid_token: <<~MESSAGE,
124
+ The ngrok token currently configured is invalid.
125
+
126
+ After generating a new token, update your local ngrok configuration using {{command:shopify app tunnel auth <token>}}
127
+ MESSAGE
118
128
  missing_token: "{{x}} {{red:auth requires a token argument}}. "\
119
129
  "Find it on your ngrok dashboard: {{underline:https://dashboard.ngrok.com/auth/your-authtoken}}.",
120
130
  invalid_port: "%s is not a valid port.",
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "shopify_cli"
3
4
 
4
5
  module Extension
@@ -12,21 +13,26 @@ module Extension
12
13
 
13
14
  class << self
14
15
  def supported?(type)
15
- binary_installed? && type_supported?(type) && beta_enabled?
16
+ binary_installed? && type_supported?(type) && type_enabled?(type)
16
17
  end
17
18
 
18
- private
19
-
20
- def binary_installed?
21
- Models::DevelopmentServer.new.executable_installed?
19
+ def beta_enabled?
20
+ ShopifyCLI::Feature.enabled?(:extension_server_beta)
22
21
  end
23
22
 
24
23
  def type_supported?(type)
25
24
  SUPPORTED_EXTENSION_TYPES.include?(type.downcase)
26
25
  end
27
26
 
28
- def beta_enabled?
29
- ShopifyCLI::Shopifolk.check && ShopifyCLI::Feature.enabled?(:extension_server_beta)
27
+ private
28
+
29
+ def binary_installed?
30
+ Models::DevelopmentServer.new.executable_installed?
31
+ end
32
+
33
+ # Some types are enabled unconditionally; others require beta_enabled
34
+ def type_enabled?(type)
35
+ beta_enabled? || "checkout_ui_extension" == type.downcase
30
36
  end
31
37
  end
32
38
  end
@@ -2,9 +2,27 @@ require "semantic/semantic"
2
2
 
3
3
  module Extension
4
4
  module Models
5
- NpmPackage = Struct.new(:name, :version, keyword_init: true) do
5
+ class NpmPackage
6
+ include SmartProperties
6
7
  include Comparable
7
8
 
9
+ property :name
10
+ property :version
11
+ property :scripts, accepts: Hash
12
+ property :dependencies, accepts: Hash
13
+ property :dev_dependencies, accepts: Hash
14
+
15
+ def initialize(**config)
16
+ super(**config.select { |property_name, _| self.class.properties.key?(property_name) })
17
+ end
18
+
19
+ def self.parse(io)
20
+ ShopifyCLI::Result.call { JSON.parse(io.read) }
21
+ .then(&ShopifyCLI::TransformDataStructure.new(underscore_keys: true, symbolize_keys: true, shallow: true))
22
+ .then { |specification| new(**specification) }
23
+ .unwrap { |error| raise "Failed to parse NPM package specification: #{error}" }
24
+ end
25
+
8
26
  def <=>(other)
9
27
  return nil unless name == other.name
10
28
  Semantic::Version.new(version) <=> Semantic::Version.new(other.version)
@@ -13,15 +13,16 @@ module Extension
13
13
  ]
14
14
 
15
15
  property! :name, accepts: VALID_RENDERERS
16
+ property! :version, accepts: String, default: "latest"
16
17
 
17
18
  def self.find(type)
18
19
  case type.downcase
19
20
  when "product_subscription"
20
- new(name: "@shopify/admin-ui-extensions")
21
+ new(name: "@shopify/admin-ui-extensions", version: "^1.0.1")
21
22
  when "checkout_ui_extension"
22
- new(name: "@shopify/checkout-ui-extensions")
23
+ new(name: "@shopify/checkout-ui-extensions", version: "^0.14.0")
23
24
  when "checkout_post_purchase"
24
- new(name: "@shopify/post-purchase-ui-extensions")
25
+ new(name: "@shopify/post-purchase-ui-extensions", version: "^0.13.2")
25
26
  end
26
27
  end
27
28
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "yaml"
4
+
3
5
  module Extension
4
6
  module Models
5
7
  module ServerConfig
@@ -43,6 +43,7 @@ module Extension
43
43
  # Localization is optional
44
44
  return {} if locale_filenames.empty?
45
45
 
46
+ validate_no_duplicate_locale(locale_filenames)
46
47
  validate_total_size(locale_filenames)
47
48
  default_locale = single_default_locale(locale_filenames)
48
49
 
@@ -61,6 +62,18 @@ module Extension
61
62
  end
62
63
  end
63
64
 
65
+ def validate_no_duplicate_locale(locale_filenames)
66
+ duplicate_locale = locale_filenames
67
+ .map { |filename| basename_for_locale_filename(filename.downcase) }
68
+ .group_by { |locale| locale }
69
+ .detect { |_k, v| v.size > 1 }
70
+ &.first
71
+ raise(
72
+ ShopifyCLI::Abort,
73
+ ShopifyCLI::Context.message("#{L10N_ERROR_PREFIX}.duplicate_locale_code", duplicate_locale)
74
+ ) unless duplicate_locale.nil?
75
+ end
76
+
64
77
  def validate_total_size(locale_filenames)
65
78
  total_size = locale_filenames.sum { |filename| File.size(filename) }
66
79
  if total_size > L10N_BUNDLE_SIZE_LIMIT
@@ -64,10 +64,6 @@ module Script
64
64
  autoload :ServiceLocator, Project.project_filepath("layers/infrastructure/service_locator")
65
65
 
66
66
  module Languages
67
- autoload :AssemblyScriptProjectCreator,
68
- Project.project_filepath("layers/infrastructure/languages/assemblyscript_project_creator")
69
- autoload :AssemblyScriptTaskRunner,
70
- Project.project_filepath("layers/infrastructure/languages/assemblyscript_task_runner")
71
67
  autoload :ProjectCreator, Project.project_filepath("layers/infrastructure/languages/project_creator")
72
68
  autoload :TaskRunner, Project.project_filepath("layers/infrastructure/languages/task_runner")
73
69
  autoload :TypeScriptProjectCreator,
@@ -1,9 +1,6 @@
1
1
  payment_methods:
2
2
  domain: 'checkout'
3
3
  libraries:
4
- assemblyscript:
5
- repo: "https://github.com/Shopify/scripts-apis-examples"
6
- package: "@shopify/scripts-checkout-apis"
7
4
  typescript:
8
5
  beta: true
9
6
  package: "@shopify/scripts-checkout-apis"
@@ -13,9 +10,6 @@ payment_methods:
13
10
  shipping_methods:
14
11
  domain: 'checkout'
15
12
  libraries:
16
- assemblyscript:
17
- repo: "https://github.com/Shopify/scripts-apis-examples"
18
- package: "@shopify/scripts-checkout-apis"
19
13
  typescript:
20
14
  beta: true
21
15
  package: "@shopify/scripts-checkout-apis"
@@ -42,3 +36,21 @@ delivery_discount_types:
42
36
  repo: "https://github.com/Shopify/scripts-apis-examples"
43
37
  wasm:
44
38
  repo: "https://github.com/Shopify/scripts-apis-examples"
39
+ product_discount_type:
40
+ beta: true
41
+ domain: 'discounts'
42
+ libraries:
43
+ wasm:
44
+ repo: "https://github.com/Shopify/scripts-apis-examples"
45
+ order_discount_type:
46
+ beta: true
47
+ domain: 'discounts'
48
+ libraries:
49
+ wasm:
50
+ repo: "https://github.com/Shopify/scripts-apis-examples"
51
+ shipping_discount_type:
52
+ beta: true
53
+ domain: 'discounts'
54
+ libraries:
55
+ wasm:
56
+ repo: "https://github.com/Shopify/scripts-apis-examples"
@@ -5,31 +5,16 @@ module Script
5
5
  module Application
6
6
  class BuildScript
7
7
  class << self
8
- def call(ctx:, task_runner:, script_project:, library:)
8
+ def call(ctx:, task_runner:)
9
9
  CLI::UI::Frame.open(ctx.message("script.application.building")) do
10
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)
14
-
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
- )
11
+ task_runner.build
21
12
  spinner.update_title(ctx.message("script.application.built"))
22
13
  end
23
- rescue StandardError => e
14
+ rescue Infrastructure::Errors::BuildError => e
24
15
  CLI::UI::Frame.with_frame_color_override(:red) do
25
16
  ctx.puts("\n{{red:#{e.message}}}")
26
17
  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
18
  raise
34
19
  end
35
20
  end
@@ -21,30 +21,32 @@ 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,