shopify-cli 2.12.0 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) 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/shopify.yml +2 -1
  6. data/.github/workflows/stale.yml +41 -0
  7. data/.rubocop.yml +1 -1
  8. data/.ruby-version +1 -1
  9. data/CHANGELOG.md +36 -0
  10. data/Gemfile.lock +18 -18
  11. data/Rakefile +16 -0
  12. data/bin/shopify +4 -4
  13. data/dev.yml +1 -1
  14. data/ext/javy/hashes/javy-arm-macos-v0.2.0.gz.sha256 +1 -0
  15. data/ext/javy/hashes/javy-arm-macos-v0.2.1.gz.sha256 +1 -0
  16. data/ext/javy/hashes/javy-x86_64-linux-v0.2.0.gz.sha256 +1 -0
  17. data/ext/javy/hashes/javy-x86_64-linux-v0.2.1.gz.sha256 +1 -0
  18. data/ext/javy/hashes/javy-x86_64-macos-v0.2.0.gz.sha256 +1 -0
  19. data/ext/javy/hashes/javy-x86_64-macos-v0.2.1.gz.sha256 +1 -0
  20. data/ext/javy/hashes/javy-x86_64-windows-v0.2.0.gz.sha256 +1 -0
  21. data/ext/javy/hashes/javy-x86_64-windows-v0.2.1.gz.sha256 +1 -0
  22. data/ext/javy/version +1 -1
  23. data/lib/project_types/extension/features/argo_setup_steps.rb +4 -6
  24. data/lib/project_types/extension/models/npm_package.rb +19 -1
  25. data/lib/project_types/extension/models/server_config/development_renderer.rb +4 -3
  26. data/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +13 -0
  27. data/lib/project_types/extension/tasks/configure_features.rb +15 -2
  28. data/lib/project_types/extension/tasks/convert_server_config.rb +2 -1
  29. data/lib/project_types/script/cli.rb +0 -4
  30. data/lib/project_types/script/commands/create.rb +4 -4
  31. data/lib/project_types/script/config/extension_points.yml +0 -6
  32. data/lib/project_types/script/errors.rb +1 -1
  33. data/lib/project_types/script/forms/create.rb +7 -7
  34. data/lib/project_types/script/layers/application/build_script.rb +9 -26
  35. data/lib/project_types/script/layers/application/create_script.rb +9 -10
  36. data/lib/project_types/script/layers/application/project_dependencies.rb +12 -14
  37. data/lib/project_types/script/layers/application/push_script.rb +14 -10
  38. data/lib/project_types/script/layers/domain/errors.rb +3 -3
  39. data/lib/project_types/script/layers/domain/push_package.rb +6 -0
  40. data/lib/project_types/script/layers/domain/script_config.rb +2 -4
  41. data/lib/project_types/script/layers/domain/script_project.rb +3 -2
  42. data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +0 -16
  43. data/lib/project_types/script/layers/infrastructure/languages/task_runner.rb +0 -1
  44. data/lib/project_types/script/layers/infrastructure/languages/typescript_project_creator.rb +19 -4
  45. data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +2 -10
  46. data/lib/project_types/script/layers/infrastructure/languages/wasm_project_creator.rb +0 -3
  47. data/lib/project_types/script/layers/infrastructure/languages/wasm_task_runner.rb +1 -1
  48. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +3 -21
  49. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +14 -26
  50. data/lib/project_types/script/layers/infrastructure/script_service.rb +4 -2
  51. data/lib/project_types/script/messages/messages.rb +9 -9
  52. data/lib/project_types/script/ui/error_handler.rb +4 -4
  53. data/lib/project_types/script/ui/strict_spinner.rb +4 -6
  54. data/lib/project_types/theme/cli.rb +2 -0
  55. data/lib/project_types/theme/commands/common/root_helper.rb +11 -5
  56. data/lib/project_types/theme/commands/list.rb +34 -0
  57. data/lib/project_types/theme/commands/open.rb +65 -0
  58. data/lib/project_types/theme/commands/package.rb +1 -0
  59. data/lib/project_types/theme/commands/pull.rb +4 -4
  60. data/lib/project_types/theme/commands/push.rb +4 -4
  61. data/lib/project_types/theme/conversions/base_glob.rb +20 -5
  62. data/lib/project_types/theme/forms/select.rb +11 -39
  63. data/lib/project_types/theme/messages/messages.rb +33 -2
  64. data/lib/project_types/theme/presenters/theme_presenter.rb +48 -0
  65. data/lib/project_types/theme/presenters/themes_presenter.rb +32 -0
  66. data/lib/shopify_cli/api.rb +1 -1
  67. data/lib/shopify_cli/command.rb +1 -7
  68. data/lib/shopify_cli/commands/app/deploy.rb +0 -1
  69. data/lib/shopify_cli/constants.rb +2 -2
  70. data/lib/shopify_cli/context.rb +13 -15
  71. data/lib/shopify_cli/core/entry_point.rb +1 -1
  72. data/lib/shopify_cli/core/monorail.rb +14 -6
  73. data/lib/shopify_cli/environment.rb +19 -11
  74. data/lib/shopify_cli/exception_reporter.rb +2 -0
  75. data/lib/shopify_cli/messages/messages.rb +5 -5
  76. data/lib/shopify_cli/packager.rb +1 -1
  77. data/lib/shopify_cli/result.rb +14 -0
  78. data/lib/shopify_cli/services/app/create/node_service.rb +2 -14
  79. data/lib/shopify_cli/services/app/create/php_service.rb +1 -6
  80. data/lib/shopify_cli/services/app/create/rails_service.rb +5 -13
  81. data/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_reloader.rb +5 -5
  82. data/lib/shopify_cli/theme/dev_server/watcher.rb +10 -2
  83. data/lib/shopify_cli/theme/development_theme.rb +2 -5
  84. data/lib/shopify_cli/theme/syncer.rb +27 -32
  85. data/lib/shopify_cli/theme/theme.rb +16 -27
  86. data/lib/shopify_cli/theme/theme_admin_api.rb +72 -0
  87. data/lib/shopify_cli/transform_data_structure.rb +3 -2
  88. data/lib/shopify_cli/version.rb +1 -1
  89. data/shipit.yml +3 -0
  90. data/shopify-cli.gemspec +9 -2
  91. data/shopify-dev +9 -11
  92. metadata +21 -9
  93. data/lib/project_types/rails/ruby.rb +0 -17
  94. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_project_creator.rb +0 -21
  95. 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: ee0786bedc79f0e7fb3646adc5161faeb0fb2f4f15c6147394782db33236f425
