shopify-cli 0.9.2 → 0.9.3

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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/docs/_config.yml +3 -0
  4. data/docs/_data/nav.yml +9 -0
  5. data/docs/getting-started/index.md +5 -40
  6. data/docs/getting-started/install/index.md +39 -0
  7. data/docs/getting-started/migrate/index.md +63 -0
  8. data/docs/getting-started/uninstall/index.md +37 -0
  9. data/docs/getting-started/upgrade/index.md +37 -0
  10. data/docs/index.md +5 -6
  11. data/lib/project_types/extension/cli.rb +2 -1
  12. data/lib/project_types/extension/commands/tunnel.rb +1 -1
  13. data/lib/project_types/extension/forms/register.rb +2 -3
  14. data/lib/project_types/extension/graphql/get_app_by_api_key.graphql +9 -0
  15. data/lib/project_types/extension/tasks/converters/app_converter.rb +27 -0
  16. data/lib/project_types/extension/tasks/get_app.rb +22 -0
  17. data/lib/project_types/extension/tasks/get_apps.rb +1 -6
  18. data/lib/project_types/script/cli.rb +3 -2
  19. data/lib/project_types/script/commands/create.rb +5 -4
  20. data/lib/project_types/script/errors.rb +1 -0
  21. data/lib/project_types/script/forms/create.rb +8 -4
  22. data/lib/project_types/script/layers/application/create_script.rb +11 -18
  23. data/lib/project_types/script/layers/application/project_dependencies.rb +0 -5
  24. data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +106 -0
  25. data/lib/project_types/script/layers/infrastructure/errors.rb +1 -1
  26. data/lib/project_types/script/layers/infrastructure/project_creator.rb +23 -0
  27. data/lib/project_types/script/layers/infrastructure/script_repository.rb +0 -33
  28. data/lib/project_types/script/messages/messages.rb +5 -6
  29. data/lib/project_types/script/templates/ts/as-pect.d.ts +1 -0
  30. data/lib/project_types/script/ui/error_handler.rb +5 -0
  31. data/lib/shopify-cli/tunnel.rb +33 -1
  32. data/lib/shopify-cli/version.rb +1 -1
  33. data/vendor/deps/cli-ui/REVISION +1 -1
  34. data/vendor/deps/cli-ui/lib/cli/ui.rb +52 -11
  35. data/vendor/deps/cli-ui/lib/cli/ui/color.rb +11 -7
  36. data/vendor/deps/cli-ui/lib/cli/ui/formatter.rb +34 -21
  37. data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +107 -149
  38. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +99 -0
  39. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +119 -0
  40. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +158 -0
  41. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +112 -0
  42. data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +9 -15
  43. data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +47 -0
  44. data/vendor/deps/cli-ui/lib/cli/ui/progress.rb +9 -7
  45. data/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +39 -14
  46. data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +62 -44
  47. data/vendor/deps/cli-ui/lib/cli/ui/prompt/options_handler.rb +7 -2
  48. data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +23 -3
  49. data/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +34 -10
  50. data/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb +12 -7
  51. data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +26 -16
  52. data/vendor/deps/cli-ui/lib/cli/ui/truncater.rb +3 -3
  53. data/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +75 -0
  54. data/vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb +27 -0
  55. data/vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb +61 -0
  56. metadata +20 -7
  57. data/lib/project_types/extension/features/tunnel_url.rb +0 -20
  58. data/lib/project_types/script/layers/infrastructure/assemblyscript_dependency_manager.rb +0 -51
  59. data/lib/project_types/script/layers/infrastructure/dependency_manager.rb +0 -36
  60. data/lib/project_types/script/layers/infrastructure/test_suite_repository.rb +0 -62
  61. data/vendor/deps/cli-ui/lib/cli/ui/box.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2b12fdb1aec476c1b05eee2e33817d3636f76927d4cdc5700347344b687e28d
