Skip to content

Commit

Permalink
Remove shorthand options
Browse files Browse the repository at this point in the history
  • Loading branch information
alexweininger committed Sep 28, 2021
1 parent 615b473 commit 8c3f567
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.7.3-alpha",
"description": "Azure Static Web Apps CLI",
"scripts": {
"start": "node ./dist/cli/bin.js start ./cypress/fixtures/static --api=./cypress/fixtures/api --port 1234 --devserver-timeout 10000 --verbose silly",
"start": "node ./dist/cli/bin.js start ./cypress/fixtures/static --api-location=./cypress/fixtures/api --port 1234 --devserver-timeout 10000 --verbose silly",
"start:config": "node ./dist/cli/bin.js --config ./cypress/fixtures/static/swa-cli.config.json start app",
"prestart": "npm run build",
"pretest": "npm run build",
Expand Down
42 changes: 21 additions & 21 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ Run the CLI and provide the folder that contains the API backend (a valid Azure

```bash
# static content plus API
swa start ./my-dist --api ./api-folder
swa start ./my-dist --api-location ./api-folder

# frontend dev server plus API
swa start http://localhost:3000 --api ./api-folder
swa start http://localhost:3000 --api-location ./api-folder
```

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

1. Start your API using Azure Functions Core Tools: `func host start` or start debugging in VS Code.
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:
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:
```bash
swa start ./my-dist --api http://localhost:7071
swa start ./my-dist --api-location http://localhost:7071
```

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

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

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

## swa-cli.config.json file

Expand Down
6 changes: 3 additions & 3 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ export async function run(argv?: string[]) {
.description("start the emulator from a directory or bind to a dev server")
.option("--app-location <appLocation>", "set location for the static app source code", DEFAULT_CONFIG.appLocation)
.option(
"--app, --app-artifact-location <outputLocation>",
"--output-location <outputLocation>",
"set the location of the build output directory relative to the --app-location.",
DEFAULT_CONFIG.outputLocation
)
.option("--api, --api-location <apiLocation>", "set the API folder or Azure Functions emulator address", DEFAULT_CONFIG.apiLocation)
.option("--api-location <apiLocation>", "set the API folder or Azure Functions emulator address", DEFAULT_CONFIG.apiLocation)
.option(
"--swa-config-location <swaConfigLocation>",
"set the directory where the staticwebapp.config.json file is found",
Expand Down Expand Up @@ -107,7 +107,7 @@ Examples:
swa start http://localhost:3000 --swa-config-location ./app-source
Serve static content and run an API from another folder
swa start ./output-folder --api ./api
swa start ./output-folder --api-location ./api
Use a custom command to run framework development server at startup
swa start http://localhost:3000 --run "npm start"
Expand Down

0 comments on commit 8c3f567

Please sign in to comment.