shopify-cli 2.6.4 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer.json +5 -0
- data/.github/DESIGN.md +1 -1
- data/.github/ISSUE_TEMPLATE.md +7 -0
- data/.gitignore +1 -0
- data/.vscode/extensions.json +5 -0
- data/.vscode/settings.json +9 -0
- data/CHANGELOG.md +35 -3
- data/CONTRIBUTING.md +1 -21
- data/{Dockerfile → Codespace.dockerfile} +11 -3
- data/Gemfile +1 -0
- data/Gemfile.lock +6 -4
- data/README.md +20 -99
- data/Rakefile +27 -0
- 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/ext/javy/javy.rb +186 -0
- data/ext/javy/version +1 -0
- data/lib/project_types/extension/cli.rb +7 -3
- data/lib/project_types/extension/commands/build.rb +1 -0
- 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 +1 -8
- 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/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 +11 -10
- 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 -144
- 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 -161
- 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 -151
- data/lib/project_types/script/cli.rb +2 -1
- data/lib/project_types/script/commands/create.rb +2 -5
- data/lib/project_types/script/commands/javy.rb +31 -0
- data/lib/project_types/script/commands/push.rb +1 -1
- data/lib/project_types/script/config/extension_points.yml +3 -0
- data/lib/project_types/script/errors.rb +0 -18
- data/lib/project_types/script/layers/application/create_script.rb +2 -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 +8 -3
- data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +22 -3
- data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +25 -0
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +3 -4
- data/lib/project_types/script/layers/infrastructure/script_service.rb +1 -1
- data/lib/project_types/script/messages/messages.rb +16 -22
- data/lib/project_types/script/ui/error_handler.rb +1 -27
- 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 +9 -2
- data/lib/project_types/theme/messages/messages.rb +30 -1
- 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 +24 -20
- 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 +7 -2
- 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.rb +1 -0
- data/lib/shopify_cli/constants.rb +4 -0
- data/lib/shopify_cli/exception_reporter.rb +8 -6
- 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 +253 -9
- 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/services/app/connect_service.rb +25 -0
- data/lib/shopify_cli/services/app/create/node_service.rb +155 -0
- data/lib/shopify_cli/services/app/create/php_service.rb +152 -0
- data/lib/shopify_cli/services/app/create/rails_service.rb +215 -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.rb +31 -0
- data/lib/shopify_cli/theme/dev_server/local_assets.rb +1 -1
- data/lib/shopify_cli/theme/dev_server.rb +35 -17
- data/lib/shopify_cli/tunnel.rb +25 -20
- data/lib/shopify_cli/version.rb +1 -1
- data/lib/shopify_cli.rb +1 -2
- data/shopify-cli.gemspec +2 -6
- data/shopify-dev +18 -0
- data/utilities/constants.rb +7 -0
- data/utilities/docker/container.rb +30 -2
- data/utilities/docker.rb +3 -2
- data/utilities/utilities.rb +1 -0
- data/vendor/deps/cli-kit/lib/cli/kit/system.rb +1 -1
- metadata +56 -53
- 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 -45
- 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 -48
- 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 -51
- 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/sub_command.rb +0 -17
- data/shopify.fish +0 -12
- data/shopify.sh +0 -11
@@ -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
|
22
|
-
property :context, accepts: ShopifyCLI::Context
|
17
|
+
property! :type, accepts: Models::DevelopmentServerRequirements::SUPPORTED_EXTENSION_TYPES
|
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,155 +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
|
-
open_info: <<~MESSAGE,
|
126
|
-
{{*}} To install and start using your app, open this URL in your browser:
|
127
|
-
{{green:%s}}
|
128
|
-
MESSAGE
|
129
|
-
running_server: "Running server…",
|
130
|
-
},
|
131
|
-
|
132
|
-
tunnel: {
|
133
|
-
help: <<~HELP,
|
134
|
-
Start or stop an http tunnel to your local development app using ngrok.
|
135
|
-
Usage: {{command:%s node tunnel [ auth | start | stop ]}}
|
136
|
-
HELP
|
137
|
-
extended_help: <<~HELP,
|
138
|
-
{{bold:Subcommands:}}
|
139
|
-
|
140
|
-
{{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.
|
141
|
-
Usage: {{command:%1$s node tunnel auth <token>}}
|
142
|
-
|
143
|
-
{{cyan:start}}: Starts an ngrok tunnel, will print the URL for an existing tunnel if already running.
|
144
|
-
Usage: {{command:%1$s node tunnel start}}
|
145
|
-
|
146
|
-
{{cyan:stop}}: Stops the ngrok tunnel.
|
147
|
-
Usage: {{command:%1$s node tunnel stop}}
|
148
|
-
|
149
|
-
HELP
|
150
|
-
|
151
|
-
error: {
|
152
|
-
token_argument_missing: "{{x}} {{red:auth requires a token argument}}\n\n",
|
153
|
-
},
|
154
|
-
|
155
|
-
},
|
156
|
-
|
157
15
|
forms: {
|
158
16
|
create: {
|
159
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
|
@@ -5,168 +5,9 @@ module PHP
|
|
5
5
|
MESSAGES = {
|
6
6
|
php: {
|
7
7
|
help: <<~HELP,
|
8
|
-
Suite of commands for developing PHP apps with Laravel. See {{command:%1$s php <command> --help}} for usage of each command.
|
9
|
-
Usage: {{command:%1$s php [ %2$s ]}}
|
8
|
+
Suite of commands for developing PHP apps with Laravel. See {{command:%1$s app php <command> --help}} for usage of each command.
|
9
|
+
Usage: {{command:%1$s app php [ %2$s ]}}
|
10
10
|
HELP
|
11
|
-
|
12
|
-
connect: {
|
13
|
-
connected: "Project now connected to {{green:%s}}",
|
14
|
-
help: <<~HELP,
|
15
|
-
{{command:%s php connect}}: Connects an existing PHP app to Shopify CLI. Creates a config file.
|
16
|
-
Usage: {{command:%s php connect}}
|
17
|
-
HELP
|
18
|
-
production_warning: <<~MESSAGE,
|
19
|
-
{{yellow:! Warning: if you have connected to an {{bold:app in production}}, running {{command:serve}} may update the app URL and cause an outage.
|
20
|
-
MESSAGE
|
21
|
-
},
|
22
|
-
|
23
|
-
create: {
|
24
|
-
help: <<~HELP,
|
25
|
-
{{command:%s create php}}: Creates an embedded PHP app.
|
26
|
-
Usage: {{command:%s create php}}
|
27
|
-
Options:
|
28
|
-
{{command:--name=NAME}} App name. Any string.
|
29
|
-
{{command:--organization-id=ID}} Partner organization ID. Must be an existing organization.
|
30
|
-
{{command:--shop-domain=MYSHOPIFYDOMAIN}} Development store URL. Must be an existing development store.
|
31
|
-
{{command:--type=APPTYPE}} Whether this app is public or custom.
|
32
|
-
{{command:--verbose}} Output verbose information when installing dependencies.
|
33
|
-
HELP
|
34
|
-
|
35
|
-
error: {
|
36
|
-
php_required: <<~VERSION,
|
37
|
-
PHP is required to create an app project. For installation instructions, visit:
|
38
|
-
{{underline:https://www.php.net/manual/en/install.php}}
|
39
|
-
VERSION
|
40
|
-
php_version_failure: <<~VERSION,
|
41
|
-
Failed to get the current PHP version. Please make sure it is installed as per the instructions at:
|
42
|
-
{{underline:https://www.php.net/manual/en/install.php.}}
|
43
|
-
VERSION
|
44
|
-
php_version_too_low: "Your PHP version is too low. Please use version %s or higher.",
|
45
|
-
composer_required: <<~COMPOSER,
|
46
|
-
Composer is required to create an app project. Download at:
|
47
|
-
{{underline:https://getcomposer.org/download/}}
|
48
|
-
COMPOSER
|
49
|
-
npm_required: "npm is required to create an app project. Download at https://www.npmjs.com/get-npm.",
|
50
|
-
npm_version_failure: "Failed to get the current npm version. Please make sure it is installed as per " \
|
51
|
-
"the instructions at https://www.npmjs.com/get-npm.",
|
52
|
-
app_setup: "Failed to set up the app",
|
53
|
-
},
|
54
|
-
|
55
|
-
php_version: "PHP %s",
|
56
|
-
npm_version: "npm %s",
|
57
|
-
app_setting_up: "Setting up app…",
|
58
|
-
app_set_up: "App is now set up",
|
59
|
-
},
|
60
|
-
|
61
|
-
open: {
|
62
|
-
help: <<~HELP,
|
63
|
-
Open your local development app in the default browser.
|
64
|
-
Usage: {{command:%s open}}
|
65
|
-
HELP
|
66
|
-
},
|
67
|
-
|
68
|
-
deploy: {
|
69
|
-
help: <<~HELP,
|
70
|
-
Deploy the current PHP project to a hosting service. Heroku ({{underline:https://www.heroku.com}}) is currently the only option, but more will be added in the future.
|
71
|
-
Usage: {{command:%s deploy [ heroku ]}}
|
72
|
-
HELP
|
73
|
-
|
74
|
-
extended_help: <<~HELP,
|
75
|
-
{{bold:Subcommands:}}
|
76
|
-
{{cyan:heroku}}: Deploys the current PHP project to Heroku.
|
77
|
-
Usage: {{command:%s deploy heroku}}
|
78
|
-
HELP
|
79
|
-
|
80
|
-
heroku: {
|
81
|
-
help: <<~HELP,
|
82
|
-
Deploy the current PHP project to Heroku
|
83
|
-
Usage: {{command:%s deploy heroku}}
|
84
|
-
HELP
|
85
|
-
|
86
|
-
error: {
|
87
|
-
generate_app_key: "Failed to generate Laravel APP_KEY",
|
88
|
-
},
|
89
|
-
|
90
|
-
downloading: "Downloading Heroku CLI…",
|
91
|
-
downloaded: "Downloaded Heroku CLI",
|
92
|
-
installing: "Installing Heroku CLI…",
|
93
|
-
installing_windows: "Running Heroku CLI install wizard…",
|
94
|
-
installed: "Installed Heroku CLI",
|
95
|
-
authenticating: "Authenticating with Heroku…",
|
96
|
-
authenticated: "{{v}} Authenticated with Heroku",
|
97
|
-
authenticated_with_account: "{{v}} Authenticated with Heroku as `%s`",
|
98
|
-
deploying: "Deploying to Heroku…",
|
99
|
-
deployed: "Deployed to Heroku",
|
100
|
-
post_deploy: <<~DEPLOYED,
|
101
|
-
{{v}} Deployed to Heroku, you can access your app at {{green:%s}}
|
102
|
-
|
103
|
-
If you're deploying this app for the first time, make sure to set up your database and your app's environment at {{bold:App dashboard -> Settings -> Config Vars}}.
|
104
|
-
|
105
|
-
When setting your config vars, don't forget to set up your database and the appropriate Laravel values for it, particularly {{bold:DB_CONNECTION and DB_DATABASE}}.
|
106
|
-
DEPLOYED
|
107
|
-
git: {
|
108
|
-
checking: "Checking git repo…",
|
109
|
-
initialized: "Git repo initialized",
|
110
|
-
what_branch: "What branch would you like to deploy?",
|
111
|
-
branch_selected: "{{v}} Git branch `%s` selected for deploy",
|
112
|
-
},
|
113
|
-
app: {
|
114
|
-
no_apps_found: "No existing Heroku app found. What would you like to do?",
|
115
|
-
name: "What is your Heroku app’s name?",
|
116
|
-
select: "Specify an existing Heroku app",
|
117
|
-
selecting: "Selecting Heroku app `%s`…",
|
118
|
-
selected: "{{v}} Heroku app `%s` selected",
|
119
|
-
create: "Create a new Heroku app",
|
120
|
-
creating: "Creating new Heroku app…",
|
121
|
-
created: "{{v}} New Heroku app created",
|
122
|
-
setting_configs: "Setting Shopify app configs…",
|
123
|
-
configs_set: "{{v}} Shopify app configs set",
|
124
|
-
},
|
125
|
-
},
|
126
|
-
},
|
127
|
-
|
128
|
-
serve: {
|
129
|
-
help: <<~HELP,
|
130
|
-
Start a local development PHP server for your project, as well as a public ngrok tunnel to your localhost.
|
131
|
-
Usage: {{command:%s serve}}
|
132
|
-
HELP
|
133
|
-
extended_help: <<~HELP,
|
134
|
-
{{bold:Options:}}
|
135
|
-
{{cyan:--host=HOST}}: Bypass running tunnel and use custom host. HOST must be HTTPS url.
|
136
|
-
{{cyan:--port=PORT}}: Use custom port.
|
137
|
-
HELP
|
138
|
-
|
139
|
-
open_info: <<~MESSAGE,
|
140
|
-
{{*}} To install and start using your app, open this URL in your browser:
|
141
|
-
{{green:%s}}
|
142
|
-
MESSAGE
|
143
|
-
running_server: "Running server…",
|
144
|
-
},
|
145
|
-
|
146
|
-
tunnel: {
|
147
|
-
help: <<~HELP,
|
148
|
-
Start or stop an http tunnel to your local development app using ngrok.
|
149
|
-
Usage: {{command:%s tunnel [ auth | start | stop ]}}
|
150
|
-
HELP
|
151
|
-
extended_help: <<~HELP,
|
152
|
-
{{bold:Subcommands:}}
|
153
|
-
|
154
|
-
{{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.
|
155
|
-
Usage: {{command:%1$s tunnel auth <token>}}
|
156
|
-
|
157
|
-
{{cyan:start}}: Starts an ngrok tunnel, will print the URL for an existing tunnel if already running.
|
158
|
-
Usage: {{command:%1$s tunnel start}}
|
159
|
-
|
160
|
-
{{cyan:stop}}: Stops the ngrok tunnel.
|
161
|
-
Usage: {{command:%1$s tunnel stop}}
|
162
|
-
|
163
|
-
HELP
|
164
|
-
|
165
|
-
error: {
|
166
|
-
token_argument_missing: "{{x}} {{red:auth requires a token argument}}\n\n",
|
167
|
-
},
|
168
|
-
},
|
169
|
-
|
170
11
|
forms: {
|
171
12
|
create: {
|
172
13
|
error: {
|
@@ -5,22 +5,6 @@ module Rails
|
|
5
5
|
register_messages(Rails::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("Rails::Command", "rails")
|
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")
|
@@ -1,8 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module Rails
|
3
3
|
class Command
|
4
|
-
class Create < ShopifyCLI::
|
5
|
-
|
4
|
+
class Create < ShopifyCLI::Command::AppSubCommand
|
5
|
+
unless ShopifyCLI::Environment.acceptance_test?
|
6
|
+
prerequisite_task :ensure_authenticated
|
7
|
+
end
|
6
8
|
|
7
9
|
USER_AGENT_CODE = <<~USERAGENT
|
8
10
|
module ShopifyAPI
|
@@ -31,8 +33,8 @@ module Rails
|
|
31
33
|
end
|
32
34
|
|
33
35
|
def call(args, _name)
|
34
|
-
|
35
|
-
return @ctx.puts(self.class.help) if
|
36
|
+
form_data = self.form_data(args)
|
37
|
+
return @ctx.puts(self.class.help) if form_data.nil?
|
36
38
|
|
37
39
|
ruby_version = Ruby.version(@ctx)
|
38
40
|
@ctx.abort(@ctx.message("rails.create.error.invalid_ruby_version")) unless
|
@@ -41,34 +43,61 @@ module Rails
|
|
41
43
|
check_node
|
42
44
|
check_yarn
|
43
45
|
|
44
|
-
build(
|
46
|
+
build(form_data.name, form_data.db)
|
47
|
+
|
45
48
|
set_custom_ua
|
46
49
|
ShopifyCLI::Project.write(
|
47
50
|
@ctx,
|
48
51
|
project_type: "rails",
|
49
|
-
organization_id:
|
52
|
+
organization_id: form_data.organization_id,
|
50
53
|
)
|
51
54
|
|
52
|
-
api_client = ShopifyCLI::
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
api_client = if ShopifyCLI::Environment.acceptance_test?
|
56
|
+
{
|
57
|
+
"apiKey" => "public_api_key",
|
58
|
+
"apiSecretKeys" => [
|
59
|
+
{
|
60
|
+
"secret" => "api_secret_key",
|
61
|
+
},
|
62
|
+
],
|
63
|
+
}
|
64
|
+
else
|
65
|
+
ShopifyCLI::Tasks::CreateApiClient.call(
|
66
|
+
@ctx,
|
67
|
+
org_id: form_data.organization_id,
|
68
|
+
title: form_data.title,
|
69
|
+
type: form_data.type,
|
70
|
+
)
|
71
|
+
end
|
58
72
|
|
59
73
|
ShopifyCLI::Resources::EnvFile.new(
|
60
74
|
api_key: api_client["apiKey"],
|
61
75
|
secret: api_client["apiSecretKeys"].first["secret"],
|
62
|
-
shop:
|
76
|
+
shop: form_data.shop_domain,
|
63
77
|
scopes: "write_products,write_customers,write_draft_orders",
|
64
78
|
).write(@ctx)
|
65
79
|
|
66
|
-
partners_url = ShopifyCLI::PartnersAPI.partners_url_for(
|
80
|
+
partners_url = ShopifyCLI::PartnersAPI.partners_url_for(form_data.organization_id, api_client["id"])
|
67
81
|
|
68
|
-
@ctx.puts(@ctx.message("apps.create.info.created",
|
69
|
-
@ctx.puts(@ctx.message("apps.create.info.serve",
|
82
|
+
@ctx.puts(@ctx.message("apps.create.info.created", form_data.title, partners_url))
|
83
|
+
@ctx.puts(@ctx.message("apps.create.info.serve", form_data.name, ShopifyCLI::TOOL_NAME, "rails"))
|
70
84
|
unless ShopifyCLI::Shopifolk.acting_as_shopify_organization?
|
71
|
-
@ctx.puts(@ctx.message("apps.create.info.install", partners_url,
|
85
|
+
@ctx.puts(@ctx.message("apps.create.info.install", partners_url, form_data.title))
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def form_data(args)
|
90
|
+
if ShopifyCLI::Environment.acceptance_test?
|
91
|
+
Struct.new(:title, :name, :organization_id, :type, :shop_domain, :db, keyword_init: true).new(
|
92
|
+
title: options.flags[:title],
|
93
|
+
name: options.flags[:title],
|
94
|
+
organization_id: "123",
|
95
|
+
shop_domain: "test.shopify.io",
|
96
|
+
type: "public",
|
97
|
+
db: options.flags[:db]
|
98
|
+
)
|
99
|
+
else
|
100
|
+
Forms::Create.ask(@ctx, args, options.flags)
|
72
101
|
end
|
73
102
|
end
|
74
103
|
|
@@ -3,12 +3,10 @@ require "uri"
|
|
3
3
|
module Rails
|
4
4
|
module Forms
|
5
5
|
class Create < ShopifyCLI::Form
|
6
|
-
|
7
|
-
flag_arguments :title, :organization_id, :shop_domain, :type, :db
|
6
|
+
flag_arguments :name, :organization_id, :shop_domain, :type, :db
|
8
7
|
VALID_DB_TYPES = ["sqlite3",
|
9
8
|
"mysql",
|
10
9
|
"postgresql",
|
11
|
-
"sqlite3",
|
12
10
|
"oracle",
|
13
11
|
"frontbase",
|
14
12
|
"ibm_db",
|
@@ -19,7 +17,7 @@ module Rails
|
|
19
17
|
"jdbc"]
|
20
18
|
|
21
19
|
def ask
|
22
|
-
self.
|
20
|
+
self.name ||= CLI::UI::Prompt.ask(ctx.message("rails.forms.create.app_name"))
|
23
21
|
self.name = format_name
|
24
22
|
self.type = ask_type
|
25
23
|
res = ShopifyCLI::Tasks::SelectOrgAndShop.call(ctx, organization_id: organization_id, shop_domain: shop_domain)
|
@@ -31,13 +29,13 @@ module Rails
|
|
31
29
|
private
|
32
30
|
|
33
31
|
def format_name
|
34
|
-
|
32
|
+
formatted_name = name.downcase.split(" ").join("_")
|
35
33
|
|
36
|
-
if
|
34
|
+
if formatted_name.include?("shopify")
|
37
35
|
ctx.abort(ctx.message("rails.forms.create.error.invalid_app_name"))
|
38
36
|
end
|
39
37
|
|
40
|
-
|
38
|
+
formatted_name
|
41
39
|
end
|
42
40
|
|
43
41
|
def ask_type
|