4
- data.tar.gz: 83411b72925dbe120a4c89fa1d715f3fe61a7596ed4d356f03b537ea6bb31481
3
+ metadata.gz: e0d2feda9dda6ab4615cc2c15d8afb30f33cac588acd3f2672cd7456e4ad4fd8
4
+ data.tar.gz: 0b2ad4137e51ab352a41719e370b98fe147062386c6696f0be9a59bf884c1954
5
5
  SHA512:
6
- metadata.gz: 3557bcc2a93f0775a294b0c2d1c784949e84602155de21d3d3db89237ae7e50bbf3ba591bdc329ca6074ae27178444c6c939cd42ac361dcb5a9d50a9de4e8567
7
- data.tar.gz: 78ebf53316d6bebf24bb04832a5b052512d46df48f9f71cc3f388305c6210cd0ec32b2f1ba9151cd80d8199a26142c8684775f93198d7d9b61bf1291d1d39732
6
+ metadata.gz: 0564124577f1f85d2597250792c27e3de0eda4a02fcb7ba6f9dd8b7b2a3bf36492e6b7a3dce9d48b946af8bfb81f3f39e3d0fa06966082f40b0232e5d8597e8b
7
+ data.tar.gz: 07f8d25b7e123b5d9c09de7cd49a31017174e9a7251d50ca461381d06219b0560f6223e9d1dd3d89cd273b65965ab42eb1b007fe6151d9cfcff32bf4d16b3b0e
@@ -1,3 +1,8 @@
1
+ Version 0.9.3
2
+ ------
3
+ * Rebased to master
4
+ * Removed auto-generated files from builds directory
5
+
1
6
  Version 0.9.2
2
7
  ------
3
8
  * Rebased to master, to pull in 7+ Pull Requests
@@ -14,3 +14,6 @@ defaults:
14
14
  path: ""
15
15
  values:
16
16
  toc: true
17
+
18
+ plugins:
19
+ - jekyll-redirect-from
@@ -5,6 +5,15 @@ sidebar:
5
5
  - title: Getting started
6
6
  section: getting-started
7
7
  url: /getting-started/
8
+ subnav:
9
+ - title: Install
10
+ url: /getting-started/install/
11
+ - title: Upgrade
12
+ url: /getting-started/upgrade/
13
+ - title: Uninstall
14
+ url: /getting-started/uninstall/
15
+ - title: Migrate from a legacy version
16
+ url: /getting-started/migrate/
8
17
  - title: Core commands
9
18
  section: core
10
19
  url: /core/
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  title: Getting started
3
3
  section: getting-started
4
+ toc: false
4
5
  ---
5
6
 
