shopify-cli 2.15.1 → 2.15.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.vscode/settings.json +1 -2
  3. data/CHANGELOG.md +68 -20
  4. data/Gemfile.lock +1 -1
  5. data/Rakefile +21 -0
  6. data/ext/javy/hashes/javy-arm-macos-v0.3.0.gz.sha256 +1 -0
  7. data/ext/javy/hashes/javy-x86_64-linux-v0.3.0.gz.sha256 +1 -0
  8. data/ext/javy/hashes/javy-x86_64-macos-v0.3.0.gz.sha256 +1 -0
  9. data/ext/javy/hashes/javy-x86_64-windows-v0.3.0.gz.sha256 +1 -0
  10. data/ext/javy/version +1 -1
  11. data/ext/shopify-extensions/version +1 -1
  12. data/lib/project_types/extension/cli.rb +4 -0
  13. data/lib/project_types/extension/commands/check.rb +6 -1
  14. data/lib/project_types/extension/forms/questions/ask_template.rb +1 -2
  15. data/lib/project_types/extension/messages/messages.rb +1 -3
  16. data/lib/project_types/extension/models/development_server_requirements.rb +1 -0
  17. data/lib/project_types/extension/models/specification_handlers/beacon_extension.rb +57 -0
  18. data/lib/project_types/extension/models/specification_handlers/beacon_extension_utils/script_config.rb +33 -0
  19. data/lib/project_types/extension/models/specification_handlers/beacon_extension_utils/script_config_repository.rb +75 -0
  20. data/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +16 -1
  21. data/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +4 -1
  22. data/lib/project_types/extension/tasks/configure_options.rb +2 -1
  23. data/lib/project_types/extension/tasks/convert_server_config.rb +13 -2
  24. data/lib/project_types/extension/tasks/merge_server_config.rb +5 -2
  25. data/lib/project_types/script/cli.rb +1 -0
  26. data/lib/project_types/script/layers/application/create_script.rb +14 -6
  27. data/lib/project_types/script/layers/infrastructure/errors.rb +17 -0
  28. data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +6 -21
  29. data/lib/project_types/script/layers/infrastructure/script_service.rb +2 -0
  30. data/lib/project_types/script/layers/infrastructure/sparse_checkout_details.rb +35 -0
  31. data/lib/project_types/script/messages/messages.rb +3 -0
  32. data/lib/project_types/script/ui/error_handler.rb +11 -0
  33. data/lib/project_types/theme/cli.rb +1 -0
  34. data/lib/project_types/theme/commands/check.rb +4 -1
  35. data/lib/project_types/theme/commands/open.rb +2 -2
  36. data/lib/project_types/theme/commands/push.rb +1 -3
  37. data/lib/project_types/theme/commands/serve.rb +1 -0
  38. data/lib/project_types/theme/commands/share.rb +56 -0
  39. data/lib/project_types/theme/messages/messages.rb +64 -11
  40. data/lib/shopify_cli/changelog.rb +97 -25
  41. data/lib/shopify_cli/command_options/command_serve_options.rb +10 -0
  42. data/lib/shopify_cli/commands/app/serve.rb +7 -7
  43. data/lib/shopify_cli/commands/login.rb +5 -2
  44. data/lib/shopify_cli/context.rb +13 -0
  45. data/lib/shopify_cli/git.rb +36 -0
  46. data/lib/shopify_cli/identity_auth.rb +24 -4
  47. data/lib/shopify_cli/messages/messages.rb +22 -11
  48. data/lib/shopify_cli/release.rb +120 -20
  49. data/lib/shopify_cli/services/app/create/rails_service.rb +9 -1
  50. data/lib/shopify_cli/services/app/serve/node_service.rb +2 -25
  51. data/lib/shopify_cli/services/app/serve/php_service.rb +2 -25
  52. data/lib/shopify_cli/services/app/serve/rails_service.rb +8 -28
  53. data/lib/shopify_cli/services/app/serve/serve_service.rb +57 -0
  54. data/lib/shopify_cli/services.rb +1 -0
  55. data/lib/shopify_cli/tasks/update_dashboard_urls.rb +7 -9
  56. data/lib/shopify_cli/theme/dev_server/hot-reload.js +40 -13
  57. data/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_reloader.rb +1 -1
  58. data/lib/shopify_cli/theme/dev_server/hot_reload/sections_index.rb +51 -0
  59. data/lib/shopify_cli/theme/dev_server/hot_reload.rb +6 -1
  60. data/lib/shopify_cli/theme/dev_server/local_assets.rb +1 -1
  61. data/lib/shopify_cli/theme/dev_server/remote_watcher/json_files_update_job.rb +35 -0
  62. data/lib/shopify_cli/theme/dev_server/remote_watcher.rb +44 -0
  63. data/lib/shopify_cli/theme/dev_server/watcher.rb +2 -8
  64. data/lib/shopify_cli/theme/dev_server.rb +18 -5
  65. data/lib/shopify_cli/theme/file.rb +15 -4
  66. data/lib/shopify_cli/theme/syncer/checksums.rb +60 -0
  67. data/lib/shopify_cli/theme/syncer/forms/apply_to_all.rb +39 -0
  68. data/lib/shopify_cli/theme/syncer/forms/apply_to_all_form.rb +35 -0
  69. data/lib/shopify_cli/theme/syncer/forms/base_strategy_form.rb +62 -0
  70. data/lib/shopify_cli/theme/syncer/forms/select_delete_strategy.rb +27 -0
  71. data/lib/shopify_cli/theme/syncer/forms/select_update_strategy.rb +28 -0
  72. data/lib/shopify_cli/theme/syncer/ignore_helper.rb +33 -0
  73. data/lib/shopify_cli/theme/syncer/json_delete_handler.rb +51 -0
  74. data/lib/shopify_cli/theme/syncer/json_update_handler.rb +82 -0
  75. data/lib/shopify_cli/theme/syncer/merger.rb +53 -0
  76. data/lib/shopify_cli/theme/syncer/operation.rb +1 -1
  77. data/lib/shopify_cli/theme/syncer.rb +79 -63
  78. data/lib/shopify_cli/theme/theme.rb +21 -7
  79. data/lib/shopify_cli/theme/theme_admin_api.rb +23 -8
  80. data/lib/shopify_cli/thread_pool/job.rb +10 -2
  81. data/lib/shopify_cli/thread_pool.rb +15 -3
  82. data/lib/shopify_cli/tunnel.rb +3 -13
  83. data/lib/shopify_cli/version.rb +1 -1
  84. data/vendor/deps/cli-ui/lib/cli/ui/os.rb +8 -0
  85. metadata +25 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 141760dcf4bd3da2b9e92a238c72ee4612fc9e72ce4f522db84f190028439175
