@zonke-cloud/astro-adapter
v0.1.1
Published
Adapter for deploying Astro applications to AWS using Zonké.
Readme
Astro Adapter
An Astro adapter to deploy static or SSR sites to AWS using Zonké.
Installation
Configuration Options
output- The output type of the Astro project. Options are:static- Deploy as a static site.server- Deploy as a server-rendered site.
target- The target deployment environment. Options are:s3- Deploy to S3 (behind CloudFront) for static site hosting. Corresponds to thestaticoutput type.lambda- Deploy to S3, CloudFront, and Lambda with SSR support. Corresponds to theserveroutput type.EC2(Coming Soon) - Deploy to S3, CloudFront, and ECS EC2 with SSR support. Corresponds to theserveroutput type.Fargate(Coming Soon) - Deploy to S3, CloudFront, and ECS Fargate with SSR support. Corresponds to theserveroutput type.
serverBundleOptions(optional) - Used to bundle the server code for SSR deployments. Conforms to the BuildOptions interface from esbuild. You should only need to specify theexternaloption to exclude certain modules from the bundle:serverBundleOptions: { external: ['fsevents', 'sharp', 'lightningcss', 'vite'], }NOTE: Modules marked as
externalwill be installed in the server directory and included in the deployment package.
Using astro add
To install the Astro adapter and update your astro.config.mjs, run:
npx astro add @zonke-cloud/astro-adapterManual Installation
Install the Astro adapter:
npm install @zonke-cloud/astro-adapterUpdate your astro.config.mjs to include the adapter:
import aws from '@zonke-cloud/astro-adapter';
export default {
output: 'server', // or 'static'
adapter: aws({
target: 'lambda', // or 's3'
serverBundleOptions: {
// Example of excluding modules from the server bundle.
external: ['fsevents', 'sharp', 'lightningcss', 'vite'],
},
}),
};NOTE: You should not need the adapter for static deployments, but it will work if you include it.
Acknowledgements
The package is inspired by the astro-aws adapter and modified to work with Zonké's deployment infrastructure.
Maintained by the Zonké team | Discord | Twitter | LinkedIn
