diff --git a/readme.md b/readme.md index 1f3c230e0..dbd99b99b 100644 --- a/readme.md +++ b/readme.md @@ -327,12 +327,12 @@ swa start http://localhost:3000 --swa-config-location ./my-app-source If you need to override the default values for the `swa` command, you can provide the following options: -| Option | Description | Default | Example | -| ----------------------- | ------------------------------------------------------------------ | ----------------------- | ----------------------------------------- | -| `--verbose` | Enable verbose output. Values are: `silly, info, log, silent` | `log` | `--verbose=silly` | -| `--config` | Path to [`swa-cli.config.json`](#swa-cli.config.json) file to use | `./swa-cli.config.json` | `--config=./path/to/swa-cli.config.json` | -| `--print-config` | Print all resolved options | `false` | `--print-config` or `--print-config=true` | -| `--swa-config-location` | The directory where the `staticwebapp.config.json` file is located | `./` | `--swa-config-location=./app` | +| Option | Description | Default | Example | +| ----------------------------- | ------------------------------------------------------------------ | ----------------------- | ----------------------------------------- | +| `-V`, `--verbose` | Enable verbose output. Values are: `silly, info, log, silent` | `log` | `--verbose=silly` | +| `-c`, `--config` | Path to [`swa-cli.config.json`](#swa-cli.config.json) file to use | `./swa-cli.config.json` | `--config=./path/to/swa-cli.config.json` | +| `-g`, `--print-config` | Print all resolved options | `false` | `--print-config` or `--print-config=true` | +| `-w`, `--swa-config-location` | The directory where the `staticwebapp.config.json` file is located | `./` | `--swa-config-location=./app` | ### Subcommand `swa login` options @@ -342,33 +342,33 @@ TODO If you need to override the default values for the `swa start` subcommand, you can provide the following options: -| Option | Description | Default | Example | -| --------------------- | -------------------------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------ | -| `--app-location` | The folder containing the source code of the front-end application | `./` | `--app-location="./app"` | -| `--api-location` | The folder containing the source code of the API application. This could also be an URL to a `func` dev server | `./api` | `--api-location="./api"` or `--api-location=http://localhost:8083` | -| `--api-port` | The API server port passed to `func start` | `7071` | `--api-port=8082` | -| `--host` | The host address to use for the CLI dev server | `0.0.0.0` | `--host=192.168.68.80` | -| `--port` | The port value to use for the CLI dev server | `4280` | `--port=8080` | -| `--ssl` | Serve the front-end application and API over HTTPS | `false` | `--ssl` or `--ssl=true` | -| `--ssl-cert` | The SSL certificate (.crt) to use when enabling HTTPS | | `--ssl-cert="/home/user/ssl/example.crt"` | -| `--ssl-key` | The SSL key (.key) to use when enabling HTTPS | | `--ssl-key="/home/user/ssl/example.key"` | -| `--run` | Run a custon shell command or file at startup | | `--run="cd app & npm start"` | -| `--devserver-timeout` | The time (in seconds) to wait when connecting to a front-end application's dev server or api server | `60` | `--devserver-timeout=100` | -| `--func-args` | Pass additional arguments to the `func start` command | | `--func-args="--javascript"` | -| `--open` | Automatically open the CLI dev server in the default browser. | `false` | `--open` or `--open=true` | +| Option | Description | Default | Example | +| --------------------------- | -------------------------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------ | +| `-a`, `--app-location` | The folder containing the source code of the front-end application | `./` | `--app-location="./app"` | +| `-i`, `--api-location` | The folder containing the source code of the API application. This could also be an URL to a `func` dev server | `./api` | `--api-location="./api"` or `--api-location=http://localhost:8083` | +| `-j`, `--api-port` | The API server port passed to `func start` | `7071` | `--api-port=8082` | +| `-q`, `--host` | The host address to use for the CLI dev server | `0.0.0.0` | `--host=192.168.68.80` | +| `-p`, `--port` | The port value to use for the CLI dev server | `4280` | `--port=8080` | +| `-s`, `--ssl` | Serve the front-end application and API over HTTPS | `false` | `--ssl` or `--ssl=true` | +| `-e`, `--ssl-cert` | The SSL certificate (.crt) to use when enabling HTTPS | | `--ssl-cert="/home/user/ssl/example.crt"` | +| `-k`, `--ssl-key` | The SSL key (.key) to use when enabling HTTPS | | `--ssl-key="/home/user/ssl/example.key"` | +| `-r`, `--run` | Run a custon shell command or file at startup | | `--run="cd app & npm start"` | +| `-t`, `--devserver-timeout` | The time (in seconds) to wait when connecting to a front-end application's dev server or api server | `60` | `--devserver-timeout=100` | +| `-f`, `--func-args` | Pass additional arguments to the `func start` command | | `--func-args="--javascript"` | +| `-o`, `--open` | Automatically open the CLI dev server in the default browser. | `false` | `--open` or `--open=true` | ### Subcommand `swa deploy` options If you need to override the default values for the `swa deploy` subcommand, you can provide the following options: -| Option | Description | Default | Example | -| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | --------- | ----------------------------------------- | -| `--api-location` | The folder containing the source code of the API application | `./api` | `--api-location="./api"` | -| `--deployment-token` | The secret toekn used to authenticate with the Static Web Apps | | `--deployment-token="123"` | -| `--dry-run` | Simulate a deploy process without actually running it | `false` | `--dry-run` | -| `--print-token` | print the deployment token | `false` | `--print-token` | -| `--env` | the type of deployment environment where to deploy the project | `preview` | `--env="production"` or `--env="preview"` | -| `--print-token` | Print the deployment token. Usefull when using `--deployment-token` on CI/CD
Note: this command does not run the deployment process. | `false` | `--print-token` | +| Option | Description | Default | Example | +| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | --------- | ----------------------------------------- | +| `-i`, `--api-location` | The folder containing the source code of the API application | `./api` | `--api-location="./api"` | +| `-d`, `--deployment-token` | The secret toekn used to authenticate with the Static Web Apps | | `--deployment-token="123"` | +| `-dr`, `--dry-run` | Simulate a deploy process without actually running it | `false` | `--dry-run` | +| `-pt`, `--print-token` | print the deployment token | `false` | `--print-token` | +| `--env` | the type of deployment environment where to deploy the project | `preview` | `--env="production"` or `--env="preview"` | +| `-pt`, `--print-token` | Print the deployment token. Usefull when using `--deployment-token` on CI/CD
Note: this command does not run the deployment process. | `false` | `--print-token` | The deploy command does also support the same options as the `swa login` command. diff --git a/src/cli/commands/build.ts b/src/cli/commands/build.ts index 9bfa00e78..6a59834c6 100644 --- a/src/cli/commands/build.ts +++ b/src/cli/commands/build.ts @@ -21,11 +21,11 @@ export default function registerCommand(program: Command) { .command("build [configName|appLocation]") .usage("[configName|appLocation] [options]") .description("build your project") - .option("--app-location ", "the folder containing the source code of the front-end application", DEFAULT_CONFIG.appLocation) - .option("--api-location ", "the folder containing the source code of the API application", DEFAULT_CONFIG.apiLocation) - .option("--output-location ", "the folder containing the built source of the front-end application", DEFAULT_CONFIG.outputLocation) - .option("--app-build-command ", "the command used to build your app", DEFAULT_CONFIG.appBuildCommand) - .option("--api-build-command ", "the command used to build your api", DEFAULT_CONFIG.apiBuildCommand) + .option("-a, --app-location ", "the folder containing the source code of the front-end application", DEFAULT_CONFIG.appLocation) + .option("-i, --api-location ", "the folder containing the source code of the API application", DEFAULT_CONFIG.apiLocation) + .option("-O, --output-location ", "the folder containing the built source of the front-end application", DEFAULT_CONFIG.outputLocation) + .option("-A, --app-build-command ", "the command used to build your app", DEFAULT_CONFIG.appBuildCommand) + .option("-I, --api-build-command ", "the command used to build your api", DEFAULT_CONFIG.apiBuildCommand) .option("--auto", "automatically detect how to build your app and api", false) .action(async (positionalArg: string | undefined, _options: SWACLIConfig, command: Command) => { const options = await configureOptions(positionalArg, command.optsWithGlobals(), command, "build"); diff --git a/src/cli/commands/deploy.ts b/src/cli/commands/deploy.ts index 2df03caa2..c9d8c4763 100644 --- a/src/cli/commands/deploy.ts +++ b/src/cli/commands/deploy.ts @@ -28,17 +28,17 @@ export default function registerCommand(program: Command) { .command("deploy [configName|outputLocation]") .usage("[configName|outputLocation] [options]") .description("deploy the current project to Azure Static Web Apps") - .option("--app-location ", "the folder containing the source code of the front-end application", DEFAULT_CONFIG.appLocation) - .option("--api-location ", "the folder containing the source code of the API application", DEFAULT_CONFIG.apiLocation) - .option("--output-location ", "the folder containing the built source of the front-end application", DEFAULT_CONFIG.outputLocation) + .option("-a, --app-location ", "the folder containing the source code of the front-end application", DEFAULT_CONFIG.appLocation) + .option("-i, --api-location ", "the folder containing the source code of the API application", DEFAULT_CONFIG.apiLocation) + .option("-O, --output-location ", "the folder containing the built source of the front-end application", DEFAULT_CONFIG.outputLocation) .option( - "--swa-config-location ", + "-w, --swa-config-location ", "the directory where the staticwebapp.config.json file is located", DEFAULT_CONFIG.swaConfigLocation ) - .option("--deployment-token ", "the secret token used to authenticate with the Static Web Apps") - .option("--dry-run", "simulate a deploy process without actually running it", DEFAULT_CONFIG.dryRun) - .option("--print-token", "print the deployment token", false) + .option("-d, --deployment-token ", "the secret token used to authenticate with the Static Web Apps") + .option("-dr, --dry-run", "simulate a deploy process without actually running it", DEFAULT_CONFIG.dryRun) + .option("-pt, --print-token", "print the deployment token", false) .option("--env [environment]", "the type of deployment environment where to deploy the project", DEFAULT_CONFIG.env) .action(async (positionalArg: string | undefined, _options: SWACLIConfig, command: Command) => { const options = await configureOptions(positionalArg, command.optsWithGlobals(), command, "deploy"); diff --git a/src/cli/commands/init.ts b/src/cli/commands/init.ts index feae37fb3..be33efda8 100644 --- a/src/cli/commands/init.ts +++ b/src/cli/commands/init.ts @@ -20,7 +20,7 @@ export default function registerCommand(program: Command) { .command("init [configName]") .usage("[configName] [options]") .description("initialize a new static web app project") - .option("--yes", "answer yes to all prompts (disable interactive mode)", false) + .option("-y, --yes", "answer yes to all prompts (disable interactive mode)", false) .action(async (configName: string | undefined, _options: SWACLIConfig, command: Command) => { const options = await configureOptions(undefined, command.optsWithGlobals(), command, "init", false); if (configName) { diff --git a/src/cli/commands/login.ts b/src/cli/commands/login.ts index 2991d2ef5..87f5b8f66 100644 --- a/src/cli/commands/login.ts +++ b/src/cli/commands/login.ts @@ -14,17 +14,17 @@ const { readFile, writeFile } = fsPromises; export function addSharedLoginOptionsToCommand(command: Command) { command - .option("--subscription-id ", "Azure subscription ID used by this project", DEFAULT_CONFIG.subscriptionId) - .option("--resource-group ", "Azure resource group used by this project", DEFAULT_CONFIG.resourceGroupName) - .option("--tenant-id ", "Azure tenant ID", DEFAULT_CONFIG.tenantId) - .option("--client-id ", "Azure client ID", DEFAULT_CONFIG.clientId) - .option("--client-secret ", "Azure client secret", DEFAULT_CONFIG.clientSecret) - .option("--app-name ", "Azure Static Web App application name", DEFAULT_CONFIG.appName) - .option("--clear-credentials", "clear persisted credentials before login", DEFAULT_CONFIG.clearCredentials) - - .option("--use-keychain", "enable using the operating system native keychain for persistent credentials", DEFAULT_CONFIG.useKeychain) + .option("-S, --subscription-id ", "Azure subscription ID used by this project", DEFAULT_CONFIG.subscriptionId) + .option("-R, --resource-group ", "Azure resource group used by this project", DEFAULT_CONFIG.resourceGroupName) + .option("-T, --tenant-id ", "Azure tenant ID", DEFAULT_CONFIG.tenantId) + .option("-C, --client-id ", "Azure client ID", DEFAULT_CONFIG.clientId) + .option("-CS, --client-secret ", "Azure client secret", DEFAULT_CONFIG.clientSecret) + .option("-n, --app-name ", "Azure Static Web App application name", DEFAULT_CONFIG.appName) + .option("-cc, --clear-credentials", "clear persisted credentials before login", DEFAULT_CONFIG.clearCredentials) + + .option("-u, --use-keychain", "enable using the operating system native keychain for persistent credentials", DEFAULT_CONFIG.useKeychain) // Note: Commander does not automatically recognize the --no-* option, so we have to explicitly use --no-use-keychain- instead - .option("--no-use-keychain", "disable using the operating system native keychain", !DEFAULT_CONFIG.useKeychain); + .option("-nu, --no-use-keychain", "disable using the operating system native keychain", !DEFAULT_CONFIG.useKeychain); } export default function registerCommand(program: Command) { diff --git a/src/cli/commands/start.ts b/src/cli/commands/start.ts index 4e3f9eb77..69e0be878 100644 --- a/src/cli/commands/start.ts +++ b/src/cli/commands/start.ts @@ -32,32 +32,32 @@ export default function registerCommand(program: Command) { .command("start [configName|outputLocation|appDevserverUrl]") .usage("[configName|outputLocation|appDevserverUrl] [options]") .description("start the emulator from a directory or bind to a dev server") - .option("--app-location ", "the folder containing the source code of the front-end application", DEFAULT_CONFIG.appLocation) - .option("--api-location ", "the folder containing the source code of the API application", DEFAULT_CONFIG.apiLocation) - .option("--output-location ", "the folder containing the built source of the front-end application", DEFAULT_CONFIG.outputLocation) - .option("--app-devserver-url ", "connect to the dev server at this URL instead of using output location", DEFAULT_CONFIG.appDevserverUrl) - .option("--api-devserver-url ", "connect to the api server at this URL instead of using output location", DEFAULT_CONFIG.apiDevserverUrl) - .option("--api-port ", "the API server port passed to `func start`", parsePort, DEFAULT_CONFIG.apiPort) - .option("--host ", "the host address to use for the CLI dev server", DEFAULT_CONFIG.host) - .option("--port ", "the port value to use for the CLI dev server", parsePort, DEFAULT_CONFIG.port) - - .option("--ssl", "serve the front-end application and API over HTTPS", DEFAULT_CONFIG.ssl) - .option("--ssl-cert ", "the SSL certificate (.crt) to use when enabling HTTPS", DEFAULT_CONFIG.sslCert) - .option("--ssl-key ", "the SSL key (.key) to use when enabling HTTPS", DEFAULT_CONFIG.sslKey) - .option("--run ", "run a custom shell command or script file at startup", DEFAULT_CONFIG.run) + .option("-a, --app-location ", "the folder containing the source code of the front-end application", DEFAULT_CONFIG.appLocation) + .option("-i, --api-location ", "the folder containing the source code of the API application", DEFAULT_CONFIG.apiLocation) + .option("-O, --output-location ", "the folder containing the built source of the front-end application", DEFAULT_CONFIG.outputLocation) + .option("-D, --app-devserver-url ", "connect to the app dev server at this URL instead of using output location", DEFAULT_CONFIG.appDevserverUrl) + .option("-is, --api-devserver-url ", "connect to the api server at this URL instead of using output location", DEFAULT_CONFIG.apiDevserverUrl) + .option("-j, --api-port ", "the API server port passed to `func start`", parsePort, DEFAULT_CONFIG.apiPort) + .option("-q, --host ", "the host address to use for the CLI dev server", DEFAULT_CONFIG.host) + .option("-p, --port ", "the port value to use for the CLI dev server", parsePort, DEFAULT_CONFIG.port) + + .option("-s, --ssl", "serve the front-end application and API over HTTPS", DEFAULT_CONFIG.ssl) + .option("-e, --ssl-cert ", "the SSL certificate (.crt) to use when enabling HTTPS", DEFAULT_CONFIG.sslCert) + .option("-k, --ssl-key ", "the SSL key (.key) to use when enabling HTTPS", DEFAULT_CONFIG.sslKey) + .option("-r, --run ", "run a custom shell command or script file at startup", DEFAULT_CONFIG.run) .option( - "--devserver-timeout