4
- data.tar.gz: 13d805804c7764151bfdd80747e879bd480ffcf85ba91fa280b776b93f784855
3
+ metadata.gz: e5861ffd7a22ca4048791e4993469dff421162159c7dabbf06b413522297c4a8
4
+ data.tar.gz: b5593ee5d6cfbf5c9b616b050263eb825d2d7a9846f5bf71953b4d7f708ee06e
5
5
  SHA512:
6
- metadata.gz: 8347252541e765517a6bc485cc7bc1b811771a55610543549d676d5321944185e9a446bed4c8a3909f21f336fd56ae76b91ede2e3731f30ea66c0916d1a3e591
7
- data.tar.gz: 930367d81adf351b66aa7365daaf9f4406067db80a4959409e68ddd5ab7041ed10db4f983f81d1af3d8f2457b8d79543cbf33c927e69bfbde027a31da4b166a8
6
+ metadata.gz: 8cf0ff62f5bf1687d5d98f4d808bf9f7d0bb921322483a5e446e34ef6638ff5a67a5ae15b3e34916a9c4fe627f4aee581f8630d4182925928eb67a762624c103
7
+ data.tar.gz: 161eba94f7e0fd3ca350a162eef9706c8f5a76da972eb4b3cbefdc2f9f3fdc8a37a72b7a48f47d81e1860dca4367eb8c2ceae6fe1bd57d4a9a61c7df3ecd0209
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).
@@ -17,6 +17,7 @@ jobs:
17
17
  strategy:
18
18
  matrix:
19
19
  version:
20
+ - 3.1.0
20
21
  - 3.0.2
21
22
  - 2.6.6
22
23
  - 2.7.5
@@ -82,7 +83,7 @@ jobs:
82
83
  strategy:
83
84
  matrix:
84
85
  version:
85
- - 3.0.2
86
+ - 3.1.0
86
87
  os:
87
88
  - macos-latest
88
89
  steps:
