-
Notifications
You must be signed in to change notification settings - Fork 518
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Zeabur | ||
|
||
Deploy Nitro apps to [Zeabur](https://zeabur.com). | ||
|
||
**Preset:** `zeabur` ([switch to this preset](/deploy/#changing-the-deployment-preset)) | ||
|
||
::alert | ||
**Zero Config Provider** | ||
:br | ||
Integration with this provider is possible with zero configuration. ([Learn More](/deploy/#zero-config-providers)) | ||
:: | ||
|
||
::alert{type="warning"} | ||
This preset is experimental and available to try via [nightly channel](/guide/getting-started#nightly-release-channel). | ||
:: | ||
|
||
## Deploy using Git | ||
|
||
1. Push your code to your git repository (Currently only GitHub supported). | ||
2. [Import your project](https://zeabur.com/docs/get-started) into Zeabur. | ||
3. Zeabur will detect that you are using Nitro and will enable the correct settings for your deployment. | ||
4. Your application is deployed! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import fsp from "node:fs/promises"; | ||
import { dirname, relative, resolve } from "pathe"; | ||
import { writeFile } from "../utils"; | ||
import { defineNitroPreset } from "../preset"; | ||
import type { Nitro } from "../types"; | ||
|
||
// https://zeabur.com/docs/advanced/serverless-output-format | ||
|
||
export const zeabur = defineNitroPreset({ | ||
extends: "node", | ||
entry: "#internal/nitro/entries/zeabur", | ||
output: { | ||
dir: "{{ rootDir }}/.zeabur/output", | ||
serverDir: "{{ output.dir }}/functions/__nitro.func", | ||
publicDir: "{{ output.dir }}/static", | ||
}, | ||
commands: { | ||
deploy: "", | ||
preview: "", | ||
}, | ||
hooks: { | ||
async compiled(nitro: Nitro) { | ||
const buildConfigPath = resolve(nitro.options.output.dir, "config.json"); | ||
const cfg = { | ||
containerized: false, | ||
routes: [{ src: ".*", dest: "/__nitro" }], | ||
}; | ||
await writeFile(buildConfigPath, JSON.stringify(cfg, null, 2)); | ||
|
||
// Write ISR functions | ||
for (const [key, value] of Object.entries(nitro.options.routeRules)) { | ||
if (!value.isr) { | ||
continue; | ||
} | ||
const funcPrefix = resolve(nitro.options.output.serverDir, ".." + key); | ||
await fsp.mkdir(dirname(funcPrefix), { recursive: true }); | ||
await fsp.symlink( | ||
"./" + relative(dirname(funcPrefix), nitro.options.output.serverDir), | ||
funcPrefix + ".func", | ||
"junction" | ||
); | ||
await writeFile( | ||
funcPrefix + ".prerender-config.json", | ||
JSON.stringify({ type: "Prerender" }) | ||
); | ||
} | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import "#internal/nitro/virtual/polyfill"; | ||
import { NodeListener, toNodeListener } from "h3"; | ||
import { nitroApp } from "../app"; | ||
|
||
const handler = toNodeListener(nitroApp.h3App); | ||
|
||
export default <NodeListener>function (req, res) { | ||
return handler(req, res); | ||
}; |