shopify-cli 2.24.0 → 2.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/dev.yml +0 -3
- data/lib/project_types/extension/commands/serve.rb +57 -3
- data/lib/project_types/extension/extension_project.rb +8 -1
- data/lib/project_types/extension/loaders/project.rb +3 -2
- data/lib/project_types/extension/messages/messages.rb +21 -6
- data/lib/project_types/extension/models/server_config/development_renderer.rb +1 -1
- data/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +18 -6
- data/lib/project_types/script/cli.rb +0 -79
- data/lib/project_types/script/commands/connect.rb +3 -8
- data/lib/project_types/script/commands/create.rb +4 -29
- data/lib/project_types/script/commands/javy.rb +3 -8
- data/lib/project_types/script/commands/push.rb +4 -41
- data/lib/project_types/script/messages/messages.rb +1 -258
- data/lib/project_types/theme/commands/common/shop_helper.rb +13 -0
- data/lib/project_types/theme/commands/delete.rb +4 -1
- data/lib/project_types/theme/commands/list.rb +3 -4
- data/lib/project_types/theme/commands/open.rb +4 -1
- data/lib/project_types/theme/commands/publish.rb +4 -1
- data/lib/project_types/theme/commands/pull.rb +3 -1
- data/lib/project_types/theme/commands/push.rb +3 -1
- data/lib/project_types/theme/commands/serve.rb +15 -3
- data/lib/project_types/theme/messages/messages.rb +9 -7
- data/lib/shopify_cli/commands/logout.rb +13 -2
- data/lib/shopify_cli/environment.rb +1 -1
- data/lib/shopify_cli/file_system_listener.rb +30 -0
- data/lib/shopify_cli/git.rb +116 -33
- data/lib/shopify_cli/identity_auth.rb +1 -0
- data/lib/shopify_cli/messages/messages.rb +1 -1
- data/lib/shopify_cli/packager.rb +12 -3
- data/lib/shopify_cli/project.rb +1 -1
- data/lib/shopify_cli/release.rb +4 -2
- data/lib/shopify_cli/tasks/ensure_project_type.rb +3 -1
- data/lib/shopify_cli/theme/dev_server/cdn_fonts.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/certificate_manager.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/errors.rb +9 -0
- data/lib/shopify_cli/theme/dev_server/header_hash.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/hooks/file_change_hook.rb +77 -0
- data/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_deleter.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_reloader.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/{hot-reload-no-script.html → hot_reload/resources/hot-reload-no-script.html} +0 -0
- data/lib/shopify_cli/theme/dev_server/hot_reload/resources/hot_reload.js +48 -0
- data/lib/shopify_cli/theme/dev_server/hot_reload/resources/sse_client.js +43 -0
- data/lib/shopify_cli/theme/dev_server/hot_reload/resources/theme.js +114 -0
- data/lib/shopify_cli/theme/dev_server/hot_reload/resources/theme_extension.js +121 -0
- data/lib/shopify_cli/theme/dev_server/hot_reload/script_injector.rb +57 -0
- data/lib/shopify_cli/theme/dev_server/hot_reload/sections_index.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/hot_reload.rb +8 -76
- data/lib/shopify_cli/theme/dev_server/local_assets.rb +28 -28
- data/lib/shopify_cli/theme/dev_server/proxy.rb +33 -25
- data/lib/shopify_cli/theme/dev_server/proxy_param_builder.rb +82 -0
- data/lib/shopify_cli/theme/dev_server/reload_mode.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/remote_watcher/json_files_update_job.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/remote_watcher.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/sse.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/watcher.rb +8 -9
- data/lib/shopify_cli/theme/dev_server/web_server.rb +1 -1
- data/lib/shopify_cli/theme/dev_server.rb +287 -99
- data/lib/shopify_cli/theme/extension/app_extension.rb +40 -0
- data/lib/shopify_cli/theme/extension/dev_server/hooks/file_change_hook.rb +68 -0
- data/lib/shopify_cli/theme/extension/dev_server/hot_reload/script_injector.rb +30 -0
- data/lib/shopify_cli/theme/extension/dev_server/hot_reload.rb +13 -0
- data/lib/shopify_cli/theme/extension/dev_server/local_assets.rb +30 -0
- data/lib/shopify_cli/theme/{dev_server/proxy/template_param_builder.rb → extension/dev_server/proxy_param_builder.rb} +26 -16
- data/lib/shopify_cli/theme/extension/dev_server/watcher.rb +47 -0
- data/lib/shopify_cli/theme/extension/dev_server.rb +150 -0
- data/lib/shopify_cli/theme/extension/host_theme.rb +104 -0
- data/lib/shopify_cli/theme/extension/syncer/extension_serve_job.rb +133 -0
- data/lib/shopify_cli/theme/extension/syncer/operation.rb +21 -0
- data/lib/shopify_cli/theme/extension/syncer.rb +81 -0
- data/lib/shopify_cli/theme/extension/ui/host_theme_progress_bar.rb +35 -0
- data/lib/shopify_cli/theme/ignore_helper.rb +31 -0
- data/lib/shopify_cli/theme/root.rb +62 -0
- data/lib/shopify_cli/theme/syncer.rb +12 -6
- data/lib/shopify_cli/theme/theme.rb +10 -52
- data/lib/shopify_cli/version.rb +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +1 -1
- metadata +28 -53
- data/.github/workflows/triage.yml +0 -22
- data/lib/project_types/script/config/extension_points.yml +0 -45
- data/lib/project_types/script/errors.rb +0 -10
- data/lib/project_types/script/forms/ask_app.rb +0 -27
- data/lib/project_types/script/forms/ask_org.rb +0 -30
- data/lib/project_types/script/forms/ask_script_uuid.rb +0 -22
- data/lib/project_types/script/forms/create.rb +0 -33
- data/lib/project_types/script/forms/run_against_shopify_org.rb +0 -14
- data/lib/project_types/script/graphql/app_script_set.graphql +0 -46
- data/lib/project_types/script/graphql/get_app_scripts.graphql +0 -6
- data/lib/project_types/script/graphql/module_upload_url_generate.graphql +0 -13
- data/lib/project_types/script/graphql/script_service_proxy.graphql +0 -7
- data/lib/project_types/script/layers/application/build_script.rb +0 -25
- data/lib/project_types/script/layers/application/connect_app.rb +0 -86
- data/lib/project_types/script/layers/application/create_script.rb +0 -90
- data/lib/project_types/script/layers/application/extension_points.rb +0 -66
- data/lib/project_types/script/layers/application/project_dependencies.rb +0 -26
- data/lib/project_types/script/layers/application/push_script.rb +0 -74
- data/lib/project_types/script/layers/domain/app_bridge.rb +0 -16
- data/lib/project_types/script/layers/domain/errors.rb +0 -47
- data/lib/project_types/script/layers/domain/extension_point.rb +0 -81
- data/lib/project_types/script/layers/domain/metadata.rb +0 -46
- data/lib/project_types/script/layers/domain/push_package.rb +0 -41
- data/lib/project_types/script/layers/domain/script_config.rb +0 -32
- data/lib/project_types/script/layers/domain/script_project.rb +0 -61
- data/lib/project_types/script/layers/infrastructure/api_clients/partners_proxy_api_client.rb +0 -53
- data/lib/project_types/script/layers/infrastructure/api_clients/script_service_api_client.rb +0 -35
- data/lib/project_types/script/layers/infrastructure/command_runner.rb +0 -19
- data/lib/project_types/script/layers/infrastructure/errors.rb +0 -211
- data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +0 -37
- data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +0 -62
- data/lib/project_types/script/layers/infrastructure/languages/task_runner.rb +0 -47
- data/lib/project_types/script/layers/infrastructure/languages/tool_version_checker.rb +0 -26
- data/lib/project_types/script/layers/infrastructure/languages/typescript_project_creator.rb +0 -45
- data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +0 -103
- data/lib/project_types/script/layers/infrastructure/languages/wasm_project_creator.rb +0 -12
- data/lib/project_types/script/layers/infrastructure/languages/wasm_task_runner.rb +0 -32
- data/lib/project_types/script/layers/infrastructure/metadata_repository.rb +0 -18
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +0 -36
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +0 -273
- data/lib/project_types/script/layers/infrastructure/script_service.rb +0 -135
- data/lib/project_types/script/layers/infrastructure/script_uploader.rb +0 -40
- data/lib/project_types/script/layers/infrastructure/service_locator.rb +0 -20
- data/lib/project_types/script/layers/infrastructure/sparse_checkout_details.rb +0 -35
- data/lib/project_types/script/ui/error_handler.rb +0 -331
- data/lib/project_types/script/ui/printing_spinner.rb +0 -75
- data/lib/project_types/script/ui/strict_spinner.rb +0 -20
- data/lib/shopify_cli/theme/dev_server/hot-reload.js +0 -194
- data/lib/shopify_cli/theme/syncer/ignore_helper.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1947b9e99b60efb4eb548badb8f41ee520f17ed0025a2666ec58a62594964abc
|
4
|
+
data.tar.gz: b7b7714ce470469573282c561c335103cb8471319785fd327a7f7e8442eb71d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82a5eeb29ba45bf1e7eb407371c07922f14c3a7fe8ed0777b555ebbfa952a3dc35b303e0e477abe5c467bd01112e678ce31804051a52b92beb0bea2a323c5264
|
7
|
+
data.tar.gz: e24d863f0a3649d729242bd6104403d5642a6e04c44fc52adb6856d98c55e20c06ff4b13e4ca553ba01299b726ad89193ee97bcd322709deb060f681bbfeae6d
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,20 @@ 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.26.0 - 2022-10-03
|
6
|
+
|
7
|
+
### Added
|
8
|
+
* [#2636](https://github.com/Shopify/shopify-cli/pull/2636): Show store when the CLI prompts users to select a theme
|
9
|
+
|
10
|
+
## Version 2.25.0 - 2022-09-14
|
11
|
+
|
12
|
+
### Added
|
13
|
+
* [#2600](https://github.com/Shopify/shopify-cli/pull/2600): Add support to the `SIGTERM` signal
|
14
|
+
* [#2602](https://github.com/Shopify/shopify-cli/pull/2602): Add `--only/--ignore` support to the `theme serve` command
|
15
|
+
|
16
|
+
### Fixed
|
17
|
+
* [#2607](https://github.com/Shopify/shopify-cli/pull/2607): Fix proxy to redirect to host and port set by cli
|
18
|
+
|
5
19
|
## Version 2.24.0 - 2022-08-29
|
6
20
|
|
7
21
|
### Fixed
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Shopify CLI 2.0
|
2
2
|
|
3
|
-
<a href=""><img src="https://github.com/shopify/shopify-cli/workflows/
|
3
|
+
<a href="https://github.com/Shopify/shopify-cli/actions/workflows/shopify.yml"><img src="https://github.com/shopify/shopify-cli/actions/workflows/shopify.yml/badge.svg" alt="Shopify"></a>
|
4
4
|
<img src="https://img.shields.io/github/v/release/shopify/shopify-cli?include_prereleases&style=flat-square" alt="Latest Version">
|
5
5
|
<img src="https://img.shields.io/github/forks/shopify/shopify-cli?style=flat-square" alt="GitHub forks">
|
6
6
|
<img src="https://img.shields.io/github/stars/shopify/shopify-cli?style=flat-square" alt="GitHub stars">
|
data/dev.yml
CHANGED
@@ -17,6 +17,24 @@ module Extension
|
|
17
17
|
parser.on("-p", "--port=PORT", "Specify the port to use") do |port|
|
18
18
|
flags[:port] = port.to_i
|
19
19
|
end
|
20
|
+
parser.on("-T", "--theme=NAME_OR_ID", "Theme ID or name of the theme app extension host theme.") do |theme|
|
21
|
+
flags[:theme] = theme
|
22
|
+
end
|
23
|
+
parser.on("--api-key=API_KEY", "Connect your extension and app by inserting your app's API key") do |api_key|
|
24
|
+
flags[:api_key] = api_key.gsub('"', "")
|
25
|
+
end
|
26
|
+
parser.on("--api-secret=API_SECRET", "The API secret of the app the script is registered with.") do |api_secret|
|
27
|
+
flags[:api_secret] = api_secret.gsub('"', "")
|
28
|
+
end
|
29
|
+
parser.on("--extension-id=EXTENSION_ID", "The id of the extension's registration.") do |registration_id|
|
30
|
+
flags[:registration_id] = registration_id.gsub('"', "")
|
31
|
+
end
|
32
|
+
parser.on("--extension-title=EXTENSION_TITLE", "The title of the extension") do |extension_title|
|
33
|
+
flags[:extension_title] = extension_title.gsub('"', "")
|
34
|
+
end
|
35
|
+
parser.on("--extension-type=EXTENSION_TYPE", "The type of the extension") do |extension_type|
|
36
|
+
flags[:extension_type] = extension_type.gsub('"', "")
|
37
|
+
end
|
20
38
|
end
|
21
39
|
|
22
40
|
class RuntimeConfiguration
|
@@ -26,13 +44,27 @@ module Extension
|
|
26
44
|
property :resource_url, accepts: String, default: nil
|
27
45
|
property! :tunnel_requested, accepts: [true, false], reader: :tunnel_requested?, default: true
|
28
46
|
property :port, accepts: (1...(2**16))
|
47
|
+
property :theme, accepts: String, default: nil
|
48
|
+
property :api_key, accepts: String, default: nil
|
49
|
+
property :api_secret, accepts: String, default: nil
|
50
|
+
property :registration_id, accepts: String, default: nil
|
51
|
+
property :extension_title, accepts: String, default: nil
|
52
|
+
property :extension_type, accepts: String, default: nil
|
29
53
|
end
|
30
54
|
|
31
|
-
def call(
|
55
|
+
def call(args, _command_name)
|
56
|
+
@ctx.root = args.first || @ctx.root
|
57
|
+
|
32
58
|
config = RuntimeConfiguration.new(
|
33
59
|
tunnel_requested: tunnel_requested?,
|
34
60
|
resource_url: options.flags[:resource_url],
|
35
|
-
port: options.flags[:port]
|
61
|
+
port: options.flags[:port],
|
62
|
+
theme: options.flags[:theme],
|
63
|
+
api_key: options.flags[:api_key],
|
64
|
+
api_secret: options.flags[:api_secret],
|
65
|
+
registration_id: options.flags[:registration_id],
|
66
|
+
extension_title: options.flags[:extension_title],
|
67
|
+
extension_type: options.flags[:extension_type],
|
36
68
|
)
|
37
69
|
|
38
70
|
ShopifyCLI::Result
|
@@ -49,6 +81,23 @@ module Extension
|
|
49
81
|
|
50
82
|
private
|
51
83
|
|
84
|
+
def project
|
85
|
+
return super unless options.flags[:extension_type]
|
86
|
+
|
87
|
+
@project ||= Extension::Loaders::Project.load(
|
88
|
+
context: options.flags[:context],
|
89
|
+
directory: @ctx.root,
|
90
|
+
api_key: options.flags[:api_key],
|
91
|
+
api_secret: options.flags[:api_secret],
|
92
|
+
registration_id: options.flags[:registration_id],
|
93
|
+
env: {
|
94
|
+
ExtensionProjectKeys::TITLE_KEY => options.flags[:extension_title],
|
95
|
+
ExtensionProjectKeys::REGISTRATION_ID_KEY => options.flags[:registration_id],
|
96
|
+
ExtensionProjectKeys::SPECIFICATION_IDENTIFIER_KEY => options.flags[:extension_type],
|
97
|
+
}
|
98
|
+
)
|
99
|
+
end
|
100
|
+
|
52
101
|
def tunnel_requested?
|
53
102
|
tunnel = options.flags[:tunnel]
|
54
103
|
tunnel.nil? || !!tunnel
|
@@ -87,7 +136,12 @@ module Extension
|
|
87
136
|
context: @ctx,
|
88
137
|
tunnel_url: runtime_configuration.tunnel_url,
|
89
138
|
port: runtime_configuration.port,
|
90
|
-
|
139
|
+
theme: runtime_configuration.theme,
|
140
|
+
api_key: runtime_configuration.api_key,
|
141
|
+
api_secret: runtime_configuration.api_secret,
|
142
|
+
registration_id: runtime_configuration.registration_id,
|
143
|
+
resource_url: runtime_configuration.resource_url,
|
144
|
+
project: project,
|
91
145
|
)
|
92
146
|
runtime_configuration
|
93
147
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require "shopify_cli"
|
3
|
+
require "shopify_cli/environment"
|
3
4
|
require "securerandom"
|
4
5
|
|
5
6
|
module Extension
|
@@ -82,7 +83,13 @@ module Extension
|
|
82
83
|
end
|
83
84
|
|
84
85
|
def specification_identifier
|
85
|
-
|
86
|
+
key = ExtensionProjectKeys::SPECIFICATION_IDENTIFIER_KEY
|
87
|
+
|
88
|
+
if ShopifyCLI::Environment.run_as_subprocess?
|
89
|
+
get_extra_field(key)
|
90
|
+
else
|
91
|
+
config[key]
|
92
|
+
end
|
86
93
|
end
|
87
94
|
|
88
95
|
def registration_id?
|
@@ -3,12 +3,13 @@
|
|
3
3
|
module Extension
|
4
4
|
module Loaders
|
5
5
|
module Project
|
6
|
-
def self.load(context:, directory:, api_key:, registration_id:, api_secret:)
|
6
|
+
def self.load(context:, directory:, api_key:, registration_id:, api_secret:, env: {})
|
7
7
|
env_overrides = {
|
8
8
|
"SHOPIFY_API_KEY" => api_key,
|
9
9
|
"SHOPIFY_API_SECRET" => api_secret,
|
10
10
|
"EXTENSION_ID" => registration_id,
|
11
|
-
}.compact
|
11
|
+
}.compact.merge(env)
|
12
|
+
|
12
13
|
env_file_present = env_file_exists?(directory)
|
13
14
|
env = if env_file_present
|
14
15
|
ShopifyCLI::Resources::EnvFile.read(directory, overrides: env_overrides)
|
@@ -102,15 +102,32 @@ module Extension
|
|
102
102
|
serve: {
|
103
103
|
help: <<~HELP,
|
104
104
|
Serve your extension in a local simulator for development.
|
105
|
-
Usage: {{command:%s extension serve}}
|
105
|
+
Usage: {{command:%s extension serve [ ROOT ]}}
|
106
106
|
Options:
|
107
|
-
|
107
|
+
{{command:-p, --port=PORT}} Local port of the development serve.
|
108
|
+
{{command:-T, --theme=NAME_OR_ID}} Theme ID or name of the host theme.
|
109
|
+
{{command:--tunnel=TUNNEL}} Establish an ngrok tunnel (default: false).
|
110
|
+
{{command:--api-key=API_KEY}} Connect your extension and app by inserting your app's API key (which you can get from your app setup page on shopify.dev).
|
111
|
+
{{command:--api-secret=API_SECRET}} The API secret of the app the script is registered with.
|
112
|
+
{{command:--extension-id=EXTENSION_ID}} The id of the extension's registration.
|
108
113
|
HELP
|
109
|
-
frame_title: "
|
114
|
+
frame_title: "Viewing extension…",
|
110
115
|
no_available_ports_found: "No available ports found to run extension.",
|
111
116
|
serve_failure_message: "Failed to run extension code.",
|
112
117
|
serve_missing_information: "Missing shop or api_key.",
|
113
118
|
tunnel_already_running: "A tunnel running on another port has been detected. Close the tunnel and try again.",
|
119
|
+
preview_message: <<~PREVIEW_MESSAGE,
|
120
|
+
Enable your theme app extension:
|
121
|
+
{{green:%s}}
|
122
|
+
|
123
|
+
Setup your theme app extension in the host theme:
|
124
|
+
{{green:%s}}
|
125
|
+
|
126
|
+
Preview your theme app extension:
|
127
|
+
{{green:%s}}
|
128
|
+
|
129
|
+
(Use Ctrl-C to stop)
|
130
|
+
PREVIEW_MESSAGE
|
114
131
|
},
|
115
132
|
tunnel: {
|
116
133
|
duplicate_session: <<~MESSAGE,
|
@@ -267,9 +284,7 @@ module Extension
|
|
267
284
|
{{*}} You’re ready to start building {{green:%s}}!
|
268
285
|
MESSAGE
|
269
286
|
},
|
270
|
-
|
271
|
-
unsupported: "shopify extension serve is not supported for theme app extensions",
|
272
|
-
},
|
287
|
+
|
273
288
|
},
|
274
289
|
},
|
275
290
|
}
|
@@ -25,7 +25,7 @@ module Extension
|
|
25
25
|
when "checkout_post_purchase"
|
26
26
|
new(name: "@shopify/post-purchase-ui-extensions", version: "^0.13.2")
|
27
27
|
when "pos_ui_extension"
|
28
|
-
new(name: "@shopify/retail-ui-extensions", version: "^0.
|
28
|
+
new(name: "@shopify/retail-ui-extensions", version: "^0.12.0")
|
29
29
|
when "web_pixel_extension"
|
30
30
|
nil
|
31
31
|
else
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require "base64"
|
3
3
|
require "json"
|
4
|
+
require "shopify_cli/theme/extension/dev_server"
|
4
5
|
|
5
6
|
module Extension
|
6
7
|
module Models
|
@@ -64,16 +65,27 @@ module Extension
|
|
64
65
|
"Theme App Extension"
|
65
66
|
end
|
66
67
|
|
67
|
-
def choose_port?(
|
68
|
-
|
68
|
+
def choose_port?(_ctx)
|
69
|
+
false
|
69
70
|
end
|
70
71
|
|
71
|
-
def establish_tunnel?(
|
72
|
-
|
72
|
+
def establish_tunnel?(_ctx)
|
73
|
+
false
|
73
74
|
end
|
74
75
|
|
75
|
-
def serve(
|
76
|
-
ctx
|
76
|
+
def serve(**options)
|
77
|
+
@ctx = options[:context]
|
78
|
+
root = options[:context]&.root
|
79
|
+
project = options[:project]
|
80
|
+
properties = options
|
81
|
+
.slice(:port, :theme)
|
82
|
+
.compact
|
83
|
+
.merge({
|
84
|
+
project: project,
|
85
|
+
specification_handler: self,
|
86
|
+
})
|
87
|
+
|
88
|
+
ShopifyCLI::Theme::Extension::DevServer.start(@ctx, root, **properties)
|
77
89
|
end
|
78
90
|
|
79
91
|
private
|
@@ -18,85 +18,6 @@ module Script
|
|
18
18
|
end
|
19
19
|
ShopifyCLI::Commands.register("Script::Command", "script")
|
20
20
|
|
21
|
-
# define/autoload project specific Forms
|
22
|
-
module Forms
|
23
|
-
autoload :AskOrg, Project.project_filepath("forms/ask_org")
|
24
|
-
autoload :AskApp, Project.project_filepath("forms/ask_app")
|
25
|
-
autoload :AskScriptUuid, Project.project_filepath("forms/ask_script_uuid")
|
26
|
-
autoload :RunAgainstShopifyOrg, Project.project_filepath("forms/run_against_shopify_org")
|
27
|
-
autoload :Create, Project.project_filepath("forms/create")
|
28
|
-
autoload :Connect, Project.project_filepath("forms/connect")
|
29
|
-
autoload :ScriptForm, Project.project_filepath("forms/script_form")
|
30
|
-
end
|
31
|
-
|
32
|
-
module Tasks
|
33
|
-
autoload :EnsureEnv, Project.project_filepath("tasks/ensure_env")
|
34
|
-
end
|
35
|
-
|
36
|
-
module Layers
|
37
|
-
module Application
|
38
|
-
autoload :BuildScript, Project.project_filepath("layers/application/build_script")
|
39
|
-
autoload :ConnectApp, Project.project_filepath("layers/application/connect_app")
|
40
|
-
autoload :CreateScript, Project.project_filepath("layers/application/create_script")
|
41
|
-
autoload :PushScript, Project.project_filepath("layers/application/push_script")
|
42
|
-
autoload :ExtensionPoints, Project.project_filepath("layers/application/extension_points")
|
43
|
-
autoload :ProjectDependencies, Project.project_filepath("layers/application/project_dependencies")
|
44
|
-
end
|
45
|
-
|
46
|
-
module Domain
|
47
|
-
autoload :Errors, Project.project_filepath("layers/domain/errors")
|
48
|
-
autoload :PushPackage, Project.project_filepath("layers/domain/push_package")
|
49
|
-
autoload :Metadata, Project.project_filepath("layers/domain/metadata")
|
50
|
-
autoload :ExtensionPoint, Project.project_filepath("layers/domain/extension_point")
|
51
|
-
autoload :ScriptConfig, Project.project_filepath("layers/domain/script_config")
|
52
|
-
autoload :ScriptProject, Project.project_filepath("layers/domain/script_project")
|
53
|
-
autoload :AppBridge, Project.project_filepath("layers/domain/app_bridge")
|
54
|
-
end
|
55
|
-
|
56
|
-
module Infrastructure
|
57
|
-
autoload :Errors, Project.project_filepath("layers/infrastructure/errors")
|
58
|
-
autoload :CommandRunner, Project.project_filepath("layers/infrastructure/command_runner")
|
59
|
-
autoload :PushPackageRepository, Project.project_filepath("layers/infrastructure/push_package_repository")
|
60
|
-
autoload :ExtensionPointRepository, Project.project_filepath("layers/infrastructure/extension_point_repository")
|
61
|
-
autoload :MetadataRepository, Project.project_filepath("layers/infrastructure/metadata_repository")
|
62
|
-
autoload :ScriptProjectRepository, Project.project_filepath("layers/infrastructure/script_project_repository")
|
63
|
-
autoload :ScriptService, Project.project_filepath("layers/infrastructure/script_service")
|
64
|
-
autoload :ScriptUploader, Project.project_filepath("layers/infrastructure/script_uploader")
|
65
|
-
autoload :ServiceLocator, Project.project_filepath("layers/infrastructure/service_locator")
|
66
|
-
autoload :SparseCheckoutDetails, Project.project_filepath("layers/infrastructure/sparse_checkout_details")
|
67
|
-
|
68
|
-
module Languages
|
69
|
-
autoload :ProjectCreator, Project.project_filepath("layers/infrastructure/languages/project_creator")
|
70
|
-
autoload :TaskRunner, Project.project_filepath("layers/infrastructure/languages/task_runner")
|
71
|
-
autoload :TypeScriptProjectCreator,
|
72
|
-
Project.project_filepath("layers/infrastructure/languages/typescript_project_creator.rb")
|
73
|
-
autoload :TypeScriptTaskRunner,
|
74
|
-
Project.project_filepath("layers/infrastructure/languages/typescript_task_runner.rb")
|
75
|
-
autoload :WasmProjectCreator,
|
76
|
-
Project.project_filepath("layers/infrastructure/languages/wasm_project_creator.rb")
|
77
|
-
autoload :WasmTaskRunner,
|
78
|
-
Project.project_filepath("layers/infrastructure/languages/wasm_task_runner.rb")
|
79
|
-
autoload :ToolVersionChecker,
|
80
|
-
Project.project_filepath("layers/infrastructure/languages/tool_version_checker.rb")
|
81
|
-
end
|
82
|
-
|
83
|
-
module ApiClients
|
84
|
-
autoload :PartnersProxyApiClient,
|
85
|
-
Project.project_filepath("layers/infrastructure/api_clients/partners_proxy_api_client")
|
86
|
-
autoload :ScriptServiceApiClient,
|
87
|
-
Project.project_filepath("layers/infrastructure/api_clients/script_service_api_client")
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
module UI
|
93
|
-
autoload :ErrorHandler, Project.project_filepath("ui/error_handler")
|
94
|
-
autoload :PrintingSpinner, Project.project_filepath("ui/printing_spinner")
|
95
|
-
autoload :StrictSpinner, Project.project_filepath("ui/strict_spinner")
|
96
|
-
end
|
97
|
-
|
98
|
-
autoload :Errors, Project.project_filepath("errors")
|
99
|
-
|
100
21
|
module Loaders
|
101
22
|
autoload :Project, Script::Project.project_filepath("loaders/project")
|
102
23
|
autoload :SpecificationHandler, Script::Project.project_filepath("loaders/specification_handler")
|
@@ -2,19 +2,14 @@
|
|
2
2
|
module Script
|
3
3
|
class Command
|
4
4
|
class Connect < ShopifyCLI::Command::SubCommand
|
5
|
-
|
6
|
-
prerequisite_task ensure_project_type: :script
|
7
|
-
|
8
|
-
recommend_default_ruby_range
|
5
|
+
hidden_feature
|
9
6
|
|
10
7
|
def call(_args, _)
|
11
|
-
|
12
|
-
rescue StandardError => e
|
13
|
-
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.connect.error.operation_failed"))
|
8
|
+
@ctx.abort(@ctx.message("script.deprecated"))
|
14
9
|
end
|
15
10
|
|
16
11
|
def self.help
|
17
|
-
ShopifyCLI::Context.new.message("script.
|
12
|
+
ShopifyCLI::Context.new.message("script.deprecated")
|
18
13
|
end
|
19
14
|
end
|
20
15
|
end
|
@@ -3,9 +3,7 @@
|
|
3
3
|
module Script
|
4
4
|
class Command
|
5
5
|
class Create < ShopifyCLI::Command::SubCommand
|
6
|
-
|
7
|
-
|
8
|
-
recommend_default_ruby_range
|
6
|
+
hidden_feature
|
9
7
|
|
10
8
|
options do |parser, flags|
|
11
9
|
parser.on("--title=TITLE") { |title| flags[:title] = title }
|
@@ -14,35 +12,12 @@ module Script
|
|
14
12
|
parser.on("--branch=BRANCH") { |branch| flags[:branch] = branch }
|
15
13
|
end
|
16
14
|
|
17
|
-
def call(
|
18
|
-
|
19
|
-
return @ctx.puts(self.class.help) if form.nil?
|
20
|
-
|
21
|
-
unless !form.title.empty? && form.extension_point
|
22
|
-
return @ctx.puts(self.class.help)
|
23
|
-
end
|
24
|
-
|
25
|
-
project = Layers::Application::CreateScript.call(
|
26
|
-
ctx: @ctx,
|
27
|
-
language: options.flags[:language]&.downcase || "wasm",
|
28
|
-
sparse_checkout_branch: options.flags[:branch] || "main",
|
29
|
-
title: form.title,
|
30
|
-
extension_point_type: form.extension_point,
|
31
|
-
)
|
32
|
-
@ctx.puts(@ctx.message("script.create.change_directory_notice", project.title))
|
33
|
-
rescue StandardError => e
|
34
|
-
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.create.error.operation_failed"))
|
15
|
+
def call(_args, _)
|
16
|
+
@ctx.abort(@ctx.message("script.deprecated"))
|
35
17
|
end
|
36
18
|
|
37
19
|
def self.help
|
38
|
-
|
39
|
-
allowed_languages = Layers::Application::ExtensionPoints.all_languages.map { |lang| "{{cyan:#{lang}}}" }
|
40
|
-
ShopifyCLI::Context.message(
|
41
|
-
"script.create.help",
|
42
|
-
ShopifyCLI::TOOL_NAME,
|
43
|
-
allowed_apis.join(", "),
|
44
|
-
allowed_languages.join(", ")
|
45
|
-
)
|
20
|
+
ShopifyCLI::Context.new.message("script.deprecated")
|
46
21
|
end
|
47
22
|
end
|
48
23
|
end
|
@@ -12,17 +12,12 @@ module Script
|
|
12
12
|
parser.on("--out=OUT") { |out_file| flags[:out_file] = out_file }
|
13
13
|
end
|
14
14
|
|
15
|
-
def call(
|
16
|
-
|
17
|
-
dest = options.flags[:out_file]
|
18
|
-
|
19
|
-
@ctx.abort(@ctx.message("script.javy.errors.invalid_arguments", ShopifyCLI::TOOL_NAME)) unless source
|
20
|
-
|
21
|
-
::Javy.build(source: source, dest: dest).unwrap { |e| @ctx.abort(e.message) }
|
15
|
+
def call(_args, _)
|
16
|
+
@ctx.abort(@ctx.message("script.deprecated"))
|
22
17
|
end
|
23
18
|
|
24
19
|
def self.help
|
25
|
-
ShopifyCLI::Context.message("script.
|
20
|
+
ShopifyCLI::Context.new.message("script.deprecated")
|
26
21
|
end
|
27
22
|
end
|
28
23
|
end
|
@@ -3,9 +3,7 @@
|
|
3
3
|
module Script
|
4
4
|
class Command
|
5
5
|
class Push < ShopifyCLI::Command::SubCommand
|
6
|
-
|
7
|
-
|
8
|
-
recommend_default_ruby_range
|
6
|
+
hidden_feature
|
9
7
|
|
10
8
|
options do |parser, flags|
|
11
9
|
parser.on("--force") { |t| flags[:force] = t }
|
@@ -16,47 +14,12 @@ module Script
|
|
16
14
|
end
|
17
15
|
end
|
18
16
|
|
19
|
-
def call(_args,
|
20
|
-
|
21
|
-
project = load_project
|
22
|
-
push(project: project)
|
23
|
-
rescue StandardError => e
|
24
|
-
UI::ErrorHandler.pretty_print_and_raise(e,
|
25
|
-
failed_op: @ctx.message("script.push.error.operation_failed"))
|
26
|
-
end
|
27
|
-
|
28
|
-
def push(project:)
|
29
|
-
force = options.flags.key?(:force)
|
30
|
-
api_key = project.env[:api_key]
|
31
|
-
uuid = project.env[:extra]["UUID"]
|
32
|
-
|
33
|
-
if ShopifyCLI::Environment.interactive? || (uuid && !uuid.empty?)
|
34
|
-
Layers::Application::PushScript.call(ctx: @ctx, force: force, project: project)
|
35
|
-
@ctx.puts(@ctx.message("script.push.script_pushed", api_key: api_key))
|
36
|
-
else
|
37
|
-
message = @ctx.message("script.error.missing_push_options_ci", "--uuid")
|
38
|
-
message += @ctx.message("script.error.missing_push_options_ci_solution", ShopifyCLI::TOOL_NAME)
|
39
|
-
raise ShopifyCLI::Abort, message
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def load_project
|
44
|
-
Script::Loaders::Project.load(
|
45
|
-
directory: Dir.pwd,
|
46
|
-
api_key: options.flags[:api_key],
|
47
|
-
api_secret: options.flags[:api_secret],
|
48
|
-
uuid: options.flags[:uuid]
|
49
|
-
)
|
50
|
-
end
|
51
|
-
|
52
|
-
def connect_to_app
|
53
|
-
if ShopifyCLI::Environment.interactive?
|
54
|
-
Layers::Application::ConnectApp.call(ctx: @ctx)
|
55
|
-
end
|
17
|
+
def call(_args, _)
|
18
|
+
@ctx.abort(@ctx.message("script.deprecated"))
|
56
19
|
end
|
57
20
|
|
58
21
|
def self.help
|
59
|
-
ShopifyCLI::Context.message("script.
|
22
|
+
ShopifyCLI::Context.new.message("script.deprecated")
|
60
23
|
end
|
61
24
|
end
|
62
25
|
end
|