Skip to content

Commit 74b991f

Browse files
feat: Remove shorthand options (#320)
1 parent 615b473 commit 74b991f

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.7.3-alpha",
44
"description": "Azure Static Web Apps CLI",
55
"scripts": {
6-
"start": "node ./dist/cli/bin.js start ./cypress/fixtures/static --api=./cypress/fixtures/api --port 1234 --devserver-timeout 10000 --verbose silly",
6+
"start": "node ./dist/cli/bin.js start ./cypress/fixtures/static --api-location=./cypress/fixtures/api --port 1234 --devserver-timeout 10000 --verbose silly",
77
"start:config": "node ./dist/cli/bin.js --config ./cypress/fixtures/static/swa-cli.config.json start app",
88
"prestart": "npm run build",
99
"pretest": "npm run build",

readme.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ Run the CLI and provide the folder that contains the API backend (a valid Azure
115115

116116
```bash
117117
# static content plus API
118-
swa start ./my-dist --api ./api-folder
118+
swa start ./my-dist --api-location ./api-folder
119119

120120
# frontend dev server plus API
121-
swa start http://localhost:3000 --api ./api-folder
121+
swa start http://localhost:3000 --api-location ./api-folder
122122
```
123123

124124
#### Start API server manually
@@ -128,9 +128,9 @@ When developing your backend locally, sometimes it's useful to run Azure Functio
128128
To use the CLI with your local API backend dev server, follow these two steps:
129129

130130
1. Start your API using Azure Functions Core Tools: `func host start` or start debugging in VS Code.
131-
2. In a separate terminal, run the SWA CLI with the `--api` flag and the URI of the local API server, in the following format:
131+
2. In a separate terminal, run the SWA CLI with the `--api-location` flag and the URI of the local API server, in the following format:
132132
```bash
133-
swa start ./my-dist --api http://localhost:7071
133+
swa start ./my-dist --api-location http://localhost:7071
134134
```
135135

136136
## Use a configuration file (staticwebapp.config.json)
@@ -165,23 +165,23 @@ swa start http://localhost:3000 --swa-config-location ./my-app-source
165165

166166
If you need to override the default values, provide the following options:
167167

168-
| Options | Description | Default | Example |
169-
| -------------------------------- | ------------------------------------------------------- | ----------------------- | ---------------------------------------------------- |
170-
| `--app-location` | set location for the static app source code | `./` | `--app-location="./my-project"` |
171-
| `--app, --app-artifact-location` | set app artifact (dist) folder or dev server | `./` | `--app="./my-dist"` or `--app=http://localhost:4200` |
172-
| `--api, --api-artifact-location` | set the API folder or dev server | | `--api="./api"` or `--api=http://localhost:8083` |
173-
| `--swa-config-location` | set the directory of the staticwebapp.config.json file. | | `--swa-config-location=./my-project-folder` |
174-
| `--api-port` | set the API server port | `7071` | `--api-port=8082` |
175-
| `--host` | set the emulator host address | `0.0.0.0` | `--host=192.168.68.80` |
176-
| `--port` | set the emulator port value | `4280` | `--port=8080` |
177-
| `--ssl` | serving the app and API over HTTPS (default: false) | `false` | `--ssl` or `--ssl=true` |
178-
| `--ssl-cert` | SSL certificate to use for serving HTTPS | | `--ssl-cert="/home/user/ssl/example.crt"` |
179-
| `--ssl-key` | SSL key to use for serving HTTPS | | `--ssl-key="/home/user/ssl/example.key"` |
180-
| `--run` | Run a command at startup | | `--run="cd app & npm start"` |
181-
| `--devserver-timeout` | The time to wait(in ms) for the dev server to start | 30000 | `--devserver-timeout=60000` |
182-
| `--func-args` | Additional arguments to pass to `func start` | | `--func-args="--javascript"` |
183-
| `--config` | Path to swa-cli.config.json file to use. | `./swa-cli.config.json` | `--config ./config/swa-cli.config.json` |
184-
| `--print-config` | Print all resolved options. Useful for debugging. | | `--print-config` or `--print-config=true` |
168+
| Options | Description | Default | Example |
169+
| ----------------------- | ------------------------------------------------------- | ----------------------- | ---------------------------------------------------------------------------- |
170+
| `--app-location` | set location for the static app source code | `./` | `--app-location="./my-project"` |
171+
| `--output-location` | set app artifact (dist) folder or dev server | `./` | `--output-location="./my-dist"` or `--output-location=http://localhost:4200` |
172+
| `--api-location` | set the API folder or dev server | | `--api-location="./api"` or `--api-location=http://localhost:8083` |
173+
| `--swa-config-location` | set the directory of the staticwebapp.config.json file. | | `--swa-config-location=./my-project-folder` |
174+
| `--api-port` | set the API server port | `7071` | `--api-port=8082` |
175+
| `--host` | set the emulator host address | `0.0.0.0` | `--host=192.168.68.80` |
176+
| `--port` | set the emulator port value | `4280` | `--port=8080` |
177+
| `--ssl` | serving the app and API over HTTPS (default: false) | `false` | `--ssl` or `--ssl=true` |
178+
| `--ssl-cert` | SSL certificate to use for serving HTTPS | | `--ssl-cert="/home/user/ssl/example.crt"` |
179+
| `--ssl-key` | SSL key to use for serving HTTPS | | `--ssl-key="/home/user/ssl/example.key"` |
180+
| `--run` | Run a command at startup | | `--run="cd app & npm start"` |
181+
| `--devserver-timeout` | The time to wait(in ms) for the dev server to start | 30000 | `--devserver-timeout=60000` |
182+
| `--func-args` | Additional arguments to pass to `func start` | | `--func-args="--javascript"` |
183+
| `--config` | Path to swa-cli.config.json file to use. | `./swa-cli.config.json` | `--config ./config/swa-cli.config.json` |
184+
| `--print-config` | Print all resolved options. Useful for debugging. | | `--print-config` or `--print-config=true` |
185185

186186
## swa-cli.config.json file
187187

src/cli/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ export async function run(argv?: string[]) {
3232
.description("start the emulator from a directory or bind to a dev server")
3333
.option("--app-location <appLocation>", "set location for the static app source code", DEFAULT_CONFIG.appLocation)
3434
.option(
35-
"--app, --app-artifact-location <outputLocation>",
35+
"--output-location <outputLocation>",
3636
"set the location of the build output directory relative to the --app-location.",
3737
DEFAULT_CONFIG.outputLocation
3838
)
39-
.option("--api, --api-location <apiLocation>", "set the API folder or Azure Functions emulator address", DEFAULT_CONFIG.apiLocation)
39+
.option("--api-location <apiLocation>", "set the API folder or Azure Functions emulator address", DEFAULT_CONFIG.apiLocation)
4040
.option(
4141
"--swa-config-location <swaConfigLocation>",
4242
"set the directory where the staticwebapp.config.json file is found",
@@ -107,7 +107,7 @@ Examples:
107107
swa start http://localhost:3000 --swa-config-location ./app-source
108108
109109
Serve static content and run an API from another folder
110-
swa start ./output-folder --api ./api
110+
swa start ./output-folder --api-location ./api
111111
112112
Use a custom command to run framework development server at startup
113113
swa start http://localhost:3000 --run "npm start"

0 commit comments

Comments
 (0)