Skip to content

Commit

Permalink
Merge branch 'main' into pr/maou-shonen/1279
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jun 21, 2023
2 parents cfafe84 + bac3b0d commit a53c385
Show file tree
Hide file tree
Showing 46 changed files with 1,924 additions and 1,090 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ jobs:
if: ${{ matrix.os != 'windows-latest' }}
with:
bun-version: latest
- uses: denoland/setup-deno@v1
if: ${{ matrix.os != 'windows-latest' }}
with:
deno-version: v1.x
- run: pnpm install
- run: pnpm test:types
- run: pnpm build
Expand Down
2 changes: 1 addition & 1 deletion docs/content/2.deploy/providers/cloudflare.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
## Cloudflare Pages
**Preset:** `cloudflare_pages` ([switch to this preset](/deploy/#changing-the-deployment-preset))
**Preset:** `cloudflare-pages` ([switch to this preset](/deploy/#changing-the-deployment-preset))

::alert{type="warning"}
**Note:** This is an experimental preset.
Expand Down
28 changes: 23 additions & 5 deletions docs/content/2.deploy/providers/deno.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Deploy Nitro apps to [Deno Deploy](https://deno.com/deploy).

## Deno Deploy

**Preset:** `deno` ([switch to this preset](/deploy/#changing-the-deployment-preset))
**Preset:** `deno-deploy` ([switch to this preset](/deploy/#changing-the-deployment-preset))

::alert{type="warning"}
Deno support is experimental.
Deno deploy preset is experimental.
::

### Deploy with the CLI
Expand All @@ -17,8 +17,8 @@ You can use [deployctl](https://deno.com/deploy/docs/deployctl) to deploy your a
Login to [Deno Deploy](https://dash.deno.com/account#access-tokens) to obtain a `DENO_DEPLOY_TOKEN` access token, and set it as an environment variable.

```bash
# Build with the deno NITRO preset
NITRO_PRESET=deno npm run build
# Build with the deno-deploy NITRO preset
NITRO_PRESET=deno-deploy npm run build

# Make sure to run the deployctl command from the output directory
cd .output
Expand Down Expand Up @@ -56,11 +56,29 @@ jobs:
- run: pnpm install
- run: pnpm build
env:
NITRO_PRESET: deno
NITRO_PRESET: deno-deploy
- name: Deploy to Deno Deploy
uses: denoland/deployctl@v1
with:
project: my-project
entrypoint: server/index.ts
root: .output
```
## Deno Server (Runtime)
**Preset:** `deno-server` ([switch to this preset](/deploy/#changing-the-deployment-preset))

::alert{type="warning"}
Deno runtime preset is experimental.
::

You can build your Nitro server using Node.js to run within [Deno Runtime](https://deno.com/runtime) in a custom server.

```bash
# Build with the deno NITRO preset
NITRO_PRESET=deno-server npm run build
# Start production server
deno run --unstable --allow-net --allow-read --allow-env .output/server/index.ts
```
66 changes: 66 additions & 0 deletions docs/content/2.deploy/providers/flightcontrol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Flightcontrol

**Preset:** `flightcontrol` ([switch to this preset](/deploy/#changing-the-deployment-preset))

Nitro supports deploying to [AWS via Flightcontrol](https://flightcontrol.dev?ref=nitro) with minimal configuration.

::alert
Flight control has zero config support for [Nuxt](https://nuxt.com/) projects.
::

### Set Up your Flightcontrol account

On a high level, the steps you will need to follow to deploy a project for the first time are:

1. Create an account at [Flightcontrol](https://app.flightcontrol.dev/signup?ref=nitro)
2. Create an account at [AWS](https://portal.aws.amazon.com/billing/signup) (if you don't already have one)
3. Link your AWS account to the FlightControl
4. Authorize the Flightcontrol GitHub App to access your chosen repositories, public or private.
5. Create a Flightcontrol project with configuration via the Dashboard or with configuration via `flightcontrol.json`.

### Create a Project with Configuration via the Dashboard

1. Create a Flightcontrol project from the Dashboard. Select a repository for the source.
2. Select the `GUI` config type.
3. Select the Nuxt preset. This preset will also work for any Nitro-based applications.
4. Select your preferred AWS server size.
5. Submit the new project form.

### Create a Project with Configuration via `flightcontrol.json`

1. Create a Flightcontrol project from your dashboard. Select a repository for the source.
2. Select the `flightcontrol.json` config type.
3. Add a new file at the root of your repository called `flightcontrol.json`. Here is an example configuration that creates an AWS fargate service for your app:

```json
{
"$schema": "https://app.flightcontrol.dev/schema.json",
"environments": [
{
"id": "production",
"name": "Production",
"region": "us-west-2",
"source": {
"branch": "main"
},
"services": [
{
"id": "nitro",
"buildType": "nixpacks",
"name": "My Nitro site",
"type": "fargate",
"domain": "www.yourdomain.com",
"outputDirectory": ".output",
"startCommand": "node .output/server/index.mjs",
"cpu": 0.25,
"memory": 0.5
}
]
}
]
}
```

4. Submit the new project form.

Learn more about Flightcontrol's [configuration](https://www.flightcontrol.dev/docs?ref=nitro).
25 changes: 24 additions & 1 deletion docs/content/3.config.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,28 @@ There are situations in that we directly want to provide a handler instance with

We can use `devHandlers` but note that they are **only available in development mode** and **not in production build**.

For example:

```ts
import { defineNitroConfig } from 'nitropack/config'
import { eventHandler } from 'h3'

export default defineNitroConfig({
devHandlers: [
{
route: '/',
handler: eventHandler((event) => {
console.log(event)
})
}
]
})
```

::alert{type=info}
Note that `eventHandler` is a helper function from [`h3`](https://github.com/unjs/h3) library.
::

### `devProxy`

Proxy configuration for development server.
Expand Down Expand Up @@ -312,7 +334,8 @@ routeRules: {
'/blog/**': { cache: { /* cache options*/ } },
'/assets/**': { headers: { 'cache-control': 's-maxage=0' } },
'/api/v1/**': { cors: true, headers: { 'access-control-allow-methods': 'GET' } },
'/old-page': { redirect: '/new-page' },
'/old-page': { redirect: '/new-page' }, // uses status code 307 (Temporary Redirect)
'/old-page2': { redirect: { to:'/new-page2', statusCode: 301 } },
'/proxy/example': { proxy: 'https://example.com' },
'/proxy/**': { proxy: '/api/**' },
}
Expand Down
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"preview": "nuxi preview"
},
"devDependencies": {
"@nuxt-themes/docus": "^1.12.0",
"@nuxthq/studio": "^0.12.1",
"@nuxt-themes/docus": "^1.12.3",
"@nuxthq/studio": "^0.13.2",
"@nuxtjs/plausible": "^0.2.1",
"nuxt": "3.5.1"
"nuxt": "3.5.3"
}
}
Loading

0 comments on commit a53c385

Please sign in to comment.