Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 02fdb90
Author: Yohan Lasorsa <noda@free.fr>
Date:   Fri Dec 16 10:09:48 2022 +0100

    fix: --api-devserver-url not working if --api-location not set (#523, #579) (#620)

    * fix: --api-devserver-url not working if --api-location not set (#523, #579)

    * docs: fix documentation regarding --api-devserver-url usage (#579)

commit 7ecbae2
Author: Reshmi Sriram <85954235+Reshmi-Sriram@users.noreply.github.com>
Date:   Thu Dec 15 13:10:12 2022 +0530

    docs: Add firewall section to troubleshoot (#618)

    * Added firewall section

    * updated the message

commit eee1263
Author: BeardinaSuit <BeardInASuit@outlook.com>
Date:   Sun Dec 11 23:54:32 2022 -0500

    fix: handle new provider name when deploying (#617)

commit 27ec687
Author: Stuart Leeks <stuart@leeks.net>
Date:   Tue Dec 6 09:40:07 2022 +0000

    Fix typo (#605)

    fix: typo in CONTRIBUTING.md

commit 9c43aa8
Author: Stuart Leeks <stuart@leeks.net>
Date:   Tue Dec 6 09:38:51 2022 +0000

    Update title (#606)

    docs: In the doc content this is referred to as the "configuration file" and this feels like a more natural title

commit 97e9461
Merge: 08ac26c ac6909a
Author: Rupa Reddy <rupareddy@microsoft.com>
Date:   Tue Dec 6 13:06:18 2022 +0530

    Merge pull request #614 from Azure/origin/rupareddy/LoginCC

    fix(login): fixed short-form of --clear-credentials flag

commit 08ac26c
Merge: 2cd0e98 6d1ad19
Author: Rupa Reddy <rupareddy@microsoft.com>
Date:   Tue Dec 6 12:59:29 2022 +0530

    Merge pull request #613 from Azure/origin/rupareddy/FixRGName

    fix(deploy): create SWA in user-provided Resource Group

commit 6d1ad19
Author: rupareddy5 <rupareddy@microsoft.com>
Date:   Mon Dec 5 14:57:37 2022 +0530

    fix: to fix the inability to create a SWA in user-mentioned resource group, changed all the resourceGroupName references to resourceGroup in the code to match with --resource-group flag.

commit ac6909a
Author: rupareddy5 <rupareddy@microsoft.com>
Date:   Mon Dec 5 13:34:00 2022 +0530

    fixed short-form of --clear-credentials flag

commit ca856be
Author: rupareddy5 <rupareddy@microsoft.com>
Date:   Fri Dec 2 16:17:38 2022 +0530

    create SWA in user-provided Resource Group

commit 2cd0e98
Author: sgollapudi77 <85578033+sgollapudi77@users.noreply.github.com>
Date:   Wed Nov 9 11:32:46 2022 +0530

    chore: upgrade dependency version to fix security vulnerability (#597)

    * chore: upgrade dependency version to fix security vulnerability

    * chore: upgrade integrity of package

commit 3bdc5f1
Author: sgollapudi77 <85578033+sgollapudi77@users.noreply.github.com>
Date:   Sun Oct 9 16:34:22 2022 +0530

    chore: bump into 1.0.4-alpha after release (#586)

commit 5ab32a7
Merge: b4fbf3a a6f08e3
Author: Sulabh Upadhyay <suupadhy@microsoft.com>
Date:   Fri Oct 7 14:15:35 2022 +0530

    Merge pull request #585 from Azure/all-contributors/add-rupareddy5-21

    docs: add rupareddy5-21 as a contributor for code

commit a6f08e3
Author: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Date:   Fri Oct 7 08:20:26 2022 +0000

    docs: update .all-contributorsrc

commit b461129
Author: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Date:   Fri Oct 7 08:20:25 2022 +0000

    docs: update docs/www/docs/contribute/3-contributors.md

commit b4fbf3a
Author: sgollapudi77 <85578033+sgollapudi77@users.noreply.github.com>
Date:   Fri Oct 7 12:51:28 2022 +0530

    ci: Remove Node 12 from the testing matrix (#584)

commit 4b0114b
Author: sgollapudi77 <85578033+sgollapudi77@users.noreply.github.com>
Date:   Fri Oct 7 12:01:04 2022 +0530

    chore: prep-release 1.0.3 (#583)

commit 4af9624
Author: Wassim Chegham <github@wassim.dev>
Date:   Fri Oct 7 07:30:23 2022 +0200

    docs: update troubleshooting with explainer #576 (#581)

commit 70c126e
Author: Wassim Chegham <github@wassim.dev>
Date:   Fri Oct 7 07:30:03 2022 +0200

    docs: add valid azure regions for SWA (#582)

    * docs: add valid azure regions for SWA

    * docs: update azure regions

commit 6004141
Author: Wassim Chegham <github@wassim.dev>
Date:   Thu Oct 6 08:52:36 2022 +0200

    fix(core): match * glob in routes (#574)

    Fixes #569

commit d24df7a
Author: Aaron Powell <me@aaron-powell.com>
Date:   Thu Oct 6 17:51:46 2022 +1100

    fix(api): bumping the node support to 18 for v4 functions (#564)

commit 1fec77e
Merge: 19c619b 2771906
Author: Rupa Reddy <rupareddy@microsoft.com>
Date:   Thu Oct 6 11:38:36 2022 +0530

    Merge pull request #577 from rupareddy5-21/main

    Updating deployment provider

commit 2771906
Author: Rupa Reddy <rupareddy@microsoft.com>
Date:   Thu Sep 29 16:34:22 2022 +0530

    Updating Deployment provider

commit 1b7fabd
Author: Rupa Reddy <rupareddy@microsoft.com>
Date:   Thu Sep 29 16:33:02 2022 +0530

    updating Deployment provider

commit 19c619b
Author: Natalia Venditto <nataliafrontend@gmail.com>
Date:   Mon Sep 26 15:13:12 2022 +0200

    docs: add default port for vite-based frameworks (#571)

commit 47823b0
Merge: 06356c1 7e021c7
Author: Sulabh Upadhyay <suupadhy@microsoft.com>
Date:   Fri Sep 16 15:05:06 2022 +0530

    Merge pull request #560 from Azure/swa-start-perf-boost

    fix(start): keep connection open with http-proxy

commit 06356c1
Author: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Date:   Wed Sep 14 23:10:22 2022 +0530

    docs: add thsackos as a contributor (#561)

    * docs: update docs/www/docs/contribute/3-contributors.md

    * docs: update .all-contributorsrc

    Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

commit 8b7d725
Author: thsackos <47867435+thsackos@users.noreply.github.com>
Date:   Wed Sep 14 06:13:25 2022 -0700

    fix(cli): implement missing response override referrer behavior (#543)

    The documentation calls out user-defined redirect behavior using the
    .referrer parameter in the response override configuration. This PR
    enables the SWA CLI emulator to support that functionality.

    Fixes #542

commit 7e021c7
Author: Wassim Chegham <github@wassim.dev>
Date:   Wed Sep 14 12:19:03 2022 +0200

    fix(start): keep connection open with http-proxy
  • Loading branch information
sgollapudi77 committed Dec 19, 2022
1 parent dd442a0 commit 267519c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
10 changes: 5 additions & 5 deletions docs/www/docs/cli/swa-start.md
Expand Up @@ -51,7 +51,7 @@ Here is a list of the default ports used by some popular dev servers:
| [Next.js](https://nextjs.org/) | 3000 | `swa start http://localhost:3000` |
| [React (Create React App)](https://reactjs.org/docs/create-a-new-react-app.html) | 3000 | `swa start http://localhost:3000` |
| [Svelte (sirv-cli)](https://github.com/lukeed/sirv/tree/master/packages/sirv-cli/) | 5000 | `swa start http://localhost:5000` |
| [Vue](https://github.com/vuejs/create-vue) | 3000 | `swa start http://localhost:3000` |
| [Vue](https://github.com/vuejs/create-vue) | 3000 | `swa start http://localhost:3000` |

Instead of starting a dev server separately, you can provide the startup command to the CLI.

Expand Down Expand Up @@ -94,10 +94,10 @@ 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-location` 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-devserver-url` flag and the URI of the local API server, in the following format:

```bash
swa start ./my-dist --api-location http://localhost:7071
swa start ./my-dist --api-devserver-url http://localhost:7071
```

## Options
Expand All @@ -108,7 +108,7 @@ Here are the options you can use with `swa start`:
- `-i, --api-location <path>`: the folder containing the source code of the API application
- `-O, --output-location <path>`: the folder containing the built source of the front-end application. The path is relative to `--app-location` (default: ".")
- `-D, --app-devserver-url <url>`: connect to the app dev server at this URL instead of using output location
- `-is, --api-devserver-url <url>`: connect to the api server at this URL instead of using output location
- `-is, --api-devserver-url <url>`: connect to the api server at this URL instead of using api location
- `-j, --api-port <apiPort>`: the API server port passed to `func start` (default: 7071)
- `-q, --host <host>`: the host address to use for the CLI dev server (default: "localhost")
- `-p, --port <port>`: the port value to use for the CLI dev server (default: 4280)
Expand Down Expand Up @@ -157,7 +157,7 @@ swa start http://localhost:3000 --run-build "npm start"
Connect both front-end and the API to running development server

```bash
swa start http://localhost:3000 --api-location http://localhost:7071
swa start http://localhost:3000 --api-devserver-url http://localhost:7071
```

## See Also
Expand Down
4 changes: 2 additions & 2 deletions docs/www/docs/use/3-api-server.md
Expand Up @@ -29,10 +29,10 @@ To use the SWA emulator services alongside the API server:
func host start
```

2. Start SWA CLI in a separate terminal and use the `--api-location` option to pass it the relevant local API Server URI. _For example:_
2. Start SWA CLI in a separate terminal and use the `--api-devserver-url` option to pass it the relevant local API Server URI. _For example:_

```bash
swa start ./my-dist --api-location http://localhost:7071
swa start ./my-dist --api-devserver-url http://localhost:7071
```

## 4.3 Start API Server Automatically
Expand Down
23 changes: 13 additions & 10 deletions src/cli/commands/start.ts
Expand Up @@ -35,8 +35,12 @@ export default function registerCommand(program: Command) {
.option("-a, --app-location <path>", "the folder containing the source code of the front-end application", DEFAULT_CONFIG.appLocation)
.option("-i, --api-location <path>", "the folder containing the source code of the API application", DEFAULT_CONFIG.apiLocation)
.option("-O, --output-location <path>", "the folder containing the built source of the front-end application", DEFAULT_CONFIG.outputLocation)
.option("-D, --app-devserver-url <url>", "connect to the app dev server at this URL instead of using output location", DEFAULT_CONFIG.appDevserverUrl)
.option("-is, --api-devserver-url <url>", "connect to the api server at this URL instead of using output location", DEFAULT_CONFIG.apiDevserverUrl)
.option(
"-D, --app-devserver-url <url>",
"connect to the app dev server at this URL instead of using output location",
DEFAULT_CONFIG.appDevserverUrl
)
.option("-is, --api-devserver-url <url>", "connect to the api server at this URL instead of using api location", DEFAULT_CONFIG.apiDevserverUrl)
.option<number>("-j, --api-port <apiPort>", "the API server port passed to `func start`", parsePort, DEFAULT_CONFIG.apiPort)
.option("-q, --host <host>", "the host address to use for the CLI dev server", DEFAULT_CONFIG.host)
.option<number>("-p, --port <port>", "the port value to use for the CLI dev server", parsePort, DEFAULT_CONFIG.port)
Expand Down Expand Up @@ -107,7 +111,7 @@ Use a custom command to run framework development server at startup
swa start http://localhost:3000 --run-build "npm start"
Connect both front-end and the API to running development server
swa start http://localhost:3000 --api-location http://localhost:7071
swa start http://localhost:3000 --api-devserver-url http://localhost:7071
`
);
}
Expand Down Expand Up @@ -183,17 +187,16 @@ export async function start(options: SWACLIConfig) {
logger.silly(` ${outputLocation}`);
}

if (apiLocation) {
if (apiDevserverUrl) {
// TODO: properly refactor this after GA to send apiDevserverUrl to the server
useApiDevServer = apiDevserverUrl;
apiLocation = apiDevserverUrl;
} else if (apiLocation) {
// resolves to the absolute path of the apiLocation
let resolvedApiLocation = path.resolve(apiLocation);

if (apiDevserverUrl) {
// TODO: properly refactor this after GA to send apiDevserverUrl to the server
useApiDevServer = apiDevserverUrl;
apiLocation = apiDevserverUrl;
}
// make sure api folder exists
else if (fs.existsSync(resolvedApiLocation)) {
if (fs.existsSync(resolvedApiLocation)) {
apiLocation = resolvedApiLocation;
} else {
logger.info(`Skipping API because folder "${resolvedApiLocation}" is missing`, "swa");
Expand Down

0 comments on commit 267519c

Please sign in to comment.