shopify-cli 2.6.3 → 2.7.0
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/.devcontainer.json +5 -0
- data/.github/DESIGN.md +1 -1
- data/.github/ISSUE_TEMPLATE.md +7 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +15 -4
- data/.github/workflows/shopify.yml +3 -6
- data/.vscode/extensions.json +5 -0
- data/.vscode/settings.json +9 -0
- data/CHANGELOG.md +98 -104
- data/CONTRIBUTING.md +1 -21
- data/Codespace.dockerfile +35 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +9 -5
- data/README.md +20 -99
- data/RELEASING.md +17 -30
- data/Rakefile +0 -5
- data/Tests.dockerfile +35 -0
- data/assets/logo.png +0 -0
- data/dev.yml +0 -3
- data/docs/README.md +13 -0
- data/docs/contributors/testing.md +27 -0
- data/docs/users/installation.md +46 -0
- data/{THEMEKIT_MIGRATION.md → docs/users/migrate-from-themekit.md} +1 -1
- data/lib/project_types/extension/cli.rb +7 -3
- data/lib/project_types/extension/commands/create.rb +6 -6
- data/lib/project_types/extension/commands/extension_command.rb +1 -1
- data/lib/project_types/extension/features/argo.rb +9 -10
- data/lib/project_types/extension/features/argo_serve.rb +9 -23
- data/lib/project_types/extension/forms/create.rb +1 -1
- data/lib/project_types/extension/forms/questions/ask_template.rb +3 -6
- data/lib/project_types/extension/messages/messages.rb +1 -0
- data/lib/project_types/extension/models/development_server_requirements.rb +2 -3
- data/lib/project_types/extension/models/server_config/app.rb +13 -0
- data/lib/project_types/extension/models/server_config/development.rb +5 -4
- data/lib/project_types/extension/models/server_config/development_renderer.rb +1 -1
- data/lib/project_types/extension/models/server_config/development_resource.rb +13 -0
- data/lib/project_types/extension/models/server_config/extension.rb +4 -0
- data/lib/project_types/extension/models/server_config/root.rb +4 -1
- data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +1 -1
- data/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +1 -1
- data/lib/project_types/extension/tasks/convert_server_config.rb +65 -0
- data/lib/project_types/extension/tasks/ensure_resource_url.rb +39 -0
- data/lib/project_types/extension/tasks/find_package_from_json.rb +37 -0
- data/lib/project_types/extension/tasks/merge_server_config.rb +32 -0
- data/lib/project_types/extension/tasks/run_extension_command.rb +10 -9
- data/lib/project_types/node/cli.rb +0 -16
- data/lib/project_types/node/forms/create.rb +5 -5
- data/lib/project_types/node/messages/messages.rb +2 -149
- data/lib/project_types/php/cli.rb +0 -11
- data/lib/project_types/php/forms/create.rb +5 -6
- data/lib/project_types/php/messages/messages.rb +2 -164
- data/lib/project_types/rails/cli.rb +0 -16
- data/lib/project_types/rails/commands/create.rb +46 -17
- data/lib/project_types/rails/forms/create.rb +5 -7
- data/lib/project_types/rails/messages/messages.rb +6 -154
- data/lib/project_types/script/cli.rb +1 -1
- data/lib/project_types/script/commands/create.rb +5 -6
- data/lib/project_types/script/commands/push.rb +1 -1
- data/lib/project_types/script/config/extension_points.yml +10 -0
- data/lib/project_types/script/errors.rb +0 -18
- data/lib/project_types/script/graphql/app_script_set.graphql +2 -0
- data/lib/project_types/script/layers/application/build_script.rb +2 -1
- data/lib/project_types/script/layers/application/create_script.rb +2 -2
- data/lib/project_types/script/layers/application/push_script.rb +15 -1
- data/lib/project_types/script/layers/domain/push_package.rb +5 -2
- data/lib/project_types/script/layers/domain/script_json.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/api_clients/partners_proxy_api_client.rb +0 -4
- data/lib/project_types/script/layers/infrastructure/errors.rb +17 -2
- data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +29 -13
- data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +29 -13
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +4 -2
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +3 -4
- data/lib/project_types/script/layers/infrastructure/script_service.rb +7 -2
- data/lib/project_types/script/messages/messages.rb +9 -22
- data/lib/project_types/script/ui/error_handler.rb +16 -26
- data/lib/project_types/theme/cli.rb +1 -1
- data/lib/project_types/theme/commands/check.rb +1 -1
- data/lib/project_types/theme/commands/delete.rb +1 -1
- data/lib/project_types/theme/commands/init.rb +1 -1
- data/lib/project_types/theme/commands/language_server.rb +1 -1
- data/lib/project_types/theme/commands/package.rb +1 -1
- data/lib/project_types/theme/commands/publish.rb +1 -1
- data/lib/project_types/theme/commands/pull.rb +1 -1
- data/lib/project_types/theme/commands/push.rb +1 -1
- data/lib/project_types/theme/commands/serve.rb +10 -2
- data/lib/project_types/theme/messages/messages.rb +10 -0
- data/lib/shopify_cli/admin_api/populate_resource_command.rb +1 -1
- data/lib/shopify_cli/api.rb +7 -2
- data/lib/shopify_cli/app_type_detector.rb +36 -0
- data/lib/shopify_cli/command/app_sub_command.rb +10 -0
- data/lib/shopify_cli/command/project_command.rb +18 -0
- data/lib/shopify_cli/command/sub_command.rb +19 -0
- data/lib/shopify_cli/command.rb +13 -3
- data/lib/shopify_cli/command_options/command_serve_options.rb +43 -0
- data/lib/shopify_cli/command_options.rb +7 -0
- data/lib/shopify_cli/commands/app/connect.rb +22 -0
- data/lib/shopify_cli/commands/app/create/node.rb +38 -0
- data/lib/shopify_cli/commands/app/create/php.rb +36 -0
- data/lib/shopify_cli/commands/app/create/rails.rb +40 -0
- data/lib/shopify_cli/commands/app/create.rb +28 -0
- data/lib/shopify_cli/commands/app/deploy.rb +49 -0
- data/lib/shopify_cli/commands/app/open.rb +19 -0
- data/lib/shopify_cli/commands/app/serve.rb +49 -0
- data/lib/shopify_cli/commands/app/tunnel.rb +43 -0
- data/lib/shopify_cli/commands/app.rb +29 -0
- data/lib/shopify_cli/commands/config.rb +2 -2
- data/lib/shopify_cli/commands/login.rb +3 -3
- data/lib/shopify_cli/commands/reporting.rb +38 -0
- data/lib/shopify_cli/commands/switch.rb +1 -1
- data/lib/shopify_cli/commands.rb +2 -0
- data/lib/shopify_cli/constants.rb +11 -3
- data/lib/shopify_cli/core/monorail.rb +9 -20
- data/lib/shopify_cli/environment.rb +15 -1
- data/lib/shopify_cli/exception_reporter.rb +29 -16
- data/lib/shopify_cli/git.rb +12 -1
- data/lib/shopify_cli/github/issue_url_generator.rb +19 -0
- data/lib/shopify_cli/github.rb +5 -0
- data/lib/shopify_cli/messages/messages.rb +295 -22
- data/lib/shopify_cli/migrator/migration.rb +1 -1
- data/lib/shopify_cli/migrator/migrations/1631709766_noop.rb +1 -1
- data/lib/shopify_cli/migrator/migrations/1633691650_merge_reporting_configuration.rb +41 -0
- data/lib/shopify_cli/migrator.rb +9 -11
- data/lib/shopify_cli/project.rb +5 -1
- data/lib/shopify_cli/project_commands.rb +1 -1
- data/lib/shopify_cli/reporting_configuration_controller.rb +64 -0
- data/lib/shopify_cli/services/app/connect_service.rb +25 -0
- data/lib/shopify_cli/services/app/create/node_service.rb +153 -0
- data/lib/shopify_cli/services/app/create/php_service.rb +152 -0
- data/lib/shopify_cli/services/app/create/rails_service.rb +213 -0
- data/lib/shopify_cli/services/app/deploy/heroku/node_service.rb +101 -0
- data/lib/shopify_cli/services/app/deploy/heroku/php_service.rb +135 -0
- data/lib/shopify_cli/services/app/deploy/heroku/rails_service.rb +120 -0
- data/lib/shopify_cli/services/app/open_service.rb +19 -0
- data/lib/shopify_cli/services/app/serve/node_service.rb +42 -0
- data/lib/shopify_cli/services/app/serve/php_service.rb +46 -0
- data/lib/shopify_cli/services/app/serve/rails_service.rb +48 -0
- data/lib/shopify_cli/services/app/tunnel/auth_service.rb +21 -0
- data/lib/shopify_cli/services/app/tunnel/start_service.rb +20 -0
- data/lib/shopify_cli/services/app/tunnel/stop_service.rb +20 -0
- data/lib/shopify_cli/services/base_service.rb +13 -0
- data/lib/shopify_cli/services/reporting_service.rb +16 -0
- data/lib/shopify_cli/services.rb +37 -0
- data/lib/shopify_cli/theme/dev_server/local_assets.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/watcher.rb +2 -2
- data/lib/shopify_cli/theme/dev_server.rb +9 -2
- data/lib/shopify_cli/version.rb +1 -1
- data/lib/shopify_cli.rb +5 -2
- data/shopify-cli.gemspec +2 -13
- data/shopify-dev +18 -0
- data/utilities/constants.rb +7 -0
- data/utilities/docker/container.rb +104 -0
- data/utilities/docker.rb +45 -3
- data/utilities/utilities.rb +1 -0
- metadata +63 -54
- data/Dockerfile +0 -17
- data/docs/_config.yml +0 -2
- data/docs/app/node/commands/index.md +0 -4
- data/docs/app/node/index.md +0 -4
- data/docs/app/rails/commands/index.md +0 -4
- data/docs/app/rails/index.md +0 -4
- data/docs/core/index.md +0 -4
- data/docs/getting-started/index.md +0 -4
- data/docs/getting-started/install/index.md +0 -4
- data/docs/getting-started/migrate/index.md +0 -4
- data/docs/getting-started/uninstall/index.md +0 -4
- data/docs/getting-started/upgrade/index.md +0 -4
- data/docs/help/start-app/index.md +0 -4
- data/docs/index.md +0 -4
- data/ext/shopify-cli/extconf.rb +0 -60
- data/install.sh +0 -7
- data/lib/project_types/extension/tasks/converters/server_config_converter.rb +0 -31
- data/lib/project_types/extension/tasks/load_server_config.rb +0 -23
- data/lib/project_types/node/commands/connect.rb +0 -21
- data/lib/project_types/node/commands/create.rb +0 -125
- data/lib/project_types/node/commands/deploy/heroku.rb +0 -96
- data/lib/project_types/node/commands/deploy.rb +0 -32
- data/lib/project_types/node/commands/generate.rb +0 -22
- data/lib/project_types/node/commands/open.rb +0 -18
- data/lib/project_types/node/commands/serve.rb +0 -54
- data/lib/project_types/node/commands/tunnel.rb +0 -41
- data/lib/project_types/php/commands/connect.rb +0 -19
- data/lib/project_types/php/commands/create.rb +0 -143
- data/lib/project_types/php/commands/deploy/heroku.rb +0 -129
- data/lib/project_types/php/commands/deploy.rb +0 -32
- data/lib/project_types/php/commands/open.rb +0 -16
- data/lib/project_types/php/commands/serve.rb +0 -51
- data/lib/project_types/php/commands/tunnel.rb +0 -37
- data/lib/project_types/rails/commands/connect.rb +0 -21
- data/lib/project_types/rails/commands/deploy/heroku.rb +0 -115
- data/lib/project_types/rails/commands/deploy.rb +0 -32
- data/lib/project_types/rails/commands/generate/webhook.rb +0 -42
- data/lib/project_types/rails/commands/generate.rb +0 -60
- data/lib/project_types/rails/commands/open.rb +0 -18
- data/lib/project_types/rails/commands/serve.rb +0 -52
- data/lib/project_types/rails/commands/tunnel.rb +0 -41
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +0 -0
- data/lib/shopify_cli/exception_reporter/permission_controller.rb +0 -54
- data/lib/shopify_cli/sub_command.rb +0 -17
- data/shopify.fish +0 -12
- data/shopify.sh +0 -11
|
@@ -5,10 +5,14 @@ module Extension
|
|
|
5
5
|
module ServerConfig
|
|
6
6
|
class Extension < Base
|
|
7
7
|
include SmartProperties
|
|
8
|
+
|
|
8
9
|
property! :uuid, accepts: String
|
|
9
10
|
property! :type, accepts: String
|
|
10
11
|
property! :user, accepts: ServerConfig::User
|
|
11
12
|
property! :development, accepts: ServerConfig::Development
|
|
13
|
+
property :extension_points, accepts: Array
|
|
14
|
+
property :version, accepts: String
|
|
15
|
+
property :title, accepts: String
|
|
12
16
|
|
|
13
17
|
def self.build(uuid: "", template:, type:, root_dir:)
|
|
14
18
|
renderer = ServerConfig::DevelopmentRenderer.find(type)
|
|
@@ -6,8 +6,11 @@ module Extension
|
|
|
6
6
|
class Root < Base
|
|
7
7
|
include SmartProperties
|
|
8
8
|
|
|
9
|
-
property
|
|
9
|
+
property :app, accepts: ServerConfig::App
|
|
10
10
|
property! :extensions, accepts: Array, default: -> { [] }
|
|
11
|
+
property! :port, accepts: Integer, default: 39351
|
|
12
|
+
property :public_url, accepts: String
|
|
13
|
+
property :store, accepts: String
|
|
11
14
|
|
|
12
15
|
def to_yaml
|
|
13
16
|
to_h.to_yaml.gsub("---\n", "")
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require "shopify_cli"
|
|
3
|
+
|
|
4
|
+
module Extension
|
|
5
|
+
module Tasks
|
|
6
|
+
class ConvertServerConfig
|
|
7
|
+
include SmartProperties
|
|
8
|
+
|
|
9
|
+
property! :api_key, accepts: String
|
|
10
|
+
property! :context, accepts: ShopifyCLI::Context
|
|
11
|
+
property! :hash, accepts: Hash
|
|
12
|
+
property! :registration_uuid, accepts: String
|
|
13
|
+
property :resource_url, accepts: String
|
|
14
|
+
property! :store, accepts: String
|
|
15
|
+
property! :title, accepts: String
|
|
16
|
+
property! :tunnel_url, accepts: String
|
|
17
|
+
property! :type, accepts: String
|
|
18
|
+
|
|
19
|
+
def self.call(*args)
|
|
20
|
+
new(*args).call
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def call
|
|
24
|
+
context.abort(context.message("tasks.errors.parse_error")) if hash.nil?
|
|
25
|
+
|
|
26
|
+
renderer = Models::ServerConfig::DevelopmentRenderer.find(type)
|
|
27
|
+
|
|
28
|
+
extension = Models::ServerConfig::Extension.new(
|
|
29
|
+
uuid: registration_uuid,
|
|
30
|
+
type: type.upcase,
|
|
31
|
+
user: Models::ServerConfig::User.new,
|
|
32
|
+
development: Models::ServerConfig::Development.new(
|
|
33
|
+
build_dir: hash.dig("development", "build_dir"),
|
|
34
|
+
renderer: renderer,
|
|
35
|
+
entries: Models::ServerConfig::DevelopmentEntries.new(
|
|
36
|
+
main: hash.dig("development", "entries", "main")
|
|
37
|
+
)
|
|
38
|
+
),
|
|
39
|
+
extension_points: hash.dig("extension_points"),
|
|
40
|
+
version: version(renderer.name, context),
|
|
41
|
+
title: title
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
unless resource_url.nil?
|
|
45
|
+
extension.development.resource = Models::ServerConfig::DevelopmentResource.new(url: resource_url)
|
|
46
|
+
end
|
|
47
|
+
server_config = Models::ServerConfig::Root.new(
|
|
48
|
+
extensions: [extension],
|
|
49
|
+
public_url: tunnel_url,
|
|
50
|
+
store: store
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
unless api_key.nil?
|
|
54
|
+
server_config.app = Models::ServerConfig::App.new(api_key: api_key)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
server_config
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def version(renderer, context)
|
|
61
|
+
Tasks::FindPackageFromJson.call(renderer, context: context).version
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require "shopify_cli"
|
|
3
|
+
|
|
4
|
+
module Extension
|
|
5
|
+
module Tasks
|
|
6
|
+
class EnsureResourceUrl < ShopifyCLI::Task
|
|
7
|
+
include SmartProperties
|
|
8
|
+
|
|
9
|
+
property! :context, accepts: ShopifyCLI::Context
|
|
10
|
+
property! :specification_handler, accepts: Extension::Models::SpecificationHandlers::Default
|
|
11
|
+
|
|
12
|
+
def self.call(*args)
|
|
13
|
+
new(*args).call
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def call
|
|
17
|
+
project = ExtensionProject.current(force_reload: true)
|
|
18
|
+
|
|
19
|
+
ShopifyCLI::Result
|
|
20
|
+
.wrap(project.resource_url)
|
|
21
|
+
.rescue { specification_handler.build_resource_url(shop: project.env.shop, context: context) }
|
|
22
|
+
.then(&method(:persist_resource_url))
|
|
23
|
+
.unwrap do |nil_or_exception|
|
|
24
|
+
case nil_or_exception
|
|
25
|
+
when nil
|
|
26
|
+
context.warn(context.message("warnings.resource_url_auto_generation_failed", project.env.shop))
|
|
27
|
+
else
|
|
28
|
+
context.abort(nil_or_exception)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def persist_resource_url(resource_url)
|
|
34
|
+
ExtensionProject.update_env_file(context: context, resource_url: resource_url)
|
|
35
|
+
resource_url
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require "json"
|
|
3
|
+
|
|
4
|
+
module Extension
|
|
5
|
+
module Tasks
|
|
6
|
+
class FindPackageFromJson < ShopifyCLI::Task
|
|
7
|
+
include SmartProperties
|
|
8
|
+
|
|
9
|
+
property! :context, accepts: ShopifyCLI::Context
|
|
10
|
+
|
|
11
|
+
def self.call(package_name, **config)
|
|
12
|
+
new(**config).call(package_name)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def call(package_name)
|
|
16
|
+
ShopifyCLI::Result.success(resolve_package_json(package_name))
|
|
17
|
+
.then { |file| File.read(file) }
|
|
18
|
+
.then { |file| JSON.parse(file) }
|
|
19
|
+
.then { |file| file.dig("version") }
|
|
20
|
+
.then { |version| return Models::NpmPackage.new(name: package_name, version: version) }
|
|
21
|
+
.unwrap do |error|
|
|
22
|
+
context.debug(error)
|
|
23
|
+
context.abort(context.message("errors.module_not_found", package_name))
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def resolve_package_json(package_name)
|
|
30
|
+
path = "path.join(require.resolve('#{package_name}'), '../package.json')"
|
|
31
|
+
package_json, error, _ = CLI::Kit::System.capture3("node", "-p", path)
|
|
32
|
+
return error unless !error.nil?
|
|
33
|
+
package_json.chomp
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require "shopify_cli"
|
|
3
|
+
require "yaml"
|
|
4
|
+
|
|
5
|
+
module Extension
|
|
6
|
+
module Tasks
|
|
7
|
+
class MergeServerConfig < ShopifyCLI::Task
|
|
8
|
+
class << self
|
|
9
|
+
def call(context:, file_name:, resource_url:, tunnel_url:, type:)
|
|
10
|
+
config = YAML.load_file(file_name)
|
|
11
|
+
project = ExtensionProject.current
|
|
12
|
+
Tasks::ConvertServerConfig.call(
|
|
13
|
+
api_key: project.env.api_key,
|
|
14
|
+
context: context,
|
|
15
|
+
hash: config,
|
|
16
|
+
registration_uuid: project.registration_uuid,
|
|
17
|
+
resource_url: resource_url || project.resource_url,
|
|
18
|
+
store: project.env.shop || "",
|
|
19
|
+
title: project.title,
|
|
20
|
+
tunnel_url: tunnel_url,
|
|
21
|
+
type: type
|
|
22
|
+
)
|
|
23
|
+
rescue Psych::SyntaxError => e
|
|
24
|
+
raise(
|
|
25
|
+
ShopifyCLI::Abort,
|
|
26
|
+
ShopifyCLI::Context.message("core.yaml.error.invalid", file_name, e.message)
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -7,10 +7,6 @@ module Extension
|
|
|
7
7
|
class RunExtensionCommand < ShopifyCLI::Task
|
|
8
8
|
include SmartProperties
|
|
9
9
|
|
|
10
|
-
SUPPORTED_EXTENSION_TYPES = [
|
|
11
|
-
"checkout_ui_extension",
|
|
12
|
-
]
|
|
13
|
-
|
|
14
10
|
SUPPORTED_COMMANDS = [
|
|
15
11
|
"create",
|
|
16
12
|
"build",
|
|
@@ -18,12 +14,14 @@ module Extension
|
|
|
18
14
|
]
|
|
19
15
|
|
|
20
16
|
property! :command, accepts: SUPPORTED_COMMANDS
|
|
21
|
-
property! :type, accepts: SUPPORTED_EXTENSION_TYPES
|
|
17
|
+
property! :type, accepts: Models::DevelopmentServerRequirements::SUPPORTED_EXTENSION_TYPES
|
|
22
18
|
property :context, accepts: ShopifyCLI::Context
|
|
23
19
|
property :config_file_name, accepts: String
|
|
24
20
|
property :port, accepts: Integer, default: 39351
|
|
21
|
+
property :resource_url, accepts: String
|
|
25
22
|
property :root_dir, accepts: String
|
|
26
23
|
property :template, accepts: Models::ServerConfig::Development::VALID_TEMPLATES
|
|
24
|
+
property :tunnel_url, accepts: String
|
|
27
25
|
|
|
28
26
|
def call
|
|
29
27
|
ShopifyCLI::Result.success(config_file_exists?)
|
|
@@ -43,14 +41,17 @@ module Extension
|
|
|
43
41
|
end
|
|
44
42
|
|
|
45
43
|
def load_or_build_server_config(config_file_exists)
|
|
46
|
-
return
|
|
44
|
+
return merge_server_config if config_file_exists
|
|
47
45
|
build_server_config
|
|
48
46
|
end
|
|
49
47
|
|
|
50
|
-
def
|
|
51
|
-
Tasks::
|
|
48
|
+
def merge_server_config
|
|
49
|
+
Tasks::MergeServerConfig.call(
|
|
50
|
+
context: context,
|
|
52
51
|
file_name: config_file_name,
|
|
53
|
-
|
|
52
|
+
resource_url: resource_url,
|
|
53
|
+
tunnel_url: tunnel_url,
|
|
54
|
+
type: type
|
|
54
55
|
)
|
|
55
56
|
end
|
|
56
57
|
|
|
@@ -5,22 +5,6 @@ module Node
|
|
|
5
5
|
register_messages(Node::Messages::MESSAGES)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
# define/autoload project specific Commands
|
|
9
|
-
class Command < ShopifyCLI::ProjectCommands
|
|
10
|
-
subcommand :Connect, "connect", Project.project_filepath("commands/connect")
|
|
11
|
-
subcommand :Create, "create", Project.project_filepath("commands/create")
|
|
12
|
-
subcommand :Deploy, "deploy", Project.project_filepath("commands/deploy")
|
|
13
|
-
subcommand :Generate, "generate", Project.project_filepath("commands/generate")
|
|
14
|
-
subcommand :Open, "open", Project.project_filepath("commands/open")
|
|
15
|
-
subcommand :Serve, "serve", Project.project_filepath("commands/serve")
|
|
16
|
-
subcommand :Tunnel, "tunnel", Project.project_filepath("commands/tunnel")
|
|
17
|
-
end
|
|
18
|
-
ShopifyCLI::Commands.register("Node::Command", "node")
|
|
19
|
-
|
|
20
|
-
# define/autoload project specific Tasks
|
|
21
|
-
module Tasks
|
|
22
|
-
end
|
|
23
|
-
|
|
24
8
|
# define/autoload project specific Forms
|
|
25
9
|
module Forms
|
|
26
10
|
autoload :Create, Project.project_filepath("forms/create")
|
|
@@ -4,10 +4,10 @@ module Node
|
|
|
4
4
|
module Forms
|
|
5
5
|
class Create < ShopifyCLI::Form
|
|
6
6
|
attr_accessor :name
|
|
7
|
-
flag_arguments :
|
|
7
|
+
flag_arguments :name, :organization_id, :shop_domain, :type
|
|
8
8
|
|
|
9
9
|
def ask
|
|
10
|
-
self.
|
|
10
|
+
self.name ||= CLI::UI::Prompt.ask(ctx.message("node.forms.create.app_name"))
|
|
11
11
|
self.name = format_name
|
|
12
12
|
self.type = ask_type
|
|
13
13
|
res = ShopifyCLI::Tasks::SelectOrgAndShop.call(ctx, organization_id: organization_id, shop_domain: shop_domain)
|
|
@@ -18,12 +18,12 @@ module Node
|
|
|
18
18
|
private
|
|
19
19
|
|
|
20
20
|
def format_name
|
|
21
|
-
|
|
21
|
+
formatted_name = name.downcase.split(" ").join("_")
|
|
22
22
|
|
|
23
|
-
if
|
|
23
|
+
if formatted_name.include?("shopify")
|
|
24
24
|
ctx.abort(ctx.message("node.forms.create.error.invalid_app_name"))
|
|
25
25
|
end
|
|
26
|
-
|
|
26
|
+
formatted_name
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def ask_type
|
|
@@ -5,160 +5,13 @@ module Node
|
|
|
5
5
|
MESSAGES = {
|
|
6
6
|
node: {
|
|
7
7
|
help: <<~HELP,
|
|
8
|
-
Suite of commands for developing Node.js apps. See {{command:%1$s node <command> --help}} for usage of each command.
|
|
9
|
-
Usage: {{command:%1$s node [ %2$s ]}}
|
|
8
|
+
Suite of commands for developing Node.js apps. See {{command:%1$s app node <command> --help}} for usage of each command.
|
|
9
|
+
Usage: {{command:%1$s app node [ %2$s ]}}
|
|
10
10
|
HELP
|
|
11
11
|
|
|
12
12
|
error: {
|
|
13
13
|
generic: "Error",
|
|
14
14
|
},
|
|
15
|
-
|
|
16
|
-
connect: {
|
|
17
|
-
connected: "Project now connected to {{green:%s}}",
|
|
18
|
-
help: <<~HELP,
|
|
19
|
-
{{command:%s node connect}}: Connects an existing Node.js app to Shopify CLI. Creates a config file.
|
|
20
|
-
Usage: {{command:%s node connect}}
|
|
21
|
-
HELP
|
|
22
|
-
production_warning: <<~MESSAGE,
|
|
23
|
-
{{yellow:! Warning: if you have connected to an {{bold:app in production}}, running {{command:serve}} may update the app URL and cause an outage.
|
|
24
|
-
MESSAGE
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
create: {
|
|
28
|
-
help: <<~HELP,
|
|
29
|
-
{{command:%s node create}}: Creates an embedded nodejs app.
|
|
30
|
-
Usage: {{command:%s node create}}
|
|
31
|
-
Options:
|
|
32
|
-
{{command:--name=NAME}} App name. Any string.
|
|
33
|
-
{{command:--organization-id=ID}} Partner organization ID. Must be an existing organization.
|
|
34
|
-
{{command:--store=MYSHOPIFYDOMAIN }} Development store URL. Must be an existing development store.
|
|
35
|
-
HELP
|
|
36
|
-
error: {
|
|
37
|
-
node_required: "node is required to create an app project. Download at https://nodejs.org/en/download.",
|
|
38
|
-
node_version_failure: "Failed to get the current node version. Please make sure it is installed as " \
|
|
39
|
-
"per the instructions at https://nodejs.org/en.",
|
|
40
|
-
npm_required: "npm is required to create an app project. Download at https://www.npmjs.com/get-npm.",
|
|
41
|
-
npm_version_failure: "Failed to get the current npm version. Please make sure it is installed as per " \
|
|
42
|
-
"the instructions at https://www.npmjs.com/get-npm.",
|
|
43
|
-
},
|
|
44
|
-
node_version: "node %s",
|
|
45
|
-
npm_version: "npm %s",
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
deploy: {
|
|
49
|
-
help: <<~HELP,
|
|
50
|
-
Deploy the current Node project to a hosting service. Heroku ({{underline:https://www.heroku.com}}) is currently the only option, but more will be added in the future.
|
|
51
|
-
Usage: {{command:%s node deploy [ heroku ]}}
|
|
52
|
-
HELP
|
|
53
|
-
extended_help: <<~HELP,
|
|
54
|
-
{{bold:Subcommands:}}
|
|
55
|
-
{{cyan:heroku}}: Deploys the current Node project to Heroku.
|
|
56
|
-
Usage: {{command:%s node deploy heroku}}
|
|
57
|
-
HELP
|
|
58
|
-
heroku: {
|
|
59
|
-
help: <<~HELP,
|
|
60
|
-
Deploy the current Node project to Heroku
|
|
61
|
-
Usage: {{command:%s node deploy heroku}}
|
|
62
|
-
HELP
|
|
63
|
-
downloading: "Downloading Heroku CLI…",
|
|
64
|
-
downloaded: "Downloaded Heroku CLI",
|
|
65
|
-
installing: "Installing Heroku CLI…",
|
|
66
|
-
installing_windows: "Running Heroku CLI install wizard…",
|
|
67
|
-
installed: "Installed Heroku CLI",
|
|
68
|
-
authenticating: "Authenticating with Heroku…",
|
|
69
|
-
authenticated: "{{v}} Authenticated with Heroku",
|
|
70
|
-
authenticated_with_account: "{{v}} Authenticated with Heroku as {{green:%s}}",
|
|
71
|
-
deploying: "Deploying to Heroku…",
|
|
72
|
-
deployed: "{{v}} Deployed to Heroku",
|
|
73
|
-
git: {
|
|
74
|
-
checking: "Checking git repo…",
|
|
75
|
-
initialized: "Git repo initialized",
|
|
76
|
-
what_branch: "What branch would you like to deploy?",
|
|
77
|
-
branch_selected: "{{v}} Git branch {{green:%s}} selected for deploy",
|
|
78
|
-
},
|
|
79
|
-
app: {
|
|
80
|
-
no_apps_found: "No existing Heroku app found. What would you like to do?",
|
|
81
|
-
name: "What is your Heroku app’s name?",
|
|
82
|
-
select: "Specify an existing Heroku app",
|
|
83
|
-
selecting: "Selecting Heroku app %s…",
|
|
84
|
-
selected: "{{v}} Heroku app {{green:%s}} selected",
|
|
85
|
-
create: "Create a new Heroku app",
|
|
86
|
-
creating: "Creating new Heroku app…",
|
|
87
|
-
created: "{{v}} New Heroku app created",
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
generate: {
|
|
93
|
-
help: <<~HELP,
|
|
94
|
-
{{red:The {{command:generate}} command is no longer supported.}}
|
|
95
|
-
You can complete any tasks previously supported by {{command:generate}} with these guides:
|
|
96
|
-
{{green:page}}
|
|
97
|
-
Create a page with Polaris design components: {{green:https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react/build-your-user-interface-with-polaris}}
|
|
98
|
-
|
|
99
|
-
{{green:webhook}}
|
|
100
|
-
Register and process webhooks: {{green:https://github.com/Shopify/shopify-node-api/blob/main/docs/usage/webhooks.md}}
|
|
101
|
-
|
|
102
|
-
{{green:billing}}
|
|
103
|
-
Create and manage app billing models: {{green:https://shopify.dev/tutorials/bill-for-your-app-using-graphql-admin-api}}
|
|
104
|
-
HELP
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
open: {
|
|
108
|
-
help: <<~HELP,
|
|
109
|
-
Open your local development app in the default browser.
|
|
110
|
-
Usage: {{command:%s node open}}
|
|
111
|
-
HELP
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
serve: {
|
|
115
|
-
help: <<~HELP,
|
|
116
|
-
Start a local development node server for your project, as well as a public ngrok tunnel to your localhost.
|
|
117
|
-
Usage: {{command:%s node serve}}
|
|
118
|
-
HELP
|
|
119
|
-
extended_help: <<~HELP,
|
|
120
|
-
{{bold:Options:}}
|
|
121
|
-
{{cyan:--host=HOST}}: Bypass running tunnel and use custom host. HOST must be HTTPS url.
|
|
122
|
-
{{cyan:--port=PORT}}: Use custom port.
|
|
123
|
-
HELP
|
|
124
|
-
|
|
125
|
-
error: {
|
|
126
|
-
host_must_be_https: "HOST must be a HTTPS url.",
|
|
127
|
-
invalid_port: "%s is not a valid port.",
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
open_info: <<~MESSAGE,
|
|
131
|
-
{{*}} To install and start using your app, open this URL in your browser:
|
|
132
|
-
{{green:%s}}
|
|
133
|
-
MESSAGE
|
|
134
|
-
running_server: "Running server…",
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
tunnel: {
|
|
138
|
-
help: <<~HELP,
|
|
139
|
-
Start or stop an http tunnel to your local development app using ngrok.
|
|
140
|
-
Usage: {{command:%s node tunnel [ auth | start | stop ]}}
|
|
141
|
-
HELP
|
|
142
|
-
extended_help: <<~HELP,
|
|
143
|
-
{{bold:Subcommands:}}
|
|
144
|
-
|
|
145
|
-
{{cyan:auth}}: Writes an ngrok auth token to ~/.ngrok2/ngrok.yml to connect with an ngrok account. Visit https://dashboard.ngrok.com/signup to sign up.
|
|
146
|
-
Usage: {{command:%1$s node tunnel auth <token>}}
|
|
147
|
-
|
|
148
|
-
{{cyan:start}}: Starts an ngrok tunnel, will print the URL for an existing tunnel if already running.
|
|
149
|
-
Usage: {{command:%1$s node tunnel start}}
|
|
150
|
-
|
|
151
|
-
{{cyan:stop}}: Stops the ngrok tunnel.
|
|
152
|
-
Usage: {{command:%1$s node tunnel stop}}
|
|
153
|
-
|
|
154
|
-
HELP
|
|
155
|
-
|
|
156
|
-
error: {
|
|
157
|
-
token_argument_missing: "{{x}} {{red:auth requires a token argument}}\n\n",
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
},
|
|
161
|
-
|
|
162
15
|
forms: {
|
|
163
16
|
create: {
|
|
164
17
|
error: {
|
|
@@ -5,17 +5,6 @@ module PHP
|
|
|
5
5
|
register_messages(PHP::Messages::MESSAGES)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
# define/autoload project specific Commands
|
|
9
|
-
class Command < ShopifyCLI::ProjectCommands
|
|
10
|
-
subcommand :Connect, "connect", Project.project_filepath("commands/connect")
|
|
11
|
-
subcommand :Create, "create", Project.project_filepath("commands/create")
|
|
12
|
-
subcommand :Deploy, "deploy", Project.project_filepath("commands/deploy")
|
|
13
|
-
subcommand :Open, "open", Project.project_filepath("commands/open")
|
|
14
|
-
subcommand :Serve, "serve", Project.project_filepath("commands/serve")
|
|
15
|
-
subcommand :Tunnel, "tunnel", Project.project_filepath("commands/tunnel")
|
|
16
|
-
end
|
|
17
|
-
ShopifyCLI::Commands.register("PHP::Command", "php")
|
|
18
|
-
|
|
19
8
|
# define/autoload project specific Tasks
|
|
20
9
|
module Tasks
|
|
21
10
|
end
|
|
@@ -3,11 +3,10 @@ require "uri"
|
|
|
3
3
|
module PHP
|
|
4
4
|
module Forms
|
|
5
5
|
class Create < ShopifyCLI::Form
|
|
6
|
-
|
|
7
|
-
flag_arguments :title, :organization_id, :shop_domain, :type
|
|
6
|
+
flag_arguments :name, :organization_id, :shop_domain, :type
|
|
8
7
|
|
|
9
8
|
def ask
|
|
10
|
-
self.
|
|
9
|
+
self.name ||= CLI::UI::Prompt.ask(ctx.message("php.forms.create.app_name"))
|
|
11
10
|
self.name = format_name
|
|
12
11
|
self.type = ask_type
|
|
13
12
|
res = ShopifyCLI::Tasks::SelectOrgAndShop.call(ctx, organization_id: organization_id, shop_domain: shop_domain)
|
|
@@ -18,12 +17,12 @@ module PHP
|
|
|
18
17
|
private
|
|
19
18
|
|
|
20
19
|
def format_name
|
|
21
|
-
|
|
20
|
+
formatted_name = name.downcase.split(" ").join("_")
|
|
22
21
|
|
|
23
|
-
if
|
|
22
|
+
if formatted_name.include?("shopify")
|
|
24
23
|
ctx.abort(ctx.message("php.forms.create.error.invalid_app_name"))
|
|
25
24
|
end
|
|
26
|
-
|
|
25
|
+
formatted_name
|
|
27
26
|
end
|
|
28
27
|
|
|
29
28
|
def ask_type
|