shopify-cli 2.7.2 → 2.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +2 -2
- data/.github/workflows/shopify.yml +1 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +15 -0
- data/Codespace.dockerfile +2 -2
- data/Gemfile.lock +4 -4
- data/Tests.dockerfile +2 -2
- data/dev.yml +1 -1
- data/ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256 +1 -0
- data/ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256 +1 -0
- data/ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256 +1 -0
- data/ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256 +1 -0
- data/ext/javy/javy.rb +24 -5
- data/lib/project_types/rails/commands/create.rb +1 -1
- data/lib/project_types/script/cli.rb +1 -1
- data/lib/project_types/script/config/extension_points.yml +10 -2
- data/lib/project_types/script/graphql/app_script_set.graphql +2 -2
- data/lib/project_types/script/layers/application/create_script.rb +1 -1
- data/lib/project_types/script/layers/application/push_script.rb +1 -1
- data/lib/project_types/script/layers/domain/errors.rb +1 -4
- data/lib/project_types/script/layers/domain/push_package.rb +3 -3
- data/lib/project_types/script/layers/domain/{script_json.rb → script_config.rb} +2 -2
- data/lib/project_types/script/layers/domain/script_project.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/errors.rb +28 -5
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +104 -27
- data/lib/project_types/script/layers/infrastructure/script_service.rb +11 -11
- data/lib/project_types/script/messages/messages.rb +8 -2
- data/lib/project_types/script/ui/error_handler.rb +30 -15
- data/lib/project_types/theme/commands/push.rb +1 -2
- data/lib/shopify_cli/context.rb +1 -0
- data/lib/shopify_cli/git.rb +2 -0
- data/lib/shopify_cli/services/app/create/rails_service.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/cdn_fonts.rb +73 -0
- data/lib/shopify_cli/theme/dev_server/hot-reload.js +25 -9
- data/lib/shopify_cli/theme/dev_server.rb +2 -0
- data/lib/shopify_cli/tunnel.rb +1 -0
- data/lib/shopify_cli/version.rb +1 -1
- data/shopify-cli.gemspec +1 -1
- metadata +10 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f839cd234fbc37b84d85cc7ba1efddedf6b1571adba40562b3f4296286ca0130
|
|
4
|
+
data.tar.gz: fb66a6a0728d317bddc220e1af1c4fa0049bd42e34cbef6f4310daa19cfe9e86
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 11c1e49165ad7140139fe89b56e55287e6a3facca584c18234a4dbb302428d01a62cf2f4c5c27edf1943c9ec7f6610c8733fc1689b3cb78f9425b01c2f4f3836
|
|
7
|
+
data.tar.gz: 8fc34d5588a785bbd8fa7f47b0dc8f9682dc955a8c23aa733dd33e39e37ebc9fbe898c542314ea16604a7f08a384d54ec693c8eb129af7bde0a156567c345058
|
data/.github/CODEOWNERS
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
* @shopify/core-build-learn
|
|
2
2
|
* @shopify/development-lifecycle
|
|
3
3
|
|
|
4
|
-
/lib/project_types/script/ @shopify/scripts-
|
|
5
|
-
/test/project_types/script/ @shopify/scripts-
|
|
4
|
+
/lib/project_types/script/ @shopify/scripts-platform
|
|
5
|
+
/test/project_types/script/ @shopify/scripts-platform
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.7.
|
|
1
|
+
2.7.5
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
From version 2.6.0, the sections in this file adhere to the [keep a changelog](https://keepachangelog.com/en/1.0.0/) specification.
|
|
2
|
+
## Version 2.7.3
|
|
3
|
+
### Added
|
|
4
|
+
* [#1826](https://github.com/Shopify/shopify-cli/pull/1826): Support using `script.config.yml` file for script configuration
|
|
5
|
+
* [#1843](https://github.com/Shopify/shopify-cli/pull/1826): Support using javy on Apple ARM processors
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
* [#1811](https://github.com/Shopify/shopify-cli/pull/1811): Update theme-check to 1.9.0
|
|
9
|
+
* [#1831](https://github.com/Shopify/shopify-cli/pull/1831): Ensure correct `ngrok` version is downloaded for Apple M1
|
|
10
|
+
* [#1823](https://github.com/Shopify/shopify-cli/pull/1823): Indicate git is unavailable; don't error out
|
|
11
|
+
* [#1807](https://github.com/Shopify/shopify-cli/pull/1807): Fix `--live` parameter, it should not imply `--allow-live` in the `theme push` command
|
|
12
|
+
* [#1812](https://github.com/Shopify/shopify-cli/pull/1812): App creation with Rails 7
|
|
13
|
+
* [#1821](https://github.com/Shopify/shopify-cli/pull/1821): Fix Shopify hosted fonts to load via the local preview URL
|
|
14
|
+
* [#1830](https://github.com/Shopify/shopify-cli/pull/1830): Fix hot reload when users update many files "simultaneously"
|
|
15
|
+
* [#1837](https://github.com/Shopify/shopify-cli/pull/1837): Fix `ShopifyCLI::Theme::DevServer::CdnFonts` class to support any font
|
|
16
|
+
|
|
2
17
|
## Version 2.7.2
|
|
3
18
|
### Fixed
|
|
4
19
|
* [#1763](https://github.com/Shopify/shopify-cli/pull/1763): Fix: Tunnel --PORT parameter not working in Node.js app.
|
data/Codespace.dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# This is a Docker image to test the CLI in UNIX environments other than macOS
|
|
2
2
|
# Build the image: docker build . -t shopify-cli
|
|
3
3
|
# Run tests: docker run -t --rm --volume "$(pwd):/usr/src/app" shopify-cli bundle exec rake test
|
|
4
|
-
FROM cimg/ruby:2.7.
|
|
4
|
+
FROM cimg/ruby:2.7.5
|
|
5
5
|
|
|
6
6
|
RUN git config --global user.email "development-lifecycle@shopify.com"
|
|
7
7
|
RUN git config --global user.name "Development Lifecycle"
|
|
@@ -29,7 +29,7 @@ RUN sudo apt-get install -y nodejs
|
|
|
29
29
|
RUN sudo npm install --global yarn
|
|
30
30
|
|
|
31
31
|
# Python is necessary to compile NPM packages with native extensions through node-gyp
|
|
32
|
-
RUN sudo apt install
|
|
32
|
+
RUN sudo apt install python2-minimal -y
|
|
33
33
|
|
|
34
34
|
# Install sqlite3
|
|
35
35
|
RUN sudo apt-get install libsqlite3-dev -y
|
data/Gemfile.lock
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
shopify-cli (2.7.
|
|
4
|
+
shopify-cli (2.7.3)
|
|
5
5
|
bugsnag (~> 6.22)
|
|
6
6
|
listen (~> 3.7.0)
|
|
7
|
-
theme-check (~> 1.
|
|
7
|
+
theme-check (~> 1.9.0)
|
|
8
8
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
@@ -81,7 +81,7 @@ GEM
|
|
|
81
81
|
mini_portile2 (~> 2.6.1)
|
|
82
82
|
racc (~> 1.4)
|
|
83
83
|
parallel (1.21.0)
|
|
84
|
-
parser (3.0.
|
|
84
|
+
parser (3.0.3.1)
|
|
85
85
|
ast (~> 2.4.1)
|
|
86
86
|
pry (0.13.1)
|
|
87
87
|
coderay (~> 1.1)
|
|
@@ -119,7 +119,7 @@ GEM
|
|
|
119
119
|
ruby-progressbar (1.11.0)
|
|
120
120
|
sys-uname (1.2.2)
|
|
121
121
|
ffi (~> 1.1)
|
|
122
|
-
theme-check (1.
|
|
122
|
+
theme-check (1.9.0)
|
|
123
123
|
liquid (>= 5.1.0)
|
|
124
124
|
nokogiri (>= 1.12)
|
|
125
125
|
parser (~> 3)
|
data/Tests.dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# This is a Docker image to test the CLI in UNIX environments other than macOS
|
|
2
2
|
# Build the image: docker build . -t shopify-cli
|
|
3
3
|
# Run tests: docker run -t --rm --volume "$(pwd):/usr/src/app" shopify-cli bundle exec rake test
|
|
4
|
-
FROM cimg/ruby:2.7.
|
|
4
|
+
FROM cimg/ruby:2.7.5
|
|
5
5
|
|
|
6
6
|
RUN git config --global user.email "development-lifecycle@shopify.com"
|
|
7
7
|
RUN git config --global user.name "Development Lifecycle"
|
|
@@ -29,7 +29,7 @@ RUN sudo apt-get install -y nodejs
|
|
|
29
29
|
RUN sudo npm install --global yarn
|
|
30
30
|
|
|
31
31
|
# Python is necessary to compile NPM packages with native extensions through node-gyp
|
|
32
|
-
RUN sudo apt install
|
|
32
|
+
RUN sudo apt install python2-minimal -y
|
|
33
33
|
|
|
34
34
|
# Install sqlite3
|
|
35
35
|
RUN sudo apt-get install libsqlite3-dev -y
|
data/dev.yml
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
16e1a74c06eff6e5be79253a8ee96a08a404e95be3479a6e384c8926bb736e43
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
53cb9d0e8a345d68f91512a28a7d2eab93463dc8650c7a044f03cbee1f7cac05
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
5e1ca88385206a653980139ab969efd80de11fd9b298dafe450d3ac27d6d0173
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
37f9b3f75b4ffca68b06656d6f90abfbac57597ee45fffb59b3a559b6b5de44e
|
data/ext/javy/javy.rb
CHANGED
|
@@ -2,10 +2,12 @@ require "rbconfig"
|
|
|
2
2
|
require "open-uri"
|
|
3
3
|
require "zlib"
|
|
4
4
|
require "open3"
|
|
5
|
+
require "digest/sha2"
|
|
5
6
|
|
|
6
7
|
module Javy
|
|
7
8
|
ROOT = __dir__
|
|
8
9
|
BIN_FOLDER = File.join(ROOT, "bin")
|
|
10
|
+
HASH_FOLDER = File.join(ROOT, "hashes")
|
|
9
11
|
VERSION = File.read(File.join(ROOT, "version")).strip
|
|
10
12
|
TARGET = File.join(BIN_FOLDER, "javy-#{VERSION}")
|
|
11
13
|
|
|
@@ -17,14 +19,13 @@ module Javy
|
|
|
17
19
|
end
|
|
18
20
|
|
|
19
21
|
def build(source:, dest: nil)
|
|
20
|
-
ensure_installed
|
|
21
|
-
|
|
22
22
|
optional_args = []
|
|
23
23
|
optional_args += ["-o", dest] unless dest.nil?
|
|
24
24
|
|
|
25
25
|
ShopifyCLI::Result
|
|
26
|
-
.wrap {
|
|
26
|
+
.wrap { ensure_installed }
|
|
27
27
|
.call
|
|
28
|
+
.then { exec(source, *optional_args) }
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
private
|
|
@@ -45,7 +46,8 @@ module Javy
|
|
|
45
46
|
|
|
46
47
|
def ensure_installed
|
|
47
48
|
delete_outdated_installations
|
|
48
|
-
install unless Installer.installed?(target: target)
|
|
49
|
+
install.unwrap { |e| raise e } unless Installer.installed?(target: target)
|
|
50
|
+
true
|
|
49
51
|
end
|
|
50
52
|
|
|
51
53
|
def delete_outdated_installations
|
|
@@ -97,16 +99,25 @@ module Javy
|
|
|
97
99
|
url: url
|
|
98
100
|
))
|
|
99
101
|
end
|
|
102
|
+
|
|
103
|
+
def self.invalid_binary
|
|
104
|
+
new("Invalid Javy binary downloaded.")
|
|
105
|
+
end
|
|
100
106
|
end
|
|
101
107
|
|
|
102
108
|
Asset = Struct.new(:platform, :version, :owner, :repository, :basename, keyword_init: true) do
|
|
103
109
|
def download(target:)
|
|
104
110
|
FileUtils.mkdir_p(BIN_FOLDER)
|
|
105
111
|
|
|
112
|
+
source_file = url.open
|
|
113
|
+
validate_sha!(source_file)
|
|
114
|
+
source_file.seek(0)
|
|
115
|
+
|
|
106
116
|
Dir.chdir(File.dirname(target)) do
|
|
107
117
|
File.open(File.basename(target), "wb") do |target_file|
|
|
108
|
-
decompress(
|
|
118
|
+
decompress(source_file, target_file)
|
|
109
119
|
end
|
|
120
|
+
|
|
110
121
|
File.chmod(0755, target)
|
|
111
122
|
end
|
|
112
123
|
|
|
@@ -143,6 +154,12 @@ module Javy
|
|
|
143
154
|
ensure
|
|
144
155
|
zlib.close
|
|
145
156
|
end
|
|
157
|
+
|
|
158
|
+
def validate_sha!(source)
|
|
159
|
+
generated_hash = Digest::SHA256.hexdigest(source.read).strip
|
|
160
|
+
expected_hash = File.read(File.join(HASH_FOLDER, "#{filename}.sha256")).strip
|
|
161
|
+
raise InstallationError.invalid_binary unless generated_hash == expected_hash
|
|
162
|
+
end
|
|
146
163
|
end
|
|
147
164
|
|
|
148
165
|
Platform = Struct.new(:ruby_config) do
|
|
@@ -169,6 +186,8 @@ module Javy
|
|
|
169
186
|
case ruby_config.fetch("host_cpu")
|
|
170
187
|
when "x64", "x86_64"
|
|
171
188
|
"x86_64"
|
|
189
|
+
when "arm"
|
|
190
|
+
"arm"
|
|
172
191
|
else
|
|
173
192
|
raise InstallationError.cpu_unsupported
|
|
174
193
|
end
|
|
@@ -156,10 +156,10 @@ module Rails
|
|
|
156
156
|
|
|
157
157
|
CLI::UI::Frame.open(@ctx.message("rails.create.generating_app", name)) do
|
|
158
158
|
new_command = %w(rails new)
|
|
159
|
+
new_command << name
|
|
159
160
|
new_command += DEFAULT_RAILS_FLAGS
|
|
160
161
|
new_command << "--database=#{db}"
|
|
161
162
|
new_command += options.flags[:rails_opts].split unless options.flags[:rails_opts].nil?
|
|
162
|
-
new_command << name
|
|
163
163
|
|
|
164
164
|
syscall(new_command)
|
|
165
165
|
end
|
|
@@ -46,7 +46,7 @@ module Script
|
|
|
46
46
|
autoload :PushPackage, Project.project_filepath("layers/domain/push_package")
|
|
47
47
|
autoload :Metadata, Project.project_filepath("layers/domain/metadata")
|
|
48
48
|
autoload :ExtensionPoint, Project.project_filepath("layers/domain/extension_point")
|
|
49
|
-
autoload :
|
|
49
|
+
autoload :ScriptConfig, Project.project_filepath("layers/domain/script_config")
|
|
50
50
|
autoload :ScriptProject, Project.project_filepath("layers/domain/script_project")
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -18,11 +18,19 @@ shipping_methods:
|
|
|
18
18
|
beta: true
|
|
19
19
|
package: "@shopify/scripts-checkout-apis"
|
|
20
20
|
repo: "https://github.com/Shopify/scripts-apis-examples"
|
|
21
|
-
|
|
21
|
+
merchandise_discount_types:
|
|
22
22
|
beta: true
|
|
23
23
|
domain: 'discounts'
|
|
24
24
|
libraries:
|
|
25
25
|
typescript:
|
|
26
26
|
beta: true
|
|
27
|
-
package: "@shopify/scripts-
|
|
27
|
+
package: "@shopify/scripts-discounts-apis"
|
|
28
|
+
repo: "https://github.com/Shopify/scripts-apis-examples"
|
|
29
|
+
delivery_discount_types:
|
|
30
|
+
beta: true
|
|
31
|
+
domain: 'discounts'
|
|
32
|
+
libraries:
|
|
33
|
+
typescript:
|
|
34
|
+
beta: true
|
|
35
|
+
package: "@shopify/scripts-discounts-apis"
|
|
28
36
|
repo: "https://github.com/Shopify/scripts-apis-examples"
|
|
@@ -6,7 +6,7 @@ mutation AppScriptSet(
|
|
|
6
6
|
$force: Boolean,
|
|
7
7
|
$schemaMajorVersion: String,
|
|
8
8
|
$schemaMinorVersion: String,
|
|
9
|
-
$
|
|
9
|
+
$scriptConfigVersion: String!,
|
|
10
10
|
$configurationUi: Boolean!,
|
|
11
11
|
$configurationDefinition: String!,
|
|
12
12
|
$moduleUploadUrl: String!,
|
|
@@ -20,7 +20,7 @@ mutation AppScriptSet(
|
|
|
20
20
|
force: $force
|
|
21
21
|
schemaMajorVersion: $schemaMajorVersion
|
|
22
22
|
schemaMinorVersion: $schemaMinorVersion,
|
|
23
|
-
|
|
23
|
+
scriptConfigVersion: $scriptConfigVersion,
|
|
24
24
|
configurationUi: $configurationUi,
|
|
25
25
|
configurationDefinition: $configurationDefinition,
|
|
26
26
|
moduleUploadUrl: $moduleUploadUrl,
|
|
@@ -43,7 +43,7 @@ module Script
|
|
|
43
43
|
extension_point_type: package.extension_point_type,
|
|
44
44
|
force: force,
|
|
45
45
|
metadata: package.metadata,
|
|
46
|
-
|
|
46
|
+
script_config: package.script_config,
|
|
47
47
|
module_upload_url: module_upload_url,
|
|
48
48
|
library: package.library,
|
|
49
49
|
)
|
|
@@ -14,7 +14,7 @@ module Script
|
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
class
|
|
17
|
+
class MissingScriptConfigFieldError < ScriptProjectError
|
|
18
18
|
attr_reader :field
|
|
19
19
|
def initialize(field)
|
|
20
20
|
super()
|
|
@@ -22,9 +22,6 @@ module Script
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
class InvalidScriptJsonDefinitionError < ScriptProjectError; end
|
|
26
|
-
class NoScriptJsonFile < ScriptProjectError; end
|
|
27
|
-
|
|
28
25
|
class ScriptNotFoundError < ScriptProjectError
|
|
29
26
|
attr_reader :script_name, :extension_point_type
|
|
30
27
|
def initialize(extension_point_type, script_name)
|
|
@@ -7,7 +7,7 @@ module Script
|
|
|
7
7
|
attr_reader :id,
|
|
8
8
|
:uuid,
|
|
9
9
|
:extension_point_type,
|
|
10
|
-
:
|
|
10
|
+
:script_config,
|
|
11
11
|
:script_content,
|
|
12
12
|
:compiled_type,
|
|
13
13
|
:metadata,
|
|
@@ -20,7 +20,7 @@ module Script
|
|
|
20
20
|
script_content:,
|
|
21
21
|
compiled_type: nil,
|
|
22
22
|
metadata:,
|
|
23
|
-
|
|
23
|
+
script_config:,
|
|
24
24
|
library:
|
|
25
25
|
)
|
|
26
26
|
@id = id
|
|
@@ -29,7 +29,7 @@ module Script
|
|
|
29
29
|
@script_content = script_content
|
|
30
30
|
@compiled_type = compiled_type
|
|
31
31
|
@metadata = metadata
|
|
32
|
-
@
|
|
32
|
+
@script_config = script_config
|
|
33
33
|
@library = library
|
|
34
34
|
end
|
|
35
35
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Script
|
|
4
4
|
module Layers
|
|
5
5
|
module Domain
|
|
6
|
-
class
|
|
6
|
+
class ScriptConfig
|
|
7
7
|
attr_reader :content, :version, :title, :description, :configuration_ui, :configuration
|
|
8
8
|
|
|
9
9
|
REQUIRED_FIELDS = %w(version title)
|
|
@@ -23,7 +23,7 @@ module Script
|
|
|
23
23
|
|
|
24
24
|
def validate_content!(content)
|
|
25
25
|
REQUIRED_FIELDS.each do |field|
|
|
26
|
-
raise Errors::
|
|
26
|
+
raise Errors::MissingScriptConfigFieldError, field if content[field].nil?
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
end
|
|
@@ -5,9 +5,9 @@ module Script
|
|
|
5
5
|
module Infrastructure
|
|
6
6
|
module Errors
|
|
7
7
|
class BuildError < ScriptProjectError; end
|
|
8
|
-
class
|
|
8
|
+
class ScriptConfigSyntaxError < ScriptProjectError; end
|
|
9
9
|
|
|
10
|
-
class
|
|
10
|
+
class ScriptConfigMissingKeysError < ScriptProjectError
|
|
11
11
|
attr_reader :missing_keys
|
|
12
12
|
def initialize(missing_keys)
|
|
13
13
|
super()
|
|
@@ -15,7 +15,7 @@ module Script
|
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
class
|
|
18
|
+
class ScriptConfigInvalidValueError < ScriptProjectError
|
|
19
19
|
attr_reader :valid_input_modes
|
|
20
20
|
def initialize(valid_input_modes)
|
|
21
21
|
super()
|
|
@@ -23,7 +23,7 @@ module Script
|
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
class
|
|
26
|
+
class ScriptConfigFieldsMissingKeysError < ScriptProjectError
|
|
27
27
|
attr_reader :missing_keys
|
|
28
28
|
def initialize(missing_keys)
|
|
29
29
|
super()
|
|
@@ -31,7 +31,7 @@ module Script
|
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
class
|
|
34
|
+
class ScriptConfigFieldsInvalidValueError < ScriptProjectError
|
|
35
35
|
attr_reader :valid_types
|
|
36
36
|
def initialize(valid_types)
|
|
37
37
|
super()
|
|
@@ -39,6 +39,29 @@ module Script
|
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
class InvalidScriptConfigYmlDefinitionError < ScriptProjectError; end
|
|
43
|
+
|
|
44
|
+
class InvalidScriptJsonDefinitionError < ScriptProjectError; end
|
|
45
|
+
|
|
46
|
+
class MissingScriptConfigYmlFieldError < ScriptProjectError
|
|
47
|
+
attr_reader :field
|
|
48
|
+
def initialize(field)
|
|
49
|
+
super()
|
|
50
|
+
@field = field
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
class MissingScriptJsonFieldError < ScriptProjectError
|
|
55
|
+
attr_reader :field
|
|
56
|
+
def initialize(field)
|
|
57
|
+
super()
|
|
58
|
+
@field = field
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
class NoScriptConfigYmlFileError < ScriptProjectError; end
|
|
63
|
+
class NoScriptConfigFileError < ScriptProjectError; end
|
|
64
|
+
|
|
42
65
|
class APILibraryNotFoundError < ScriptProjectError
|
|
43
66
|
attr_reader :library_name
|
|
44
67
|
def initialize(library_name)
|
|
@@ -18,7 +18,7 @@ module Script
|
|
|
18
18
|
script_content: script_content,
|
|
19
19
|
compiled_type: compiled_type,
|
|
20
20
|
metadata: metadata,
|
|
21
|
-
|
|
21
|
+
script_config: script_project.script_config,
|
|
22
22
|
library: library
|
|
23
23
|
)
|
|
24
24
|
end
|
|
@@ -34,7 +34,7 @@ module Script
|
|
|
34
34
|
extension_point_type: script_project.extension_point_type,
|
|
35
35
|
script_content: script_content,
|
|
36
36
|
metadata: metadata,
|
|
37
|
-
|
|
37
|
+
script_config: script_project.script_config,
|
|
38
38
|
library: library
|
|
39
39
|
)
|
|
40
40
|
end
|
|
@@ -7,7 +7,6 @@ module Script
|
|
|
7
7
|
include SmartProperties
|
|
8
8
|
property! :ctx, accepts: ShopifyCLI::Context
|
|
9
9
|
|
|
10
|
-
SCRIPT_JSON_FILENAME = "script.json"
|
|
11
10
|
MUTABLE_ENV_VALUES = %i(uuid)
|
|
12
11
|
|
|
13
12
|
def create(script_name:, extension_point_type:, language:)
|
|
@@ -40,7 +39,7 @@ module Script
|
|
|
40
39
|
script_name: script_name,
|
|
41
40
|
extension_point_type: extension_point_type,
|
|
42
41
|
language: language,
|
|
43
|
-
|
|
42
|
+
script_config: script_config_repository.get!
|
|
44
43
|
)
|
|
45
44
|
end
|
|
46
45
|
|
|
@@ -58,7 +57,7 @@ module Script
|
|
|
58
57
|
script_name: script_name,
|
|
59
58
|
extension_point_type: extension_point_type,
|
|
60
59
|
language: language,
|
|
61
|
-
|
|
60
|
+
script_config: script_config_repository.get!,
|
|
62
61
|
)
|
|
63
62
|
end
|
|
64
63
|
|
|
@@ -77,14 +76,12 @@ module Script
|
|
|
77
76
|
script_name: script_name,
|
|
78
77
|
extension_point_type: extension_point_type,
|
|
79
78
|
language: language,
|
|
80
|
-
|
|
79
|
+
script_config: script_config_repository.get!,
|
|
81
80
|
)
|
|
82
81
|
end
|
|
83
82
|
|
|
84
|
-
def
|
|
85
|
-
|
|
86
|
-
.new(ctx: ctx)
|
|
87
|
-
.update_or_create(title: title)
|
|
83
|
+
def update_script_config(title:)
|
|
84
|
+
script_config = script_config_repository.update!(title: title)
|
|
88
85
|
|
|
89
86
|
Domain::ScriptProject.new(
|
|
90
87
|
id: ctx.root,
|
|
@@ -92,7 +89,7 @@ module Script
|
|
|
92
89
|
script_name: script_name,
|
|
93
90
|
extension_point_type: extension_point_type,
|
|
94
91
|
language: language,
|
|
95
|
-
|
|
92
|
+
script_config: script_config,
|
|
96
93
|
)
|
|
97
94
|
end
|
|
98
95
|
|
|
@@ -140,40 +137,120 @@ module Script
|
|
|
140
137
|
end
|
|
141
138
|
end
|
|
142
139
|
|
|
143
|
-
|
|
140
|
+
def script_config_repository
|
|
141
|
+
@script_config_repository ||= begin
|
|
142
|
+
supported_repos = [
|
|
143
|
+
ScriptConfigYmlRepository.new(ctx: ctx),
|
|
144
|
+
ScriptJsonRepository.new(ctx: ctx),
|
|
145
|
+
]
|
|
146
|
+
repo = supported_repos.find(&:active?)
|
|
147
|
+
raise Infrastructure::Errors::NoScriptConfigYmlFileError if repo.nil?
|
|
148
|
+
repo
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
class ScriptConfigRepository
|
|
144
153
|
include SmartProperties
|
|
145
154
|
property! :ctx, accepts: ShopifyCLI::Context
|
|
146
155
|
|
|
147
|
-
def
|
|
148
|
-
|
|
156
|
+
def active?
|
|
157
|
+
ctx.file_exist?(filename)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def get!
|
|
161
|
+
raise Infrastructure::Errors::NoScriptConfigFileError unless active?
|
|
162
|
+
|
|
163
|
+
content = ctx.read(filename)
|
|
164
|
+
hash = file_content_to_hash(content)
|
|
165
|
+
|
|
166
|
+
from_h(hash)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def update!(title:)
|
|
170
|
+
hash = get!.content
|
|
171
|
+
update_hash(hash: hash, title: title)
|
|
172
|
+
|
|
173
|
+
ctx.write(filename, hash_to_file_content(hash))
|
|
174
|
+
|
|
175
|
+
from_h(hash)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
private
|
|
179
|
+
|
|
180
|
+
def update_hash(hash:, title:)
|
|
181
|
+
hash["version"] ||= "2"
|
|
182
|
+
hash["title"] = title
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def from_h(hash)
|
|
186
|
+
Domain::ScriptConfig.new(content: hash)
|
|
187
|
+
rescue Domain::Errors::MissingScriptConfigFieldError => e
|
|
188
|
+
raise missing_field_error, e.field
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# to be implemented by subclasses
|
|
192
|
+
def filename
|
|
193
|
+
raise NotImplementedError
|
|
149
194
|
end
|
|
150
195
|
|
|
151
|
-
def
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
json["title"] = title
|
|
196
|
+
def file_content_to_hash(file_content)
|
|
197
|
+
raise NotImplementedError
|
|
198
|
+
end
|
|
155
199
|
|
|
156
|
-
|
|
200
|
+
def hash_to_file_content(hash)
|
|
201
|
+
raise NotImplementedError
|
|
202
|
+
end
|
|
157
203
|
|
|
158
|
-
|
|
204
|
+
def missing_field_error
|
|
205
|
+
raise NotImplementedError
|
|
159
206
|
end
|
|
207
|
+
end
|
|
160
208
|
|
|
209
|
+
class ScriptConfigYmlRepository < ScriptConfigRepository
|
|
161
210
|
private
|
|
162
211
|
|
|
163
|
-
def
|
|
164
|
-
|
|
212
|
+
def filename
|
|
213
|
+
"script.config.yml"
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def file_content_to_hash(file_content)
|
|
217
|
+
begin
|
|
218
|
+
hash = YAML.load(file_content)
|
|
219
|
+
rescue Psych::SyntaxError
|
|
220
|
+
raise Errors::InvalidScriptConfigYmlDefinitionError
|
|
221
|
+
end
|
|
222
|
+
raise Errors::InvalidScriptConfigYmlDefinitionError unless hash.is_a?(Hash)
|
|
223
|
+
hash
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
def hash_to_file_content(hash)
|
|
227
|
+
YAML.dump(hash)
|
|
228
|
+
end
|
|
165
229
|
|
|
166
|
-
|
|
167
|
-
|
|
230
|
+
def missing_field_error
|
|
231
|
+
Errors::MissingScriptConfigYmlFieldError
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
class ScriptJsonRepository < ScriptConfigRepository
|
|
236
|
+
private
|
|
168
237
|
|
|
169
|
-
|
|
238
|
+
def filename
|
|
239
|
+
"script.json"
|
|
170
240
|
end
|
|
171
241
|
|
|
172
|
-
def
|
|
173
|
-
JSON.parse(
|
|
174
|
-
true
|
|
242
|
+
def file_content_to_hash(file_content)
|
|
243
|
+
JSON.parse(file_content)
|
|
175
244
|
rescue JSON::ParserError
|
|
176
|
-
|
|
245
|
+
raise Errors::InvalidScriptJsonDefinitionError
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
def hash_to_file_content(hash)
|
|
249
|
+
JSON.pretty_generate(hash)
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
def missing_field_error
|
|
253
|
+
Errors::MissingScriptJsonFieldError
|
|
177
254
|
end
|
|
178
255
|
end
|
|
179
256
|
end
|
|
@@ -17,7 +17,7 @@ module Script
|
|
|
17
17
|
extension_point_type:,
|
|
18
18
|
force: false,
|
|
19
19
|
metadata:,
|
|
20
|
-
|
|
20
|
+
script_config:,
|
|
21
21
|
module_upload_url:,
|
|
22
22
|
library:
|
|
23
23
|
)
|
|
@@ -25,14 +25,14 @@ module Script
|
|
|
25
25
|
variables = {
|
|
26
26
|
uuid: uuid,
|
|
27
27
|
extensionPointName: extension_point_type.upcase,
|
|
28
|
-
title:
|
|
29
|
-
description:
|
|
28
|
+
title: script_config.title,
|
|
29
|
+
description: script_config.description,
|
|
30
30
|
force: force,
|
|
31
31
|
schemaMajorVersion: metadata.schema_major_version.to_s, # API expects string value
|
|
32
32
|
schemaMinorVersion: metadata.schema_minor_version.to_s, # API expects string value
|
|
33
|
-
|
|
34
|
-
configurationUi:
|
|
35
|
-
configurationDefinition:
|
|
33
|
+
scriptConfigVersion: script_config.version,
|
|
34
|
+
configurationUi: script_config.configuration_ui,
|
|
35
|
+
configurationDefinition: script_config.configuration&.to_json,
|
|
36
36
|
moduleUploadUrl: module_upload_url,
|
|
37
37
|
library: {
|
|
38
38
|
language: library[:language],
|
|
@@ -47,19 +47,19 @@ module Script
|
|
|
47
47
|
if user_errors.any? { |e| e["tag"] == "already_exists_error" }
|
|
48
48
|
raise Errors::ScriptRepushError, uuid
|
|
49
49
|
elsif (e = user_errors.any? { |err| err["tag"] == "configuration_definition_syntax_error" })
|
|
50
|
-
raise Errors::
|
|
50
|
+
raise Errors::ScriptConfigSyntaxError
|
|
51
51
|
elsif (e = user_errors.find { |err| err["tag"] == "configuration_definition_missing_keys_error" })
|
|
52
|
-
raise Errors::
|
|
52
|
+
raise Errors::ScriptConfigMissingKeysError, e["message"]
|
|
53
53
|
elsif (e = user_errors.find { |err| err["tag"] == "configuration_definition_invalid_value_error" })
|
|
54
|
-
raise Errors::
|
|
54
|
+
raise Errors::ScriptConfigInvalidValueError, e["message"]
|
|
55
55
|
elsif (e = user_errors.find do |err|
|
|
56
56
|
err["tag"] == "configuration_definition_schema_field_missing_keys_error"
|
|
57
57
|
end)
|
|
58
|
-
raise Errors::
|
|
58
|
+
raise Errors::ScriptConfigFieldsMissingKeysError, e["message"]
|
|
59
59
|
elsif (e = user_errors.find do |err|
|
|
60
60
|
err["tag"] == "configuration_definition_schema_field_invalid_value_error"
|
|
61
61
|
end)
|
|
62
|
-
raise Errors::
|
|
62
|
+
raise Errors::ScriptConfigFieldsInvalidValueError, e["message"]
|
|
63
63
|
elsif user_errors.find { |err| %w(not_use_msgpack_error schema_version_argument_error).include?(err["tag"]) }
|
|
64
64
|
raise Domain::Errors::MetadataValidationError
|
|
65
65
|
else
|
|
@@ -47,14 +47,20 @@ module Script
|
|
|
47
47
|
invalid_language_cause: "Invalid language %s.",
|
|
48
48
|
invalid_language_help: "Allowed values: %s.",
|
|
49
49
|
|
|
50
|
+
missing_script_config_yml_field_cause: "The script.config.yml file is missing the required %s field.",
|
|
51
|
+
missing_script_config_yml_field_help: "Add the field and try again.",
|
|
52
|
+
|
|
50
53
|
missing_script_json_field_cause: "The script.json file is missing the required %s field.",
|
|
51
54
|
missing_script_json_field_help: "Add the field and try again.",
|
|
52
55
|
|
|
53
56
|
invalid_script_json_definition_cause: "The script.json file contains invalid JSON.",
|
|
54
57
|
invalid_script_json_definition_help: "Fix the errors and try again.",
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
invalid_script_config_yml_definition_cause: "The script.config.yml file contains invalid YAML.",
|
|
60
|
+
invalid_script_config_yml_definition_help: "Fix the errors and try again.",
|
|
61
|
+
|
|
62
|
+
no_script_config_yml_file_cause: "The script.config.yml file is missing.",
|
|
63
|
+
no_script_config_yml_file_help: "Create this file and try again.",
|
|
58
64
|
|
|
59
65
|
configuration_syntax_error_cause: "The script.json is not formatted properly.",
|
|
60
66
|
configuration_syntax_error_help: "Fix the errors and try again.",
|
|
@@ -103,32 +103,47 @@ module Script
|
|
|
103
103
|
cause_of_error: ShopifyCLI::Context.message("script.error.metadata_not_found_cause"),
|
|
104
104
|
help_suggestion: ShopifyCLI::Context.message("script.error.metadata_not_found_help"),
|
|
105
105
|
}
|
|
106
|
-
when Layers::
|
|
106
|
+
when Layers::Infrastructure::Errors::BuildError
|
|
107
107
|
{
|
|
108
|
-
cause_of_error: ShopifyCLI::Context.message("script.error.
|
|
109
|
-
help_suggestion: ShopifyCLI::Context.message("script.error.
|
|
108
|
+
cause_of_error: ShopifyCLI::Context.message("script.error.build_error_cause"),
|
|
109
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.build_error_help"),
|
|
110
|
+
}
|
|
111
|
+
when Layers::Infrastructure::Errors::InvalidScriptConfigYmlDefinitionError
|
|
112
|
+
{
|
|
113
|
+
cause_of_error: ShopifyCLI::Context.message("script.error.invalid_script_config_yml_definition_cause"),
|
|
114
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.invalid_script_config_yml_definition_help"),
|
|
110
115
|
}
|
|
111
|
-
when Layers::
|
|
116
|
+
when Layers::Infrastructure::Errors::InvalidScriptJsonDefinitionError
|
|
112
117
|
{
|
|
113
118
|
cause_of_error: ShopifyCLI::Context.message("script.error.invalid_script_json_definition_cause"),
|
|
114
119
|
help_suggestion: ShopifyCLI::Context.message("script.error.invalid_script_json_definition_help"),
|
|
115
120
|
}
|
|
116
|
-
when Layers::
|
|
121
|
+
when Layers::Infrastructure::Errors::MissingScriptConfigYmlFieldError
|
|
117
122
|
{
|
|
118
|
-
cause_of_error: ShopifyCLI::Context.message("script.error.
|
|
119
|
-
help_suggestion: ShopifyCLI::Context.message("script.error.
|
|
123
|
+
cause_of_error: ShopifyCLI::Context.message("script.error.missing_script_config_yml_field_cause", e.field),
|
|
124
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.missing_script_config_yml_field_help"),
|
|
120
125
|
}
|
|
121
|
-
when Layers::Infrastructure::Errors::
|
|
126
|
+
when Layers::Infrastructure::Errors::MissingScriptConfigYmlFieldError
|
|
122
127
|
{
|
|
123
|
-
cause_of_error: ShopifyCLI::Context.message("script.error.
|
|
124
|
-
help_suggestion: ShopifyCLI::Context.message("script.error.
|
|
128
|
+
cause_of_error: ShopifyCLI::Context.message("script.error.missing_script_config_yml_field_cause", e.field),
|
|
129
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.missing_script_config_yml_field_help"),
|
|
130
|
+
}
|
|
131
|
+
when Layers::Infrastructure::Errors::MissingScriptJsonFieldError
|
|
132
|
+
{
|
|
133
|
+
cause_of_error: ShopifyCLI::Context.message("script.error.missing_script_json_field_cause", e.field),
|
|
134
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.missing_script_json_field_help"),
|
|
135
|
+
}
|
|
136
|
+
when Layers::Infrastructure::Errors::NoScriptConfigYmlFileError
|
|
137
|
+
{
|
|
138
|
+
cause_of_error: ShopifyCLI::Context.message("script.error.no_script_config_yml_file_cause"),
|
|
139
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.no_script_config_yml_file_help"),
|
|
125
140
|
}
|
|
126
|
-
when Layers::Infrastructure::Errors::
|
|
141
|
+
when Layers::Infrastructure::Errors::ScriptConfigSyntaxError
|
|
127
142
|
{
|
|
128
143
|
cause_of_error: ShopifyCLI::Context.message("script.error.configuration_syntax_error_cause"),
|
|
129
144
|
help_suggestion: ShopifyCLI::Context.message("script.error.configuration_syntax_error_help"),
|
|
130
145
|
}
|
|
131
|
-
when Layers::Infrastructure::Errors::
|
|
146
|
+
when Layers::Infrastructure::Errors::ScriptConfigMissingKeysError
|
|
132
147
|
{
|
|
133
148
|
cause_of_error: ShopifyCLI::Context.message(
|
|
134
149
|
"script.error.configuration_missing_keys_error_cause",
|
|
@@ -136,7 +151,7 @@ module Script
|
|
|
136
151
|
),
|
|
137
152
|
help_suggestion: ShopifyCLI::Context.message("script.error.configuration_missing_keys_error_help"),
|
|
138
153
|
}
|
|
139
|
-
when Layers::Infrastructure::Errors::
|
|
154
|
+
when Layers::Infrastructure::Errors::ScriptConfigInvalidValueError
|
|
140
155
|
{
|
|
141
156
|
cause_of_error: ShopifyCLI::Context.message(
|
|
142
157
|
"script.error.configuration_invalid_value_error_cause",
|
|
@@ -144,7 +159,7 @@ module Script
|
|
|
144
159
|
),
|
|
145
160
|
help_suggestion: ShopifyCLI::Context.message("script.error.configuration_invalid_value_error_help"),
|
|
146
161
|
}
|
|
147
|
-
when Layers::Infrastructure::Errors::
|
|
162
|
+
when Layers::Infrastructure::Errors::ScriptConfigFieldsMissingKeysError
|
|
148
163
|
{
|
|
149
164
|
cause_of_error: ShopifyCLI::Context.message(
|
|
150
165
|
"script.error.configuration_schema_field_missing_keys_error_cause",
|
|
@@ -154,7 +169,7 @@ module Script
|
|
|
154
169
|
"script.error.configuration_definition_schema_field_missing_keys_error_help"
|
|
155
170
|
),
|
|
156
171
|
}
|
|
157
|
-
when Layers::Infrastructure::Errors::
|
|
172
|
+
when Layers::Infrastructure::Errors::ScriptConfigFieldsInvalidValueError
|
|
158
173
|
{
|
|
159
174
|
cause_of_error: ShopifyCLI::Context.message(
|
|
160
175
|
"script.error.configuration_schema_field_invalid_value_error_cause",
|
|
@@ -50,8 +50,7 @@ module Theme
|
|
|
50
50
|
form.theme
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
if theme.live? && is_confirm_required
|
|
53
|
+
if theme.live? && !options.flags[:allow_live]
|
|
55
54
|
return unless CLI::UI::Prompt.confirm(@ctx.message("theme.push.live"))
|
|
56
55
|
end
|
|
57
56
|
|
data/lib/shopify_cli/context.rb
CHANGED
|
@@ -61,6 +61,7 @@ module ShopifyCLI
|
|
|
61
61
|
# will return which operating system that the cli is running on [:mac, :linux]
|
|
62
62
|
def os
|
|
63
63
|
host = uname
|
|
64
|
+
return :mac_m1 if /arm64-apple-darwin/i.match(host)
|
|
64
65
|
return :mac if /darwin/i.match(host)
|
|
65
66
|
return :windows if /mswin|mingw|cygwin/i.match(host)
|
|
66
67
|
return :linux if /linux|bsd/i.match(host)
|
data/lib/shopify_cli/git.rb
CHANGED
|
@@ -159,10 +159,10 @@ module ShopifyCLI
|
|
|
159
159
|
|
|
160
160
|
CLI::UI::Frame.open(context.message("core.app.create.rails.generating_app", name)) do
|
|
161
161
|
new_command = %w(rails new)
|
|
162
|
+
new_command << name
|
|
162
163
|
new_command += DEFAULT_RAILS_FLAGS
|
|
163
164
|
new_command << "--database=#{db}"
|
|
164
165
|
new_command += rails_opts.split unless rails_opts.nil?
|
|
165
|
-
new_command << name
|
|
166
166
|
|
|
167
167
|
syscall(new_command)
|
|
168
168
|
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ShopifyCLI
|
|
4
|
+
module Theme
|
|
5
|
+
module DevServer
|
|
6
|
+
class CdnFonts
|
|
7
|
+
FONTS_PATH = "/fonts"
|
|
8
|
+
FONTS_CDN = "https://fonts.shopifycdn.com"
|
|
9
|
+
FONTS_REGEX = %r{#{FONTS_CDN}}
|
|
10
|
+
|
|
11
|
+
def initialize(app, theme:)
|
|
12
|
+
@app = app
|
|
13
|
+
@theme = theme
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def call(env)
|
|
17
|
+
path = env["PATH_INFO"]
|
|
18
|
+
|
|
19
|
+
# Serve from fonts CDN
|
|
20
|
+
return serve_font(env) if path.start_with?(FONTS_PATH)
|
|
21
|
+
|
|
22
|
+
# Proxy the request, and replace the URLs in the response
|
|
23
|
+
status, headers, body = @app.call(env)
|
|
24
|
+
body = replace_font_urls(body)
|
|
25
|
+
[status, headers, body]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def serve_font(env)
|
|
31
|
+
parameters = %w(PATH_INFO QUERY_STRING REQUEST_METHOD rack.input)
|
|
32
|
+
path, query, method, body_stream = *env.slice(*parameters).values
|
|
33
|
+
|
|
34
|
+
uri = fonts_cdn_uri(path, query)
|
|
35
|
+
|
|
36
|
+
response = Net::HTTP.start(uri.host, 443, use_ssl: true) do |http|
|
|
37
|
+
req_class = Net::HTTP.const_get(method.capitalize)
|
|
38
|
+
req = req_class.new(uri)
|
|
39
|
+
req.initialize_http_header(fonts_cdn_headers)
|
|
40
|
+
req.body_stream = body_stream
|
|
41
|
+
http.request(req)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
[
|
|
45
|
+
response.code.to_s,
|
|
46
|
+
{
|
|
47
|
+
"Content-Type" => response.content_type,
|
|
48
|
+
"Content-Length" => response.content_length.to_s,
|
|
49
|
+
},
|
|
50
|
+
[response.body],
|
|
51
|
+
]
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def fonts_cdn_headers
|
|
55
|
+
{
|
|
56
|
+
"Referer" => "https://#{@theme.shop}",
|
|
57
|
+
"Transfer-Encoding" => "chunked",
|
|
58
|
+
}
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def fonts_cdn_uri(path, query)
|
|
62
|
+
uri = URI.join("#{FONTS_CDN}/", path.gsub(%r{^#{FONTS_PATH}\/}, ""))
|
|
63
|
+
uri.query = query.split("&").last
|
|
64
|
+
uri
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def replace_font_urls(body)
|
|
68
|
+
[body.join.gsub(FONTS_REGEX, FONTS_PATH)]
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -17,19 +17,35 @@
|
|
|
17
17
|
|
|
18
18
|
connect();
|
|
19
19
|
|
|
20
|
+
function isRefreshRequired(files) {
|
|
21
|
+
return files.some((file) => !isCssFile(file) && !isSectionFile(file));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function refreshFile(file) {
|
|
25
|
+
if (isCssFile(file)) {
|
|
26
|
+
reloadCssFile(file);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (isSectionFile(file)) {
|
|
31
|
+
reloadSection(file);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function refreshPage() {
|
|
37
|
+
console.log('[HotReload] Refreshing entire page');
|
|
38
|
+
window.location.reload();
|
|
39
|
+
}
|
|
40
|
+
|
|
20
41
|
function handleUpdate(message) {
|
|
21
42
|
var data = JSON.parse(message.data);
|
|
43
|
+
var modifiedFiles = data.modified;
|
|
22
44
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (isCssFile(modified)) {
|
|
27
|
-
reloadCssFile(modified)
|
|
28
|
-
} else if (isSectionFile(modified)) {
|
|
29
|
-
reloadSection(modified);
|
|
45
|
+
if (isRefreshRequired(modifiedFiles)) {
|
|
46
|
+
refreshPage();
|
|
30
47
|
} else {
|
|
31
|
-
|
|
32
|
-
window.location.reload();
|
|
48
|
+
modifiedFiles.forEach(refreshFile);
|
|
33
49
|
}
|
|
34
50
|
}
|
|
35
51
|
|
|
@@ -3,6 +3,7 @@ require_relative "development_theme"
|
|
|
3
3
|
require_relative "ignore_filter"
|
|
4
4
|
require_relative "syncer"
|
|
5
5
|
|
|
6
|
+
require_relative "dev_server/cdn_fonts"
|
|
6
7
|
require_relative "dev_server/hot_reload"
|
|
7
8
|
require_relative "dev_server/header_hash"
|
|
8
9
|
require_relative "dev_server/local_assets"
|
|
@@ -33,6 +34,7 @@ module ShopifyCLI
|
|
|
33
34
|
|
|
34
35
|
# Setup the middleware stack. Mimics Rack::Builder / config.ru, but in reverse order
|
|
35
36
|
@app = Proxy.new(ctx, theme: theme, syncer: @syncer)
|
|
37
|
+
@app = CdnFonts.new(@app, theme: theme)
|
|
36
38
|
@app = LocalAssets.new(ctx, @app, theme: theme)
|
|
37
39
|
@app = HotReload.new(ctx, @app, theme: theme, watcher: watcher, ignore_filter: ignore_filter)
|
|
38
40
|
stopped = false
|
data/lib/shopify_cli/tunnel.rb
CHANGED
|
@@ -21,6 +21,7 @@ module ShopifyCLI
|
|
|
21
21
|
# mapping for supported operating systems for where to download ngrok from.
|
|
22
22
|
DOWNLOAD_URLS = {
|
|
23
23
|
mac: "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-darwin-amd64.zip",
|
|
24
|
+
mac_m1: "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-darwin-arm64.zip",
|
|
24
25
|
linux: "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip",
|
|
25
26
|
windows: "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-windows-amd64.zip",
|
|
26
27
|
}
|
data/lib/shopify_cli/version.rb
CHANGED
data/shopify-cli.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shopify-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.7.
|
|
4
|
+
version: 2.7.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shopify
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-12-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -92,14 +92,14 @@ dependencies:
|
|
|
92
92
|
requirements:
|
|
93
93
|
- - "~>"
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: 1.
|
|
95
|
+
version: 1.9.0
|
|
96
96
|
type: :runtime
|
|
97
97
|
prerelease: false
|
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
|
100
100
|
- - "~>"
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: 1.
|
|
102
|
+
version: 1.9.0
|
|
103
103
|
description: |
|
|
104
104
|
Shopify CLI helps you build Shopify apps faster. It quickly scaffolds Node.js
|
|
105
105
|
and Ruby on Rails embedded apps. It also automates many common tasks in the
|
|
@@ -150,6 +150,10 @@ files:
|
|
|
150
150
|
- docs/contributors/testing.md
|
|
151
151
|
- docs/users/installation.md
|
|
152
152
|
- docs/users/migrate-from-themekit.md
|
|
153
|
+
- ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256
|
|
154
|
+
- ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256
|
|
155
|
+
- ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256
|
|
156
|
+
- ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256
|
|
153
157
|
- ext/javy/javy.rb
|
|
154
158
|
- ext/javy/version
|
|
155
159
|
- ext/shopify-extensions/extconf.rb
|
|
@@ -294,7 +298,7 @@ files:
|
|
|
294
298
|
- lib/project_types/script/layers/domain/extension_point.rb
|
|
295
299
|
- lib/project_types/script/layers/domain/metadata.rb
|
|
296
300
|
- lib/project_types/script/layers/domain/push_package.rb
|
|
297
|
-
- lib/project_types/script/layers/domain/
|
|
301
|
+
- lib/project_types/script/layers/domain/script_config.rb
|
|
298
302
|
- lib/project_types/script/layers/domain/script_project.rb
|
|
299
303
|
- lib/project_types/script/layers/infrastructure/api_clients/partners_proxy_api_client.rb
|
|
300
304
|
- lib/project_types/script/layers/infrastructure/api_clients/script_service_api_client.rb
|
|
@@ -444,6 +448,7 @@ files:
|
|
|
444
448
|
- lib/shopify_cli/tasks/select_org_and_shop.rb
|
|
445
449
|
- lib/shopify_cli/tasks/update_dashboard_urls.rb
|
|
446
450
|
- lib/shopify_cli/theme/dev_server.rb
|
|
451
|
+
- lib/shopify_cli/theme/dev_server/cdn_fonts.rb
|
|
447
452
|
- lib/shopify_cli/theme/dev_server/certificate_manager.rb
|
|
448
453
|
- lib/shopify_cli/theme/dev_server/header_hash.rb
|
|
449
454
|
- lib/shopify_cli/theme/dev_server/hot-reload.js
|