shopify-cli 2.6.3 → 2.7.0
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/.github/PULL_REQUEST_TEMPLATE.md +15 -4
- data/.github/workflows/shopify.yml +3 -6
- data/.vscode/extensions.json +5 -0
- data/.vscode/settings.json +9 -0
- data/CHANGELOG.md +98 -104
- data/CONTRIBUTING.md +1 -21
- data/Codespace.dockerfile +35 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +9 -5
- data/README.md +20 -99
- data/RELEASING.md +17 -30
- data/Rakefile +0 -5
- data/Tests.dockerfile +35 -0
- data/assets/logo.png +0 -0
- data/dev.yml +0 -3
- data/docs/README.md +13 -0
- data/docs/contributors/testing.md +27 -0
- data/docs/users/installation.md +46 -0
- data/{THEMEKIT_MIGRATION.md → docs/users/migrate-from-themekit.md} +1 -1
- data/lib/project_types/extension/cli.rb +7 -3
- data/lib/project_types/extension/commands/create.rb +6 -6
- data/lib/project_types/extension/commands/extension_command.rb +1 -1
- data/lib/project_types/extension/features/argo.rb +9 -10
- data/lib/project_types/extension/features/argo_serve.rb +9 -23
- data/lib/project_types/extension/forms/create.rb +1 -1
- data/lib/project_types/extension/forms/questions/ask_template.rb +3 -6
- data/lib/project_types/extension/messages/messages.rb +1 -0
- data/lib/project_types/extension/models/development_server_requirements.rb +2 -3
- data/lib/project_types/extension/models/server_config/app.rb +13 -0
- data/lib/project_types/extension/models/server_config/development.rb +5 -4
- data/lib/project_types/extension/models/server_config/development_renderer.rb +1 -1
- data/lib/project_types/extension/models/server_config/development_resource.rb +13 -0
- data/lib/project_types/extension/models/server_config/extension.rb +4 -0
- data/lib/project_types/extension/models/server_config/root.rb +4 -1
- data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +1 -1
- data/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +1 -1
- data/lib/project_types/extension/tasks/convert_server_config.rb +65 -0
- data/lib/project_types/extension/tasks/ensure_resource_url.rb +39 -0
- data/lib/project_types/extension/tasks/find_package_from_json.rb +37 -0
- data/lib/project_types/extension/tasks/merge_server_config.rb +32 -0
- data/lib/project_types/extension/tasks/run_extension_command.rb +10 -9
- data/lib/project_types/node/cli.rb +0 -16
- data/lib/project_types/node/forms/create.rb +5 -5
- data/lib/project_types/node/messages/messages.rb +2 -149
- data/lib/project_types/php/cli.rb +0 -11
- data/lib/project_types/php/forms/create.rb +5 -6
- data/lib/project_types/php/messages/messages.rb +2 -164
- data/lib/project_types/rails/cli.rb +0 -16
- data/lib/project_types/rails/commands/create.rb +46 -17
- data/lib/project_types/rails/forms/create.rb +5 -7
- data/lib/project_types/rails/messages/messages.rb +6 -154
- data/lib/project_types/script/cli.rb +1 -1
- data/lib/project_types/script/commands/create.rb +5 -6
- data/lib/project_types/script/commands/push.rb +1 -1
- data/lib/project_types/script/config/extension_points.yml +10 -0
- data/lib/project_types/script/errors.rb +0 -18
- data/lib/project_types/script/graphql/app_script_set.graphql +2 -0
- data/lib/project_types/script/layers/application/build_script.rb +2 -1
- data/lib/project_types/script/layers/application/create_script.rb +2 -2
- data/lib/project_types/script/layers/application/push_script.rb +15 -1
- data/lib/project_types/script/layers/domain/push_package.rb +5 -2
- data/lib/project_types/script/layers/domain/script_json.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/api_clients/partners_proxy_api_client.rb +0 -4
- data/lib/project_types/script/layers/infrastructure/errors.rb +17 -2
- data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +29 -13
- data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +29 -13
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +4 -2
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +3 -4
- data/lib/project_types/script/layers/infrastructure/script_service.rb +7 -2
- data/lib/project_types/script/messages/messages.rb +9 -22
- data/lib/project_types/script/ui/error_handler.rb +16 -26
- data/lib/project_types/theme/cli.rb +1 -1
- data/lib/project_types/theme/commands/check.rb +1 -1
- data/lib/project_types/theme/commands/delete.rb +1 -1
- data/lib/project_types/theme/commands/init.rb +1 -1
- data/lib/project_types/theme/commands/language_server.rb +1 -1
- data/lib/project_types/theme/commands/package.rb +1 -1
- data/lib/project_types/theme/commands/publish.rb +1 -1
- data/lib/project_types/theme/commands/pull.rb +1 -1
- data/lib/project_types/theme/commands/push.rb +1 -1
- data/lib/project_types/theme/commands/serve.rb +10 -2
- data/lib/project_types/theme/messages/messages.rb +10 -0
- data/lib/shopify_cli/admin_api/populate_resource_command.rb +1 -1
- data/lib/shopify_cli/api.rb +7 -2
- data/lib/shopify_cli/app_type_detector.rb +36 -0
- data/lib/shopify_cli/command/app_sub_command.rb +10 -0
- data/lib/shopify_cli/command/project_command.rb +18 -0
- data/lib/shopify_cli/command/sub_command.rb +19 -0
- data/lib/shopify_cli/command.rb +13 -3
- data/lib/shopify_cli/command_options/command_serve_options.rb +43 -0
- data/lib/shopify_cli/command_options.rb +7 -0
- data/lib/shopify_cli/commands/app/connect.rb +22 -0
- data/lib/shopify_cli/commands/app/create/node.rb +38 -0
- data/lib/shopify_cli/commands/app/create/php.rb +36 -0
- data/lib/shopify_cli/commands/app/create/rails.rb +40 -0
- data/lib/shopify_cli/commands/app/create.rb +28 -0
- data/lib/shopify_cli/commands/app/deploy.rb +49 -0
- data/lib/shopify_cli/commands/app/open.rb +19 -0
- data/lib/shopify_cli/commands/app/serve.rb +49 -0
- data/lib/shopify_cli/commands/app/tunnel.rb +43 -0
- data/lib/shopify_cli/commands/app.rb +29 -0
- data/lib/shopify_cli/commands/config.rb +2 -2
- data/lib/shopify_cli/commands/login.rb +3 -3
- data/lib/shopify_cli/commands/reporting.rb +38 -0
- data/lib/shopify_cli/commands/switch.rb +1 -1
- data/lib/shopify_cli/commands.rb +2 -0
- data/lib/shopify_cli/constants.rb +11 -3
- data/lib/shopify_cli/core/monorail.rb +9 -20
- data/lib/shopify_cli/environment.rb +15 -1
- data/lib/shopify_cli/exception_reporter.rb +29 -16
- data/lib/shopify_cli/git.rb +12 -1
- data/lib/shopify_cli/github/issue_url_generator.rb +19 -0
- data/lib/shopify_cli/github.rb +5 -0
- data/lib/shopify_cli/messages/messages.rb +295 -22
- data/lib/shopify_cli/migrator/migration.rb +1 -1
- data/lib/shopify_cli/migrator/migrations/1631709766_noop.rb +1 -1
- data/lib/shopify_cli/migrator/migrations/1633691650_merge_reporting_configuration.rb +41 -0
- data/lib/shopify_cli/migrator.rb +9 -11
- data/lib/shopify_cli/project.rb +5 -1
- data/lib/shopify_cli/project_commands.rb +1 -1
- data/lib/shopify_cli/reporting_configuration_controller.rb +64 -0
- data/lib/shopify_cli/services/app/connect_service.rb +25 -0
- data/lib/shopify_cli/services/app/create/node_service.rb +153 -0
- data/lib/shopify_cli/services/app/create/php_service.rb +152 -0
- data/lib/shopify_cli/services/app/create/rails_service.rb +213 -0
- data/lib/shopify_cli/services/app/deploy/heroku/node_service.rb +101 -0
- data/lib/shopify_cli/services/app/deploy/heroku/php_service.rb +135 -0
- data/lib/shopify_cli/services/app/deploy/heroku/rails_service.rb +120 -0
- data/lib/shopify_cli/services/app/open_service.rb +19 -0
- data/lib/shopify_cli/services/app/serve/node_service.rb +42 -0
- data/lib/shopify_cli/services/app/serve/php_service.rb +46 -0
- data/lib/shopify_cli/services/app/serve/rails_service.rb +48 -0
- data/lib/shopify_cli/services/app/tunnel/auth_service.rb +21 -0
- data/lib/shopify_cli/services/app/tunnel/start_service.rb +20 -0
- data/lib/shopify_cli/services/app/tunnel/stop_service.rb +20 -0
- data/lib/shopify_cli/services/base_service.rb +13 -0
- data/lib/shopify_cli/services/reporting_service.rb +16 -0
- data/lib/shopify_cli/services.rb +37 -0
- data/lib/shopify_cli/theme/dev_server/local_assets.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/watcher.rb +2 -2
- data/lib/shopify_cli/theme/dev_server.rb +9 -2
- data/lib/shopify_cli/version.rb +1 -1
- data/lib/shopify_cli.rb +5 -2
- data/shopify-cli.gemspec +2 -13
- data/shopify-dev +18 -0
- data/utilities/constants.rb +7 -0
- data/utilities/docker/container.rb +104 -0
- data/utilities/docker.rb +45 -3
- data/utilities/utilities.rb +1 -0
- metadata +63 -54
- data/Dockerfile +0 -17
- data/docs/_config.yml +0 -2
- data/docs/app/node/commands/index.md +0 -4
- data/docs/app/node/index.md +0 -4
- data/docs/app/rails/commands/index.md +0 -4
- data/docs/app/rails/index.md +0 -4
- data/docs/core/index.md +0 -4
- data/docs/getting-started/index.md +0 -4
- data/docs/getting-started/install/index.md +0 -4
- data/docs/getting-started/migrate/index.md +0 -4
- data/docs/getting-started/uninstall/index.md +0 -4
- data/docs/getting-started/upgrade/index.md +0 -4
- data/docs/help/start-app/index.md +0 -4
- data/docs/index.md +0 -4
- data/ext/shopify-cli/extconf.rb +0 -60
- data/install.sh +0 -7
- data/lib/project_types/extension/tasks/converters/server_config_converter.rb +0 -31
- data/lib/project_types/extension/tasks/load_server_config.rb +0 -23
- data/lib/project_types/node/commands/connect.rb +0 -21
- data/lib/project_types/node/commands/create.rb +0 -125
- data/lib/project_types/node/commands/deploy/heroku.rb +0 -96
- data/lib/project_types/node/commands/deploy.rb +0 -32
- data/lib/project_types/node/commands/generate.rb +0 -22
- data/lib/project_types/node/commands/open.rb +0 -18
- data/lib/project_types/node/commands/serve.rb +0 -54
- data/lib/project_types/node/commands/tunnel.rb +0 -41
- data/lib/project_types/php/commands/connect.rb +0 -19
- data/lib/project_types/php/commands/create.rb +0 -143
- data/lib/project_types/php/commands/deploy/heroku.rb +0 -129
- data/lib/project_types/php/commands/deploy.rb +0 -32
- data/lib/project_types/php/commands/open.rb +0 -16
- data/lib/project_types/php/commands/serve.rb +0 -51
- data/lib/project_types/php/commands/tunnel.rb +0 -37
- data/lib/project_types/rails/commands/connect.rb +0 -21
- data/lib/project_types/rails/commands/deploy/heroku.rb +0 -115
- data/lib/project_types/rails/commands/deploy.rb +0 -32
- data/lib/project_types/rails/commands/generate/webhook.rb +0 -42
- data/lib/project_types/rails/commands/generate.rb +0 -60
- data/lib/project_types/rails/commands/open.rb +0 -18
- data/lib/project_types/rails/commands/serve.rb +0 -52
- data/lib/project_types/rails/commands/tunnel.rb +0 -41
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +0 -0
- data/lib/shopify_cli/exception_reporter/permission_controller.rb +0 -54
- data/lib/shopify_cli/sub_command.rb +0 -17
- data/shopify.fish +0 -12
- data/shopify.sh +0 -11
data/README.md
CHANGED
@@ -1,113 +1,34 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
<div align="center">
|
2
|
+
<img src="assets/logo.png" width="150"/>
|
3
|
+
<h1>Shopify CLI</h1>
|
4
|
+
<a href=""><img src="https://github.com/shopify/shopify-cli/workflows/CI/badge.svg" alt="Shopify"></a>
|
5
|
+
<img src="https://img.shields.io/github/v/release/shopify/shopify-cli?include_prereleases&style=flat-square" alt="Latest Version">
|
6
|
+
<img src="https://img.shields.io/github/forks/shopify/shopify-cli?style=flat-square" alt="GitHub forks">
|
7
|
+
<img src="https://img.shields.io/github/stars/shopify/shopify-cli?style=flat-square" alt="GitHub stars">
|
8
|
+
<img src="https://img.shields.io/github/commit-activity/w/shopify/shopify-cli?style=flat-square" alt="Commit Activity">
|
9
|
+
<img src="https://img.shields.io/github/contributors/shopify/shopify-cli?style=flat-square" alt="Contributors">
|
10
|
+
<img src="https://img.shields.io/github/commits-since/shopify/shopify-cli/latest?style=flat-square" alt="Latest Commits">
|
11
|
+
<a href="http://twitter.com/ShopifyDevs"><img src="https://img.shields.io/twitter/follow/ShopifyDevs?style=flat-square" alt="Twitter Followers"></a>
|
12
|
+
<img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License">
|
13
|
+
<img src="https://img.shields.io/badge/Powered%20by-Ruby-red" alt="Powered by Ruby">
|
14
|
+
</div>
|
5
15
|
|
6
16
|
|
7
17
|
Shopify CLI helps you build Shopify themes and apps. Use Shopify CLI to automate and enhance your local development workflow.
|
8
18
|
|
9
19
|
Shopify CLI is available as a gem and can be run and installed on Mac, Linux and Windows systems.
|
10
20
|
|
11
|
-
## Installation
|
12
|
-
|
13
|
-
- Make sure you have [Homebrew](https://brew.sh/) installed
|
14
|
-
- Open your terminal app
|
15
|
-
- Run `brew tap shopify/shopify`
|
16
|
-
- Run `brew install shopify-cli`
|
17
|
-
- After the installation is completed, run `shopify version`, if this outputs a version number you've successfully installed the CLI.
|
18
|
-
|
19
|
-
### To upgrade Shopify CLI
|
20
|
-
|
21
|
-
#### Homebrew (Mac OS)
|
22
|
-
|
23
|
-
```shell
|
24
|
-
$ brew update
|
25
|
-
$ brew upgrade shopify-cli
|
26
|
-
```
|
27
|
-
|
28
|
-
#### apt (Debian, Ubuntu)
|
29
|
-
|
30
|
-
1.- Download the latest `.deb` binary for Shopify CLI from the releases page.
|
31
|
-
|
32
|
-
2.- Install the downloaded file and make sure to replace /path/to/download/shopify-cli-x.y.z.deb with the path to your file's location:
|
33
|
-
|
34
|
-
```shell
|
35
|
-
$ sudo apt install /path/to/downloaded/shopify-cli-x.y.z.deb
|
36
|
-
```
|
37
|
-
|
38
|
-
#### yum (CentOS 8+, Fedora, Red Hat, SUSE)
|
39
|
-
|
40
|
-
1.- Download the latest .rpm file for Shopify App CLI from the releases page.
|
41
|
-
|
42
|
-
2.- Install the downloaded file and make sure to replace /path/to/downloaded/shopify-cli-x.y.x.rpm with the path to your file's location:
|
43
|
-
|
44
|
-
```shell
|
45
|
-
$ sudo yum install /path/to/downloaded/shopify-cli-x.y.x.rpm
|
46
|
-
```
|
47
|
-
|
48
|
-
#### RubyGems (macOS, Linux, Windows 10)
|
49
|
-
|
50
|
-
```shell
|
51
|
-
$ gem update shopify-cli
|
52
|
-
```
|
53
|
-
|
54
|
-
|
55
|
-
## Command specification and semantics
|
56
|
-
|
57
|
-
Shopify CLI offers a command structure similar to other CLIs:
|
58
|
-
|
59
|
-
`shopify [ GLOBAL_ACTION | RESOURCE [ ACTION ] ] [ VARIADIC_ARGS ] [ OPTIONS ]`
|
60
|
-
|
61
|
-
The top level command will always be a **resource** or a **global action**:
|
62
|
-
|
63
|
-
- Resources represent Shopify concepts that you can work with in the CLI, for example `theme`.
|
64
|
-
- Usually, global actions are commands that alter the state of the CLI (e.g `config` or `login`)
|
65
|
-
|
66
|
-
Actions are commands that you can run to interact with a resource.
|
67
|
-
|
68
|
-
You can add `--help` or `-h` to the end of your command to get a full explanation of the available options for the command.
|
69
|
-
|
70
|
-
## Quick start guide for theme developers
|
71
|
-
|
72
|
-
This quick start guide shows you how to begin local theme development when working with a new theme from scratch.
|
73
|
-
|
74
|
-
### 1.- Authenticate the CLI
|
75
|
-
|
76
|
-
After you install Shopify CLI, you need to authenticate your CLI instance and connect to the store that you want to work on.
|
77
|
-
|
78
|
-
Run:
|
79
|
-
|
80
|
-
`shopify login --store=<your-shop-url>`
|
81
|
-
|
82
|
-
When prompted, open the provided accounts.shopify.com URL in a browser. In your browser window, log into the account that's attached to the store that you want to use for development.
|
83
|
-
|
84
|
-
### 2.- Create a new theme
|
85
|
-
|
86
|
-
Run:
|
87
|
-
|
88
|
-
`shopify theme init`
|
89
|
-
|
90
|
-
To initialize a theme on your current working directory. This will actually clone Shopify's starter theme which you should use as a reference when building themes for Shopify.
|
91
|
-
|
92
|
-
### 3.- Start the local theme server
|
93
|
-
|
94
|
-
Shopify CLI comes with a local theme server which lets you preview your changes live on your local machine.
|
95
|
-
|
96
|
-
After you create or navigate to your theme, you can run `shopify theme serve` to interact with the theme in a browser. Shopify CLI uploads the theme as a development theme on the store that you're connected to, and gives you an IP address and port to preview changes in real time using the store's data.
|
97
|
-
|
98
|
-
Run:
|
99
|
-
|
100
|
-
`shopify theme serve`
|
21
|
+
## Installation
|
101
22
|
|
102
|
-
|
23
|
+
Check out our [installation steps](docs/users/installation.md).
|
103
24
|
|
104
|
-
|
25
|
+
## Contributing 👩💻
|
105
26
|
|
106
|
-
|
27
|
+
Shopify CLI is an [open source tool](/LICENSE) and everyone is welcome to help the community by [contributing](/docs/README.md) to the project.
|
107
28
|
|
108
|
-
|
29
|
+
## Help 🖐
|
109
30
|
|
110
|
-
|
31
|
+
If you encounter issues using the CLI or have feedback you'd like to share with us, below are some options:
|
111
32
|
|
112
33
|
- [Open a GitHub issue](https://github.com/Shopify/shopify-cli/issues) - To report bugs or request new features, open an issue in the Shopify CLI repository.
|
113
34
|
|
data/RELEASING.md
CHANGED
@@ -1,65 +1,52 @@
|
|
1
1
|
## Releasing Shopify CLI
|
2
2
|
|
3
3
|
1. Check the Semantic Versioning page for info on how to version the new release: http://semver.org
|
4
|
-
|
5
|
-
1. Make sure you're on the most recent `main`
|
4
|
+
2. Make sure you're on the most recent `main`
|
6
5
|
```
|
7
6
|
$ git checkout main
|
8
7
|
$ git pull
|
9
8
|
```
|
10
|
-
|
11
|
-
1. Create a branch named `release_X_Y_Z` (replacing `X_Y_Z` with the intended release version)
|
9
|
+
3. Create a branch named `release_X_Y_Z` (replacing `X_Y_Z` with the intended release version)
|
12
10
|
```
|
13
11
|
$ git checkout -b release_X_Y_Z
|
14
12
|
```
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
1. Add an entry for the new release to `CHANGELOG.md`
|
21
|
-
|
22
|
-
1. Commit the changes with a commit message like "Packaging for release X.Y.Z"
|
13
|
+
4. Update the version of Shopify CLI in `lib/shopify_cli/version.rb`
|
14
|
+
5. Update the version of Shopify CLI at the top of `Gemfile.lock` (failing to do so causes the CI build to fail)
|
15
|
+
6. Add an entry for the new release to `CHANGELOG.md`
|
16
|
+
7. Commit the changes with a commit message like "Packaging for release X.Y.Z"
|
23
17
|
```
|
24
18
|
$ git commit -am "Packaging for release vX.Y.Z"
|
25
19
|
```
|
26
|
-
|
27
|
-
1. Push out the changes
|
20
|
+
8. Push out the changes
|
28
21
|
```
|
29
22
|
$ git push -u origin release_X_Y_Z
|
30
23
|
```
|
31
24
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
1. Update your `main` branch to the latest version
|
25
|
+
9. Open a PR for the branch, get necessary approvals from code owners and merge into main branch. Note that the PR title will be the release note in Shipit, so make sure it mentions the release
|
26
|
+
10. Deploy using Shipit
|
27
|
+
11. Update your `main` branch to the latest version
|
37
28
|
```
|
38
29
|
$ git checkout main
|
39
30
|
$ git pull
|
40
31
|
```
|
41
|
-
|
42
|
-
|
32
|
+
|
33
|
+
12. On local machine and _AFTER_ gem has been published to https://rubygems.org, run
|
43
34
|
```
|
44
35
|
$ rake package
|
45
36
|
```
|
46
37
|
This will generate the `.deb`, `.rpm` and brew formula files, which will be located in `packaging/builds/X.Y.Z/`.
|
47
38
|
|
48
|
-
|
39
|
+
13. Clone the `Shopify/homebrew-shopify` repository (if not already cloned), and then
|
49
40
|
* create a branch named `release_X_Y_Z_of_shopify-cli`
|
50
41
|
* update the brew formula in `shopify-cli.rb` with the generated formula in `packaging/builds/X.Y.Z/` in the `Shopify/shopify-cli` repo (from the `rake package` step above)
|
51
42
|
* commit the change and create a PR on the [Shopify Homebrew repository](https://github.com/Shopify/homebrew-shopify)
|
52
43
|
* when PR is approved, merge into main branch
|
53
|
-
|
54
|
-
|
44
|
+
|
45
|
+
14. Go to [releases](https://github.com/Shopify/shopify-cli/releases) page of `Shopify/shopify-cli` repo and create a new release:
|
55
46
|
* use the tag created by Shipit (should be "vX.Y.Z")
|
56
47
|
* release title = "Version X.Y.Z"
|
57
|
-
* description should be
|
58
|
-
```
|
59
|
-
Release of version X.Y.Z of Shopify CLI
|
60
|
-
|
61
|
-
Please refer to [CHANGELOG](https://github.com/Shopify/shopify-cli/blob/main/CHANGELOG.md) for details.
|
62
|
-
```
|
48
|
+
* description should be the content of the section in the `CHANGELOG.md`
|
63
49
|
* upload the `.deb` and `.rpm` files from `packaging/builds/X.Y.Z/` (generated in step 9)
|
64
50
|
* if it's a pre-release version, select the "This is a pre-release" checkbox
|
65
51
|
* and click "Publish release".
|
52
|
+
15. Go through all the PR [labeled with `includes-post-release-steps`](https://github.com/Shopify/shopify-cli/labels/includes-post-release-steps) and follow the post-release steps described in those PRs. Delete the labels afterward.
|
data/Rakefile
CHANGED
@@ -22,11 +22,6 @@ namespace :linux do
|
|
22
22
|
task :test do
|
23
23
|
Utilities::Docker.run_and_rm_container("bundle", "exec", "rake", "test")
|
24
24
|
end
|
25
|
-
|
26
|
-
desc "Runs the acceptance tests suite in a Linux Docker environment"
|
27
|
-
task :features do
|
28
|
-
Utilities::Docker.run_and_rm_container("bundle", "exec", "cucumber")
|
29
|
-
end
|
30
25
|
end
|
31
26
|
|
32
27
|
RuboCop::RakeTask.new
|
data/Tests.dockerfile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# This is a Docker image to test the CLI in UNIX environments other than macOS
|
2
|
+
# Build the image: docker build . -t shopify-cli
|
3
|
+
# Run tests: docker run -t --rm --volume "$(pwd):/usr/src/app" shopify-cli bundle exec rake test
|
4
|
+
FROM cimg/ruby:2.7.1
|
5
|
+
|
6
|
+
RUN git config --global user.email "development-lifecycle@shopify.com"
|
7
|
+
RUN git config --global user.name "Development Lifecycle"
|
8
|
+
|
9
|
+
RUN gem update bundler
|
10
|
+
|
11
|
+
WORKDIR /usr/src/app
|
12
|
+
|
13
|
+
COPY Gemfile Gemfile.lock ./
|
14
|
+
COPY shopify-cli.gemspec shopify-cli.gemspec
|
15
|
+
COPY lib/shopify_cli/version.rb lib/shopify_cli/version.rb
|
16
|
+
RUN bundle install
|
17
|
+
|
18
|
+
# Update git
|
19
|
+
RUN sudo add-apt-repository -y ppa:git-core/ppa
|
20
|
+
RUN sudo apt-get update
|
21
|
+
RUN sudo apt-get install git -y
|
22
|
+
|
23
|
+
# Install the latest version of NodeJS
|
24
|
+
RUN sudo apt-get install ca-certificates -y
|
25
|
+
RUN curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
|
26
|
+
RUN sudo apt-get install -y nodejs
|
27
|
+
|
28
|
+
# Install the latest version of Yarn
|
29
|
+
RUN sudo npm install --global yarn
|
30
|
+
|
31
|
+
# Python is necessary to compile NPM packages with native extensions through node-gyp
|
32
|
+
RUN sudo apt install python-minimal -y
|
33
|
+
|
34
|
+
# Install sqlite3
|
35
|
+
RUN sudo apt-get install libsqlite3-dev -y
|
data/assets/logo.png
ADDED
Binary file
|
data/dev.yml
CHANGED
data/docs/README.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Documentation
|
2
|
+
|
3
|
+
This directory contains documentation for **contributors** of the Shopify CLI.
|
4
|
+
It also contains documentation that is relevant to **users** like migration guidelines.
|
5
|
+
|
6
|
+
## Contributors
|
7
|
+
|
8
|
+
- [**Testing**](contributors/testing.md): Read about testing strategies and how they are used across the codebase.
|
9
|
+
|
10
|
+
## Users
|
11
|
+
|
12
|
+
- [**Installation**](users/installation.md): Learn how to install the Shopify CLI in different OSs.
|
13
|
+
- [**Migrate from theme-kit**](users/migrate-from-themekit.md): If you were previously using theme-kit, check out this documentation to learn how to migrate to the Shopify CLI theme commands.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
## Testing
|
2
|
+
|
3
|
+
The project employs a diverse suite tests that help ensure it works as intended and prevents regressions as it continues to grow and evolve.
|
4
|
+
|
5
|
+
### Unit Tests
|
6
|
+
Most of the internal components the project uses have unit tests to thoroughly test them. Here dependencies of components are mocked or stubbed appropriately to ensure tests are reliable, test only one component and are fast!
|
7
|
+
|
8
|
+
### Acceptance Tests
|
9
|
+
|
10
|
+
Acceptance tests run the built `shopify` command line against a wide range of fixtures and verify its output and results. They are the slowest to run however provide the most coverage. The idea is to test a few complete scenarios for each major feature.
|
11
|
+
|
12
|
+
Those are written in [Cucumber](https://cucumber.io/) and Ruby and can be found in the [`features/`](/features) directory. They can be executed by running:
|
13
|
+
|
14
|
+
```bash
|
15
|
+
bundle exec cucumber
|
16
|
+
bundle exec cucumber features/theme.feature:3 # A specific test
|
17
|
+
```
|
18
|
+
|
19
|
+
> **Note** that we currently don't have an approach for stubbing the interactions with the GraphQL APIs and that therefore we can't write acceptance tests for commands that interact with APIs.
|
20
|
+
|
21
|
+
#### Debugging acceptance tests
|
22
|
+
When developing acceptance tests, it can be helpful to see the outputs of running commands.
|
23
|
+
To see outputs, append `--verbose` when running an acceptance test. Example:
|
24
|
+
|
25
|
+
```sh
|
26
|
+
bundle exec cucumber features/theme.feature --verbose
|
27
|
+
```
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Installation
|
2
|
+
|
3
|
+
## Installation through RubyGems
|
4
|
+
|
5
|
+
The easiest method to install the Shopify CLI is through RubyGems:
|
6
|
+
|
7
|
+
```shell
|
8
|
+
$ gem install shopify-cli
|
9
|
+
```
|
10
|
+
|
11
|
+
## Installation for macOS Users
|
12
|
+
|
13
|
+
- Make sure you have [Homebrew](https://brew.sh/) installed
|
14
|
+
- Open your terminal app
|
15
|
+
- Run `brew tap shopify/shopify`
|
16
|
+
- Run `brew install shopify-cli`
|
17
|
+
- After the installation is completed, run `shopify version`, if this outputs a version number you've successfully installed the CLI.
|
18
|
+
|
19
|
+
### To upgrade Shopify CLI
|
20
|
+
|
21
|
+
#### Homebrew (Mac OS)
|
22
|
+
|
23
|
+
```shell
|
24
|
+
$ brew update
|
25
|
+
$ brew upgrade shopify-cli
|
26
|
+
```
|
27
|
+
|
28
|
+
## Installation for Debian and Ubuntu users through `apt`
|
29
|
+
|
30
|
+
1.- Download the latest `.deb` binary for Shopify CLI from the releases page.
|
31
|
+
|
32
|
+
2.- Install the downloaded file and make sure to replace /path/to/download/shopify-cli-x.y.z.deb with the path to your file's location:
|
33
|
+
|
34
|
+
```shell
|
35
|
+
$ sudo apt install /path/to/downloaded/shopify-cli-x.y.z.deb
|
36
|
+
```
|
37
|
+
|
38
|
+
## Installation for CentOS 8+, Fedora, Red Hat, and SUSE users through `yum`
|
39
|
+
|
40
|
+
1.- Download the latest .rpm file for Shopify App CLI from the releases page.
|
41
|
+
|
42
|
+
2.- Install the downloaded file and make sure to replace /path/to/downloaded/shopify-cli-x.y.x.rpm with the path to your file's location:
|
43
|
+
|
44
|
+
```shell
|
45
|
+
$ sudo yum install /path/to/downloaded/shopify-cli-x.y.x.rpm
|
46
|
+
```
|
@@ -12,7 +12,7 @@ module Extension
|
|
12
12
|
register_messages(Extension::Messages::MessageLoading.load)
|
13
13
|
end
|
14
14
|
|
15
|
-
class Command < ShopifyCLI::
|
15
|
+
class Command < ShopifyCLI::Command::ProjectCommand
|
16
16
|
hidden_feature
|
17
17
|
autoload :ExtensionCommand, Project.project_filepath("commands/extension_command")
|
18
18
|
|
@@ -42,7 +42,10 @@ module Extension
|
|
42
42
|
autoload :GetExtensions, Project.project_filepath("tasks/get_extensions")
|
43
43
|
autoload :GetProduct, Project.project_filepath("tasks/get_product")
|
44
44
|
autoload :RunExtensionCommand, Project.project_filepath("tasks/run_extension_command")
|
45
|
-
autoload :
|
45
|
+
autoload :MergeServerConfig, Project.project_filepath("tasks/merge_server_config")
|
46
|
+
autoload :FindPackageFromJson, Project.project_filepath("tasks/find_package_from_json.rb")
|
47
|
+
autoload :EnsureResourceUrl, Project.project_filepath("tasks/ensure_resource_url.rb")
|
48
|
+
autoload :ConvertServerConfig, Project.project_filepath("tasks/convert_server_config")
|
46
49
|
|
47
50
|
module Converters
|
48
51
|
autoload :RegistrationConverter, Project.project_filepath("tasks/converters/registration_converter")
|
@@ -50,7 +53,6 @@ module Extension
|
|
50
53
|
autoload :ValidationErrorConverter, Project.project_filepath("tasks/converters/validation_error_converter")
|
51
54
|
autoload :AppConverter, Project.project_filepath("tasks/converters/app_converter")
|
52
55
|
autoload :ProductConverter, Project.project_filepath("tasks/converters/product_converter")
|
53
|
-
autoload :ServerConfigConverter, Project.project_filepath("tasks/converters/server_config_converter")
|
54
56
|
end
|
55
57
|
end
|
56
58
|
|
@@ -93,9 +95,11 @@ module Extension
|
|
93
95
|
|
94
96
|
module ServerConfig
|
95
97
|
autoload :Base, Project.project_filepath("models/server_config/base")
|
98
|
+
autoload :App, Project.project_filepath("models/server_config/app")
|
96
99
|
autoload :Development, Project.project_filepath("models/server_config/development")
|
97
100
|
autoload :DevelopmentEntries, Project.project_filepath("models/server_config/development_entries")
|
98
101
|
autoload :DevelopmentRenderer, Project.project_filepath("models/server_config/development_renderer")
|
102
|
+
autoload :DevelopmentResource, Project.project_filepath("models/server_config/development_resource")
|
99
103
|
autoload :Extension, Project.project_filepath("models/server_config/extension")
|
100
104
|
autoload :Root, Project.project_filepath("models/server_config/root")
|
101
105
|
autoload :User, Project.project_filepath("models/server_config/user")
|
@@ -2,15 +2,14 @@
|
|
2
2
|
|
3
3
|
module Extension
|
4
4
|
class Command
|
5
|
-
class Create < ShopifyCLI::SubCommand
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
prerequisite_task :ensure_authenticated
|
5
|
+
class Create < ShopifyCLI::Command::SubCommand
|
6
|
+
unless ShopifyCLI::Environment.acceptance_test?
|
7
|
+
prerequisite_task :ensure_authenticated
|
8
|
+
end
|
11
9
|
|
12
10
|
options do |parser, flags|
|
13
11
|
parser.on("--name=NAME") { |name| flags[:name] = name }
|
12
|
+
parser.on("--template=TEMPLATE") { |template| flags[:template] = template }
|
14
13
|
parser.on("--type=TYPE") { |type| flags[:type] = type.upcase }
|
15
14
|
parser.on("--api-key=KEY") { |key| flags[:api_key] = key.downcase }
|
16
15
|
parser.on("--getting-started") { flags[:getting_started] = true }
|
@@ -65,6 +64,7 @@ module Extension
|
|
65
64
|
@ctx.chdir(form.directory_name)
|
66
65
|
write_env_file(form)
|
67
66
|
rescue => error
|
67
|
+
@ctx.debug(error)
|
68
68
|
raise error
|
69
69
|
end
|
70
70
|
|
@@ -23,7 +23,7 @@ module Extension
|
|
23
23
|
Features::ArgoSetup.new(git_template: git_template).call(directory_name, identifier, context)
|
24
24
|
end
|
25
25
|
|
26
|
-
def config(context)
|
26
|
+
def config(context, include_renderer_version: true)
|
27
27
|
js_system = ShopifyCLI::JsSystem.new(ctx: context)
|
28
28
|
if js_system.package_manager == "yarn"
|
29
29
|
run_yarn_install(context, js_system)
|
@@ -31,9 +31,15 @@ module Extension
|
|
31
31
|
end
|
32
32
|
filepath = File.join(context.root, SCRIPT_PATH)
|
33
33
|
context.abort(context.message("features.argo.missing_file_error")) unless File.exist?(filepath)
|
34
|
+
|
35
|
+
renderer_version = nil
|
36
|
+
if include_renderer_version
|
37
|
+
renderer_version = renderer_package(context).version
|
38
|
+
end
|
39
|
+
|
34
40
|
begin
|
35
41
|
{
|
36
|
-
renderer_version:
|
42
|
+
renderer_version: renderer_version,
|
37
43
|
serialized_script: Base64.strict_encode64(File.read(filepath).chomp),
|
38
44
|
}
|
39
45
|
rescue StandardError
|
@@ -42,14 +48,7 @@ module Extension
|
|
42
48
|
end
|
43
49
|
|
44
50
|
def renderer_package(context)
|
45
|
-
|
46
|
-
Tasks::FindNpmPackages
|
47
|
-
.exactly_one_of(renderer_package_name, js_system: js_system, production_only: true)
|
48
|
-
.unwrap { |err| raise err }
|
49
|
-
rescue Extension::PackageResolutionFailed
|
50
|
-
context.abort(
|
51
|
-
context.message("features.argo.dependencies.argo_missing_renderer_package_error")
|
52
|
-
)
|
51
|
+
Tasks::FindPackageFromJson.call(renderer_package_name, context: context)
|
53
52
|
end
|
54
53
|
|
55
54
|
private
|
@@ -63,7 +63,9 @@ module Extension
|
|
63
63
|
ShopifyCLI::Tasks::EnsureDevStore.call(context) if required_fields.include?(:shop)
|
64
64
|
|
65
65
|
project = ExtensionProject.current
|
66
|
-
|
66
|
+
if resource_url_required?
|
67
|
+
Tasks::EnsureResourceUrl.call(context: context, specification_handler: specification_handler)
|
68
|
+
end
|
67
69
|
|
68
70
|
return if required_fields.all? do |field|
|
69
71
|
value = project.env.public_send(field)
|
@@ -73,6 +75,10 @@ module Extension
|
|
73
75
|
context.abort(context.message("serve.serve_missing_information"))
|
74
76
|
end
|
75
77
|
|
78
|
+
def resource_url_required?
|
79
|
+
specification_handler.supplies_resource_url? && resource_url.nil?
|
80
|
+
end
|
81
|
+
|
76
82
|
def options
|
77
83
|
project = ExtensionProject.current
|
78
84
|
|
@@ -88,28 +94,6 @@ module Extension
|
|
88
94
|
end
|
89
95
|
end
|
90
96
|
|
91
|
-
def ensure_resource_resource_url!
|
92
|
-
project = ExtensionProject.current(force_reload: true)
|
93
|
-
|
94
|
-
ShopifyCLI::Result
|
95
|
-
.wrap(project.resource_url)
|
96
|
-
.rescue { specification_handler.build_resource_url(shop: project.env.shop, context: context) }
|
97
|
-
.then(&method(:persist_resource_url))
|
98
|
-
.unwrap do |nil_or_exception|
|
99
|
-
case nil_or_exception
|
100
|
-
when nil
|
101
|
-
context.warn(context.message("warnings.resource_url_auto_generation_failed", project.env.shop))
|
102
|
-
else
|
103
|
-
context.abort(nil_or_exception)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
def persist_resource_url(resource_url)
|
109
|
-
ExtensionProject.update_env_file(context: context, resource_url: resource_url)
|
110
|
-
resource_url
|
111
|
-
end
|
112
|
-
|
113
97
|
def new_serve_flow
|
114
98
|
Tasks::RunExtensionCommand.new(
|
115
99
|
type: specification_handler.specification.identifier,
|
@@ -117,6 +101,8 @@ module Extension
|
|
117
101
|
context: context,
|
118
102
|
port: port,
|
119
103
|
config_file_name: specification_handler.server_config_file,
|
104
|
+
resource_url: resource_url,
|
105
|
+
tunnel_url: tunnel_url
|
120
106
|
).call
|
121
107
|
end
|
122
108
|
|
@@ -24,7 +24,7 @@ module Extension
|
|
24
24
|
ShopifyCLI::Result.wrap(ExtensionProjectDetails.new)
|
25
25
|
.then(&Questions::AskApp.new(ctx: ctx, api_key: api_key))
|
26
26
|
.then(&Questions::AskType.new(ctx: ctx, type: type))
|
27
|
-
.then(&Questions::AskTemplate.new(ctx: ctx))
|
27
|
+
.then(&Questions::AskTemplate.new(ctx: ctx, template: template))
|
28
28
|
.then(&Questions::AskName.new(ctx: ctx, name: name))
|
29
29
|
.unwrap { |e| raise e }
|
30
30
|
.tap do |project_details|
|
@@ -4,18 +4,15 @@ module Extension
|
|
4
4
|
class AskTemplate
|
5
5
|
include ShopifyCLI::MethodObject
|
6
6
|
|
7
|
-
TEMPLATE_REQUIRED_TYPES = [
|
8
|
-
"checkout_ui_extension",
|
9
|
-
]
|
10
|
-
|
11
7
|
property! :ctx
|
8
|
+
property :template, accepts: Models::ServerConfig::Development::VALID_TEMPLATES
|
12
9
|
property :prompt,
|
13
10
|
accepts: ->(prompt) { prompt.respond_to?(:call) },
|
14
11
|
default: -> { CLI::UI::Prompt.method(:ask) }
|
15
12
|
|
16
13
|
def call(project_details)
|
17
14
|
return project_details unless template_required?(project_details)
|
18
|
-
project_details.template = choose_interactively
|
15
|
+
project_details.template = template || choose_interactively
|
19
16
|
project_details
|
20
17
|
end
|
21
18
|
|
@@ -24,7 +21,7 @@ module Extension
|
|
24
21
|
def template_required?(project_details)
|
25
22
|
return false unless extension_server_beta?
|
26
23
|
type = project_details&.type&.identifier
|
27
|
-
|
24
|
+
Models::DevelopmentServerRequirements::SUPPORTED_EXTENSION_TYPES.include?(type.downcase)
|
28
25
|
end
|
29
26
|
|
30
27
|
def extension_server_beta?
|
@@ -175,6 +175,7 @@ module Extension
|
|
175
175
|
errors: {
|
176
176
|
unknown_type: "Unknown extension type %s",
|
177
177
|
package_not_found: "`%s` package not found.",
|
178
|
+
module_not_found: "Unable to find module %s. Ensure your dependencies are up-to-date and try again.",
|
178
179
|
},
|
179
180
|
warnings: {
|
180
181
|
resource_url_auto_generation_failed: "{{*}} {{yellow:Warning:}} Unable to auto generate " \
|
@@ -6,11 +6,10 @@ module Extension
|
|
6
6
|
class DevelopmentServerRequirements
|
7
7
|
SUPPORTED_EXTENSION_TYPES = [
|
8
8
|
"checkout_ui_extension",
|
9
|
+
"checkout_post_purchase",
|
10
|
+
"product_subscription",
|
9
11
|
]
|
10
12
|
|
11
|
-
UNIX_NAME = "shopify-extensions"
|
12
|
-
WINDOWS_NAME = "shopify-extensions.exe"
|
13
|
-
|
14
13
|
class << self
|
15
14
|
def supported?(type)
|
16
15
|
binary_installed? && type_supported?(type) && beta_enabled?
|
@@ -12,11 +12,12 @@ module Extension
|
|
12
12
|
|
13
13
|
CURRENT_DIRECTORY = "."
|
14
14
|
|
15
|
-
property
|
15
|
+
property :root_dir, accepts: String, default: CURRENT_DIRECTORY
|
16
16
|
property! :build_dir, accepts: String, default: "build"
|
17
|
-
property
|
18
|
-
property
|
19
|
-
property
|
17
|
+
property :template, accepts: VALID_TEMPLATES
|
18
|
+
property :renderer, accepts: ServerConfig::DevelopmentRenderer
|
19
|
+
property :entries, accepts: ServerConfig::DevelopmentEntries
|
20
|
+
property :resource, accepts: ServerConfig::DevelopmentResource
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|