-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat: support AWS via SST in adapter-auto #9874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@sveltejs/adapter-auto': patch | ||
| --- | ||
|
|
||
| [feat] support AWS via SST | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| --- | ||
| title: AWS via SST | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we'd want to add any docs here. We've only added docs for adapters we maintain. We could potentially link to external docs though
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For comparison, the adapter-auto docs link out to the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah makes sense! Removed. |
||
| --- | ||
|
|
||
| To deploy to AWS via SST, use [`svelte-kit-sst`](https://github.com/serverless-stack/sst/tree/master/packages/svelte-kit-sst). | ||
|
|
||
| This adapter will be installed by default when you use [`adapter-auto`](adapter-auto), but adding it to your project allows you to specify SST-specific options. | ||
|
|
||
| ## Usage | ||
|
|
||
| Install with `npm i -D svelte-kit-sst`, then add the adapter to your `svelte.config.js`: | ||
|
|
||
| ```js | ||
| // @errors: 2307 2345 | ||
| /// file: svelte.config.js | ||
| import adapter from 'svelte-kit-sst'; | ||
|
|
||
| export default { | ||
| kit: { | ||
| adapter: adapter() | ||
| } | ||
| }; | ||
| ``` | ||
|
|
||
| ## Quickstart | ||
|
|
||
| 1. Create a SvelteKit app | ||
| 1. Run `npx create-sst` | ||
| 1. It should detect that you are using Svelte and ask you to confirm. | ||
| 1. Once you're ready for deployment you can run `npx sst deploy --stage=production` | ||
|
|
||
| ### SST constructs | ||
| To use any [additional SST constructs](https://docs.sst.dev/), add them to `sst.config.ts`. | ||
|
|
||
| ```ts | ||
| /// file: sst.config.ts | ||
| app.stack(function Site(ctx) { | ||
| const bucket = new Bucket(ctx.stack, "public"); | ||
| const site = new SvelteKitSite(ctx.stack, "site", { | ||
| bind: [bucket], | ||
| }); | ||
|
|
||
| ctx.stack.addOutputs({ | ||
| url: site.url, | ||
| }); | ||
| }); | ||
| ``` | ||
|
|
||
| And then access them in your `+page(.server).ts` file. | ||
|
|
||
| ```ts | ||
| /// file: +page.server.ts | ||
| import { Bucket } from "sst/node/bucket" | ||
|
|
||
| console.log(Bucket.public.bucketName) | ||
| ``` | ||
|
|
||
| Consult the [SST docs on Resource Binding](https://docs.sst.dev/resource-binding) to learn more | ||
|
|
||
| If you have any questions, you can [ask in the SST Discord](https://discord.gg/sst). | ||
Uh oh!
There was an error while loading. Please reload this page.