6
7
  Developers should have some prior knowledge of the [Shopify app ecosystem](https://shopify.dev/concepts/apps). Shopify App CLI creates apps using either [Node.js](https://nodejs.org/) or [Ruby on Rails](https://rubyonrails.org/).
@@ -8,11 +9,8 @@ Developers should have some prior knowledge of the [Shopify app ecosystem](https
8
9
  ## Requirements
9
10
 
10
11
  - [Ruby](https://www.ruby-lang.org) 2.5.1+
11
- - [Node.js](https://nodejs.org) 10.0.0+
12
- - [curl](https://curl.haxx.se)
13
12
  - A [Shopify partner account](https://partners.shopify.com/signup)
14
13
  - A [Shopify development store](https://help.shopify.com/en/partners/dashboard/development-stores#create-a-development-store) to install and test apps
15
- - An [ngrok](https://ngrok.com/) account (free or paid) for local development
16
14
 
17
15
  ### Windows requirements
18
16
 
@@ -21,41 +19,8 @@ You’ll need to install the following tools to use Shopify App CLI on Windows:
21
19
  - [Linux Subsystem for Windows](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
22
20
  - [Ubuntu VM](https://www.microsoft.com/en-ca/p/ubuntu/9nblggh4msv6)
23
21
 
24
- ## Install
22
+ ## Next steps
25
23
 
26
- Shopify App CLI installs using a shell script. Download and run it in your terminal with one command:
27
-
28
- ```console
29
- eval "$(curl -sS https://raw.githubusercontent.com/Shopify/shopify-app-cli/master/install.sh)"
30
- ```
31
-
32
- [View shell script source](https://raw.githubusercontent.com/Shopify/shopify-app-cli/master/install.sh)
33
-
34
-
35
- ## Uninstall
36
-
37
- There are two steps to completely uninstall Shopify App CLI:
38
-
39
- 1. Delete the CLI files
40
- 1. Remove the `shopify` command from your shell profile
41
-
42
- ### 1. Delete the CLI files
43
-
44
- By default, Shopify App CLI is installed in your home directory. All the files are contained in a hidden directory called `.shopify-app-cli`. Delete that directory to uninstall.
45
-
46
- ### 2. Remove the `shopify` command from your shell
47
-
48
- During the install process, Shopify App CLI adds a line to your shell configuration. This line is typically located in the `.bash_profile` file in your home directory (depending on your system, it may also be found in `.bash_login` or `.profile`). It will look similar to this:
49
-
50
- ```sh
51
- # The line won’t look exactly like this. `HOME_DIR` will instead be the absolute path to your home directory.
52
- if [[ -f /HOME_DIR/.shopify-cli/shopify.sh ]]; then source /HOME_DIR/.shopify-cli/shopify.sh; fi
53
- ```
54
-
55
- You can use `grep` to search for the correct file in your home directory. This command will return the name of the relevant file, and the line number where it appears:
56
-
57
- ```console
58
- $ grep -Ens "^if.+\.shopify-app-cli/shopify\.sh.+fi$" ~/\.*
59
- ```
60
-
61
- Deleting or commenting out the relevant line in your shell profile will remove `shopify` as a command. You may need to reload your shell.
24
+ - [Install the CLI]({{ site.baseurl }}/getting-started/install/)
25
+ - [Upgrade]({{ site.baseurl }}/getting-started/upgrade/)
26
+ - [Uninstall]({{ site.baseurl }}/getting-started/uninstall/)
@@ -0,0 +1,39 @@
1
+ ---
2
+ title: Install Shopify App CLI
3
+ section: getting-started
4
+ toc: false
5
+ redirect_from: "/install/"
6
+ ---
7
+
8
+ Shopify App CLI can be installed using a variety of package managers.
9
+
10
+ ### Homebrew (macOS)
11
+
12
+ You’ll need to run `brew tap` first to add Shopify’s third-party repositories to Homebrew.
13
+
14
+ ```console
15
+ $ brew tap shopify/shopify
16
+ $ brew install shopify-cli
17
+ ```
18
+
19
+ ### apt (Debian, Ubuntu)
20
+
21
+ You’ll need to install a downloaded .deb file with an explicit version number. Check the [releases page](https://github.com/Shopify/shopify-app-cli/releases) to make sure you install the latest package.
22
+
23
+ ```console
24
+ $ sudo apt install shopify-cli-x.y.z.deb
25
+ ```
26
+
27
+ ### yum (CentOS 8+, Fedora, Red Hat, SUSE)
28
+
29
+ You’ll need to install a downloaded .rpm file with an explicit version number. Check the [releases page](https://github.com/Shopify/shopify-app-cli/releases) to make sure you install the latest package.
30
+
31
+ ```console
32
+ $ sudo yum install shopify-cli-x.y.x.rpm
33
+ ```
34
+
35
+ ### Ruby gem
36
+
37
+ ```console
38
+ $ gem install shopify-cli
39
+ ```
@@ -0,0 +1,63 @@
1
+ ---
2
+ title: Migrate from the legacy Shopify App CLI
3
+ section: getting-started
4
+ redirect_from: "/migrate/"
5
+ ---
6
+
7
+ As of version 0.9.0, Shopify App CLI is installed and managed as a software package, instead of as a git repository. If you’re using a legacy version, you’ll need to perform a one-time migration to keep using the CLI. Follow these steps to remove the legacy version and reinstall as a package.
8
+
9
+ ## Check whether you’re using the legacy version
10
+
11
+ Prior to version 0.9.0, Shopify App CLI was installed as a Git repository. You can determine if you’re running a legacy version by running this command:
12
+
13
+ ```console
14
+ $ shopify version
15
+ ```
16
+
17
+ If you get a “Command not found” error, then you’re using a legacy version and will need to uninstall it manually.
18
+
19
+ ## 1. Uninstall the legacy Shopify App CLI
20
+
21
+ There are two steps to completely uninstall the legacy version of Shopify App CLI:
22
+
23
+ 1. Delete the legacy CLI files
24
+ 1. Remove the legacy `shopify` command from your shell profile
25
+
26
+ ### 1. Delete the CLI files
27
+
28
+ By default, Shopify App CLI was installed in your home directory. All the files are contained in a hidden directory called `.shopify-app-cli`. Delete it to uninstall:
29
+
30
+ ```console
31
+ $ rm -rf ~/.shopify-app-cli/
32
+ ```
33
+
34
+ ### 2. Remove the `shopify` command from your shell
35
+
36
+ During the install process, Shopify App CLI added a line to your shell configuration. This line could be located in one of a few possible files in your home directory:
37
+
38
+ - `~/.bash_profile`
39
+ - `~/.zshrc`
40
+ - `~/.bash_login`
41
+ - `~/.profile`
42
+ - `~/.config/fish/config.fish`
43
+
44
+ It will look similar to one of the lines below. The exact syntax may vary depending on your system:
45
+
46
+ ```sh
47
+ # The line won’t look *exactly* like this. `HOME_DIR` will instead be the absolute path to your home directory.
48
+ if [[ -f /HOME_DIR/.shopify-cli/shopify.sh ]]; then source /HOME_DIR/.shopify-cli/shopify.sh; fi
49
+
50
+ # The line might not be wrapped in an `if` statement. Example:
51
+ [ -f "/HOME_DIR/.shopify-app-cli/shopify.sh" ] && source "/HOME_DIR/.shopify-app-cli/shopify.sh"
52
+ ```
53
+
54
+ Deleting or commenting out the relevant line in your shell profile will remove `shopify` as a command. You may need to reload your shell.
55
+
56
+ ## 2. Install the new version
57
+
58
+ Next, install the most recent version of Shopify App CLI. Follow the [install directions]({{ site.baseurl }}/getting-started/install/) for your platform.
59
+
60
+ ## 3. Re-authenticate the CLI
61
+
62
+ The migration process moves some configuration files, so you’ll need to re-authenticate the CLI with your Shopify Partner Dashboard. The CLI will automatically prompt you to re-authenticate when needed.
63
+
@@ -0,0 +1,37 @@
1
+ ---
2
+ title: Uninstall Shopify App CLI
3
+ section: getting-started
4
+ toc: false
5
+ redirect_from: "/uninstall/"
6
+ ---
7
+
8
+ Shopify App CLI can be removed from your system using the same package manager you used to install it.
9
+
10
+ ### Homebrew (macOS)
11
+
12
+ ```console
13
+ $ brew uninstall shopify-cli
14
+ ```
15
+
16
+ ### apt (Debian, Ubuntu)
17
+
18
+ ```console
19
+ $ sudo apt remove shopify-cli
20
+ ```
21
+
22
+ ### yum (CentOS 8+, Fedora, Red Hat, SUSE)
23
+
24
+ ```console
25
+ $ sudo yum remove shopify-cli
26
+ ```
27
+
28
+ ### Ruby gem
29
+
30
+ ```console
31
+ $ gem uninstall shopify-cli
32
+ ```
33
+
34
+ ## Uninstall a legacy version
35
+
36
+ If you’re using a legacy version of the CLI (`<0.9.0`), you’ll need to [uninstall it manually]({{ site.baseurl }}/getting-started/migrate/#1-uninstall-the-old-cli).
37
+
@@ -0,0 +1,37 @@
1
+ ---
2
+ title: Upgrade Shopify App CLI
3
+ section: getting-started
4
+ toc: false
5
+ redirect_from: "/upgrade/"
6
+ ---
7
+
8
+ You can manage upgrades to Shopify App CLI with the package manager for your platform.
9
+
10
+ ### Homebrew (macOS)
11
+
12
+ ```console
13
+ $ brew update
14
+ $ brew upgrade shopify-cli
15
+ ```
16
+
17
+ ### apt (Debian, Ubuntu)
18
+
19
+ On Debian-based Linux distributions, download the latest `.deb` file for Shopify App CLI from the [releases page](https://github.com/Shopify/shopify-app-cli/releases) and install it to update.
20
+
21
+ ```console
22
+ $ sudo apt install shopify-cli-x.y.z.deb
23
+ ```
24
+
25
+ ### yum (CentOS 8+, Fedora, Red Hat, SUSE)
26
+
27
+ On Red Hat–based Linux distributions, download the latest `.rpm` file for Shopify App CLI from the [releases page](https://github.com/Shopify/shopify-app-cli/releases) and install it to update.
28
+
29
+ ```console
30
+ $ sudo yum install shopify-cli-x.y.z.rpm
31
+ ```
32
+
33
+ ### Ruby gem
34
+
35
+ ```console
36
+ $ gem update shopify-cli
37
+ ```
@@ -10,18 +10,17 @@ Shopify App CLI helps you build Shopify apps faster. It quickly scaffolds Node.j
10
10
 
11
11
  ## Quick start
12
12
 
13
- 1. Install Shopify App CLI:
14
- ```console
15
- $ eval "$(curl -sS https://raw.githubusercontent.com/Shopify/shopify-app-cli/master/install.sh)"
16
- ```
13
+ 1. [Install Shopify App CLI]({{ site.baseurl }}{% link getting-started/install/index.md %}).
17
14
  2. Create an app:
18
15
  ```console
19
16
  $ shopify create
20
17
  ```
21
- 3. Start and install your app on a Shopify Development store:
18
+ 3. Start and install your app on a Shopify development store:
22
19
  ```console
23
20
  $ shopify serve
24
21
  ```
25
22
  ```console
26
23
  $ shopify open
27
- ```
24
+ ```
25
+
26
+ **[Learn more in our Getting Started guide]({{ site.baseurl }}{% link getting-started/index.md %})**
@@ -30,6 +30,7 @@ module Extension
30
30
  module Tasks
31
31
  autoload :UserErrors, Project.project_filepath('tasks/user_errors')
32
32
  autoload :GetApps, Project.project_filepath('tasks/get_apps')
33
+ autoload :GetApp, Project.project_filepath('tasks/get_app')
33
34
  autoload :CreateExtension, Project.project_filepath('tasks/create_extension')
34
35
  autoload :UpdateDraft, Project.project_filepath('tasks/update_draft')
35
36
 
@@ -37,6 +38,7 @@ module Extension
37
38
  autoload :RegistrationConverter, Project.project_filepath('tasks/converters/registration_converter')
38
39
  autoload :VersionConverter, Project.project_filepath('tasks/converters/version_converter')
39
40
  autoload :ValidationErrorConverter, Project.project_filepath('tasks/converters/validation_error_converter')
41
+ autoload :AppConverter, Project.project_filepath('tasks/converters/app_converter')
40
42
  end
41
43
  end
42
44
 
@@ -51,7 +53,6 @@ module Extension
51
53
  autoload :ArgoSetupStep, Project.project_filepath('features/argo_setup_step')
52
54
  autoload :ArgoSetupSteps, Project.project_filepath('features/argo_setup_steps')
53
55
  autoload :ArgoDependencies, Project.project_filepath('features/argo_dependencies')
54
- autoload :TunnelUrl, Project.project_filepath('features/tunnel_url')
55
56
  end
56
57
 
57
58
  module Models
@@ -37,7 +37,7 @@ module Extension
37
37
  private
38
38
 
39
39
  def status
40
- tunnel_url = Features::TunnelUrl.fetch
40
+ tunnel_url = ShopifyCli::Tunnel.urls.first
41
41
 
42
42
  if tunnel_url.nil?
43
43
  @ctx.puts(@ctx.message('tunnel.no_tunnel_running'))
@@ -16,13 +16,12 @@ module Extension
16
16
  attr_writer :app
17
17
 
18
18
  def ask_app
19
- apps = load_apps
20
-
21
19
  if !api_key.nil?
22
- found_app = apps.find { |app| app.api_key == api_key }
20
+ found_app = Tasks::GetApp.call(context: ctx, api_key: api_key)
23
21
  ctx.abort(ctx.message('register.invalid_api_key', api_key)) if found_app.nil?
24
22
  found_app
25
23
  else
24
+ apps = load_apps
26
25
  CLI::UI::Prompt.ask(ctx.message('register.ask_app')) do |handler|
27
26
  apps.each do |app|
28
27
  handler.option("#{app.title} by #{app.business_name}") { app }
@@ -0,0 +1,9 @@
1
+ query getApp($api_key: String!) {
2
+ app(apiKey: $api_key) {
3
+ title
4
+ apiKey
5
+ apiSecretKeys{
6
+ secret
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+ require 'shopify_cli'
3
+
4
+ module Extension
5
+ module Tasks
6
+ module Converters
7
+ module AppConverter
8
+ API_KEY_FIELD = 'apiKey'
9
+ API_SECRET_KEYS_FIELD = 'apiSecretKeys'
10
+ API_SECRET_FIELD = 'secret'
11
+ TITLE_FIELD = 'title'
12
+ ORGANIZATION_NAME_FIELD = 'businessName'
13
+
14
+ def self.from_hash(hash, organization = {})
15
+ return nil if hash.nil?
16
+
17
+ Models::App.new(
18
+ api_key: hash[API_KEY_FIELD],
19
+ secret: hash[API_SECRET_KEYS_FIELD].first[API_SECRET_FIELD],
20
+ title: hash[TITLE_FIELD],
21
+ business_name: organization[ORGANIZATION_NAME_FIELD]
22
+ )
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ require 'shopify_cli'
3
+
4
+ module Extension
5
+ module Tasks
6
+ class GetApp < ShopifyCli::Task
7
+ GRAPHQL_FILE = 'get_app_by_api_key'
8
+
9
+ RESPONSE_FIELD = %w(data)
10
+ APP_FIELD = 'app'
11
+
12
+ def call(context:, api_key:)
13
+ input = { api_key: api_key }
14
+
15
+ response = ShopifyCli::PartnersAPI.query(context, GRAPHQL_FILE, input).dig(*RESPONSE_FIELD)
16
+ context.abort(context.message('tasks.errors.parse_error')) if response.nil?
17
+
18
+ Converters::AppConverter.from_hash(response.dig(APP_FIELD))
19
+ end
20
+ end
21
+ end
22
+ end
@@ -21,12 +21,7 @@ module Extension
21
21
  return [] unless organization.key?('apps') && organization['apps'].any?
22
22
 
23
23
  organization['apps'].map do |app|
24
- Models::App.new(
25
- api_key: app['apiKey'],
26
- secret: app["apiSecretKeys"].first["secret"],
27
- title: app['title'],
28
- business_name: organization['businessName']
29
- )
24
+ Converters::AppConverter.from_hash(app, organization)
30
25
  end
31
26
  end
32
27
  end