shopify-cli 1.3.0 → 1.6.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/.github/CODEOWNERS +2 -2
- data/.github/CONTRIBUTING.md +9 -1
- data/.github/PULL_REQUEST_TEMPLATE.md +10 -1
- data/.github/workflows/release.yml +61 -0
- data/.github/workflows/triage.yml +22 -0
- data/.gitignore +0 -1
- data/.rubocop.yml +61 -8
- data/.rubocop_todo.yml +11 -0
- data/.travis.yml +1 -0
- data/CHANGELOG.md +30 -0
- data/Gemfile +3 -2
- data/Gemfile.lock +39 -37
- data/README.md +39 -7
- data/RELEASING.md +19 -29
- data/Rakefile +2 -0
- data/dev.yml +2 -2
- data/docs/_config.yml +1 -18
- data/docs/app/node/commands/index.md +2 -80
- data/docs/app/node/index.md +2 -33
- data/docs/app/rails/commands/index.md +2 -78
- data/docs/app/rails/index.md +2 -34
- data/docs/core/index.md +2 -84
- data/docs/getting-started/index.md +2 -25
- data/docs/getting-started/install/index.md +1 -118
- data/docs/getting-started/migrate/index.md +2 -94
- data/docs/getting-started/uninstall/index.md +2 -35
- data/docs/getting-started/upgrade/index.md +2 -39
- data/docs/help/start-app/index.md +2 -4
- data/docs/index.md +2 -24
- data/install.sh +1 -1
- data/lib/project_types/extension/cli.rb +21 -11
- data/lib/project_types/extension/commands/extension_command.rb +2 -2
- data/lib/project_types/extension/features/argo.rb +117 -0
- data/lib/project_types/extension/forms/create.rb +2 -2
- data/lib/project_types/extension/models/specification.rb +35 -0
- data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +19 -0
- data/lib/project_types/extension/models/specification_handlers/default.rb +67 -0
- data/lib/project_types/extension/models/specifications.rb +77 -0
- data/lib/project_types/extension/tasks/configure_features.rb +52 -0
- data/lib/project_types/extension/tasks/fetch_specifications.rb +38 -0
- data/lib/project_types/node/cli.rb +4 -1
- data/lib/project_types/node/commands/connect.rb +15 -0
- data/lib/project_types/node/commands/create.rb +10 -4
- data/lib/project_types/node/commands/generate.rb +2 -11
- data/lib/project_types/node/messages/messages.rb +16 -50
- data/lib/project_types/rails/cli.rb +4 -1
- data/lib/project_types/rails/commands/connect.rb +15 -0
- data/lib/project_types/rails/commands/create.rb +15 -12
- data/lib/project_types/rails/forms/create.rb +1 -1
- data/lib/project_types/rails/gem.rb +1 -1
- data/lib/project_types/rails/messages/messages.rb +8 -5
- data/lib/project_types/script/cli.rb +9 -5
- data/lib/project_types/script/commands/create.rb +6 -4
- data/lib/project_types/script/commands/enable.rb +12 -4
- data/lib/project_types/script/commands/push.rb +5 -13
- data/lib/project_types/script/config/extension_points.yml +17 -12
- data/lib/project_types/script/errors.rb +21 -0
- data/lib/project_types/script/forms/create.rb +26 -2
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +10 -1
- data/lib/project_types/script/layers/application/build_script.rb +18 -17
- data/lib/project_types/script/layers/application/create_script.rb +12 -10
- data/lib/project_types/script/layers/application/extension_points.rb +24 -0
- data/lib/project_types/script/layers/application/push_script.rb +18 -16
- data/lib/project_types/script/layers/domain/errors.rb +7 -0
- data/lib/project_types/script/layers/domain/extension_point.rb +62 -7
- data/lib/project_types/script/layers/domain/metadata.rb +55 -0
- data/lib/project_types/script/layers/domain/push_package.rb +25 -6
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +17 -52
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +42 -11
- data/lib/project_types/script/layers/infrastructure/errors.rb +16 -0
- data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +10 -4
- data/lib/project_types/script/layers/infrastructure/project_creator.rb +2 -1
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +25 -13
- data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +72 -0
- data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +59 -0
- data/lib/project_types/script/layers/infrastructure/script_service.rb +9 -1
- data/lib/project_types/script/layers/infrastructure/task_runner.rb +4 -3
- data/lib/project_types/script/messages/messages.rb +55 -4
- data/lib/project_types/script/script_project.rb +25 -16
- data/lib/project_types/script/ui/error_handler.rb +59 -1
- data/lib/project_types/theme/cli.rb +40 -0
- data/lib/project_types/theme/commands/connect.rb +54 -0
- data/lib/project_types/theme/commands/create.rb +48 -0
- data/lib/project_types/theme/commands/deploy.rb +38 -0
- data/lib/project_types/theme/commands/generate.rb +20 -0
- data/lib/project_types/theme/commands/generate/env.rb +79 -0
- data/lib/project_types/theme/commands/push.rb +55 -0
- data/lib/project_types/theme/commands/serve.rb +31 -0
- data/lib/project_types/theme/forms/connect.rb +34 -0
- data/lib/project_types/theme/forms/create.rb +22 -0
- data/lib/project_types/theme/messages/messages.rb +147 -0
- data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +78 -0
- data/lib/project_types/theme/themekit.rb +113 -0
- data/lib/shopify-cli/admin_api.rb +42 -2
- data/lib/shopify-cli/api.rb +34 -33
- data/lib/shopify-cli/commands/config.rb +24 -0
- data/lib/shopify-cli/commands/connect.rb +32 -15
- data/lib/shopify-cli/commands/system.rb +10 -1
- data/lib/shopify-cli/context.rb +23 -2
- data/lib/shopify-cli/core/entry_point.rb +1 -1
- data/lib/shopify-cli/core/monorail.rb +6 -4
- data/lib/shopify-cli/feature.rb +0 -2
- data/lib/shopify-cli/http_request.rb +27 -0
- data/lib/shopify-cli/js_deps.rb +1 -1
- data/lib/shopify-cli/messages/messages.rb +31 -7
- data/lib/shopify-cli/method_object.rb +104 -0
- data/lib/shopify-cli/partners_api.rb +25 -3
- data/lib/shopify-cli/process_supervision.rb +1 -1
- data/lib/shopify-cli/project.rb +12 -8
- data/lib/shopify-cli/project_type.rb +18 -2
- data/lib/shopify-cli/resolve_constant.rb +25 -0
- data/lib/shopify-cli/result.rb +432 -0
- data/lib/shopify-cli/shopifolk.rb +87 -0
- data/lib/shopify-cli/task.rb +8 -0
- data/lib/shopify-cli/tasks/create_api_client.rb +13 -2
- data/lib/shopify-cli/tasks/ensure_env.rb +3 -0
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +10 -5
- data/lib/shopify-cli/tunnel.rb +8 -2
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +5 -1
- data/shopify.fish +1 -1
- data/shopify.sh +1 -1
- data/vendor/deps/cli-kit/REVISION +1 -1
- data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +2 -2
- data/vendor/deps/cli-kit/lib/cli/kit/system.rb +3 -3
- data/vendor/deps/cli-ui/REVISION +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui.rb +26 -22
- data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +4 -6
- data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +3 -3
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +8 -9
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +1 -0
- data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +15 -3
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +4 -11
- data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +3 -5
- data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +10 -10
- data/vendor/deps/cli-ui/lib/cli/ui/version.rb +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +56 -0
- data/vendor/deps/webrick/.gitignore +9 -0
- data/vendor/deps/webrick/Gemfile +3 -0
- data/vendor/deps/webrick/LICENSE.txt +22 -0
- data/vendor/deps/webrick/README.md +61 -0
- data/vendor/deps/webrick/Rakefile +10 -0
- data/vendor/deps/webrick/lib/webrick.rb +232 -0
- data/vendor/deps/webrick/lib/webrick/accesslog.rb +157 -0
- data/vendor/deps/webrick/lib/webrick/cgi.rb +313 -0
- data/vendor/deps/webrick/lib/webrick/compat.rb +36 -0
- data/vendor/deps/webrick/lib/webrick/config.rb +158 -0
- data/vendor/deps/webrick/lib/webrick/cookie.rb +172 -0
- data/vendor/deps/webrick/lib/webrick/htmlutils.rb +30 -0
- data/vendor/deps/webrick/lib/webrick/httpauth.rb +96 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +117 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +116 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +395 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +132 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +97 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +158 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +53 -0
- data/vendor/deps/webrick/lib/webrick/httpproxy.rb +354 -0
- data/vendor/deps/webrick/lib/webrick/httprequest.rb +636 -0
- data/vendor/deps/webrick/lib/webrick/httpresponse.rb +564 -0
- data/vendor/deps/webrick/lib/webrick/https.rb +152 -0
- data/vendor/deps/webrick/lib/webrick/httpserver.rb +294 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet.rb +23 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +152 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +47 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +126 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +88 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +552 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +47 -0
- data/vendor/deps/webrick/lib/webrick/httpstatus.rb +194 -0
- data/vendor/deps/webrick/lib/webrick/httputils.rb +512 -0
- data/vendor/deps/webrick/lib/webrick/httpversion.rb +76 -0
- data/vendor/deps/webrick/lib/webrick/log.rb +156 -0
- data/vendor/deps/webrick/lib/webrick/server.rb +381 -0
- data/vendor/deps/webrick/lib/webrick/ssl.rb +215 -0
- data/vendor/deps/webrick/lib/webrick/utils.rb +265 -0
- data/vendor/deps/webrick/lib/webrick/version.rb +18 -0
- data/vendor/deps/webrick/webrick.gemspec +74 -0
- metadata +77 -27
- data/docs/Gemfile +0 -5
- data/docs/Gemfile.lock +0 -258
- data/docs/_data/nav.yml +0 -35
- data/docs/_includes/footer.html +0 -15
- data/docs/_includes/head.html +0 -19
- data/docs/_includes/sidebar_nav.html +0 -22
- data/docs/_includes/toc.html +0 -112
- data/docs/_layouts/default.html +0 -79
- data/docs/css/docs.css +0 -157
- data/docs/images/header.png +0 -0
- data/docs/installing-ruby.md +0 -28
- data/lib/project_types/extension/features/argo/admin.rb +0 -20
- data/lib/project_types/extension/features/argo/base.rb +0 -129
- data/lib/project_types/extension/features/argo/checkout.rb +0 -20
- data/lib/project_types/extension/models/type.rb +0 -81
- data/lib/project_types/extension/models/types/checkout_post_purchase.rb +0 -23
- data/lib/project_types/extension/models/types/product_subscription.rb +0 -24
- data/lib/project_types/node/commands/generate/billing.rb +0 -39
- data/lib/project_types/node/commands/generate/page.rb +0 -59
- data/lib/project_types/node/commands/generate/webhook.rb +0 -37
- data/lib/project_types/script/layers/domain/script.rb +0 -18
- data/lib/project_types/script/layers/infrastructure/assemblyscript_tsconfig.rb +0 -38
- data/lib/project_types/script/layers/infrastructure/script_repository.rb +0 -59
- data/lib/project_types/script/templates/ts/as-pect.config.js +0 -27
- data/lib/project_types/script/templates/ts/as-pect.d.ts +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Node
|
|
3
|
+
module Commands
|
|
4
|
+
class Connect < ShopifyCli::SubCommand
|
|
5
|
+
def call(*)
|
|
6
|
+
if ShopifyCli::Project.has_current? && ShopifyCli::Project.current.env
|
|
7
|
+
@ctx.puts(@ctx.message('node.connect.production_warning'))
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
app = ShopifyCli::Commands::Connect.new.default_connect('node')
|
|
11
|
+
@ctx.done(@ctx.message('node.connect.connected', app))
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -40,11 +40,13 @@ module Node
|
|
|
40
40
|
scopes: 'write_products,write_customers,write_draft_orders',
|
|
41
41
|
).write(@ctx)
|
|
42
42
|
|
|
43
|
-
partners_url =
|
|
43
|
+
partners_url = ShopifyCli::PartnersAPI.partners_url_for(form.organization_id, api_client['id'], local_debug?)
|
|
44
44
|
|
|
45
|
-
@ctx.puts(@ctx.message('
|
|
46
|
-
@ctx.puts(@ctx.message('
|
|
47
|
-
|
|
45
|
+
@ctx.puts(@ctx.message('apps.create.info.created', form.title, partners_url))
|
|
46
|
+
@ctx.puts(@ctx.message('apps.create.info.serve', form.name, ShopifyCli::TOOL_NAME))
|
|
47
|
+
unless ShopifyCli::Shopifolk.acting_as_shopify_organization?
|
|
48
|
+
@ctx.puts(@ctx.message('apps.create.info.install', partners_url, form.title))
|
|
49
|
+
end
|
|
48
50
|
end
|
|
49
51
|
|
|
50
52
|
def self.help
|
|
@@ -112,6 +114,10 @@ module Node
|
|
|
112
114
|
@ctx.debug(e)
|
|
113
115
|
end
|
|
114
116
|
end
|
|
117
|
+
|
|
118
|
+
def local_debug?
|
|
119
|
+
@ctx.getenv(ShopifyCli::PartnersAPI::LOCAL_DEBUG)
|
|
120
|
+
end
|
|
115
121
|
end
|
|
116
122
|
end
|
|
117
123
|
end
|
|
@@ -13,20 +13,11 @@ module Node
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def self.help
|
|
16
|
-
ShopifyCli::Context.message('node.generate.help'
|
|
16
|
+
ShopifyCli::Context.message('node.generate.help')
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def self.extended_help
|
|
20
|
-
|
|
21
|
-
subcommand_registry.resolved_commands.sort.each do |name, klass|
|
|
22
|
-
extended_help += " {{cyan:#{name}}}: "
|
|
23
|
-
|
|
24
|
-
if (subcmd_help = klass.help)
|
|
25
|
-
extended_help += subcmd_help.gsub("\n ", "\n ")
|
|
26
|
-
end
|
|
27
|
-
extended_help += "\n"
|
|
28
|
-
end
|
|
29
|
-
extended_help += ShopifyCli::Context.message('node.generate.extended_help', ShopifyCli::TOOL_NAME)
|
|
20
|
+
help
|
|
30
21
|
end
|
|
31
22
|
|
|
32
23
|
def self.run_generate(script, name, ctx)
|
|
@@ -8,6 +8,13 @@ module Node
|
|
|
8
8
|
generic: "Error",
|
|
9
9
|
},
|
|
10
10
|
|
|
11
|
+
connect: {
|
|
12
|
+
connected: "Project now connected to {{green:%s}}",
|
|
13
|
+
production_warning: <<~MESSAGE,
|
|
14
|
+
{{yellow:! Warning: if you have connected to an {{bold:app in production}}, running {{command:serve}} may update the app URL and cause an outage.
|
|
15
|
+
MESSAGE
|
|
16
|
+
},
|
|
17
|
+
|
|
11
18
|
create: {
|
|
12
19
|
help: <<~HELP,
|
|
13
20
|
{{command:%s create node}}: Creates an embedded nodejs app.
|
|
@@ -26,12 +33,6 @@ module Node
|
|
|
26
33
|
npm_version_failure: "Failed to get the current npm version. Please make sure it is installed as per " \
|
|
27
34
|
"the instructions at https://www.npmjs.com/get-npm.",
|
|
28
35
|
},
|
|
29
|
-
info: {
|
|
30
|
-
created: "{{v}} {{green:%s}} was created in your Partner Dashboard {{underline:%s}}",
|
|
31
|
-
serve: "{{*}} Change directories to your new project folder {{green:%s}} and run {{command:%s serve}} " \
|
|
32
|
-
"to start a local server",
|
|
33
|
-
install: "{{*}} Then, visit {{underline:%s/test}} to install {{green:%s}} on your Dev Store",
|
|
34
|
-
},
|
|
35
36
|
node_version: "node %s",
|
|
36
37
|
npm_version: "npm %s",
|
|
37
38
|
},
|
|
@@ -82,52 +83,17 @@ module Node
|
|
|
82
83
|
|
|
83
84
|
generate: {
|
|
84
85
|
help: <<~HELP,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
{{bold:Examples:}}
|
|
90
|
-
{{cyan:%s generate webhook PRODUCTS_CREATE}}
|
|
91
|
-
Generate and register a new webhook that will be called every time a new product is created on your store.
|
|
92
|
-
EXAMPLES
|
|
93
|
-
|
|
94
|
-
error: {
|
|
95
|
-
name_exists: "%s already exists!",
|
|
96
|
-
generic: "Error generating %s",
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
billing: {
|
|
100
|
-
help: <<~HELP,
|
|
101
|
-
Enable charging for your app. This command generates the necessary code to call Shopify’s billing API.
|
|
102
|
-
Usage: {{command:%s generate billing [ one-time-billing | recurring-billing ]}}
|
|
103
|
-
HELP
|
|
104
|
-
type_select: "How would you like to charge for your app?",
|
|
105
|
-
generating: "Generating %s code ...",
|
|
106
|
-
generated: "{{green:%s}} generated in server/server.js",
|
|
107
|
-
},
|
|
86
|
+
{{red:The {{command:generate}} command is no longer supported.}}
|
|
87
|
+
You can complete any tasks previously supported by {{command:generate}} with these guides:
|
|
88
|
+
{{green:page}}
|
|
89
|
+
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}}
|
|
108
90
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
Generate a new page in your app with the specified name. New files are generated inside the project’s “/pages” directory.
|
|
112
|
-
Usage: {{command:%s generate page <pagename>}}
|
|
113
|
-
HELP
|
|
114
|
-
error: {
|
|
115
|
-
invalid_page_type: "Invalid page type.",
|
|
116
|
-
},
|
|
117
|
-
type_select: "Which template would you like to use?",
|
|
118
|
-
generating: "Generating %s page...",
|
|
119
|
-
generated: "{{green: %s}} generated in pages/%s",
|
|
120
|
-
},
|
|
91
|
+
{{green:webhook}}
|
|
92
|
+
Register and process webhooks: {{green:https://github.com/Shopify/shopify-node-api/blob/main/docs/usage/webhooks.md}}
|
|
121
93
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
Usage: {{command:%s generate webhook <type>}}
|
|
126
|
-
HELP
|
|
127
|
-
type_select: "What type of webhook would you like to create?",
|
|
128
|
-
generating: "Generating webhook: %s",
|
|
129
|
-
generated: "{{green:%s}} generated in server/server.js",
|
|
130
|
-
},
|
|
94
|
+
{{green:billing}}
|
|
95
|
+
Create and manage app billing models: {{green:https://shopify.dev/tutorials/bill-for-your-app-using-graphql-admin-api}}
|
|
96
|
+
HELP
|
|
131
97
|
},
|
|
132
98
|
|
|
133
99
|
open: {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
module Rails
|
|
3
3
|
class Project < ShopifyCli::ProjectType
|
|
4
|
-
|
|
4
|
+
title('Ruby on Rails App')
|
|
5
|
+
creator('Rails::Commands::Create')
|
|
6
|
+
connector('Rails::Commands::Connect')
|
|
5
7
|
|
|
6
8
|
register_command('Rails::Commands::Deploy', "deploy")
|
|
7
9
|
register_command('Rails::Commands::Generate', "generate")
|
|
@@ -17,6 +19,7 @@ module Rails
|
|
|
17
19
|
|
|
18
20
|
# define/autoload project specific Commands
|
|
19
21
|
module Commands
|
|
22
|
+
autoload :Connect, Project.project_filepath('commands/connect')
|
|
20
23
|
autoload :Create, Project.project_filepath('commands/create')
|
|
21
24
|
autoload :Deploy, Project.project_filepath('commands/deploy')
|
|
22
25
|
autoload :Generate, Project.project_filepath('commands/generate')
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Rails
|
|
3
|
+
module Commands
|
|
4
|
+
class Connect < ShopifyCli::SubCommand
|
|
5
|
+
def call(*)
|
|
6
|
+
if ShopifyCli::Project.has_current? && ShopifyCli::Project.current.env
|
|
7
|
+
@ctx.puts(@ctx.message('rails.connect.production_warning'))
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
app = ShopifyCli::Commands::Connect.new.default_connect('rails')
|
|
11
|
+
@ctx.done(@ctx.message('rails.connect.connected', app))
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -27,8 +27,9 @@ module Rails
|
|
|
27
27
|
form = Forms::Create.ask(@ctx, args, options.flags)
|
|
28
28
|
return @ctx.puts(self.class.help) if form.nil?
|
|
29
29
|
|
|
30
|
+
ruby_version = Ruby.version(@ctx)
|
|
30
31
|
@ctx.abort(@ctx.message('rails.create.error.invalid_ruby_version')) unless
|
|
31
|
-
|
|
32
|
+
ruby_version.satisfies?('~>2.5') || ruby_version.satisfies?('~>3.0.0')
|
|
32
33
|
|
|
33
34
|
check_node
|
|
34
35
|
check_yarn
|
|
@@ -55,11 +56,13 @@ module Rails
|
|
|
55
56
|
scopes: 'write_products,write_customers,write_draft_orders',
|
|
56
57
|
).write(@ctx)
|
|
57
58
|
|
|
58
|
-
partners_url =
|
|
59
|
+
partners_url = ShopifyCli::PartnersAPI.partners_url_for(form.organization_id, api_client['id'], local_debug?)
|
|
59
60
|
|
|
60
|
-
@ctx.puts(@ctx.message('
|
|
61
|
-
@ctx.puts(@ctx.message('
|
|
62
|
-
|
|
61
|
+
@ctx.puts(@ctx.message('apps.create.info.created', form.title, partners_url))
|
|
62
|
+
@ctx.puts(@ctx.message('apps.create.info.serve', form.name, ShopifyCli::TOOL_NAME))
|
|
63
|
+
unless ShopifyCli::Shopifolk.acting_as_shopify_organization?
|
|
64
|
+
@ctx.puts(@ctx.message('apps.create.info.install', partners_url, form.title))
|
|
65
|
+
end
|
|
63
66
|
end
|
|
64
67
|
|
|
65
68
|
def self.help
|
|
@@ -110,7 +113,7 @@ module Rails
|
|
|
110
113
|
end
|
|
111
114
|
|
|
112
115
|
def build(name, db)
|
|
113
|
-
@ctx.abort(@ctx.message('rails.create.error.install_failure', 'rails')) unless install_gem('rails')
|
|
116
|
+
@ctx.abort(@ctx.message('rails.create.error.install_failure', 'rails')) unless install_gem('rails', '<6.1')
|
|
114
117
|
@ctx.abort(@ctx.message('rails.create.error.install_failure', 'bundler ~>2.0')) unless
|
|
115
118
|
install_gem('bundler', '~>2.0')
|
|
116
119
|
|
|
@@ -133,18 +136,14 @@ module Rails
|
|
|
133
136
|
|
|
134
137
|
@ctx.puts(@ctx.message('rails.create.adding_shopify_gem'))
|
|
135
138
|
File.open(File.join(@ctx.root, 'Gemfile'), 'a') do |f|
|
|
136
|
-
f.puts "\ngem 'shopify_app', '>=
|
|
139
|
+
f.puts "\ngem 'shopify_app', '>=17.0.3'"
|
|
137
140
|
end
|
|
138
141
|
CLI::UI::Frame.open(@ctx.message('rails.create.running_bundle_install')) do
|
|
139
142
|
syscall(%w(bundle install))
|
|
140
143
|
end
|
|
141
144
|
|
|
142
145
|
CLI::UI::Frame.open(@ctx.message('rails.create.running_generator')) do
|
|
143
|
-
|
|
144
|
-
syscall(%w(spring stop))
|
|
145
|
-
rescue
|
|
146
|
-
end
|
|
147
|
-
syscall(%w(rails generate shopify_app))
|
|
146
|
+
syscall(%w(rails generate shopify_app --new-shopify-cli-app))
|
|
148
147
|
end
|
|
149
148
|
|
|
150
149
|
CLI::UI::Frame.open(@ctx.message('rails.create.running_migrations')) do
|
|
@@ -172,6 +171,10 @@ module Rails
|
|
|
172
171
|
def install_gem(name, version = nil)
|
|
173
172
|
Gem.install(@ctx, name, version)
|
|
174
173
|
end
|
|
174
|
+
|
|
175
|
+
def local_debug?
|
|
176
|
+
@ctx.getenv(ShopifyCli::PartnersAPI::LOCAL_DEBUG)
|
|
177
|
+
end
|
|
175
178
|
end
|
|
176
179
|
end
|
|
177
180
|
end
|
|
@@ -48,7 +48,7 @@ module Rails
|
|
|
48
48
|
def ask_db
|
|
49
49
|
if db.nil?
|
|
50
50
|
return 'sqlite3' unless CLI::UI::Prompt.confirm(ctx.message('rails.forms.create.db.want_select'),
|
|
51
|
-
|
|
51
|
+
default: false)
|
|
52
52
|
@db = CLI::UI::Prompt.ask(ctx.message('rails.forms.create.db.select')) do |handler|
|
|
53
53
|
VALID_DB_TYPES.each do |db_type|
|
|
54
54
|
handler.option(ctx.message("rails.forms.create.db.select_#{db_type}")) { db_type }
|
|
@@ -99,7 +99,7 @@ module Rails
|
|
|
99
99
|
# there was a specific version given during new(), so
|
|
100
100
|
# check version of gem found to determine match
|
|
101
101
|
require 'semantic/semantic'
|
|
102
|
-
found_version, _ = path.match(%r{/#{Regexp.quote(name)}-(
|
|
102
|
+
found_version, _ = path.match(%r{/#{Regexp.quote(name)}-(\d\.\d\.\d)})&.captures
|
|
103
103
|
found_version.nil? ? false : Semantic::Version.new(found_version).satisfies?(version)
|
|
104
104
|
else
|
|
105
105
|
# otherwise ignore the actual version number,
|
|
@@ -17,6 +17,13 @@ module Rails
|
|
|
17
17
|
setting_gem_path: "GEM_PATH being set to %s",
|
|
18
18
|
},
|
|
19
19
|
|
|
20
|
+
connect: {
|
|
21
|
+
connected: "Project now connected to {{green:%s}}",
|
|
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
|
+
|
|
20
27
|
create: {
|
|
21
28
|
help: <<~HELP,
|
|
22
29
|
{{command:%s create rails}}: Creates a ruby on rails app.
|
|
@@ -32,7 +39,7 @@ module Rails
|
|
|
32
39
|
|
|
33
40
|
error: {
|
|
34
41
|
invalid_ruby_version: <<~MSG,
|
|
35
|
-
This project requires a
|
|
42
|
+
This project requires a Ruby version ~> 2.5 or Ruby 3.0
|
|
36
43
|
See {{underline:https://github.com/Shopify/shopify-app-cli/blob/master/docs/installing-ruby.md}}
|
|
37
44
|
for our recommended method of installing ruby.
|
|
38
45
|
MSG
|
|
@@ -48,10 +55,6 @@ module Rails
|
|
|
48
55
|
},
|
|
49
56
|
|
|
50
57
|
info: {
|
|
51
|
-
created: "{{v}} {{green:%s}} was created in your Partner Dashboard {{underline:%s}}",
|
|
52
|
-
serve: "{{*}} Change directories to your new project folder {{green:%s}} and run {{command:%s serve}} " \
|
|
53
|
-
"to start a local server",
|
|
54
|
-
install: "{{*}} Then, visit {{underline:%s/test}} to install {{green:%s}} on your Dev Store",
|
|
55
58
|
open_new_shell: "{{*}} {{yellow:After installing %s, please open a new Command Prompt or PowerShell " \
|
|
56
59
|
"window to continue.}}",
|
|
57
60
|
},
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
module Script
|
|
4
4
|
class Project < ShopifyCli::ProjectType
|
|
5
5
|
hidden_feature(feature_set: :script_project)
|
|
6
|
-
|
|
6
|
+
title('Script')
|
|
7
|
+
creator('Script::Commands::Create')
|
|
7
8
|
|
|
8
9
|
register_command('Script::Commands::Push', 'push')
|
|
9
10
|
register_command('Script::Commands::Disable', 'disable')
|
|
@@ -41,22 +42,25 @@ module Script
|
|
|
41
42
|
module Domain
|
|
42
43
|
autoload :Errors, Project.project_filepath('layers/domain/errors')
|
|
43
44
|
autoload :PushPackage, Project.project_filepath('layers/domain/push_package')
|
|
45
|
+
autoload :Metadata, Project.project_filepath('layers/domain/metadata')
|
|
44
46
|
autoload :ExtensionPoint, Project.project_filepath('layers/domain/extension_point')
|
|
45
|
-
autoload :Script, Project.project_filepath('layers/domain/script')
|
|
46
47
|
end
|
|
47
48
|
|
|
48
49
|
module Infrastructure
|
|
49
50
|
autoload :Errors, Project.project_filepath('layers/infrastructure/errors')
|
|
50
51
|
autoload :AssemblyScriptDependencyManager,
|
|
51
|
-
|
|
52
|
+
Project.project_filepath('layers/infrastructure/assemblyscript_dependency_manager')
|
|
52
53
|
autoload :AssemblyScriptProjectCreator,
|
|
53
|
-
|
|
54
|
+
Project.project_filepath('layers/infrastructure/assemblyscript_project_creator')
|
|
54
55
|
autoload :AssemblyScriptTaskRunner, Project.project_filepath('layers/infrastructure/assemblyscript_task_runner')
|
|
55
56
|
autoload :AssemblyScriptTsConfig, Project.project_filepath('layers/infrastructure/assemblyscript_tsconfig')
|
|
57
|
+
autoload :RustProjectCreator,
|
|
58
|
+
Project.project_filepath('layers/infrastructure/rust_project_creator.rb')
|
|
59
|
+
autoload :RustTaskRunner, Project.project_filepath('layers/infrastructure/rust_task_runner')
|
|
60
|
+
|
|
56
61
|
autoload :PushPackageRepository, Project.project_filepath('layers/infrastructure/push_package_repository')
|
|
57
62
|
autoload :ExtensionPointRepository, Project.project_filepath('layers/infrastructure/extension_point_repository')
|
|
58
63
|
autoload :ProjectCreator, Project.project_filepath('layers/infrastructure/project_creator')
|
|
59
|
-
autoload :ScriptRepository, Project.project_filepath('layers/infrastructure/script_repository')
|
|
60
64
|
autoload :ScriptService, Project.project_filepath('layers/infrastructure/script_service')
|
|
61
65
|
autoload :TaskRunner, Project.project_filepath('layers/infrastructure/task_runner')
|
|
62
66
|
end
|
|
@@ -5,25 +5,27 @@ module Script
|
|
|
5
5
|
class Create < ShopifyCli::SubCommand
|
|
6
6
|
options do |parser, flags|
|
|
7
7
|
parser.on('--name=NAME') { |name| flags[:name] = name }
|
|
8
|
+
parser.on('--description=DESCRIPTION') { |description| flags[:description] = description }
|
|
8
9
|
parser.on('--extension_point=EP_NAME') { |ep_name| flags[:extension_point] = ep_name }
|
|
10
|
+
parser.on('--language=LANGUAGE') { |language| flags[:language] = language }
|
|
9
11
|
end
|
|
10
12
|
|
|
11
13
|
def call(args, _name)
|
|
12
|
-
language = 'ts'
|
|
13
14
|
cur_dir = @ctx.root
|
|
14
15
|
|
|
15
16
|
form = Forms::Create.ask(@ctx, args, options.flags)
|
|
16
17
|
return @ctx.puts(self.class.help) if form.nil?
|
|
17
18
|
|
|
18
|
-
unless !form.name.empty? && form.extension_point &&
|
|
19
|
+
unless !form.name.empty? && form.extension_point && form.language
|
|
19
20
|
return @ctx.puts(self.class.help)
|
|
20
21
|
end
|
|
21
22
|
|
|
22
23
|
project = Layers::Application::CreateScript.call(
|
|
23
24
|
ctx: @ctx,
|
|
24
|
-
language: language,
|
|
25
|
+
language: form.language,
|
|
25
26
|
script_name: form.name,
|
|
26
|
-
extension_point_type: form.extension_point
|
|
27
|
+
extension_point_type: form.extension_point,
|
|
28
|
+
description: form.description
|
|
27
29
|
)
|
|
28
30
|
@ctx.puts(@ctx.message('script.create.change_directory_notice', project.script_name))
|
|
29
31
|
rescue Script::Errors::ScriptProjectAlreadyExistsError => e
|
|
@@ -4,9 +4,7 @@ module Script
|
|
|
4
4
|
module Commands
|
|
5
5
|
class Enable < ShopifyCli::Command
|
|
6
6
|
options do |parser, flags|
|
|
7
|
-
parser.on('--config_props=KEYVALUEPAIRS', Array)
|
|
8
|
-
flags[:config_props] = Hash[t.map { |s| s.split(':') }]
|
|
9
|
-
end
|
|
7
|
+
parser.on('--config_props=KEYVALUEPAIRS', Array) { |t| flags[:config_props] = t }
|
|
10
8
|
parser.on('--config_file=CONFIGFILEPATH') { |t| flags[:config_file] = t }
|
|
11
9
|
end
|
|
12
10
|
|
|
@@ -47,7 +45,7 @@ module Script
|
|
|
47
45
|
def acquire_configuration(config_file: nil, config_props: nil)
|
|
48
46
|
properties = {}
|
|
49
47
|
properties = YAML.load(File.read(config_file)) unless config_file.nil?
|
|
50
|
-
properties = properties.merge(config_props) unless config_props.nil?
|
|
48
|
+
properties = properties.merge(parse_config_props(config_props)) unless config_props.nil?
|
|
51
49
|
|
|
52
50
|
configuration = { entries: [] }
|
|
53
51
|
properties.each do |key, value|
|
|
@@ -61,6 +59,16 @@ module Script
|
|
|
61
59
|
raise Errors::InvalidConfigYAMLError, options.flags[:config_file]
|
|
62
60
|
end
|
|
63
61
|
|
|
62
|
+
def parse_config_props(config_props)
|
|
63
|
+
Hash[
|
|
64
|
+
config_props.map do |s|
|
|
65
|
+
args = s.split(':').map(&:strip)
|
|
66
|
+
raise Errors::InvalidConfigProps unless args.size == 2
|
|
67
|
+
args
|
|
68
|
+
end
|
|
69
|
+
]
|
|
70
|
+
end
|
|
71
|
+
|
|
64
72
|
# No slice pre Ruby 2.5 so roll our own
|
|
65
73
|
def slice(hash, *keys)
|
|
66
74
|
Hash[hash.to_a - hash.select { |key, _value| !keys.include?(key) }.to_a]
|
|
@@ -9,19 +9,11 @@ module Script
|
|
|
9
9
|
|
|
10
10
|
def call(_args, _name)
|
|
11
11
|
ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop])
|
|
12
|
-
|
|
13
|
-
api_key =
|
|
14
|
-
return @ctx.puts(self.class.help) unless api_key
|
|
15
|
-
|
|
16
|
-
Layers::Application::PushScript.call(
|
|
17
|
-
ctx: @ctx,
|
|
18
|
-
language: project.language,
|
|
19
|
-
extension_point_type: project.extension_point_type,
|
|
20
|
-
script_name: project.script_name,
|
|
21
|
-
source_file: project.source_file,
|
|
22
|
-
api_key: api_key,
|
|
23
|
-
force: options.flags.key?(:force)
|
|
24
|
-
)
|
|
12
|
+
|
|
13
|
+
api_key = ScriptProject.current.api_key
|
|
14
|
+
return @ctx.puts(self.class.help) unless api_key
|
|
15
|
+
|
|
16
|
+
Layers::Application::PushScript.call(ctx: @ctx, force: options.flags.key?(:force))
|
|
25
17
|
@ctx.puts(@ctx.message('script.push.script_pushed', api_key: api_key))
|
|
26
18
|
rescue StandardError => e
|
|
27
19
|
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.push.error.operation_failed'))
|