@@ -0,0 +1,41 @@
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
+
12
+ jobs:
13
+ stale:
14
+
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ issues: write
18
+ pull-requests: write
19
+
20
+ steps:
21
+ - uses: actions/stale@v3
22
+ with:
23
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
24
+ days-before-issue-stale: 90
25
+ days-before-pr-stale: 30
26
+ days-before-close: 10
27
+ stale-issue-message: |-
28
+ This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action.
29
+
30
+ → If there's no activity within a week, then a bot will automatically close this.
31
+
32
+ Thanks for helping to improve Shopify's dev tooling and experience.
33
+ stale-pr-message: |-
34
+ This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action.
35
+
36
+ → If there's no activity within a week, then a bot will automatically close this.
37
+
38
+ Thanks for helping to improve Shopify's dev tooling and experience.
39
+ stale-issue-label: 'no-issue-activity'
40
+ stale-pr-label: 'no-pr-activity'
41
+ operations-per-run: 10 # temporary so we can ease into staling and see what happens
data/.rubocop.yml CHANGED
@@ -46,7 +46,7 @@ AllCops:
46
46
  - "vendor/**/*"
47
47
  - "docs/**/*"
48
48
  - "packaging/**/*"
49
- TargetRubyVersion: 2.4
49
+ TargetRubyVersion: 2.6
50
50
 
51
51
  Layout/EmptyLines:
52
52
  Exclude:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.5
