Skip to content

Commit 1474f09

Browse files
Abbbdabgeoffrich
andauthored
docs: add monorepo info to README (#133)
* Updated Readme.md for monorepo support * Ran prettier format to fix styling issues in readme.md * Tweak README - don't mention specific monorepo tools - remove extraneous files - link pnpm issue - reword some things --------- Co-authored-by: Geoff Rich <[email protected]>
1 parent cd30083 commit 1474f09

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

README.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ When deploying to Azure, you will need to properly [configure your build](https:
4141

4242
If you use a custom API directory (see [below](#apiDir)), your `api_location` will be the same as the value you pass to `apiDir`.
4343

44-
If your `app_location` is not the repository root `./` but `./my_app_location`, then you also need to change the `api_location` to `my_app_location/build/server` (but not the `output_location`).
44+
If your `app_location` is in a subfolder (e.g. `./my_app_location`), then your `api_location` should include the path to that subfolder (e.g. `my_app_location/build/server`.) `output_location` should still be `build/static`.
4545

4646
## Running locally with the Azure SWA CLI
4747

@@ -187,3 +187,43 @@ This is currently only available when running in production on SWA. In addition,
187187
### `context`
188188

189189
All server requests to your SvelteKit app are handled by an Azure function. This property contains that Azure function's [request context](https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-node#context-object).
190+
191+
## Monorepo support
192+
193+
If you're deploying your app from a monorepo, here's what you need to know.
194+
195+
The build currently fails if you use `pnpm` as a package manager. You can track [this issue](https://github.com/geoffrich/svelte-adapter-azure-swa/issues/135) for updates. For now, you can work around the issue by using `npm` instead.
196+
197+
Also, since your SvelteKit app is in a subfolder of the monorepo, you will need to update your deployment workflow.
198+
199+
For instance, if you have the following folder structure:
200+
201+
```
202+
apps/
203+
├── sveltekit-app
204+
└── other-app
205+
```
206+
207+
The `app_location` and `api_location` in your deployment configuration need to point to the `apps/sveltekit-app` subfolder. `output_location` should remain the same. Here's how that would look for an Azure SWA GitHub workflow:
208+
209+
```diff
210+
steps:
211+
- uses: actions/checkout@v2
212+
with:
213+
submodules: true
214+
- name: Build And Deploy
215+
id: builddeploy
216+
uses: Azure/static-web-apps-deploy@v1
217+
with:
218+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ORANGE_GRASS_0778C6300 }}
219+
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
220+
action: "upload"
221+
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
222+
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
223+
- app_location: "./" # App source code path
224+
- api_location: "build/server" # Api source code path - optional
225+
+ app_location: "./apps/sveltekit-app" # App source code path
226+
+ api_location: "apps/sveltekit-app/build/server" # Api source code path - optional
227+
output_location: "build/static" # Built app content directory - optional
228+
###### End of Repository/Build Configurations ######
229+
```

0 commit comments

Comments
 (0)