shopify-cli 2.6.5 → 2.7.2
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/.gitignore +1 -0
- data/.vscode/extensions.json +5 -0
- data/.vscode/settings.json +9 -0
- data/CHANGELOG.md +42 -4
- 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 +4 -8
- data/lib/project_types/extension/commands/create.rb +3 -5
- 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 -2
- data/lib/project_types/extension/models/development_server.rb +2 -2
- 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 +43 -16
- 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 +7 -1
- data/lib/project_types/script/commands/create.rb +3 -8
- data/lib/project_types/script/commands/javy.rb +29 -0
- data/lib/project_types/script/commands/push.rb +3 -2
- data/lib/project_types/script/config/extension_points.yml +3 -26
- data/lib/project_types/script/errors.rb +0 -18
- data/lib/project_types/script/forms/ask_app.rb +32 -0
- data/lib/project_types/script/forms/ask_org.rb +30 -0
- data/lib/project_types/script/forms/ask_script_uuid.rb +22 -0
- data/lib/project_types/script/forms/run_against_shopify_org.rb +14 -0
- data/lib/project_types/script/layers/application/build_script.rb +0 -1
- data/lib/project_types/script/layers/application/connect_app.rb +73 -0
- 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/domain/script_project.rb +4 -0
- 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 -4
- data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +1 -5
- data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +25 -4
- 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 -20
- data/lib/project_types/script/ui/error_handler.rb +1 -32
- 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 +4 -1
- data/lib/project_types/theme/commands/push.rb +7 -2
- data/lib/project_types/theme/commands/serve.rb +9 -2
- data/lib/project_types/theme/messages/messages.rb +39 -1
- data/lib/project_types/theme/ui/sync_progress_bar.rb +2 -2
- 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 +31 -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 +36 -0
- data/lib/shopify_cli/commands/app/create/php.rb +36 -0
- data/lib/shopify_cli/commands/app/create/rails.rb +38 -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 +7 -0
- data/lib/shopify_cli/context.rb +9 -0
- data/lib/shopify_cli/environment.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/identity_auth.rb +18 -0
- data/lib/shopify_cli/messages/messages.rb +254 -9
- data/lib/shopify_cli/migrator.rb +9 -11
- data/lib/shopify_cli/partners_api.rb +1 -8
- 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/tasks/ensure_authenticated.rb +9 -3
- 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/theme/syncer/error_reporter.rb +45 -0
- data/lib/shopify_cli/theme/syncer/operation.rb +56 -0
- data/lib/shopify_cli/theme/syncer/standard_reporter.rb +32 -0
- data/lib/shopify_cli/theme/syncer.rb +40 -39
- data/lib/shopify_cli/theme/theme.rb +31 -19
- data/lib/shopify_cli/tunnel.rb +25 -22
- 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 +64 -54
- 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/project_types/script/tasks/ensure_env.rb +0 -106
- data/lib/shopify_cli/sub_command.rb +0 -17
- data/shopify.fish +0 -12
- data/shopify.sh +0 -11
|
@@ -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
|
|
@@ -5,8 +5,8 @@ module Rails
|
|
|
5
5
|
MESSAGES = {
|
|
6
6
|
rails: {
|
|
7
7
|
help: <<~HELP,
|
|
8
|
-
Suite of commands for developing Ruby on Rails apps. See {{command:%1$s rails <command> --help}} for usage of each command.
|
|
9
|
-
Usage: {{command:%1$s rails [ %2$s ]}}
|
|
8
|
+
Suite of commands for developing Ruby on Rails apps. See {{command:%1$s app rails <command> --help}} for usage of each command.
|
|
9
|
+
Usage: {{command:%1$s app rails [ %2$s ]}}
|
|
10
10
|
HELP
|
|
11
11
|
|
|
12
12
|
error: {
|
|
@@ -21,117 +21,22 @@ module Rails
|
|
|
21
21
|
setting_gem_home: "GEM_HOME being set to %s",
|
|
22
22
|
setting_gem_path: "GEM_PATH being set to %s",
|
|
23
23
|
},
|
|
24
|
-
|
|
25
|
-
connect: {
|
|
26
|
-
connected: "Project now connected to {{green:%s}}",
|
|
27
|
-
help: <<~HELP,
|
|
28
|
-
{{command:%s rails connect}}: Connects an existing Ruby on Rails app to Shopify CLI. Creates a config file.
|
|
29
|
-
Usage: {{command:%s rails connect}}
|
|
30
|
-
HELP
|
|
31
|
-
production_warning: <<~MESSAGE,
|
|
32
|
-
{{yellow:! Warning: if you have connected to an {{bold:app in production}}, running {{command:serve}} may update the app URL and cause an outage.
|
|
33
|
-
MESSAGE
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
create: {
|
|
37
|
-
help: <<~HELP,
|
|
38
|
-
{{command:%s rails create}}: Creates a ruby on rails app.
|
|
39
|
-
Usage: {{command:%s rails create}}
|
|
40
|
-
Options:
|
|
41
|
-
{{command:--name=NAME}} App name. Any string.
|
|
42
|
-
{{command:--organization-id=ID}} Partner organization ID. Must be an existing organization.
|
|
43
|
-
{{command:--store=MYSHOPIFYDOMAIN }} Development store URL. Must be an existing development store.
|
|
44
|
-
{{command:--db=DB}} Database type. Must be one of: mysql, postgresql, sqlite3, oracle, frontbase, ibm_db, sqlserver, jdbcmysql, jdbcsqlite3, jdbcpostgresql, jdbc.
|
|
45
|
-
{{command:--rails-opts=RAILSOPTS}} Additional options. Must be string containing one or more valid Rails options, separated by spaces.
|
|
46
|
-
HELP
|
|
47
|
-
|
|
48
|
-
error: {
|
|
49
|
-
invalid_ruby_version: "This project requires a Ruby version ~> 2.5 or Ruby 3.0.",
|
|
50
|
-
dir_exists: "Project directory %s already exists. Please use a different name.",
|
|
51
|
-
install_failure: "Error installing %s gem",
|
|
52
|
-
node_required: "node is required to create a rails project. Download at https://nodejs.org/en/download.",
|
|
53
|
-
node_version_failure: "Failed to get the current node version. Please make sure it is installed as " \
|
|
54
|
-
"per the instructions at https://nodejs.org/en.",
|
|
55
|
-
yarn_required: "yarn is required to create a rails project. Download at " \
|
|
56
|
-
"https://classic.yarnpkg.com/en/docs/install.",
|
|
57
|
-
yarn_version_failure: "Failed to get the current yarn version. Please make sure it is installed as per " \
|
|
58
|
-
"the instructions at https://classic.yarnpkg.com/en/docs/install.",
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
info: {
|
|
62
|
-
open_new_shell: "{{*}} {{yellow:After installing %s, please open a new Command Prompt or PowerShell " \
|
|
63
|
-
"window to continue.}}",
|
|
64
|
-
},
|
|
65
|
-
installing_bundler: "Installing bundler…",
|
|
66
|
-
generating_app: "Generating new rails app project in %s…",
|
|
67
|
-
adding_shopify_gem: "{{v}} Adding shopify_app gem…",
|
|
68
|
-
node_version: "node %s",
|
|
69
|
-
yarn_version: "yarn %s",
|
|
70
|
-
running_bundle_install: "Running bundle install…",
|
|
71
|
-
running_generator: "Running shopify_app generator…",
|
|
72
|
-
running_migrations: "Running migrations…",
|
|
73
|
-
running_webpacker_install: "Running webpacker:install…",
|
|
74
|
-
},
|
|
75
|
-
|
|
76
24
|
deploy: {
|
|
77
25
|
help: <<~HELP,
|
|
78
26
|
Deploy the current Rails project to a hosting service. Heroku ({{underline:https://www.heroku.com}}) is currently the only option, but more will be added in the future.
|
|
79
|
-
Usage: {{command:%s rails deploy [ heroku ]}}
|
|
27
|
+
Usage: {{command:%s app rails deploy [ heroku ]}}
|
|
80
28
|
HELP
|
|
81
29
|
extended_help: <<~HELP,
|
|
82
30
|
{{bold:Subcommands:}}
|
|
83
31
|
{{cyan:heroku}}: Deploys the current Rails project to Heroku.
|
|
84
|
-
Usage: {{command:%s rails deploy heroku}}
|
|
32
|
+
Usage: {{command:%s app rails deploy heroku}}
|
|
85
33
|
HELP
|
|
86
|
-
|
|
87
|
-
heroku: {
|
|
88
|
-
help: <<~HELP,
|
|
89
|
-
Deploy the current Rails project to Heroku
|
|
90
|
-
Usage: {{command:%s rails deploy heroku}}
|
|
91
|
-
HELP
|
|
92
|
-
downloading: "Downloading Heroku CLI…",
|
|
93
|
-
downloaded: "Downloaded Heroku CLI",
|
|
94
|
-
installing: "Installing Heroku CLI…",
|
|
95
|
-
installed: "Installed Heroku CLI",
|
|
96
|
-
authenticated_with_account: "{{v}} Authenticated with Heroku as {{green:%s}}",
|
|
97
|
-
authenticating: "Authenticating with Heroku…",
|
|
98
|
-
authenticated: "{{v}} Authenticated with Heroku",
|
|
99
|
-
deploying: "Deploying to Heroku…",
|
|
100
|
-
deployed: "{{v}} Deployed to Heroku",
|
|
101
|
-
db_check: {
|
|
102
|
-
validating: "Validating application…",
|
|
103
|
-
checking: "Checking database type…",
|
|
104
|
-
validated: "Database type \"%s\" validated for platform \"Heroku\"",
|
|
105
|
-
problem: "A problem was encountered while checking your database type.",
|
|
106
|
-
sqlite: <<~SQLITE,
|
|
107
|
-
Heroku does not support deployment using the SQLite database system.
|
|
108
|
-
Change the database type using {{command:rails db:system:change --to=[new_db_type]}}. For more info:
|
|
109
|
-
{{underline:https://gorails.com/episodes/rails-6-db-system-change-command}}
|
|
110
|
-
SQLITE
|
|
111
|
-
},
|
|
112
|
-
git: {
|
|
113
|
-
checking: "Checking git repo…",
|
|
114
|
-
initialized: "Git repo initialized",
|
|
115
|
-
what_branch: "What branch would you like to deploy?",
|
|
116
|
-
branch_selected: "{{v}} Git branch {{green:%s}} selected for deploy",
|
|
117
|
-
},
|
|
118
|
-
app: {
|
|
119
|
-
no_apps_found: "No existing Heroku app found. What would you like to do?",
|
|
120
|
-
name: "What is your Heroku app’s name?",
|
|
121
|
-
select: "Specify an existing Heroku app",
|
|
122
|
-
selecting: "Selecting Heroku app %s…",
|
|
123
|
-
selected: "{{v}} Heroku app {{green:%s}} selected",
|
|
124
|
-
create: "Create a new Heroku app",
|
|
125
|
-
creating: "Creating new Heroku app…",
|
|
126
|
-
created: "{{v}} New Heroku app created",
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
34
|
},
|
|
130
35
|
|
|
131
36
|
generate: {
|
|
132
37
|
help: <<~HELP,
|
|
133
38
|
Generate code in your Rails project. Currently supports generating new webhooks.
|
|
134
|
-
Usage: {{command:%s rails generate [ webhook ]}}
|
|
39
|
+
Usage: {{command:%s app rails generate [ webhook ]}}
|
|
135
40
|
HELP
|
|
136
41
|
extended_help: <<~EXAMPLES,
|
|
137
42
|
{{bold:Examples:}}
|
|
@@ -147,63 +52,13 @@ module Rails
|
|
|
147
52
|
webhook: {
|
|
148
53
|
help: <<~HELP,
|
|
149
54
|
Generate and register a new webhook that listens for the specified Shopify store event.
|
|
150
|
-
Usage: {{command:%s rails generate webhook <type>}}
|
|
55
|
+
Usage: {{command:%s app rails generate webhook <type>}}
|
|
151
56
|
HELP
|
|
152
57
|
|
|
153
58
|
select: "What type of webhook would you like to create?",
|
|
154
59
|
selected: "Generating webhook: %s",
|
|
155
60
|
},
|
|
156
61
|
},
|
|
157
|
-
|
|
158
|
-
open: {
|
|
159
|
-
help: <<~HELP,
|
|
160
|
-
Open your local development app in the default browser.
|
|
161
|
-
Usage: {{command:%s rails open}}
|
|
162
|
-
HELP
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
serve: {
|
|
166
|
-
help: <<~HELP,
|
|
167
|
-
Start a local development rails server for your project, as well as a public ngrok tunnel to your localhost.
|
|
168
|
-
Usage: {{command:%s rails serve}}
|
|
169
|
-
HELP
|
|
170
|
-
extended_help: <<~HELP,
|
|
171
|
-
{{bold:Options:}}
|
|
172
|
-
{{cyan:--host=HOST}}: Bypass running tunnel and use custom host. HOST must be HTTPS url.
|
|
173
|
-
{{cyan:--port=PORT}}: Use custom port.
|
|
174
|
-
HELP
|
|
175
|
-
|
|
176
|
-
open_info: <<~MESSAGE,
|
|
177
|
-
{{*}} To install and start using your app, open this URL in your browser:
|
|
178
|
-
{{green:%s}}
|
|
179
|
-
MESSAGE
|
|
180
|
-
running_server: "Running server…",
|
|
181
|
-
},
|
|
182
|
-
|
|
183
|
-
tunnel: {
|
|
184
|
-
help: <<~HELP,
|
|
185
|
-
Start or stop an http tunnel to your local development app using ngrok.
|
|
186
|
-
Usage: {{command:%s rails tunnel [ auth | start | stop ]}}
|
|
187
|
-
HELP
|
|
188
|
-
extended_help: <<~HELP,
|
|
189
|
-
{{bold:Subcommands:}}
|
|
190
|
-
|
|
191
|
-
{{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.
|
|
192
|
-
Usage: {{command:%1$s rails tunnel auth <token>}}
|
|
193
|
-
|
|
194
|
-
{{cyan:start}}: Starts an ngrok tunnel, will print the URL for an existing tunnel if already running.
|
|
195
|
-
Usage: {{command:%1$s rails tunnel start}}
|
|
196
|
-
|
|
197
|
-
{{cyan:stop}}: Stops the ngrok tunnel.
|
|
198
|
-
Usage: {{command:%1$s rails tunnel stop}}
|
|
199
|
-
|
|
200
|
-
HELP
|
|
201
|
-
|
|
202
|
-
error: {
|
|
203
|
-
token_argument_missing: "{{x}} {{red:auth requires a token argument}}\n\n",
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
|
|
207
62
|
forms: {
|
|
208
63
|
create: {
|
|
209
64
|
error: {
|
|
@@ -9,15 +9,20 @@ module Script
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
# define/autoload project specific Commands
|
|
12
|
-
class Command < ShopifyCLI::
|
|
12
|
+
class Command < ShopifyCLI::Command::ProjectCommand
|
|
13
13
|
hidden_feature(feature_set: :script_project)
|
|
14
14
|
subcommand :Create, "create", Project.project_filepath("commands/create")
|
|
15
15
|
subcommand :Push, "push", Project.project_filepath("commands/push")
|
|
16
|
+
subcommand :Javy, "javy", Project.project_filepath("commands/javy")
|
|
16
17
|
end
|
|
17
18
|
ShopifyCLI::Commands.register("Script::Command", "script")
|
|
18
19
|
|
|
19
20
|
# define/autoload project specific Forms
|
|
20
21
|
module Forms
|
|
22
|
+
autoload :AskOrg, Project.project_filepath("forms/ask_org")
|
|
23
|
+
autoload :AskApp, Project.project_filepath("forms/ask_app")
|
|
24
|
+
autoload :AskScriptUuid, Project.project_filepath("forms/ask_script_uuid")
|
|
25
|
+
autoload :RunAgainstShopifyOrg, Project.project_filepath("forms/run_against_shopify_org")
|
|
21
26
|
autoload :Create, Project.project_filepath("forms/create")
|
|
22
27
|
autoload :ScriptForm, Project.project_filepath("forms/script_form")
|
|
23
28
|
end
|
|
@@ -29,6 +34,7 @@ module Script
|
|
|
29
34
|
module Layers
|
|
30
35
|
module Application
|
|
31
36
|
autoload :BuildScript, Project.project_filepath("layers/application/build_script")
|
|
37
|
+
autoload :ConnectApp, Project.project_filepath("layers/application/connect_app")
|
|
32
38
|
autoload :CreateScript, Project.project_filepath("layers/application/create_script")
|
|
33
39
|
autoload :PushScript, Project.project_filepath("layers/application/push_script")
|
|
34
40
|
autoload :ExtensionPoints, Project.project_filepath("layers/application/extension_points")
|
|
@@ -2,18 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
module Script
|
|
4
4
|
class Command
|
|
5
|
-
class Create < ShopifyCLI::SubCommand
|
|
6
|
-
|
|
7
|
-
prerequisite_task :ensure_authenticated
|
|
8
|
-
end
|
|
5
|
+
class Create < ShopifyCLI::Command::SubCommand
|
|
6
|
+
prerequisite_task :ensure_authenticated
|
|
9
7
|
|
|
10
8
|
options do |parser, flags|
|
|
11
9
|
parser.on("--name=NAME") { |name| flags[:name] = name }
|
|
12
|
-
parser.on("--
|
|
13
|
-
parser.on("--extension-point=EP_NAME") { |ep_name| flags[:extension_point] = ep_name }
|
|
10
|
+
parser.on("--api=API_NAME") { |ep_name| flags[:extension_point] = ep_name }
|
|
14
11
|
parser.on("--language=LANGUAGE") { |language| flags[:language] = language }
|
|
15
12
|
parser.on("--branch=BRANCH") { |branch| flags[:branch] = branch }
|
|
16
|
-
parser.on("--no-config-ui") { |no_config_ui| flags[:no_config_ui] = no_config_ui }
|
|
17
13
|
end
|
|
18
14
|
|
|
19
15
|
def call(args, _name)
|
|
@@ -30,7 +26,6 @@ module Script
|
|
|
30
26
|
sparse_checkout_branch: options.flags[:branch] || "master",
|
|
31
27
|
script_name: form.name,
|
|
32
28
|
extension_point_type: form.extension_point,
|
|
33
|
-
no_config_ui: options.flags.key?(:no_config_ui)
|
|
34
29
|
)
|
|
35
30
|
@ctx.puts(@ctx.message("script.create.change_directory_notice", project.script_name))
|
|
36
31
|
rescue StandardError => e
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require "shopify_cli"
|
|
3
|
+
require_relative "../../../../ext/javy/javy.rb"
|
|
4
|
+
|
|
5
|
+
module Script
|
|
6
|
+
class Command
|
|
7
|
+
class Javy < ShopifyCLI::Command::SubCommand
|
|
8
|
+
hidden_feature
|
|
9
|
+
|
|
10
|
+
options do |parser, flags|
|
|
11
|
+
parser.on("--in=IN") { |in_file| flags[:in_file] = in_file }
|
|
12
|
+
parser.on("--out=OUT") { |out_file| flags[:out_file] = out_file }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def call(*)
|
|
16
|
+
source = options.flags[:in_file]
|
|
17
|
+
dest = options.flags[:out_file]
|
|
18
|
+
|
|
19
|
+
@ctx.abort(@ctx.message("script.javy.errors.invalid_arguments", ShopifyCLI::TOOL_NAME)) unless source
|
|
20
|
+
|
|
21
|
+
::Javy.build(source: source, dest: dest).unwrap { |e| @ctx.abort(e.message) }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.help
|
|
25
|
+
ShopifyCLI::Context.message("script.javy.help", ShopifyCLI::TOOL_NAME)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Script
|
|
4
4
|
class Command
|
|
5
|
-
class Push < ShopifyCLI::SubCommand
|
|
5
|
+
class Push < ShopifyCLI::Command::SubCommand
|
|
6
6
|
prerequisite_task ensure_project_type: :script
|
|
7
7
|
|
|
8
8
|
options do |parser, flags|
|
|
@@ -10,7 +10,8 @@ module Script
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def call(_args, _name)
|
|
13
|
-
fresh_env =
|
|
13
|
+
fresh_env = Layers::Application::ConnectApp.call(ctx: @ctx)
|
|
14
|
+
|
|
14
15
|
force = options.flags.key?(:force) || !!fresh_env
|
|
15
16
|
|
|
16
17
|
api_key = Layers::Infrastructure::ScriptProjectRepository.new(ctx: @ctx).get.api_key
|
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
discount:
|
|
2
|
-
deprecated: true
|
|
3
|
-
libraries:
|
|
4
|
-
assemblyscript:
|
|
5
|
-
package: "@shopify/extension-point-as-discount"
|
|
6
|
-
unit_limit_per_order:
|
|
7
|
-
beta: true
|
|
8
|
-
libraries:
|
|
9
|
-
assemblyscript:
|
|
10
|
-
package: "@shopify/extension-point-as-unit-limit-per-order"
|
|
11
|
-
payment_filter:
|
|
12
|
-
deprecated: true
|
|
13
|
-
libraries:
|
|
14
|
-
assemblyscript:
|
|
15
|
-
package: "@shopify/extension-point-as-payment-filter"
|
|
16
|
-
shipping_filter:
|
|
17
|
-
deprecated: true
|
|
18
|
-
libraries:
|
|
19
|
-
assemblyscript:
|
|
20
|
-
package: "@shopify/extension-point-as-shipping-filter"
|
|
21
|
-
tax_filter:
|
|
22
|
-
beta: true
|
|
23
|
-
libraries:
|
|
24
|
-
assemblyscript:
|
|
25
|
-
repo: "https://github.com/Shopify/extension-points.git"
|
|
26
|
-
package: "@shopify/extension-point-as-tax-filter"
|
|
27
1
|
payment_methods:
|
|
28
2
|
domain: 'checkout'
|
|
29
3
|
libraries:
|
|
@@ -32,6 +6,7 @@ payment_methods:
|
|
|
32
6
|
package: "@shopify/scripts-checkout-apis"
|
|
33
7
|
typescript:
|
|
34
8
|
beta: true
|
|
9
|
+
package: "@shopify/scripts-checkout-apis"
|
|
35
10
|
repo: "https://github.com/Shopify/scripts-apis-examples"
|
|
36
11
|
shipping_methods:
|
|
37
12
|
domain: 'checkout'
|
|
@@ -41,6 +16,7 @@ shipping_methods:
|
|
|
41
16
|
package: "@shopify/scripts-checkout-apis"
|
|
42
17
|
typescript:
|
|
43
18
|
beta: true
|
|
19
|
+
package: "@shopify/scripts-checkout-apis"
|
|
44
20
|
repo: "https://github.com/Shopify/scripts-apis-examples"
|
|
45
21
|
discount_types:
|
|
46
22
|
beta: true
|
|
@@ -48,4 +24,5 @@ discount_types:
|
|
|
48
24
|
libraries:
|
|
49
25
|
typescript:
|
|
50
26
|
beta: true
|
|
27
|
+
package: "@shopify/scripts-discount-apis"
|
|
51
28
|
repo: "https://github.com/Shopify/scripts-apis-examples"
|
|
@@ -6,23 +6,5 @@ module Script
|
|
|
6
6
|
|
|
7
7
|
class NoExistingAppsError < ScriptProjectError; end
|
|
8
8
|
class NoExistingOrganizationsError < ScriptProjectError; end
|
|
9
|
-
|
|
10
|
-
class NoExistingStoresError < ScriptProjectError
|
|
11
|
-
attr_reader :organization_id
|
|
12
|
-
def initialize(organization_id)
|
|
13
|
-
super()
|
|
14
|
-
@organization_id = organization_id
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
class InvalidConfigProps < ScriptProjectError; end
|
|
19
|
-
|
|
20
|
-
class InvalidConfigYAMLError < ScriptProjectError
|
|
21
|
-
attr_reader :config_file
|
|
22
|
-
def initialize(config_file)
|
|
23
|
-
super()
|
|
24
|
-
@config_file = config_file
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
9
|
end
|
|
28
10
|
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Script
|
|
4
|
+
module Forms
|
|
5
|
+
class AskApp < ShopifyCLI::Form
|
|
6
|
+
attr_reader :app
|
|
7
|
+
|
|
8
|
+
def ask
|
|
9
|
+
apps = @xargs.fetch(:apps)
|
|
10
|
+
|
|
11
|
+
unless @xargs[:acting_as_shopify_organization]
|
|
12
|
+
apps = apps.select { |app| app["appType"] == "custom" }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
raise Errors::NoExistingAppsError if apps.empty?
|
|
16
|
+
|
|
17
|
+
@app =
|
|
18
|
+
if apps.count > 1
|
|
19
|
+
CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.app_select")) do |handler|
|
|
20
|
+
apps.each do |app|
|
|
21
|
+
handler.option(app["title"]) { app }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
else
|
|
25
|
+
apps.first.tap do |app|
|
|
26
|
+
ctx.puts(ctx.message("script.application.ensure_env.app", app["title"]))
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Script
|
|
4
|
+
module Forms
|
|
5
|
+
class AskOrg < ShopifyCLI::Form
|
|
6
|
+
attr_reader :org
|
|
7
|
+
|
|
8
|
+
BUSINESS_NAME = "businessName"
|
|
9
|
+
ID = "id"
|
|
10
|
+
|
|
11
|
+
def ask
|
|
12
|
+
orgs = @xargs
|
|
13
|
+
@org =
|
|
14
|
+
if orgs.count == 1
|
|
15
|
+
orgs.first.tap do |org|
|
|
16
|
+
ctx.puts(ctx.message("script.application.ensure_env.organization", org[BUSINESS_NAME], org[ID]))
|
|
17
|
+
end
|
|
18
|
+
elsif orgs.count > 0
|
|
19
|
+
CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.organization_select")) do |handler|
|
|
20
|
+
orgs.each do |org|
|
|
21
|
+
handler.option("#{org[BUSINESS_NAME]} (#{org[ID]})") { org }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
else
|
|
25
|
+
raise Errors::NoExistingOrganizationsError
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Script
|
|
4
|
+
module Forms
|
|
5
|
+
class AskScriptUuid < ShopifyCLI::Form
|
|
6
|
+
attr_reader :uuid
|
|
7
|
+
def ask
|
|
8
|
+
scripts = @xargs
|
|
9
|
+
|
|
10
|
+
return if scripts.empty? ||
|
|
11
|
+
!CLI::UI::Prompt.confirm(ctx.message("script.application.ensure_env.ask_connect_to_existing_script"))
|
|
12
|
+
|
|
13
|
+
@uuid =
|
|
14
|
+
CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.ask_which_script_to_connect_to")) do |handler|
|
|
15
|
+
scripts.each do |script|
|
|
16
|
+
handler.option("#{script["title"]} (#{script["uuid"]})") { script["uuid"] }
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Script
|
|
4
|
+
module Forms
|
|
5
|
+
class RunAgainstShopifyOrg < ShopifyCLI::Form
|
|
6
|
+
attr_reader :response
|
|
7
|
+
def ask
|
|
8
|
+
@ctx.puts(@ctx.message("core.tasks.select_org_and_shop.identified_as_shopify"))
|
|
9
|
+
message = @ctx.message("core.tasks.select_org_and_shop.first_party")
|
|
10
|
+
@response = CLI::UI::Prompt.confirm(message, default: false)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "shopify_cli"
|
|
4
|
+
|
|
5
|
+
module Script
|
|
6
|
+
module Layers
|
|
7
|
+
module Application
|
|
8
|
+
class ConnectApp
|
|
9
|
+
class << self
|
|
10
|
+
def call(ctx:)
|
|
11
|
+
script_project_repo = Layers::Infrastructure::ScriptProjectRepository.new(ctx: ctx)
|
|
12
|
+
script_project = script_project_repo.get
|
|
13
|
+
return false if script_project.env_valid?
|
|
14
|
+
|
|
15
|
+
if ShopifyCLI::Shopifolk.check && Forms::RunAgainstShopifyOrg.ask(ctx, nil, nil).response
|
|
16
|
+
ShopifyCLI::Shopifolk.act_as_shopify_organization
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
org =
|
|
20
|
+
if partner_proxy_bypass
|
|
21
|
+
stubbed_org
|
|
22
|
+
else
|
|
23
|
+
orgs = ShopifyCLI::PartnersAPI::Organizations.fetch_with_app(ctx)
|
|
24
|
+
Forms::AskOrg.ask(ctx, orgs, nil).org
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
app = Forms::AskApp.ask(
|
|
28
|
+
ctx,
|
|
29
|
+
{
|
|
30
|
+
apps: org["apps"],
|
|
31
|
+
acting_as_shopify_organization: ShopifyCLI::Shopifolk.acting_as_shopify_organization?,
|
|
32
|
+
},
|
|
33
|
+
nil
|
|
34
|
+
).app
|
|
35
|
+
|
|
36
|
+
script_service = Layers::Infrastructure::ServiceLocator.script_service(ctx: ctx, api_key: app["apiKey"])
|
|
37
|
+
extension_point_type = script_project.extension_point_type
|
|
38
|
+
scripts = script_service.get_app_scripts(extension_point_type: extension_point_type)
|
|
39
|
+
|
|
40
|
+
uuid = Forms::AskScriptUuid.ask(ctx, scripts, nil).uuid
|
|
41
|
+
|
|
42
|
+
script_project_repo.create_env(
|
|
43
|
+
api_key: app["apiKey"],
|
|
44
|
+
secret: app["apiSecretKeys"].first["secret"],
|
|
45
|
+
uuid: uuid
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
true
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
|
|
53
|
+
def partner_proxy_bypass
|
|
54
|
+
!ENV["BYPASS_PARTNERS_PROXY"].nil?
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def stubbed_org
|
|
58
|
+
{
|
|
59
|
+
"apps" => [
|
|
60
|
+
{
|
|
61
|
+
"appType" => "custom",
|
|
62
|
+
"apiKey" => "stubbed-api-key",
|
|
63
|
+
"apiSecretKeys" => [{ "secret" => "stubbed-api-secret" }],
|
|
64
|
+
"title" => "Fake App (Not connected to Partners)",
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
}
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -7,7 +7,7 @@ module Script
|
|
|
7
7
|
module Application
|
|
8
8
|
class CreateScript
|
|
9
9
|
class << self
|
|
10
|
-
def call(ctx:, language:, sparse_checkout_branch:, script_name:, extension_point_type
|
|
10
|
+
def call(ctx:, language:, sparse_checkout_branch:, script_name:, extension_point_type:)
|
|
11
11
|
raise Infrastructure::Errors::ScriptProjectAlreadyExistsError, script_name if ctx.dir_exist?(script_name)
|
|
12
12
|
|
|
13
13
|
in_new_directory_context(ctx, script_name) do
|
|
@@ -36,7 +36,7 @@ module Script
|
|
|
36
36
|
)
|
|
37
37
|
|
|
38
38
|
install_dependencies(ctx, language, script_name, project_creator)
|
|
39
|
-
script_project_repo.update_or_create_script_json(title: script_name
|
|
39
|
+
script_project_repo.update_or_create_script_json(title: script_name)
|
|
40
40
|
project
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -15,7 +15,7 @@ module Script
|
|
|
15
15
|
@version = @content["version"].to_s
|
|
16
16
|
@title = @content["title"]
|
|
17
17
|
@description = @content["description"]
|
|
18
|
-
@configuration_ui = @content
|
|
18
|
+
@configuration_ui = @content.fetch("configurationUi", true)
|
|
19
19
|
@configuration = @content["configuration"]
|
|
20
20
|
end
|
|
21
21
|
|
data/lib/project_types/script/layers/infrastructure/api_clients/partners_proxy_api_client.rb
CHANGED
|
@@ -27,10 +27,6 @@ module Script
|
|
|
27
27
|
case error_code(response["errors"])
|
|
28
28
|
when "forbidden"
|
|
29
29
|
raise Errors::ForbiddenError
|
|
30
|
-
when "forbidden_on_shop"
|
|
31
|
-
raise Errors::ShopAuthenticationError
|
|
32
|
-
when "app_not_installed_on_shop"
|
|
33
|
-
raise Errors::AppNotInstalledError
|
|
34
30
|
else
|
|
35
31
|
raise Errors::GraphqlError, response["errors"]
|
|
36
32
|
end
|