1
+ 3.1.0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,42 @@ 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.0
6
+
7
+ ### Fixed
8
+ * [#2086](https://github.com/Shopify/shopify-cli/pull/2086): Improve check of dependency versions
9
+ * [#2149](https://github.com/Shopify/shopify-cli/pull/2149): Fix `ThemeAdminAPI` not to handle asset errors
10
+ * [#2122](https://github.com/Shopify/shopify-cli/pull/2122): Fix `--only`/`--ignore` flags parser to support multiple occurrences without quotes
11
+ * [#2146](https://github.com/Shopify/shopify-cli/pull/2146): Prevent duplicate locales for Checkout extension localization
12
+
13
+ ## Version 2.14.0
14
+
15
+ ### Changed
16
+ * [#2126](https://github.com/Shopify/shopify-cli/pull/2126): Use javy version 0.2.1
17
+
18
+ ### Added
19
+ * [#2103](https://github.com/Shopify/shopify-cli/pull/2103): Improve `shopify theme package` to include the `release-notes.md` file
20
+
21
+ ### Fixed
22
+ * [#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
23
+ * [#2088](https://github.com/Shopify/shopify-cli/pull/2088): Update theme-check to 1.10.1
24
+ * [#2130](https://github.com/Shopify/shopify-cli/pull/2130): Fix Homebrew installation.
25
+ * [#2133](https://github.com/Shopify/shopify-cli/pull/2133): Fix ignore file handling in DevServer::Watcher.
26
+
27
+ ## Version 2.13.0
28
+
29
+ ### Added
30
+ * [#2087](https://github.com/Shopify/shopify-cli/pull/2087): Add new Theme CLI commands: `theme list` and `theme open`
31
+ * [#2035](https://github.com/Shopify/shopify-cli/pull/2035): Support Ruby 3.1
32
+
33
+ ### Fixed
34
+ * [#2092](https://github.com/Shopify/shopify-cli/pull/2092): Fix `RootHelper` parse logic to support options with an equal (e.g.: `option=value`)
35
+ * [#2089](https://github.com/Shopify/shopify-cli/pull/2089): Use javy version 0.2.0
36
+ * [#2114](https://github.com/Shopify/shopify-cli/pull/2114): Fix `theme` command error messaging with `ThemeAdminAPI` wrapper
37
+
38
+ ### Removed
39
+ * [#2102](https://github.com/Shopify/shopify-cli/pull/2102): Remove AssemblyScript as a supported script language.
40
+
5
41
  ## Version 2.12.0
6
42
  ### Added
7
43
  * [#1866](https://github.com/Shopify/shopify-cli/pull/1866): Enforce git dependency
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.12.0)
4
+ shopify-cli (2.15.0)
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/
@@ -66,7 +66,7 @@ GEM
66
66
  mime-types (3.3.1)
67
67
  mime-types-data (~> 3.2015)
68
68
  mime-types-data (3.2021.0901)
69
- mini_portile2 (2.6.1)
69
+ mini_portile2 (2.8.0)
70
70
  minitest (5.14.4)
71
71
  minitest-fail-fast (0.1.0)
72
72
  minitest (~> 5)
@@ -77,11 +77,11 @@ GEM
77
77
  ruby-progressbar
78
78
  mocha (1.13.0)
79
79
  multi_test (0.1.2)
80
- nokogiri (1.12.5)
81
- mini_portile2 (~> 2.6.1)
80
+ nokogiri (1.13.3)
81
+ mini_portile2 (~> 2.8.0)
82
82
  racc (~> 1.4)
83
83
  parallel (1.21.0)
84
- parser (3.0.3.1)
84
+ parser (3.1.1.0)
85
85
  ast (~> 2.4.1)
86
86
  pry (0.13.1)
87
87
  coderay (~> 1.1)
@@ -92,24 +92,24 @@ GEM
92
92
  public_suffix (4.0.6)
93
93
  racc (1.6.0)
94
94
  rack (2.2.3)
95
- rainbow (3.0.0)
95
+ rainbow (3.1.1)
96
96
  rake (13.0.6)
97
97
  rb-fsevent (0.11.0)
98
98
  rb-inotify (0.10.1)
99
99
  ffi (~> 1.0)
100
- regexp_parser (2.1.1)
100
+ regexp_parser (2.2.0)
101
101
  rexml (3.2.5)
102
- rubocop (1.12.1)
102
+ rubocop (1.25.1)
103
103
  parallel (~> 1.10)
104
- parser (>= 3.0.0.0)
104
+ parser (>= 3.1.0.0)
105
105
  rainbow (>= 2.2.2, < 4.0)
106
106
  regexp_parser (>= 1.8, < 3.0)
107
107
  rexml
108
- rubocop-ast (>= 1.2.0, < 2.0)
108
+ rubocop-ast (>= 1.15.1, < 2.0)
109
109
  ruby-progressbar (~> 1.7)
110
110
  unicode-display_width (>= 1.4.0, < 3.0)
111
- rubocop-ast (1.4.1)
112
- parser (>= 2.7.1.5)
111
+ rubocop-ast (1.15.1)
112
+ parser (>= 3.0.1.1)
113
113
  rubocop-minitest (0.10.1)
114
114
  rubocop (>= 0.87)
115
115
  rubocop-rake (0.5.1)
@@ -119,12 +119,12 @@ GEM
119
119
  ruby-progressbar (1.11.0)
120
120
  sys-uname (1.2.2)
121
121
  ffi (~> 1.1)
122
- theme-check (1.9.0)
122
+ theme-check (1.10.1)
123
123
  liquid (>= 5.1.0)
124
124
  nokogiri (>= 1.12)
125
125
  parser (~> 3)
126
- timecop (0.9.2)
127
- unicode-display_width (2.0.0)
126
+ timecop (0.9.4)
127
+ unicode-display_width (2.1.0)
128
128
  webmock (3.9.3)
129
129
  addressable (>= 2.3.6)
130
130
  crack (>= 0.3.2)
@@ -134,7 +134,7 @@ PLATFORMS
134
134
  ruby
135
135
 
136
136
  DEPENDENCIES
137
- bundler (~> 2.2.2)
137
+ bundler (~> 2.3.8)
138
138
  byebug
139
139
  colorize (~> 0.8.1)
140
140
  cucumber (~> 7.0)
@@ -155,4 +155,4 @@ DEPENDENCIES
155
155
  webmock
156
156
 
157
157
  BUNDLED WITH
158
- 2.2.29
158
+ 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"
data/bin/shopify CHANGED
@@ -44,8 +44,8 @@ end
44
44
 
45
45
  require_relative "./load_shopify"
46
46
 
47
- exit(proc do
48
- begin
47
+ exit(
48
+ proc do
49
49
  ShopifyCLI::ErrorHandler.call do
50
50
  ShopifyCLI::Core::EntryPoint.call(ARGV.dup)
51
51
  end
@@ -56,5 +56,5 @@ exit(proc do
56
56
  else
57
57
  1
58
58
  end
59
- end
60
- end.call)
59
+ end.call
60
+ )
data/dev.yml CHANGED
@@ -6,7 +6,7 @@ env:
6
6
  SHOPIFY_CLI_DEVELOPMENT: "1"
7
7
 
8
8
  up:
9
- - ruby: 2.7.5
9
+ - ruby: 3.1.0
10
10
  - homebrew:
11
11
  - dpkg:
12
12
  version: 1.21.1
@@ -0,0 +1 @@
1
+ 69ac26fd99a41aa1839cdf8fc8a734874370947ef79e88b90f661c2e58485ae0
@@ -0,0 +1 @@
1
+ 80576fe617d6e093a72bc826f041207ddc57605381f0db6451ba27310e57e830
@@ -0,0 +1 @@
1
+ 9d2686f5caccc34e30baff614ccfc487e90c5d1220e515ca4e47337a0b6a2daf
@@ -0,0 +1 @@
1
+ 6b7b6f6745594c2e8efcaf948c0ef367911446101d2b8a7c8138ce2aca868cbd
@@ -0,0 +1 @@
1
+ a68b5cbfce2b4b6c1a7e89e50d41dfc63f083e73f846547232897e06345e9ca3
@@ -0,0 +1 @@
1
+ 4010c2d154f1ef7ebf1f8c49621a0742ab75c60fd77746a5fa175878d07f16ef
@@ -0,0 +1 @@
1
+ 786e417716969fcac4e97d9c0c701966c54a49152f9f57fa164f916cf14ae5f3
@@ -0,0 +1 @@
1
+ c12418f7b3e4edead87ade1f44bd7280626a92d8d1238d7f8eb91b1122f20f20
data/ext/javy/version CHANGED
@@ -1 +1 @@
1
- v0.1.0
1
+ v0.2.1
@@ -17,12 +17,10 @@ module Extension
17
17
 
18
18
  def self.clone_template(git_template)
19
19
  ArgoSetupStep.default do |context, _identifier, directory_name, _js_system|
20
- begin
21
- ShopifyCLI::Git.clone(git_template, directory_name, ctx: context)
22
- context.root = File.join(context.root, directory_name)
23
- rescue StandardError
24
- context.puts("{{x}} Unable to clone the repository.")
25
- end
20
+ ShopifyCLI::Git.clone(git_template, directory_name, ctx: context)
21
+ context.root = File.join(context.root, directory_name)
22
+ rescue StandardError
23
+ context.puts("{{x}} Unable to clone the repository.")
26
24
  end
27
25
  end
28
26
 
@@ -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
@@ -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
@@ -12,13 +12,21 @@ module Extension
12
12
  argo_configuration = extract_argo_configuration(attributes)
13
13
  next if argo_configuration.nil?
14
14
  surface_area = extract_surface_area(argo_configuration)
15
- surface_area_configuration = fetch_surface_area_configuration(surface_area)
16
- argo_configuration.merge!(surface_area_configuration)
15
+ if known_surface_area?(surface_area)
16
+ surface_area_configuration = fetch_surface_area_configuration(surface_area)
17
+ argo_configuration.merge!(surface_area_configuration)
18
+ else
19
+ clear_argo_configuration(attributes)
20
+ end
17
21
  end
18
22
  end
19
23
 
20
24
  private
21
25
 
26
+ def known_surface_area?(surface_area)
27
+ surface_area_configurations.keys.include?(surface_area.to_sym)
28
+ end
29
+
22
30
  def extract_argo_configuration(attributes)
23
31
  attributes.dig(:features, :argo)
24
32
  end
@@ -35,6 +43,11 @@ module Extension
35
43
  end
36
44
  end
37
45
 
46
+ def clear_argo_configuration(attributes)
47
+ attributes[:name] = "#{attributes[:name]} (Warning: surface area not configured properly)"
48
+ attributes[:features][:argo] = nil
49
+ end
50
+
38
51
  def surface_area_configurations
39
52
  {
40
53
  admin: {
@@ -18,6 +18,7 @@ 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
21
22
 
22
23
  def self.call(*args)
23
24
  new(*args).call
@@ -36,7 +37,7 @@ module Extension
36
37
  build_dir: hash.dig("development", "build_dir") || DEFAULT_BUILD_DIR,
37
38
  renderer: renderer,
38
39
  entries: Models::ServerConfig::DevelopmentEntries.new(
39
- main: hash.dig("development", "entries", "main")
40
+ main: hash.dig("development", "entries", "main") || DEFAULT_MAIN
40
41
  )
41
42
  ),
42
43
  extension_points: hash.dig("extension_points"),
@@ -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,
@@ -8,7 +8,7 @@ module Script
8
8
  recommend_default_ruby_range
9
9
 
10
10
  options do |parser, flags|
11
- parser.on("--name=NAME") { |name| flags[:name] = name }
11
+ parser.on("--title=TITLE") { |title| flags[:title] = title }
12
12
  parser.on("--api=API_NAME") { |ep_name| flags[:extension_point] = ep_name }
13
13
  parser.on("--language=LANGUAGE") { |language| flags[:language] = language }
14
14
  parser.on("--branch=BRANCH") { |branch| flags[:branch] = branch }
@@ -18,7 +18,7 @@ module Script
18
18
  form = Forms::Create.ask(@ctx, args, options.flags)
19
19
  return @ctx.puts(self.class.help) if form.nil?
20
20
 
21
- unless !form.name.empty? && form.extension_point
21
+ unless !form.title.empty? && form.extension_point
22
22
  return @ctx.puts(self.class.help)
23
23
  end
24
24
 
@@ -26,10 +26,10 @@ module Script
26
26
  ctx: @ctx,
27
27
  language: options.flags[:language]&.downcase || "wasm",
28
28
  sparse_checkout_branch: options.flags[:branch] || "master",
29
- script_name: form.name,
29
+ title: form.title,
30
30
  extension_point_type: form.extension_point,
31
31
  )
32
- @ctx.puts(@ctx.message("script.create.change_directory_notice", project.script_name))
32
+ @ctx.puts(@ctx.message("script.create.change_directory_notice", project.title))
33
33
  rescue StandardError => e
34
34
  UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.create.error.operation_failed"))
35
35
  end
@@ -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"
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Script
4
4
  module Errors
5
- class InvalidScriptNameError < ScriptProjectError; end
5
+ class InvalidScriptTitleError < ScriptProjectError; end
6
6
 
7
7
  class NoExistingAppsError < ScriptProjectError; end
8
8
  class NoExistingOrganizationsError < ScriptProjectError; end
@@ -3,10 +3,10 @@
3
3
  module Script
4
4
  module Forms
5
5
  class Create < ShopifyCLI::Form
6
- flag_arguments :extension_point, :name
6
+ flag_arguments :extension_point, :title
7
7
 
8
8
  def ask
9
- self.name = valid_name
9
+ self.title = valid_name
10
10
  self.extension_point ||= ask_extension_point
11
11
  end
12
12
 
@@ -19,14 +19,14 @@ module Script
19
19
  )
20
20
  end
21
21
 
22
- def ask_name
23
- CLI::UI::Prompt.ask(@ctx.message("script.forms.create.script_name"))
22
+ def ask_title
23
+ CLI::UI::Prompt.ask(@ctx.message("script.forms.create.script_title"))
24
24
  end
25
25
 
26
26
  def valid_name
27
- n = (name || ask_name).downcase.gsub(" ", "_")
28
- return n if n.match?(/^[0-9A-Za-z_-]*$/)
29
- raise Errors::InvalidScriptNameError
27
+ normalized_title = (title || ask_title).downcase.gsub(" ", "_")
28
+ return normalized_title if normalized_title.match?(/^[0-9A-Za-z_-]*$/)
29
+ raise Errors::InvalidScriptTitleError
30
30
  end
31
31
  end
32
32
  end
@@ -5,34 +5,17 @@ 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
- begin
11
- UI::StrictSpinner.spin(ctx.message("script.application.building_script")) do |spinner|
12
- script_content = task_runner.build
13
- metadata_file_location = task_runner.metadata_file_location
14
- metadata = Infrastructure::MetadataRepository.new(ctx: ctx).get_metadata(metadata_file_location)
15
-
16
- Infrastructure::PushPackageRepository.new(ctx: ctx).create_push_package(
17
- script_project: script_project,
18
- script_content: script_content,
19
- metadata: metadata,
20
- library: library,
21
- )
22
- spinner.update_title(ctx.message("script.application.built"))
23
- end
24
- rescue StandardError => e
25
- CLI::UI::Frame.with_frame_color_override(:red) do
26
- ctx.puts("\n{{red:#{e.message}}}")
27
- end
28
- errors = [
29
- Infrastructure::Errors::BuildScriptNotFoundError,
30
- Infrastructure::Errors::WebAssemblyBinaryNotFoundError,
31
- ]
32
-
33
- raise Infrastructure::Errors::BuildError unless errors.any? { |err| e.is_a?(err) }
34
- raise
10
+ UI::StrictSpinner.spin(ctx.message("script.application.building_script")) do |spinner|
11
+ task_runner.build
12
+ spinner.update_title(ctx.message("script.application.built"))
13
+ end
14
+ rescue Infrastructure::Errors::BuildError => e
15
+ CLI::UI::Frame.with_frame_color_override(:red) do
16
+ ctx.puts("\n{{red:#{e.message}}}")
35
17
  end
18
+ raise
36
19
  end
37
20
  end
38
21
  end