Skip to content

Commit f9aa89f

Browse files
authored
refactor!: remove legacy presets and aliases (#3202)
1 parent 8b05869 commit f9aa89f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+148
-1924
lines changed

docs/1.guide/00.migration.md

+21
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,27 @@ This feature had been removed.
8080

8181
Use a regular `.ts` file in your server directory and import it directly.
8282

83+
## Preset updates
84+
85+
Nitro presets have been updated for the latest compatibility.
86+
87+
Some (legacy) presets have been removed or renamed.
88+
89+
| Old Preset | New Preset |
90+
|------------------------------|-------------------------------|
91+
| `node` | `node-middleware` (export changed to `middleware`) |
92+
| `cloudflare`, `cloudflare_worker`, `cloudflare_module_legacy` | `cloudflare_module` |
93+
| `deno-server-legacy` | `deno_server` with Deno v2 |
94+
| `netlify-builder` | `netlify_functions` or `netlify_edge` |
95+
| `vercel-edge` | `vercel` with Fluid compute enabled |
96+
| `azure`, `azure_functions` | `azure_swa` |
97+
| `firebase` | `firebase-functions` |
98+
| `iis` | `iis-handler` |
99+
| `deno` | `deno-deploy` |
100+
| `edgio` | `layer0` |
101+
| `cli` | Removed due to lack of use |
102+
| `service_worker` | Removed due to instability |
103+
83104
## Removed Subpath Exports
84105

85106
Nitro v2 introduced multiple subpath exports, some of which have been removed:

docs/2.deploy/20.providers/azure.md

+1-97
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
## Azure static web apps
66

7-
**Preset:** `azure`
7+
**Preset:** `azure-swa`
88

99
:read-more{title="Azure Static Web Apps" to="https://azure.microsoft.com/en-us/products/app-service/static"}
1010

@@ -70,99 +70,3 @@ That's it! Now Azure Static Web Apps will automatically deploy your Nitro-powere
7070

7171
If you are using runtimeConfig, you will likely want to configure the corresponding [environment variables on Azure](https://docs.microsoft.com/en-us/azure/static-web-apps/application-settings).
7272

73-
## Azure functions
74-
75-
**Preset:** `azure_functions`
76-
77-
::important
78-
If you encounter any issues, please ensure you're using a Node.js 16+ runtime. You can find more information about [how to set the Node version in the Azure docs](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node?tabs=v2#setting-the-node-version).
79-
Please see [nitrojs/nitro#2114](https://github.com/nitrojs/nitro/issues/2114) for some common issues.
80-
::
81-
82-
### Local preview
83-
84-
Install [Azure Functions Core Tools](https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local) if you want to test locally.
85-
86-
You can invoke a development environment from the serverless directory.
87-
88-
```bash
89-
NITRO_PRESET=azure_functions npx nypm@latest build
90-
cd .output
91-
func start
92-
```
93-
94-
You can now visit `http://localhost:7071/` in your browser and browse your site running locally on Azure Functions.
95-
96-
### Deploy from your local machine
97-
98-
To deploy, just run the following command:
99-
100-
```bash
101-
# To publish the bundled zip file
102-
az functionapp deployment source config-zip -g <resource-group> -n <app-name> --src dist/deploy.zip
103-
# Alternatively you can publish from source
104-
cd dist && func azure functionapp publish --javascript <app-name>
105-
```
106-
107-
### Deploy from CI/CD via GitHub actions
108-
109-
First, obtain your Azure Functions Publish Profile and add it as a secret to your GitHub repository settings following [these instructions](https://github.com/Azure/functions-action#using-publish-profile-as-deployment-credential-recommended).
110-
111-
Then create the following file as a workflow:
112-
113-
```yaml [.github/workflows/azure.yml]
114-
name: azure
115-
on:
116-
push:
117-
branches:
118-
- main
119-
pull_request:
120-
branches:
121-
- main
122-
jobs:
123-
deploy:
124-
runs-on: ${{ matrix.os }}
125-
strategy:
126-
matrix:
127-
os: [ ubuntu-latest ]
128-
node: [ 14 ]
129-
steps:
130-
- uses: actions/setup-node@v2
131-
with:
132-
node-version: ${{ matrix.node }}
133-
134-
- name: Checkout
135-
uses: actions/checkout@master
136-
137-
- name: Get yarn cache directory path
138-
id: yarn-cache-dir-path
139-
run: echo "::set-output name=dir::$(yarn cache dir)"
140-
141-
- uses: actions/cache@v2
142-
id: yarn-cache
143-
with:
144-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
145-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
146-
restore-keys: |
147-
${{ runner.os }}-yarn-azure
148-
149-
- name: Install Dependencies
150-
if: steps.cache.outputs.cache-hit != 'true'
151-
run: yarn
152-
153-
- name: Build
154-
run: npm run build
155-
env:
156-
NITRO_PRESET: azure_functions
157-
158-
- name: 'Deploy to Azure Functions'
159-
uses: Azure/functions-action@v1
160-
with:
161-
app-name: <your-app-name>
162-
package: .output/deploy.zip
163-
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
164-
```
165-
166-
### Optimizing Azure functions
167-
168-
Consider [turning on immutable packages](https://docs.microsoft.com/en-us/azure/app-service/deploy-run-package) to support running your app from the zip file. This can speed up cold starts.

docs/2.deploy/20.providers/cloudflare.md

+16-55
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
# Cloudflare
22

3-
> Deploy Nitro apps to Cloudflare.
3+
> Deploy Nitro apps to Cloudflare Workers and Pages.
44
5-
## Cloudflare Pages
5+
## Cloudflare Worker
66

7-
**Preset:** `cloudflare_pages`
7+
**Preset:** `cloudflare_module`
88

9-
:read-more{title="Cloudflare Pages" to="https://pages.cloudflare.com/"}
9+
:read-more{title="Cloudflare Workers" to="https://developers.cloudflare.com/workers/"}
10+
11+
::note
12+
This preset uses the [module worker syntax](https://developers.cloudflare.com/workers/learning/migrating-to-module-workers/) for deployment.
13+
::
1014

1115
::note
12-
This is the recommended preset for Cloudflare deployments, please consider using the alternative ones if you need special features.
16+
This preset benefits [Static Assets](https://developers.cloudflare.com/workers/static-assets/) by default.
1317
::
1418

19+
20+
## Cloudflare Pages
21+
22+
**Preset:** `cloudflare_pages`
23+
24+
:read-more{title="Cloudflare Pages" to="https://pages.cloudflare.com/"}
25+
1526
::note
1627
Integration with this provider is possible with [zero configuration](/deploy#zero-config-providers).
1728
::
@@ -65,43 +76,6 @@ Then you can deploy the application with:
6576

6677
:pm-x{command="wrangler pages deploy dist"}
6778

68-
## Cloudflare Module Workers
69-
70-
**Preset:** `cloudflare_module`
71-
72-
::note
73-
**Note:** This preset uses the [module worker syntax](https://developers.cloudflare.com/workers/learning/migrating-to-module-workers/) for deployment.
74-
::
75-
76-
When using Workers you will need a `wrangler.toml` file, in your root directory. To using Workers with [Static Assets](https://developers.cloudflare.com/workers/static-assets/) (BETA with [limitations](https://developers.cloudflare.com/workers/static-assets/#limitations)), you also need a compatibility date set to `2024-09-19` or later, in your `wrangler.toml` file and nitro configuration file.
77-
78-
The following shows a typical `wrangler.toml` file and a `nitro.config.ts` file for a Nitro application:
79-
80-
::code-group
81-
82-
```ts [nitro.config.ts]
83-
export default defineNitroConfig({
84-
compatibilityDate: "2024-09-19",
85-
})
86-
```
87-
88-
```ts [nuxt.config.ts]
89-
export default defineNuxtConfig({
90-
compatibilityDate: "2024-09-19",
91-
})
92-
```
93-
94-
::
95-
96-
```ini [wrangler.toml]
97-
name = "nitro-app"
98-
compatibility_date = "2024-09-19"
99-
main = "./.output/server/index.mjs"
100-
assets = { directory = "./.output/public/", binding = "ASSETS" }
101-
```
102-
103-
104-
10579
## Runtime hooks
10680

10781
You can use [runtime hooks](/guide/plugins#nitro-runtime-hooks) below in order to extend [worker handlers](https://developers.cloudflare.com/workers/runtime-apis/handlers/).
@@ -158,19 +132,6 @@ and publish it:
158132

159133
:pm-x{command="wrangler deploy"}
160134

161-
## Cloudflare Service Workers
162-
163-
**Preset:** `cloudflare`
164-
165-
::note
166-
**Note:** This preset uses the [service worker syntax](https://developers.cloudflare.com/workers/learning/service-worker/) for deployment.
167-
::
168-
169-
::warning
170-
**Note:** This preset is deprecated.
171-
::
172-
173-
The way this preset works is identical to that of the `cloudflare_module` one presented above, with the only difference being that such preset inherits all the [disadvantages](https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/#advantages-of-migrating) that such syntax brings.
174135

175136
## Deploy within CI/CD using GitHub Actions
176137

docs/2.deploy/20.providers/firebase.md

+2-79
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
> Deploy Nitro apps to Firebase hosting.
44
5-
::note
6-
You will need to be on the [**Blaze plan**](https://firebase.google.com/pricing) (Pay as you go) to get started.
7-
::
8-
95
<!--
106
117
## Firebase app hosting <sup>(beta)</sup>
@@ -42,9 +38,8 @@ You can integrate with this provider using [zero configuration](/deploy/#zero-co
4238

4339
:read-more{title="Firebase Hosting" to="https://firebase.google.com/docs/hosting"}
4440

45-
::important
46-
This preset will deploy to firebase functions 1st gen by default. If you want to deploy to firebase functions 2nd gen, see the [instructions below](#using-2nd-generation-firebase-functions).
47-
::
41+
> [!NOTE]
42+
> This preset uses [2nd gen](https://firebase.google.com/docs/functions/version-comparison#new-in-2nd-gen) firebase cloud functions
4843
4944
### Project Setup
5045

@@ -144,78 +139,6 @@ If you installed the Firebase CLI globally, you can also run:
144139
firebase deploy
145140
```
146141

147-
### Using 2nd generation firebase functions
148-
149-
- [Comparison between 1st and 2nd generation functions](https://firebase.google.com/docs/functions/version-comparison)
150-
151-
To switch to the more recent and, recommended generation of firebase functions, set the `firebase.gen` option to `2`:
152-
153-
::code-group
154-
155-
```ts{3} [nitro.config.ts]
156-
export default defineNitroConfig({
157-
firebase: {
158-
gen: 2
159-
// ...
160-
}
161-
})
162-
```
163-
164-
```ts{4} [nuxt.config.ts]
165-
export default defineNuxtConfig({
166-
nitro: {
167-
firebase: {
168-
gen: 2
169-
// ...
170-
}
171-
}
172-
})
173-
```
174-
175-
::
176-
177-
::note
178-
If you cannot use configuration for any reason, alternatively you can use `NITRO_FIREBASE_GEN` environment variable.
179-
::
180-
181-
If you already have a deployed version of your website and want to upgrade to 2nd gen, [see the Migration process on Firebase docs](https://firebase.google.com/docs/functions/2nd-gen-upgrade). Namely, the CLI will ask you to delete your existing functions before deploying the new ones.
182-
183-
### Options
184-
185-
You can set options for the firebase functions in your `nitro.config.ts` file:
186-
187-
::code-group
188-
189-
```ts [nitro.config.ts]
190-
export default defineNitroConfig({
191-
firebase: {
192-
gen: 2,
193-
httpsOptions: {
194-
region: 'europe-west1',
195-
maxInstances: 3,
196-
},
197-
},
198-
});
199-
```
200-
201-
```ts [nuxt.config.ts]
202-
export default defineNuxtConfig({
203-
nitro: {
204-
firebase: {
205-
gen: 2,
206-
httpsOptions: {
207-
region: 'europe-west1',
208-
maxInstances: 3,
209-
},
210-
},
211-
},
212-
});
213-
```
214-
215-
::
216-
217-
You can also set options for 1st generation Cloud Functions if the `gen` option is set to `1`. Note these are different from the options for 2nd generation Cloud Functions.
218-
219142
#### Runtime Node.js version
220143

221144
You can set custom Node.js version in configuration:

docs/2.deploy/20.providers/iis.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
## Using IIS handler
1616

17-
**Preset:** `iis_handler` / `iis`
17+
**Preset:** `iis_handler`
1818

1919
You can use IIS http handler directly.
2020

docs/2.deploy/20.providers/netlify.md

-12
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,6 @@ Nitro output can directly run the server at the edge. Closer to your users.
3939
Make sure the publish directory is set to `dist` when creating a new project.
4040
::
4141

42-
## On-demand builders
43-
44-
**Preset:** `netlify_builder`
45-
46-
::warning
47-
**Note:** This preset is deprecated. Instead, use the `netlify` preset with the `isr` route rule.
48-
::
49-
50-
On-demand Builders are serverless functions used to generate web content as needed that’s automatically cached on Netlify’s Edge CDN. They enable you to build pages for your site when a user visits them for the first time and then cache them at the edge for subsequent visits.
51-
52-
:read-more{title="Netlify On-demand Builders" to="https://docs.netlify.com/configure-builds/on-demand-builders/"}
53-
5442
## Custom deploy configuration
5543

5644
You can provide additional deploy configuration using the `netlify` key inside `nitro.config`. It will be merged with built-in auto-generated config. Currently the only supported value is `images.remote_images`, for [configuring Netlify Image CDN](https://docs.netlify.com/image-cdn/create-integration/).

docs/2.deploy/20.providers/vercel.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
Integration with this provider is possible with [zero configuration](/deploy/#zero-config-providers).
1111
::
1212

13+
::tip
14+
It is recommended to enable [Fluid compute](https://vercel.com/docs/functions/fluid-compute).
15+
::
16+
1317
## Deploy using git
1418

1519
1. Push your code to your git repository (GitHub, GitLab, Bitbucket).
@@ -104,9 +108,3 @@ export default defineNitroConfig({
104108
},
105109
});
106110
```
107-
108-
## Vercel edge functions
109-
110-
**Preset:** `vercel_edge` (deprecated)
111-
112-
We recommend migrating to the default Node.js runtime and enabling [Fluid compute](https://vercel.com/docs/functions/fluid-compute).

0 commit comments

Comments
 (0)