4
- data.tar.gz: f16bc2db60656219f7f1484ce455380822fb7d7da4c65faeceeaf065953076c9
3
+ metadata.gz: 5e3d4c1b037556e97ff23087c72d0396c693631115b7ce98d693a7b943cdc82f
4
+ data.tar.gz: aafbc59f2c6cda56df352d9624abff4cb0b7c33fab2a72fae68ffbee78b45208
5
5
  SHA512:
6
- metadata.gz: 1df93436fa11a84a2df90f354a59277fbf29bd2445b097da8c2ddd6d727dc9d2d4792602de476f3479329e58873dfd222ea185fd096271896bd4ee8533f5b242
7
- data.tar.gz: ada360c3f4529d52a0315c70b1c4fea63ad69f0da1ca7aab384958adb8bf342003d4c4dced65ddc4984e5732fb5e2604f77ba82702908242b1d1427570362626
6
+ metadata.gz: 7baae7341bb50950b4d586f001c3a6674486b0968091f9c8e1d8ba7f1a5ae52a67a9ef36f64e251da6f26a8aee4906bc7bcbdccf94798b69b3361d24c3488525
7
+ data.tar.gz: 156d36c1f175d9028209f050b74330b17e325fb76cb1c7b6f3f0c2f81fe55d4335300573f612e1780b45db800ad4d91df79cc0d905f4b7973dc4808f27ba6ee3
@@ -5,5 +5,4 @@
5
5
  "**/.DS_Store": true
6
6
  },
7
7
  "editor.formatOnSave": false,
