shopify-cli 2.0.0 → 2.2.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 +29 -0
- data/Gemfile.lock +4 -4
- data/README.md +3 -1
- data/RELEASING.md +2 -0
- data/THEMEKIT_MIGRATION.md +18 -0
- data/lib/graphql/api_versions.graphql +1 -1
- data/lib/graphql/get_variant_id.graphql +16 -0
- data/lib/project_types/extension/cli.rb +10 -1
- data/lib/project_types/extension/commands/check.rb +44 -0
- data/lib/project_types/extension/commands/serve.rb +8 -2
- data/lib/project_types/extension/extension_project.rb +39 -1
- data/lib/project_types/extension/extension_project_keys.rb +1 -0
- data/lib/project_types/extension/features/argo_runtime.rb +6 -38
- data/lib/project_types/extension/features/argo_serve.rb +30 -1
- data/lib/project_types/extension/features/runtimes/admin.rb +29 -0
- data/lib/project_types/extension/features/runtimes/base.rb +19 -0
- data/lib/project_types/extension/features/runtimes/checkout_post_purchase.rb +23 -0
- data/lib/project_types/extension/features/runtimes/checkout_ui_extension.rb +29 -0
- data/lib/project_types/extension/messages/messages.rb +19 -6
- data/lib/project_types/extension/models/product.rb +12 -0
- data/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +10 -2
- data/lib/project_types/extension/models/specification_handlers/default.rb +13 -4
- data/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +15 -0
- data/lib/project_types/extension/tasks/configure_features.rb +1 -0
- data/lib/project_types/extension/tasks/converters/product_converter.rb +21 -0
- data/lib/project_types/extension/tasks/get_product.rb +22 -0
- data/lib/project_types/node/messages/messages.rb +1 -1
- data/lib/project_types/rails/messages/messages.rb +18 -18
- data/lib/project_types/script/commands/create.rb +1 -1
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +3 -3
- data/lib/project_types/script/layers/infrastructure/script_service.rb +17 -2
- data/lib/project_types/theme/cli.rb +1 -0
- data/lib/project_types/theme/commands/init.rb +42 -0
- data/lib/project_types/theme/commands/serve.rb +3 -1
- data/lib/project_types/theme/forms/select.rb +1 -1
- data/lib/project_types/theme/messages/messages.rb +14 -3
- data/lib/shopify-cli/admin_api.rb +6 -2
- data/lib/shopify-cli/api.rb +2 -2
- data/lib/shopify-cli/context.rb +1 -1
- data/lib/shopify-cli/core/monorail.rb +8 -3
- data/lib/shopify-cli/http_request.rb +6 -0
- data/lib/shopify-cli/messages/messages.rb +9 -8
- data/lib/shopify-cli/packager.rb +5 -5
- data/lib/shopify-cli/theme/dev_server.rb +5 -5
- data/lib/shopify-cli/theme/dev_server/local_assets.rb +1 -1
- data/lib/shopify-cli/theme/file.rb +2 -2
- data/lib/shopify-cli/theme/syncer.rb +9 -5
- data/lib/shopify-cli/theme/theme.rb +5 -5
- data/lib/shopify-cli/tunnel.rb +1 -1
- data/lib/shopify-cli/version.rb +1 -1
- data/shopify-cli.gemspec +1 -1
- metadata +15 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c65ab33bf57676cb65c04773cba1ae81a3852fd516283dde697a74f145c411e6
|
4
|
+
data.tar.gz: f74e40e7dcad523257c9535de75a121044bdc2f98acd1ac13dffd5310c4f9337
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 850bff5ac8a7b39f4574bfd77e6a9a20030a5c6bbc4dd03167839950cb52b8a365c928d54b261992634445eb081addb51103e178840d1899c8e49bf412cbaee2
|
7
|
+
data.tar.gz: 912ddbef4eb07b6a2f7587a64e27425cdf5f821a94bad31f9b56fd021f89960f34a37d885eaa9e04472c95eae56ae43025f414c872805ee935b6556b3e1cca91
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,35 @@
|
|
1
1
|
Unreleased
|
2
2
|
------
|
3
3
|
|
4
|
+
Version 2.2.0
|
5
|
+
------
|
6
|
+
* [#1424](https://github.com/Shopify/shopify-cli/pull/1424/): Add `--resourceUrl` flag to extension serve command
|
7
|
+
* [#1419](https://github.com/Shopify/shopify-cli/pull/1419): Remove analytics prompt when used in CI
|
8
|
+
* [#1418](https://github.com/Shopify/shopify-cli/pull/1418): Auto configure resource URL for Checkout Extensions
|
9
|
+
* [#1399](https://github.com/Shopify/shopify-cli/pull/1399): Fix error when running `shopify extension serve` in a theme app extension project
|
10
|
+
|
11
|
+
Version 2.1.0
|
12
|
+
-------------
|
13
|
+
* [#1357](https://github.com/Shopify/shopify-cli/pull/1357): Update Theme-Check to 1.1
|
14
|
+
* [#1352](https://github.com/Shopify/shopify-cli/pull/1352): Add `shopify extension check` for checking theme app extensions
|
15
|
+
* [#1304](https://github.com/Shopify/shopify-cli/pull/1304): Prompt user to run `shopify extension connect` if .env file is missing
|
16
|
+
|
17
|
+
Version 2.0.2
|
18
|
+
-------------
|
19
|
+
* [#1305](https://github.com/Shopify/shopify-cli/pull/1305): Fix `Uninitialized constant Net::WriteTimeout` error
|
20
|
+
* [#1319](https://github.com/Shopify/shopify-cli/pull/1319): Fix `theme pull` not pulling some files
|
21
|
+
* [#1321](https://github.com/Shopify/shopify-cli/pull/1321): Fix error when pulling images with `theme pull`
|
22
|
+
* [#1322](https://github.com/Shopify/shopify-cli/pull/1322): Fix error when running `shopify theme language-server --help`
|
23
|
+
* [#1324](https://github.com/Shopify/shopify-cli/pull/1324): Fix issue [#1308](https://github.com/Shopify/shopify-cli/issues/1308) where a non-English language on Partner Account breaks how CLI determines latest API version.
|
24
|
+
* [#1343](https://github.com/Shopify/shopify-cli/pull/1343): Fix inconsistent use of periods vs ellipsis in messages. This replaces periods with ellipsis.
|
25
|
+
|
26
|
+
Version 2.0.1
|
27
|
+
-------------
|
28
|
+
* [#1295](https://github.com/Shopify/shopify-cli/pull/1295): Ignore files at the root of a theme app extension project
|
29
|
+
* [#1296](https://github.com/Shopify/shopify-cli/pull/1296): Fix issue [#1294](https://github.com/Shopify/shopify-cli/issues/1294) regarding call to Windows `start` command with URL.
|
30
|
+
* [#1298](https://github.com/Shopify/shopify-cli/pull/1298): Fix error in `theme serve` command
|
31
|
+
* [#1301](https://github.com/Shopify/shopify-cli/pull/1301): Add `theme init` command
|
32
|
+
|
4
33
|
Version 2.0.0
|
5
34
|
-------------
|
6
35
|
* Adds support for theme development
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
shopify-cli (2.
|
4
|
+
shopify-cli (2.2.0)
|
5
5
|
listen (~> 3.5)
|
6
|
-
theme-check (~> 1.
|
6
|
+
theme-check (~> 1.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -76,7 +76,7 @@ GEM
|
|
76
76
|
rubocop-shopify (2.0.1)
|
77
77
|
rubocop (~> 1.11)
|
78
78
|
ruby-progressbar (1.11.0)
|
79
|
-
theme-check (1.
|
79
|
+
theme-check (1.1.0)
|
80
80
|
liquid (>= 5.0.1)
|
81
81
|
nokogumbo
|
82
82
|
timecop (0.9.2)
|
@@ -108,4 +108,4 @@ DEPENDENCIES
|
|
108
108
|
webmock
|
109
109
|
|
110
110
|
BUNDLED WITH
|
111
|
-
2.
|
111
|
+
2.2.22
|
data/README.md
CHANGED
@@ -101,9 +101,11 @@ Run:
|
|
101
101
|
|
102
102
|
To start the server. The server includes hot reload for CSS & Sections.
|
103
103
|
|
104
|
+
**Note:** Shopify CLI is the recommended and officially supported tool for developing themes and creating CI/CD workflows. Please refer to the [Theme Kit Migration Guide](https://github.com/Shopify/shopify-cli/blob/main/THEMEKIT_MIGRATION.md) for details.
|
105
|
+
|
104
106
|
### Contributing
|
105
107
|
|
106
|
-
Shopify CLI is an [open source tool](https://github.com/Shopify/shopify-cli/blob/main
|
108
|
+
Shopify CLI is an [open source tool](https://github.com/Shopify/shopify-cli/blob/main/LICENSE) and everyone is welcome to help the community by [contributing](https://github.com/Shopify/shopify-cli/blob/main/.github/CONTRIBUTING.md) to the project.
|
107
109
|
|
108
110
|
### Where to get help
|
109
111
|
|
data/RELEASING.md
CHANGED
@@ -15,6 +15,8 @@
|
|
15
15
|
|
16
16
|
1. Update the version of Shopify CLI in `lib/shopify-cli/version.rb`
|
17
17
|
|
18
|
+
1. Update the version of Shopify CLI at the top of `Gemfile.lock` (failing to do so causes the CI build to fail)
|
19
|
+
|
18
20
|
1. Add an entry for the new release to `CHANGELOG.md`
|
19
21
|
|
20
22
|
1. Commit the changes with a commit message like "Packaging for release X.Y.Z"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Theme Kit Migration
|
2
|
+
|
3
|
+
Shopify CLI is the recommended and officially supported tool for developing Themes and creating CI/CD workflows.
|
4
|
+
|
5
|
+
This guide shows how to achieve equivalent flows with the new version of the CLI.
|
6
|
+
|
7
|
+
## Equivalent commands
|
8
|
+
|
9
|
+
| Theme Kit Command | Shopify CLI Equivalent | Objective |
|
10
|
+
|---|---|---|
|
11
|
+
|`theme deploy`|`shopify theme push`| Deploy a local (to the CLI) version of the Theme in the current working directory to a remote store.|
|
12
|
+
|`theme new`|`shopify theme init`| Scaffold a new theme. In the case of the CLI it clones Dawn to be used as a reference Theme. Alternatively, it's possible to simply clone Dawn `git clone git@github.com:Shopify/dawn.git` and use it with the CLI.
|
13
|
+
|`theme download`|`shopify theme pull`| Download your remote theme files.|
|
14
|
+
|`theme watch` & `theme open` | `shopify theme serve` | Start a theme server to locally preview changes with CSS & Section hot reload enabled|
|
15
|
+
|-| `shopify theme check`| Run the Theme Check linter on your theme codebase.|
|
16
|
+
|-|`shopify theme publish`| Set a remote theme as the live theme.|
|
17
|
+
|-|`shopify theme package`|Pack your Theme as a zip file ready for distribution and submission to the Theme Store.|
|
18
|
+
|`theme remove`| `shopify theme delete`| Theme kit removes files from the Theme whereas Shopify CLI will remotely destroy the specified theme.|
|
@@ -24,6 +24,7 @@ module Extension
|
|
24
24
|
subcommand :Serve, "serve", Project.project_filepath("commands/serve")
|
25
25
|
subcommand :Push, "push", Project.project_filepath("commands/push")
|
26
26
|
subcommand :Tunnel, "tunnel", Project.project_filepath("commands/tunnel")
|
27
|
+
subcommand :Check, "check", Project.project_filepath("commands/check")
|
27
28
|
end
|
28
29
|
ShopifyCli::Commands.register("Extension::Command", "extension")
|
29
30
|
|
@@ -39,12 +40,14 @@ module Extension
|
|
39
40
|
autoload :ChooseNextAvailablePort, Project.project_filepath("tasks/choose_next_available_port")
|
40
41
|
autoload :FindNpmPackages, Project.project_filepath("tasks/find_npm_packages")
|
41
42
|
autoload :GetExtensions, Project.project_filepath("tasks/get_extensions")
|
43
|
+
autoload :GetProduct, Project.project_filepath("tasks/get_product")
|
42
44
|
|
43
45
|
module Converters
|
44
46
|
autoload :RegistrationConverter, Project.project_filepath("tasks/converters/registration_converter")
|
45
47
|
autoload :VersionConverter, Project.project_filepath("tasks/converters/version_converter")
|
46
48
|
autoload :ValidationErrorConverter, Project.project_filepath("tasks/converters/validation_error_converter")
|
47
49
|
autoload :AppConverter, Project.project_filepath("tasks/converters/app_converter")
|
50
|
+
autoload :ProductConverter, Project.project_filepath("tasks/converters/product_converter")
|
48
51
|
end
|
49
52
|
end
|
50
53
|
|
@@ -62,6 +65,12 @@ module Extension
|
|
62
65
|
end
|
63
66
|
|
64
67
|
module Features
|
68
|
+
module Runtimes
|
69
|
+
autoload :Admin, Project.project_filepath("features/runtimes/admin")
|
70
|
+
autoload :Base, Project.project_filepath("features/runtimes/base")
|
71
|
+
autoload :CheckoutPostPurchase, Project.project_filepath("features/runtimes/checkout_post_purchase")
|
72
|
+
autoload :CheckoutUiExtension, Project.project_filepath("features/runtimes/checkout_ui_extension")
|
73
|
+
end
|
65
74
|
autoload :ArgoServe, Project.project_filepath("features/argo_serve")
|
66
75
|
autoload :ArgoServeOptions, Project.project_filepath("features/argo_serve_options")
|
67
76
|
autoload :ArgoSetup, Project.project_filepath("features/argo_setup")
|
@@ -76,7 +85,6 @@ module Extension
|
|
76
85
|
module Models
|
77
86
|
module SpecificationHandlers
|
78
87
|
autoload :Default, Project.project_filepath("models/specification_handlers/default")
|
79
|
-
autoload :CheckoutArgoExtension, Project.project_filepath("models/specification_handlers/checkout_ui_extension")
|
80
88
|
end
|
81
89
|
|
82
90
|
autoload :App, Project.project_filepath("models/app")
|
@@ -87,6 +95,7 @@ module Extension
|
|
87
95
|
autoload :Specifications, Project.project_filepath("models/specifications")
|
88
96
|
autoload :LazySpecificationHandler, Project.project_filepath("models/lazy_specification_handler")
|
89
97
|
autoload :NpmPackage, Project.project_filepath("models/npm_package")
|
98
|
+
autoload :Product, Project.project_filepath("models/product")
|
90
99
|
end
|
91
100
|
|
92
101
|
autoload :ExtensionProjectKeys, Project.project_filepath("extension_project_keys")
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "theme_check"
|
3
|
+
|
4
|
+
module Extension
|
5
|
+
class Command
|
6
|
+
class Check < ExtensionCommand
|
7
|
+
class CheckOptions < ShopifyCli::Options
|
8
|
+
def initialize(ctx, theme_check)
|
9
|
+
super()
|
10
|
+
@theme_check = theme_check
|
11
|
+
@ctx = ctx
|
12
|
+
end
|
13
|
+
|
14
|
+
def parse(_options_block, args)
|
15
|
+
# Check if .theme-check.yml exists, or if another -C has been passed on the command line
|
16
|
+
unless args.include?("-C") || @ctx.file_exist?(".theme-check.yml")
|
17
|
+
args += ["-C", ":theme_app_extension"]
|
18
|
+
end
|
19
|
+
@theme_check.parse(args)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(*)
|
24
|
+
super
|
25
|
+
if project.specification_identifier == "THEME_APP_EXTENSION"
|
26
|
+
@theme_check = ThemeCheck::Cli.new
|
27
|
+
self.options = CheckOptions.new(@ctx, @theme_check)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def call(*)
|
32
|
+
if project.specification_identifier == "THEME_APP_EXTENSION"
|
33
|
+
@theme_check.run
|
34
|
+
else
|
35
|
+
@ctx.abort(@ctx.message("check.unsupported", project.specification_identifier))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.help
|
40
|
+
ShopifyCli::Context.message("check.help", ShopifyCli::TOOL_NAME)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -9,19 +9,24 @@ module Extension
|
|
9
9
|
|
10
10
|
options do |parser, flags|
|
11
11
|
parser.on("-t", "--[no-]tunnel", "Establish an ngrok tunnel") { |tunnel| flags[:tunnel] = tunnel }
|
12
|
+
parser.on("--resourceUrl=RESOURCE_URL", "Provide a resource URL") do |resource_url|
|
13
|
+
flags[:resource_url] = resource_url
|
14
|
+
end
|
12
15
|
end
|
13
16
|
|
14
17
|
class RuntimeConfiguration
|
15
18
|
include SmartProperties
|
16
19
|
|
17
20
|
property :tunnel_url, accepts: String, default: nil
|
21
|
+
property :resource_url, accepts: String, default: nil
|
18
22
|
property! :tunnel_requested, accepts: [true, false], reader: :tunnel_requested?, default: true
|
19
23
|
property! :port, accepts: (1...(2**16)), default: DEFAULT_PORT
|
20
24
|
end
|
21
25
|
|
22
26
|
def call(_args, _command_name)
|
23
27
|
config = RuntimeConfiguration.new(
|
24
|
-
tunnel_requested: tunnel_requested
|
28
|
+
tunnel_requested: tunnel_requested?,
|
29
|
+
resource_url: options.flags[:resource_url]
|
25
30
|
)
|
26
31
|
|
27
32
|
ShopifyCli::Result
|
@@ -74,7 +79,8 @@ module Extension
|
|
74
79
|
specification_handler.serve(
|
75
80
|
context: @ctx,
|
76
81
|
tunnel_url: runtime_configuration.tunnel_url,
|
77
|
-
port: runtime_configuration.port
|
82
|
+
port: runtime_configuration.port,
|
83
|
+
resource_url: runtime_configuration.resource_url
|
78
84
|
)
|
79
85
|
runtime_configuration
|
80
86
|
end
|
@@ -14,16 +14,43 @@ module Extension
|
|
14
14
|
)
|
15
15
|
end
|
16
16
|
|
17
|
+
def update_env_file(context:, **updates)
|
18
|
+
current_config = {
|
19
|
+
title: current.title,
|
20
|
+
shop: current.env.shop,
|
21
|
+
api_key: current.app.api_key,
|
22
|
+
api_secret: current.app.secret,
|
23
|
+
registration_id: current.registration_id,
|
24
|
+
registration_uuid: current.registration_uuid,
|
25
|
+
resource_url: current.resource_url,
|
26
|
+
}
|
27
|
+
|
28
|
+
write_env_file(
|
29
|
+
context: context,
|
30
|
+
**current_config,
|
31
|
+
**updates
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
17
35
|
def write_env_file(
|
18
|
-
context:,
|
36
|
+
context:,
|
37
|
+
title:,
|
38
|
+
api_key: "",
|
39
|
+
api_secret: "",
|
40
|
+
registration_id: nil,
|
41
|
+
registration_uuid: nil,
|
42
|
+
resource_url: nil,
|
43
|
+
shop: nil
|
19
44
|
)
|
20
45
|
ShopifyCli::Resources::EnvFile.new(
|
21
46
|
api_key: api_key,
|
22
47
|
secret: api_secret,
|
48
|
+
shop: shop,
|
23
49
|
extra: {
|
24
50
|
ExtensionProjectKeys::TITLE_KEY => title,
|
25
51
|
ExtensionProjectKeys::REGISTRATION_ID_KEY => registration_id,
|
26
52
|
ExtensionProjectKeys::REGISTRATION_UUID_KEY => registration_uuid || generate_temporary_uuid,
|
53
|
+
ExtensionProjectKeys::RESOURCE_URL_KEY => resource_url,
|
27
54
|
}.compact
|
28
55
|
).write(context)
|
29
56
|
|
@@ -42,6 +69,7 @@ module Extension
|
|
42
69
|
end
|
43
70
|
|
44
71
|
def app
|
72
|
+
validate_env_present
|
45
73
|
Models::App.new(api_key: env["api_key"], secret: env["secret"])
|
46
74
|
end
|
47
75
|
|
@@ -71,6 +99,10 @@ module Extension
|
|
71
99
|
get_extra_field(ExtensionProjectKeys::REGISTRATION_UUID_KEY)
|
72
100
|
end
|
73
101
|
|
102
|
+
def resource_url
|
103
|
+
get_extra_field(ExtensionProjectKeys::RESOURCE_URL_KEY)
|
104
|
+
end
|
105
|
+
|
74
106
|
def reload
|
75
107
|
@env = nil
|
76
108
|
end
|
@@ -96,9 +128,15 @@ module Extension
|
|
96
128
|
end
|
97
129
|
|
98
130
|
def property_present?(key)
|
131
|
+
validate_env_present
|
99
132
|
!env[key].nil? && !env[key].strip.empty?
|
100
133
|
end
|
101
134
|
|
135
|
+
def validate_env_present
|
136
|
+
return if env
|
137
|
+
raise ShopifyCli::Abort, "Missing .env file. Run `shopify extension connect` to generate an .env file."
|
138
|
+
end
|
139
|
+
|
102
140
|
def integer?(value)
|
103
141
|
value.to_i.to_s == value.to_s
|
104
142
|
end
|
@@ -1,46 +1,14 @@
|
|
1
1
|
module Extension
|
2
2
|
module Features
|
3
3
|
class ArgoRuntime
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
ADMIN_RUN_FLAGS = [
|
10
|
-
:api_key,
|
11
|
-
:name,
|
12
|
-
:port,
|
13
|
-
:public_url,
|
14
|
-
:renderer_version,
|
15
|
-
:shop,
|
16
|
-
:uuid,
|
4
|
+
RUNTIMES = [
|
5
|
+
Runtimes::Admin.new,
|
6
|
+
Runtimes::CheckoutPostPurchase.new,
|
7
|
+
Runtimes::CheckoutUiExtension.new,
|
17
8
|
]
|
18
9
|
|
19
|
-
|
20
|
-
|
21
|
-
:public_url,
|
22
|
-
]
|
23
|
-
|
24
|
-
property! :renderer, accepts: Models::NpmPackage
|
25
|
-
property! :cli, accepts: Models::NpmPackage
|
26
|
-
|
27
|
-
def supports?(flag)
|
28
|
-
case cli
|
29
|
-
when admin?
|
30
|
-
ADMIN_RUN_FLAGS.include?(flag.to_sym)
|
31
|
-
when checkout?
|
32
|
-
CHECKOUT_RUN_FLAGS.include?(flag.to_sym)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def admin?
|
39
|
-
->(cli) { cli.name == UI_EXTENSIONS_ADMIN_RUN }
|
40
|
-
end
|
41
|
-
|
42
|
-
def checkout?
|
43
|
-
->(cli) { cli.name == UI_EXTENSIONS_CHECKOUT_RUN }
|
10
|
+
def self.find(cli_package:, identifier:)
|
11
|
+
RUNTIMES.find { |runtime| runtime.active_runtime?(cli_package, identifier) }
|
44
12
|
end
|
45
13
|
end
|
46
14
|
end
|
@@ -7,11 +7,12 @@ module Extension
|
|
7
7
|
NPM_SERVE_COMMAND = %w(run-script server)
|
8
8
|
|
9
9
|
property! :specification_handler, accepts: Extension::Models::SpecificationHandlers::Default
|
10
|
-
property! :argo_runtime, accepts: Features::
|
10
|
+
property! :argo_runtime, accepts: -> (runtime) { runtime.class < Features::Runtimes::Base }
|
11
11
|
property! :context, accepts: ShopifyCli::Context
|
12
12
|
property! :port, accepts: Integer, default: 39351
|
13
13
|
property :tunnel_url, accepts: String, default: nil
|
14
14
|
property! :js_system, accepts: ->(jss) { jss.respond_to?(:call) }, default: ShopifyCli::JsSystem
|
15
|
+
property :resource_url, accepts: String, default: nil
|
15
16
|
|
16
17
|
def call
|
17
18
|
validate_env!
|
@@ -22,6 +23,10 @@ module Extension
|
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
26
|
+
def resource_url
|
27
|
+
super || ExtensionProject.current(force_reload: true).resource_url
|
28
|
+
end
|
29
|
+
|
25
30
|
private
|
26
31
|
|
27
32
|
def start_server
|
@@ -57,6 +62,7 @@ module Extension
|
|
57
62
|
ShopifyCli::Tasks::EnsureDevStore.call(context) if required_fields.include?(:shop)
|
58
63
|
|
59
64
|
project = ExtensionProject.current
|
65
|
+
ensure_resource_resource_url! if specification_handler.supplies_resource_url?
|
60
66
|
|
61
67
|
return if required_fields.all? do |field|
|
62
68
|
value = project.env.public_send(field)
|
@@ -77,8 +83,31 @@ module Extension
|
|
77
83
|
options << "--uuid=#{project.registration_uuid}" if argo_runtime.supports?(:uuid)
|
78
84
|
options << "--publicUrl=#{tunnel_url}" if !tunnel_url.nil? && argo_runtime.supports?(:public_url)
|
79
85
|
options << "--name=#{project.title}" if argo_runtime.supports?(:name)
|
86
|
+
options << "--resourceUrl=#{resource_url}" if !resource_url.nil? && argo_runtime.supports?(:resource_url)
|
80
87
|
end
|
81
88
|
end
|
89
|
+
|
90
|
+
def ensure_resource_resource_url!
|
91
|
+
project = ExtensionProject.current(force_reload: true)
|
92
|
+
|
93
|
+
ShopifyCli::Result
|
94
|
+
.wrap(project.resource_url)
|
95
|
+
.rescue { specification_handler.build_resource_url(shop: project.env.shop, context: context) }
|
96
|
+
.then(&method(:persist_resource_url))
|
97
|
+
.unwrap do |nil_or_exception|
|
98
|
+
case nil_or_exception
|
99
|
+
when nil
|
100
|
+
context.warn(context.message("warnings.resource_url_auto_generation_failed", project.env.shop))
|
101
|
+
else
|
102
|
+
context.abort(nil_or_exception)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def persist_resource_url(resource_url)
|
108
|
+
ExtensionProject.update_env_file(context: context, resource_url: resource_url)
|
109
|
+
resource_url
|
110
|
+
end
|
82
111
|
end
|
83
112
|
end
|
84
113
|
end
|