[ci] yarn format

This commit is contained in:
jasikpark 2021-11-10 20:09:08 +00:00 committed by GitHub Actions
parent 3956bab271
commit 4eaef602ac

View file

@ -414,11 +414,12 @@ You can deploy your Astro project using [Buddy](https://buddy.works). To do so y
6. Add a deployment action - there are many to choose from, you can browse them [here](https://buddy.works/actions). Although their can settings differ, remember to set the **Source path** to `dist`. 6. Add a deployment action - there are many to choose from, you can browse them [here](https://buddy.works/actions). Although their can settings differ, remember to set the **Source path** to `dist`.
7. Press the **Run** button. 7. Press the **Run** button.
## Layer0 ## Layer0
You can deploy your Astro project using the steps in the following sections. You can deploy your Astro project using the steps in the following sections.
### Create the Astro Site ### Create the Astro Site
If you don't have an existing Astro site, you can create one by running: If you don't have an existing Astro site, you can create one by running:
```bash ```bash
@ -454,22 +455,25 @@ Paste the following into routes.ts:
```js ```js
// routes.ts // routes.ts
import { Router } from '@layer0/core' import { Router } from '@layer0/core';
export default new Router() export default new Router()
.get('/:path*/:file.:ext(js|css|png|ico|jpg|gif|svg)', ({ cache, serveStatic }) => { .get(
cache({ '/:path*/:file.:ext(js|css|png|ico|jpg|gif|svg)',
browser: { ({ cache, serveStatic }) => {
// cache js, css, and images in the browser for one hour... cache({
maxAgeSeconds: 60 * 60, browser: {
}, // cache js, css, and images in the browser for one hour...
edge: { maxAgeSeconds: 60 * 60,
// ... and at the edge for one year },
maxAgeSeconds: 60 * 60 * 24 * 365, edge: {
}, // ... and at the edge for one year
}) maxAgeSeconds: 60 * 60 * 24 * 365,
serveStatic('dist/:path*/:file.:ext') },
}) });
serveStatic('dist/:path*/:file.:ext');
}
)
.match('/:path*', ({ cache, serveStatic, setResponseHeader }) => { .match('/:path*', ({ cache, serveStatic, setResponseHeader }) => {
cache({ cache({
// prevent the browser from caching html... // prevent the browser from caching html...
@ -478,16 +482,16 @@ export default new Router()
// ...cache html at the edge for one year // ...cache html at the edge for one year
maxAgeSeconds: 60 * 60 * 24 * 365, maxAgeSeconds: 60 * 60 * 24 * 365,
}, },
}) });
setResponseHeader('content-type', 'text/html; charset=UTF-8') setResponseHeader('content-type', 'text/html; charset=UTF-8');
serveStatic('dist/:path*') serveStatic('dist/:path*');
}) });
``` ```
You can remove the origin backend from `layer0.config.js`: You can remove the origin backend from `layer0.config.js`:
```js ```js
module.exports = {} module.exports = {};
``` ```
### Deploy to Layer0 ### Deploy to Layer0
@ -502,7 +506,6 @@ $ npm run build
$ 0 deploy $ 0 deploy
``` ```
## Credits ## Credits
This guide was originally based off [Vite](https://vitejs.dev/)s well-documented static deploy guide. This guide was originally based off [Vite](https://vitejs.dev/)s well-documented static deploy guide.