8
- "workbench.colorTheme": "Dracula Soft",
9
- }
8
+ }
data/CHANGELOG.md CHANGED
@@ -2,7 +2,41 @@ 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
5
+ ## Version 2.15.4 - 2022-04-08
6
+
7
+ ### Fixed
8
+ * [#2230](https://github.com/Shopify/shopify-cli/pull/2230): Show an error without ngrok account
9
+ * [#2235](https://github.com/Shopify/shopify-cli/pull/2235): Update shopify-extensions to v0.3.0 and fix issues with template choosing and missing dependencies
10
+ * [#2226](https://github.com/Shopify/shopify-cli/pull/2226): Fix liquid file size validation to disclude locales directory
11
+
12
+ ## Version 2.15.3 - 2022-04-07
13
+
14
+ ### Changed
15
+ * [#2188](https://github.com/Shopify/shopify-cli/pull/2188): Update URLs by default on serve and add --no-update flag to skip it
16
+ * [#2203](https://github.com/Shopify/shopify-cli/pull/2203): Use javy version 0.3.0
17
+
18
+ ### Fixed
19
+ * [#2162](https://github.com/Shopify/shopify-cli/pull/2162): Improve encoding error handling for Checkout Extension localization
20
+ * [#2187](https://github.com/Shopify/shopify-cli/pull/2187): Fix app serve after rails update
21
+ * [#2191](https://github.com/Shopify/shopify-cli/pull/2191): Directories with the `.json` extension should not be handled as JSON files
22
+ * [#2018](https://github.com/Shopify/shopify-cli/pull/2018): Run theme-check as a code dependency, not a pseudo-CLI invocation
23
+ * [#2211](https://github.com/Shopify/shopify-cli/pull/2211): Fix the `theme open` command to open the theme in the browser
24
+ * [#2183](https://github.com/Shopify/shopify-cli/pull/2183): Improve error message when suspended users run `theme serve`
25
+ * [#2219](https://github.com/Shopify/shopify-cli/pull/2219): Fix issues when creating Rails apps after the release of `shopify_app` v19
26
+
27
+ ### Added
28
+ * [#2190](https://github.com/Shopify/shopify-cli/pull/2190): Better login experience with spinner
29
+ * [#2200](https://github.com/Shopify/shopify-cli/pull/2200): Add `theme share` command
30
+
31
+ ## Version 2.15.2 - 2022-03-28
32
+
33
+ ### Fixed
34
+ * [#2121](https://github.com/Shopify/shopify-cli/pull/2121): Fix the hot-reload to work when the section name is not equal to the type
35
+
36
+ ### Added
37
+ * [#2174](https://github.com/Shopify/shopify-cli/pull/2174): Add optional 2-way sync between the CLI (`theme serve`) and the Theme Editor
38
+
39
+ ## Version 2.15.1 - 2022-03-24
6
40
 
7
41
  ### Added
8
42
  * [#1934](https://github.com/Shopify/shopify-cli/pull/1934): Block directories in theme assets
@@ -12,7 +46,7 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
12
46
  * [#1874](https://github.com/Shopify/shopify-cli/pull/1874): Make ngrok errors more robust and helpful
13
47
  * [#2172](https://github.com/Shopify/shopify-cli/pull/2172): Fix Ruby check for Rails app creation
14
48
 
15
- ## Version 2.15.0
49
+ ## Version 2.15.0 - 2022-03-21
16
50
 
17
51
  ### Fixed
18
52
  * [#2086](https://github.com/Shopify/shopify-cli/pull/2086): Improve check of dependency versions
@@ -20,7 +54,7 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
20
54
  * [#2122](https://github.com/Shopify/shopify-cli/pull/2122): Fix `--only`/`--ignore` flags parser to support multiple occurrences without quotes
21
55
  * [#2146](https://github.com/Shopify/shopify-cli/pull/2146): Prevent duplicate locales for Checkout extension localization
22
56
 
23
- ## Version 2.14.0
57
+ ## Version 2.14.0 - 2022-03-15
24
58
 
25
59
  ### Changed
26
60
  * [#2126](https://github.com/Shopify/shopify-cli/pull/2126): Use javy version 0.2.1
@@ -34,7 +68,7 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
34
68
  * [#2130](https://github.com/Shopify/shopify-cli/pull/2130): Fix Homebrew installation.
35
69
  * [#2133](https://github.com/Shopify/shopify-cli/pull/2133): Fix ignore file handling in DevServer::Watcher.
36
70
 
37
- ## Version 2.13.0
71
+ ## Version 2.13.0 - 2022-03-02
38
72
 
39
73
  ### Added
40
74
  * [#2087](https://github.com/Shopify/shopify-cli/pull/2087): Add new Theme CLI commands: `theme list` and `theme open`
@@ -48,7 +82,8 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
48
82
  ### Removed
49
83
  * [#2102](https://github.com/Shopify/shopify-cli/pull/2102): Remove AssemblyScript as a supported script language.
50
84
 
51
- ## Version 2.12.0
85
+ ## Version 2.12.0 - 2022-02-23
86
+
52
87
  ### Added
53
88
  * [#1866](https://github.com/Shopify/shopify-cli/pull/1866): Enforce git dependency
54
89
  * [#2009](https://github.com/Shopify/shopify-cli/pull/2009): Add localization support for Checkout Extensions
@@ -63,21 +98,24 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
63
98
  * [#2066](https://github.com/Shopify/shopify-cli/pull/2066): Improve `--only`/`--ignore` parameters on Theme `pull`/`push` commands to work without quotes
64
99
  * [#2078](https://github.com/Shopify/shopify-cli/pull/2078): Fix errors on section rendering caused by CORS issues
65
100
 
66
- ## Version 2.11.2
101
+ ## Version 2.11.2 - 2022-02-14
102
+
67
103
  ### Fixed
68
104
  * [#2047](https://github.com/Shopify/shopify-cli/pull/2047): Fix the Homebrew installation
69
105
  * [#2019](https://github.com/Shopify/shopify-cli/pull/2019): Provide helpful link when nokogiri fails to load
70
106
  * [#2055](https://github.com/Shopify/shopify-cli/pull/2055): Remove unneeded Node requirements
71
107
  * [#2020](https://github.com/Shopify/shopify-cli/pull/2020): Fix `theme pull` so that correct dev theme is used with `-d` option
72
108
 
73
- ## Version 2.11.1
109
+ ## Version 2.11.1 - 2022-02-09
110
+
74
111
  ### Fixed
75
112
  * [#1973](https://github.com/Shopify/shopify-cli/pull/1973): Fix `theme serve` to preview generated files (`*.css.liquid`)
76
113
  * [#2034](https://github.com/Shopify/shopify-cli/pull/2034): Fix `theme serve` to accept parameters with multiple values
77
114
  * [#2033](https://github.com/Shopify/shopify-cli/pull/2033): Pin Homebrew Ruby to 3.0
78
115
  * [#2032](https://github.com/Shopify/shopify-cli/pull/2032): Runtime error checking the Node version if Node is not present in the environment.
79
116
 
80
- ## Version 2.11.0
117
+ ## Version 2.11.0 - 2022-02-07
118
+
81
119
  ### Fixed
82
120
  * [#2005](https://github.com/Shopify/shopify-cli/pull/2005): Fix PHP app serve on Windows environments
83
121
 
@@ -92,17 +130,20 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
92
130
  * [#2002](https://github.com/Shopify/shopify-cli/pull/2002): Update `-o`/`--only` parameter to allow multiple patterns on `theme push`/`theme pull` commands
93
131
  * [#2022](https://github.com/Shopify/shopify-cli/pull/2022): Don't warn the user if the Ruby version is in the range 3.0.x.
94
132
 
95
- ## Version 2.10.2
133
+ ## Version 2.10.2 - 2022-01-31
134
+
96
135
  ### Fixed
97
136
  * [#1983](https://github.com/Shopify/shopify-cli/pull/1983): Improve Windows compatibility
98
137
  * [#1928](https://github.com/Shopify/shopify-cli/pull/1928): Ensure script Wasm file sizes don't exceed the limit
99
138
  * [#2006](https://github.com/Shopify/shopify-cli/pull/2006): Fix: More defensive URL generation
100
139
 
101
- ## Version 2.10.1
140
+ ## Version 2.10.1 - 2022-01-28
141
+
102
142
  ### Fixed
103
143
  * [#1985](https://github.com/Shopify/shopify-cli/pull/1985): Revert "Fix CORS (Cross-origin resource sharing) errors (#1952)"
104
144
 
105
- ## Version 2.10.0
145
+ ## Version 2.10.0 - 2022-01-25
146
+
106
147
  ### Fixed
107
148
  * [#1937](https://github.com/Shopify/shopify-cli/pull/1937): Fix `theme pull` to no longer add empty lines on Windows
108
149
  * [#1952](https://github.com/Shopify/shopify-cli/pull/1952): Fix CORS (cross-origin resource sharing) errors
@@ -111,7 +152,8 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
111
152
  ### Added
112
153
  * [#1892](https://github.com/Shopify/shopify-cli/pull/1892): Add `-o`/`--only` parameter to filter files on `theme push`/`theme pull` commands
113
154
 
114
- ## Version 2.9.0
155
+ ## Version 2.9.0 - 2022-01-17
156
+
115
157
  ### Fixed
116
158
  * [#1922](https://github.com/Shopify/shopify-cli/pull/1922): Respect RUBY_BINDIR from Homebrew for installing gem
117
159
  * [#1906](https://github.com/Shopify/shopify-cli/pull/1906): Fix Ngrok incompatibility with some Apple ARM environments
@@ -125,13 +167,15 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
125
167
  * [#1871](https://github.com/Shopify/shopify-cli/pull/1871): Add a new `--live-reload` parameter to the `theme serve` command
126
168
 
127
169
  ### Changed
128
- - [#1929](https://github.com/Shopify/shopify-cli/pull/1929): Rename `--registration-id` to `--extension-id` in `shopify extension push`.
170
+ * [#1929](https://github.com/Shopify/shopify-cli/pull/1929): Rename `--registration-id` to `--extension-id` in `shopify extension push`.
171
+
172
+ ## Version 2.8.0 - 2022-01-06
129
173
 
130
- ## Version 2.8.0
131
174
  ### Fixed
132
175
  * [#1879](https://github.com/Shopify/shopify-cli/pull/1879): Disambiguate -s as store option
133
176
 
134
- ## Version 2.7.4
177
+ ## Version 2.7.4 - 2021-12-22
178
+
135
179
  ### Added
136
180
  * [#1825](https://github.com/Shopify/shopify-cli/pull/1825): Support passing the connection information through arguments
137
181
 
@@ -142,10 +186,11 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
142
186
  * [#1850](https://github.com/Shopify/shopify-cli/pull/1850): Fix `shopify extension` commands timeout when organization has too many apps
143
187
  * [#1860](https://github.com/Shopify/shopify-cli/pull/1860): Fix `theme serve` hot reload when there are many tabs active
144
188
 
145
- ## Version 2.7.3
189
+ ## Version 2.7.3 - 2021-12-13
190
+
146
191
  ### Added
147
192
  * [#1826](https://github.com/Shopify/shopify-cli/pull/1826): Support using `script.config.yml` file for script configuration
148
- * [#1843](https://github.com/Shopify/shopify-cli/pull/1826): Support using javy on Apple ARM processors
193
+ * [#1843](https://github.com/Shopify/shopify-cli/pull/1843): Support using javy on Apple ARM processors
149
194
  * [#1847](https://github.com/Shopify/shopify-cli/pull/1847): `shopify script connect` command.
150
195
 
151
196
  ### Fixed
@@ -158,7 +203,8 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
158
203
  * [#1830](https://github.com/Shopify/shopify-cli/pull/1830): Fix hot reload when users update many files "simultaneously"
159
204
  * [#1837](https://github.com/Shopify/shopify-cli/pull/1837): Fix `ShopifyCLI::Theme::DevServer::CdnFonts` class to support any font
160
205
 
161
- ## Version 2.7.2
206
+ ## Version 2.7.2 - 2021-11-30
207
+
162
208
  ### Fixed
163
209
  * [#1763](https://github.com/Shopify/shopify-cli/pull/1763): Fix: Tunnel --PORT parameter not working in Node.js app.
164
210
  * [#1769](https://github.com/Shopify/shopify-cli/pull/1769): Fix `theme push --development --json` to output the proper exit code
@@ -169,14 +215,16 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
169
215
  * [#1788](https://github.com/Shopify/shopify-cli/pull/1788): Improve `theme serve` errors and add logs for successful operations
170
216
  * [#1794](https://github.com/Shopify/shopify-cli/pull/1794): Fix bug where hidden subcommands appear in the help menu.
171
217
 
172
- ## Version 2.7.1
218
+ ## Version 2.7.1 - 2021-11-17
219
+
173
220
  ### Fixed
174
221
  * [#1722](https://github.com/Shopify/shopify-cli/pull/1722): Fix `theme serve` failing when the port is already being used
175
222
  * [#1751](https://github.com/Shopify/shopify-cli/pull/1751): A bug in the app creation flow that caused the CLI to abort when the form validation failed.
176
223
  * [#1750](https://github.com/Shopify/shopify-cli/pull/1750): Runtime errors in Windows' environments when the `PATHEXT` environment variable is not defined.
177
224
  * [#1758](https://github.com/Shopify/shopify-cli/pull/1758): Fix tunnel creation for expired anonymous tunnels
178
225
 
179
- ## Version 2.7.0
226
+ ## Version 2.7.0 - 2021-11-15
227
+
180
228
  ### Changed
181
229
  * [#1650](https://github.com/Shopify/shopify-cli/pull/1650): **Breaking** Move app commands under `shopify app`.
182
230
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.15.1)
4
+ shopify-cli (2.15.4)
5
5
  bugsnag (~> 6.22)
6
6
  listen (~> 3.7.0)
7
7
  theme-check (~> 1.10.1)
data/Rakefile CHANGED
@@ -129,6 +129,14 @@ end
129
129
  desc("Builds all distribution packages of the CLI")
130
130
  task(package: "package:all")
131
131
 
132
+ namespace :changelog do
133
+ require "shopify_cli/changelog"
134
+
135
+ task :update do
136
+ ShopifyCLI::Changelog.new.update!
137
+ end
138
+ end
139
+
132
140
  namespace :release do
133
141
  require "shopify_cli/release"
134
142
 
@@ -154,6 +162,19 @@ namespace :release do
154
162
  ShopifyCLI::Release.new(new_version, github_access_token).prepare!
155
163
  puts "Completed!"
156
164
  end
165
+
166
+ task :package do
167
+ github_access_token = ENV["GITHUB_ACCESS_TOKEN"]
168
+ unless github_access_token
169
+ raise <<~NO_GITHUB_ACCESS_TOKEN
170
+ GitHub access token must be provided, e.g.:
171
+
172
+ $ GITHUB_ACCESS_TOKEN=abcdef rake release:package
173
+ NO_GITHUB_ACCESS_TOKEN
174
+ end
175
+ ShopifyCLI::Release.new(ShopifyCLI::VERSION, github_access_token).package!
176
+ puts "Completed!"
177
+ end
157
178
  end
158
179
 
159
180
  namespace :extensions do
@@ -0,0 +1 @@
1
+ c7e97d166e46d96fa43a70046c80607035101b4a96e40edcf4643a6c92913692
@@ -0,0 +1 @@
1
+ 877e6383b921de2b93ecaf5d1d902c7305d65bdab52758b9d5c02d9c5cea45ab
@@ -0,0 +1 @@
1
+ c8a40adf83cacae33f819fa78501355eee9077dce3818ab4a483b2473952941e
@@ -0,0 +1 @@
1
+ 9ca1e65b0f7a2645f408cb65e683d243069f03828d4b3eeaf59f3012e5d41e73
data/ext/javy/version CHANGED
@@ -1 +1 @@
1
- v0.2.1
1
+ v0.3.0
@@ -1 +1 @@
1
- v0.2.0
1
+ v0.3.0
@@ -1,5 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "pathname"
4
+ require "json"
5
+ require "yaml"
6
+
3
7
  module Extension
4
8
  class PackageResolutionFailed < RuntimeError; end
5
9
 
@@ -32,7 +32,12 @@ module Extension
32
32
 
33
33
  def call(*)
34
34
  if project.specification_identifier == "THEME_APP_EXTENSION"
35
- @theme_check.run
35
+ begin
36
+ @theme_check.run!
37
+ rescue ThemeCheck::Cli::Abort, ThemeCheck::ThemeCheckError => e
38
+ raise ShopifyCLI::Abort,
39
+ ShopifyCLI::Context.message("theme.check.error", e.full_message)
40
+ end
36
41
  else
37
42
  @ctx.abort(@ctx.message("check.unsupported", project.specification_identifier))
38
43
  end
@@ -21,8 +21,7 @@ module Extension
21
21
 
22
22
  def template_required?(project_details)
23
23
  type = project_details&.type&.identifier
24
- (Models::DevelopmentServerRequirements.beta_enabled? &&
25
- Models::DevelopmentServerRequirements.type_supported?(type.downcase))
24
+ Models::DevelopmentServerRequirements.supported?(type)
26
25
  end
27
26
 
28
27
  def choose_interactively
@@ -41,7 +41,7 @@ module Extension
41
41
  invalid_api_key: "The API key %s does not match any of your apps.",
42
42
  ask_app: "Which app would you like to register this extension with?",
43
43
  no_apps: "{{x}} You don’t have any apps.",
44
- learn_about_apps: "{{*}} Learn more about building apps at <https://shopify.dev/concepts/apps>, " \
44
+ learn_about_apps: "{{*}} Learn more about building apps at <https://shopify.dev/apps>, " \
45
45
  "or try creating a new app using {{command:shopify [node|rails] create}}.",
46
46
  loading_apps: "Loading your apps…",
47
47
  no_available_extensions: "{{x}} There are no available extensions for this app.",
@@ -73,8 +73,6 @@ module Extension
73
73
  help: <<~HELP,
74
74
  Register your local extension to a Shopify app
75
75
  Usage: {{command:%s extension register}}
76
- Options:
77
- {{command:--api-key=API_KEY}} The API key used to register an app with the extension. This can be found on the app page on Partners Dashboard.
78
76
  HELP
79
77
  frame_title: "Registering Extension",
80
78
  waiting_text: "Registering with Shopify…",
@@ -9,6 +9,7 @@ module Extension
9
9
  "checkout_ui_extension",
10
10
  "checkout_post_purchase",
11
11
  "product_subscription",
12
+ "beacon_extension",
12
13
  ]
13
14
 
14
15
  class << self
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+ require "base64"
3
+ require "fileutils"
4
+ require "json"
5
+ require_relative "beacon_extension_utils/script_config"
6
+ require_relative "beacon_extension_utils/script_config_repository"
7
+
8
+ module Extension
9
+ module Models
10
+ module SpecificationHandlers
11
+ class BeaconExtension < Default
12
+ SCRIPT_FILE = "build/main.js"
13
+
14
+ def name
15
+ "Beacon Extension"
16
+ end
17
+
18
+ def read_configuration
19
+ end
20
+
21
+ def access_config_property(context, ext_config, key, &process_value)
22
+ context.abort(context.message("core.extension.push.beacon_extension.error.missing_config_key_error",
23
+ key)) unless ext_config.key?(key)
24
+
25
+ begin
26
+ process_value.nil? ? ext_config[key] : process_value.call(ext_config[key])
27
+ rescue StandardError
28
+ context.abort(context.message("core.extension.push.beacon_extension.error.invalid_config_value_error", key))
29
+ end
30
+ end
31
+
32
+ def config(context)
33
+ begin
34
+ ext_config = BeaconExtensionUtils::ScriptConfigYmlRepository.new(ctx: context).get!.content
35
+ rescue StandardError
36
+ context.abort(context.message("core.extension.push.beacon_extension.error.file_read_error",
37
+ BeaconExtensionUtils::ScriptConfigYmlRepository.filename))
38
+ end
39
+
40
+ begin
41
+ script_contents = File.read(File.join(context.root, SCRIPT_FILE)).chomp
42
+ rescue
43
+ context.abort(context.message("core.extension.push.beacon_extension.error.file_read_error", SCRIPT_FILE))
44
+ end
45
+ {
46
+ runtime_context: access_config_property(context, ext_config, "runtime_context"),
47
+ serialized_script: Base64.strict_encode64(script_contents),
48
+ runtime_configuration_definition: access_config_property(context, ext_config,
49
+ "configuration", &:to_json),
50
+ config_version: access_config_property(context, ext_config,
51
+ "version", &:to_s),
52
+ }
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Extension
4
+ module Models
5
+ module SpecificationHandlers
6
+ module BeaconExtensionUtils
7
+ class ScriptConfig
8
+ attr_reader :content, :version, :configuration, :filename
9
+
10
+ REQUIRED_FIELDS = %w(version)
11
+
12
+ def initialize(content:, filename:)
13
+ @filename = filename
14
+ validate_content!(content)
15
+ @content = content
16
+ @version = @content["version"].to_s
17
+ @configuration = @content["configuration"]
18
+ end
19
+
20
+ private
21
+
22
+ def validate_content!(content)
23
+ REQUIRED_FIELDS.each do |field|
24
+ if content[field].nil?
25
+ raise "invalid field:#{field}, filename:#{filename}"
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,75 @@
1
+ require_relative "script_config"
2
+ module Extension
3
+ module Models
4
+ module SpecificationHandlers
5
+ module BeaconExtensionUtils
6
+ class ScriptConfigRepository
7
+ include SmartProperties
8
+ property! :ctx, accepts: ShopifyCLI::Context
9
+
10
+ def active?
11
+ ctx.file_exist?(filename)
12
+ end
13
+
14
+ def get!
15
+ raise RuntimeError.new("NoScriptConfigFile"), filename unless active?
16
+
17
+ content = ctx.read(filename)
18
+ hash = file_content_to_hash(content)
19
+
20
+ from_h(hash)
21
+ end
22
+
23
+ def filename
24
+ raise NotImplementedError
25
+ end
26
+
27
+ private
28
+
29
+ def from_h(hash)
30
+ Extension::Models::SpecificationHandlers::BeaconExtensionUtils::ScriptConfig.new(content: hash,
31
+ filename: filename)
32
+ end
33
+
34
+ def file_content_to_hash(file_content)
35
+ raise NotImplementedError
36
+ end
37
+
38
+ def hash_to_file_content(hash)
39
+ raise NotImplementedError
40
+ end
41
+ end
42
+
43
+ class ScriptConfigYmlRepository < ScriptConfigRepository
44
+ def self.filename
45
+ "extension.config.yml"
46
+ end
47
+
48
+ def filename
49
+ ScriptConfigYmlRepository.filename
50
+ end
51
+
52
+ private
53
+
54
+ def file_content_to_hash(file_content)
55
+ begin
56
+ hash = YAML.load(file_content)
57
+ rescue Psych::SyntaxError
58
+ raise parse_error
59
+ end
60
+ raise parse_error unless hash.is_a?(Hash)
61
+ hash
62
+ end
63
+
64
+ def hash_to_file_content(hash)
65
+ YAML.dump(hash)
66
+ end
67
+
68
+ def parse_error
69
+ RuntimeError.new("ScriptConfigParseError #{filename}, serialization_format: \"YAML\" ")
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -49,7 +49,7 @@ module Extension
49
49
 
50
50
  locale_filenames.map do |filename|
51
51
  locale = basename_for_locale_filename(filename)
52
- [locale.to_sym, Base64.strict_encode64(File.read(filename, mode: "rt", encoding: "UTF-8").strip)]
52
+ [locale.to_sym, read_locale_file(filename)]
53
53
  end
54
54
  .yield_self do |encoded_files_by_locale|
55
55
  {
@@ -62,6 +62,14 @@ module Extension
62
62
  end
63
63
  end
64
64
 
65
+ def read_locale_file(filename)
66
+ content = File.read(filename, mode: "rt", encoding: "bom|utf-8").strip
67
+ raise_invalid_encoding_error(filename) unless content.valid_encoding?
68
+ Base64.strict_encode64(content)
69
+ rescue ArgumentError
70
+ raise_invalid_encoding_error(filename)
71
+ end
72
+
65
73
  def validate_no_duplicate_locale(locale_filenames)
66
74
  duplicate_locale = locale_filenames
67
75
  .map { |filename| basename_for_locale_filename(filename.downcase) }
@@ -149,6 +157,13 @@ module Extension
149
157
  def basename_for_locale_filename(filename)
150
158
  File.basename(File.basename(filename, ".json"), ".default")
151
159
  end
160
+
161
+ def raise_invalid_encoding_error(filename)
162
+ raise(
163
+ ShopifyCLI::Abort,
164
+ ShopifyCLI::Context.message("#{L10N_ERROR_PREFIX}.invalid_file_encoding", filename)
165
+ )
166
+ end
152
167
  end
153
168
  end
154
169
  end
@@ -38,7 +38,10 @@ module Extension
38
38
  # Other assets should be treated as UTF-8 encoded text
39
39
  mode = "rt"
40
40
  encoding = "UTF-8"
41
- current_liquid_size += File.size(filename)
41
+
42
+ if dirname == "snippets" || dirname == "blocks"
43
+ current_liquid_size += File.size(filename)
44
+ end
42
45
  end
43
46
  current_size += File.size(filename)
44
47
  if current_size > BUNDLE_SIZE_LIMIT
@@ -13,7 +13,8 @@ module Extension
13
13
  private
14
14
 
15
15
  def configure_skip_build(attributes)
16
- attributes[:options].merge!(skip_build: attributes[:identifier] == "theme_app_extension")
16
+ attributes[:options].merge!(skip_build: attributes[:identifier] == "theme_app_extension" ||
17
+ attributes[:identifier] == "beacon_extension")
17
18
  end
18
19
  end
19
20
  end
@@ -18,7 +18,6 @@ module Extension
18
18
  property! :type, accepts: String
19
19
 
20
20
  DEFAULT_BUILD_DIR = "build"
21
- DEFAULT_MAIN = Dir["src/*"].lazy.grep(/index.[jt]sx?/).first
22
21
 
23
22
  def self.call(*args)
24
23
  new(*args).call
@@ -37,7 +36,7 @@ module Extension
37
36
  build_dir: hash.dig("development", "build_dir") || DEFAULT_BUILD_DIR,
38
37
  renderer: renderer,
39
38
  entries: Models::ServerConfig::DevelopmentEntries.new(
40
- main: hash.dig("development", "entries", "main") || DEFAULT_MAIN
39
+ main: hash.dig("development", "entries", "main") || determine_default_entry_main(project_directory),
41
40
  )
42
41
  ),
43
42
  extension_points: hash.dig("extension_points"),
@@ -65,6 +64,18 @@ module Extension
65
64
  def version(renderer, context)
66
65
  Tasks::FindPackageFromJson.call(renderer, context: context).version
67
66
  end
67
+
68
+ private
69
+
70
+ def determine_default_entry_main(project_directory)
71
+ Dir.chdir(project_directory) do
72
+ Dir["src/*"].lazy.grep(/index.[jt]sx?/).first
73
+ end
74
+ end
75
+
76
+ def project_directory
77
+ ExtensionProject.current.directory
78
+ end
68
79
  end
69
80
  end
70
81
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require "shopify_cli"
3
3
  require "yaml"
4
+ require "pathname"
4
5
 
5
6
  module Extension
6
7
  module Tasks
@@ -8,7 +9,7 @@ module Extension
8
9
  include SmartProperties
9
10
 
10
11
  property! :context, accepts: ShopifyCLI::Context
11
- property! :file_path, accepts: ->(path) { Pathname(path).yield_self { |pn| pn.absolute? && pn.file? } }
12
+ property! :file_path, accepts: ->(path) { Pathname(path).yield_self(&:absolute?) }
12
13
  property :port, accepts: Integer, default: ShopifyCLI::Constants::Extension::DEFAULT_PORT
13
14
  property :resource_url, accepts: String
14
15
  property :tunnel_url, accepts: String
@@ -19,7 +20,9 @@ module Extension
19
20
  end
20
21
 
21
22
  def call
22
- config = YAML.load_file(file_path)
23
+ config = YAML.load_file(file_path) if File.file?(file_path)
24
+ config ||= {}
25
+
23
26
  project = ExtensionProject.current
24
27
  Tasks::ConvertServerConfig.call(
25
28
  api_key: project.env.api_key,
@@ -62,6 +62,7 @@ module Script
62
62
  autoload :ScriptService, Project.project_filepath("layers/infrastructure/script_service")
63
63
  autoload :ScriptUploader, Project.project_filepath("layers/infrastructure/script_uploader")
64
64
  autoload :ServiceLocator, Project.project_filepath("layers/infrastructure/service_locator")
65
+ autoload :SparseCheckoutDetails, Project.project_filepath("layers/infrastructure/sparse_checkout_details")
65
66
 
66
67
  module Languages
67
68
  autoload :ProjectCreator, Project.project_filepath("layers/infrastructure/languages/project_creator")