From c16583465a92634f81314b77454064994acde4ac Mon Sep 17 00:00:00 2001 From: Wojciech Sikora Date: Thu, 8 May 2025 09:48:33 +0200 Subject: [PATCH] docs(es-1660): add CLI reference --- .../2.tooling-and-concepts/5.cli-reference.md | 556 ++++++++++++++++++ 1 file changed, 556 insertions(+) diff --git a/docs/content/guides/7.multistore/2.tooling-and-concepts/5.cli-reference.md b/docs/content/guides/7.multistore/2.tooling-and-concepts/5.cli-reference.md index 377befbd78..ee2e74ff96 100644 --- a/docs/content/guides/7.multistore/2.tooling-and-concepts/5.cli-reference.md +++ b/docs/content/guides/7.multistore/2.tooling-and-concepts/5.cli-reference.md @@ -5,3 +5,559 @@ layout: default # CLI Reference +Alokai CLI built on top of `oclif`. + +# Usage + + +```sh-session +$ npm install -g @alokai/cli +$ alokai-cli COMMAND +running command... +$ alokai-cli (--version) +@alokai/cli/0.1.2-rc.0 darwin-arm64 node-v18.20.2 +$ alokai-cli --help [COMMAND] +USAGE + $ alokai-cli COMMAND +... +``` + + +# Commands + + +* [`alokai-cli help [COMMAND]`](#alokai-cli-help-command) +* [`alokai-cli store`](#alokai-cli-store) +* [`alokai-cli store add`](#alokai-cli-store-add) +* [`alokai-cli store build`](#alokai-cli-store-build) +* [`alokai-cli store changed`](#alokai-cli-store-changed) +* [`alokai-cli store deploy`](#alokai-cli-store-deploy) +* [`alokai-cli store dev`](#alokai-cli-store-dev) +* [`alokai-cli store move`](#alokai-cli-store-move) +* [`alokai-cli store start`](#alokai-cli-store-start) +* [`alokai-cli store test`](#alokai-cli-store-test) + +## `alokai-cli help [COMMAND]` + +Display help for alokai-cli. + +``` +USAGE + $ alokai-cli help [COMMAND...] [-n] + +ARGUMENTS + COMMAND... Command to show help for. + +FLAGS + -n, --nested-commands Include all nested commands in the output. + +DESCRIPTION + Display help for alokai-cli. +``` + +_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.4/src/commands/help.ts)_ + +## `alokai-cli store` + +Multibrand stores management + +``` +USAGE + $ alokai-cli store + +DESCRIPTION + Multibrand stores management +``` + +## `alokai-cli store add` + +This command allows you to add a new store to the project. + +``` +USAGE + $ alokai-cli store add [--force] [--template] [--console-project-name ] [--cloud-region ] + [--framework ] [-s ] [-p ] [-v] + +FLAGS + -p, --parent= parent + -s, --store-id= store-id + -v, --verbose verbose + --cloud-region= [default: europe-west1] cloud-region + --console-project-name= console-project-name + --force force + --framework= framework + --template template + +DESCRIPTION + This command allows you to add a new store to the project. + +EXAMPLES + Create a new store. It will prompt for all the required information. + + $ alokai-cli store add + + Create a new deployable store with one-liner + + $ alokai-cli store add --store-id=my-store --framework=nextjs --console-project-name=my-project --force + + Create a new template store with one-liner + + $ alokai-cli store add --store-id=my-store --template --framework=nextjs --console-project-name=my-project \ + --force + +FLAG DESCRIPTIONS + -p, --parent= parent + + Parent ID for the store nesting, default is root + + -s, --store-id= store-id + + Store ID for newly generated store + + -v, --verbose verbose + + Show verbose output + + --cloud-region= cloud-region + + Cloud region for the given Console project + + --console-project-name= console-project-name + + Project name for newly generated store in Alokai Console + + --force force + + Force the operation and ignore prompts + + --framework= framework + + Frontend framework for the new store to use in deployment + + --template template + + Defines if the store is a template store that will not be deployed, all its files will be used for inheritance + purposes +``` + +## `alokai-cli store build` + +Build the production version of the stores + +``` +USAGE + $ alokai-cli store build [-s ...] [--compose-only] [--cache-dir ] [-a] [-v] [--filter ...] + +FLAGS + -a, --all all + -s, --store-id=... [default: ] store-id + -v, --verbose verbose + --cache-dir= cache-dir + --compose-only compose-only + --filter=... [default: ] filter + +DESCRIPTION + Build the production version of the stores + +EXAMPLES + Build the production version of all stores + + $ alokai-cli store build --all + + Build the production version of the specific store + + $ alokai-cli store build --store-id=my-store + + Build the production version of multiple stores + + $ alokai-cli store build --store-id=my-store my-other-store + + Compose only the stores, do not build the production version + + $ alokai-cli store build --all --compose-only + + Specify the turbo cache directory + + $ alokai-cli store build --cache-dir=/path/to/cache + + Build all the apps in store except for middleware + + $ alokai-cli store build --store-id=my-store --filter=!storefront-middleware-* + +FLAG DESCRIPTIONS + -a, --all all + + Build the production store for all stores + + -s, --store-id=... store-id + + Build the production store for the specified single store or multiple stores + + -v, --verbose verbose + + Show verbose output + + --cache-dir= cache-dir + + The directory to store the turbo cache. If not provided, the cache will be stored in the default location for turbo + + --compose-only compose-only + + Only compose the stores, do not build the production version + + --filter=... filter + + Use Turborepo package filters to build only specified apps +``` + +## `alokai-cli store changed` + +Get a list of changed stores + +``` +USAGE + $ alokai-cli store changed [--condensed] [-s ] [--to ] [--global-dependencies ...] + +FLAGS + -s, --since= [default: HEAD~1] since + --condensed condensed + --global-dependencies=... [default: ] global-dependencies + --to= to + +DESCRIPTION + Get a list of changed stores + +EXAMPLES + Get a list of changed stores since the last commit + + $ alokai-cli store changed + + Get a condensed list of changed stores since the last commit + + $ alokai-cli store changed --condensed + + Mark all stores as changed when any file in the packages directory changes + + $ alokai-cli store changed --global-dependencies="packages/**" + + Get a list of changed stores since the last 10 commits + + $ alokai-cli store changed --since=HEAD~10 + + Get a list of changed stores since the specified commit + + $ alokai-cli store changed --since=commit-sha + +FLAG DESCRIPTIONS + -s, --since= since + + Get a list of changed stores since the specified git reference + + --condensed condensed + + Condensed output that will return only an array of store IDs affected by the changes + + --global-dependencies=... global-dependencies + + Path or globs to global dependencies which should trigger all stores to rebuild + + --to= to + + Git branch commit ID or relative ref (for instance HEAD) to run tests to that commit +``` + +## `alokai-cli store deploy` + +Deploy stores to the Alokai Console + +``` +USAGE + $ alokai-cli store deploy --cloud-username --cloud-password --docker-registry-url [-s + ...] [-a] [-v] + +FLAGS + -a, --all all + -s, --store-id=... [default: ] store-id + -v, --verbose verbose + --cloud-password= (required) cloud-password + --cloud-username= (required) cloud-username + --docker-registry-url= (required) [default: registry.vuestorefront.cloud] docker-registry-url + +DESCRIPTION + Deploy stores to the Alokai Console + +EXAMPLES + Deploy all stores using environment variables for credentials + + $ alokai-cli store deploy --all + + Deploy a specific store with explicit credentials + + $ alokai-cli store deploy --store-id=my-store --cloud-username=user --cloud-password=pass \ + --docker-registry-url=registry.vuestorefront.cloud + +FLAG DESCRIPTIONS + -a, --all all + + Run the deployment for all stores + + -s, --store-id=... store-id + + Run the deployment for the specified single store or multiple stores + + -v, --verbose verbose + + Show verbose output + + --cloud-password= cloud-password + + The user password for the Alokai Cloud, required for deployment. Alternatively, you can set the CLI_CLOUD_PASSWORD + environment variable + + --cloud-username= cloud-username + + The user ID for the Alokai Cloud, required for deployment. Alternatively, you can set the CLI_CLOUD_USERNAME + environment variable + + --docker-registry-url= docker-registry-url + + The URL of the Docker registry to push the images to. Alternatively, you can set the CLI_DOCKER_REGISTRY_URL + environment variable +``` + +## `alokai-cli store dev` + +Start the development server for stores. + +``` +USAGE + $ alokai-cli store dev [-s ...] [-a] [--skip-compose] [--with-local-domains] [-v] [--filter ...] + +FLAGS + -a, --all all + -s, --store-id=... [default: ] store-id + -v, --verbose verbose + --filter=... [default: ] filter + --skip-compose skip-compose + --with-local-domains with-local-domains + +DESCRIPTION + Start the development server for stores. + +EXAMPLES + Start development server for all stores + + $ alokai-cli store dev --all + + Start development server for a specific store + + $ alokai-cli store dev --store-id=my-store + + Start development server for multiple stores + + $ alokai-cli store dev --store-id=my-store my-other-store + + Start development server excluding middleware apps + + $ alokai-cli store dev --all --filter=!storefront-middleware-* + + Start development server with local domains by using Caddy + + $ alokai-cli store dev --all --with-local-domains + +FLAG DESCRIPTIONS + -a, --all all + + Run the development server for all stores + + -s, --store-id=... store-id + + Run the development server for the specified single store or multiple stores + + -v, --verbose verbose + + Show verbose output + + --filter=... filter + + Use Turborepo package filters to start dev mode only for specified apps. For example, use + --filter=!storefront-middleware-default to start dev mode in the default store except for middleware app + + --skip-compose skip-compose + + Skip composing temporary stores and use the existing ones + + --with-local-domains with-local-domains + + Run local HTTPS server using Caddy. This flag generates a Caddyfile using the `localDomain` entries from your + `alokai.config.json` file and starts the Caddy server. Before using `--with-local-domains` flag, ensure that: + 1. Caddy is installed on your system. You can install it by following the instructions at + https://caddyserver.com/docs/install. + 2. Your system's hosts file is correctly configured to map the `localDomain` values to your local machine. + You can check the generated Caddyfile in `.out/Caddyfile` file. Please keep in mind that the Caddyfile will be + overwritten every time you run the `dev` command with the `--with-local-domains` flag. +``` + +## `alokai-cli store move` + +Move stores to a different parent in the hierarchy + +``` +USAGE + $ alokai-cli store move [-s ...] [-p ] + +FLAGS + -p, --parent= ID of the new parent store + -s, --store-id=... ID of the store(s) to move + +DESCRIPTION + Move stores to a different parent in the hierarchy + +EXAMPLES + Move a store under a new parent store + + $ alokai-cli store move --store-id=my-store --parent=new-parent + + Move multiple stores under the root + + $ alokai-cli store move --store-id=store1,store2 --parent=root + +FLAG DESCRIPTIONS + -p, --parent= ID of the new parent store + + Unique identifier of the new parent store (can be 'root') + + -s, --store-id=... ID of the store(s) to move + + Unique identifier(s) of the store(s) to be moved +``` + +## `alokai-cli store start` + +Start the production server for stores. This command requires stores to be already built. + +``` +USAGE + $ alokai-cli store start [-s ...] [-a] [--with-local-domains] [-v] [--filter ...] + +FLAGS + -a, --all all + -s, --store-id=... [default: ] store-id + -v, --verbose verbose + --filter=... [default: ] filter + --with-local-domains with-local-domains + +DESCRIPTION + Start the production server for stores. This command requires stores to be already built. + +EXAMPLES + Start production server for all stores + + $ alokai-cli store start --all + + Start production server for a specific store + + $ alokai-cli store start --store-id=my-store + + Start production server for multiple stores + + $ alokai-cli store start --store-id=my-store my-other-store + + Start production server excluding middleware apps + + $ alokai-cli store start --all --filter=!storefront-middleware-* + +FLAG DESCRIPTIONS + -a, --all all + + Run the production server for all stores + + -s, --store-id=... store-id + + Run the production server for the specified single store or multiple stores + + -v, --verbose verbose + + Show verbose output + + --filter=... filter + + Use Turborepo package filters to start only specified apps. For example, use --filter=!storefront-middleware-default + to start all apps in the default store except for middleware + + --with-local-domains with-local-domains + + Run local HTTPS server using Caddy. This flag generates a Caddyfile using the `localDomain` entries from your + `alokai.config.json` file and starts the Caddy server. Before using `--with-local-domains` flag, ensure that: + 1. Caddy is installed on your system. You can install it by following the instructions at + https://caddyserver.com/docs/install. + 2. Your system's hosts file is correctly configured to map the `localDomain` values to your local machine. + You can check the generated Caddyfile in `.out/Caddyfile` file. Please keep in mind that the Caddyfile will be + overwritten every time you run the `dev` command with the `--with-local-domains` flag. +``` + +## `alokai-cli store test` + +This command allows to run playwright tests for the specified single store or multiple stores. + +``` +USAGE + $ alokai-cli store test [-s ...] [-a] [--since ] [--to ] [--ui] + +FLAGS + -a, --all all + -s, --store-id=... [default: ] store-id + --since= since + --to= to + --ui ui + +DESCRIPTION + This command allows to run playwright tests for the specified single store or multiple stores. + If a store ID or store IDs are specified, it will run tests only for the specified store(s). + +EXAMPLES + Run tests for all stores + + $ alokai-cli store test --all + + Run tests for a specific store + + $ alokai-cli store test --store-id=my-store + + Run tests for multiple stores + + $ alokai-cli store test --store-id=my-store my-other-store + + Run tests for changes since a specific commit + + $ alokai-cli store test --since=commit-sha + + Run tests in UI mode for a specific store + + $ alokai-cli store test --store-id=my-store --ui + +FLAG DESCRIPTIONS + -a, --all all + + Run playwright test for all stores + + -s, --store-id=... store-id + + Run playwright tests for the specified single store or multiple stores + + --since= since + + git branch, commit id or relative ref (for instance HEAD~1) to run tests since that commit + + --to= to + + Git branch commit ID or relative ref (for instance HEAD) to run tests to that commit + + --ui ui + + Run Playwright's tests in the UI mode. Only works with a single store and you need to provide store ID with the + --store-id flag +``` + + +