Skip to content

Commit

Permalink
Merge branch 'master' into nuxt-init-hosting
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdaniels authored Dec 7, 2023
2 parents c7fa611 + b8ef5fa commit 9098054
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
- Fixed an issue preventing Angular apps using ng-deploy from being emulated or deployed. (#6584)
- Warn if a Web Framework is outside a well known version range on deploy/emulate. (#6562)
- Use Web Framework's well known version range in `firebase init hosting`. (#6562)
- Permit use of more SSR regions in Web Frameworks deploys. (#6086)
- Limit Web Framework's generated Cloud Function name to 23 characters, fixing deploys for some. (#6260)
- Allow Nuxt as an option during `firebase init hosting`. (#6309)
34 changes: 29 additions & 5 deletions src/frameworks/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,35 @@ export const VALID_LOCALE_FORMATS = [/^ALL_[a-z]+$/, /^[a-z]+_ALL$/, /^[a-z]+(_[

export const DEFAULT_REGION = "us-central1";
export const ALLOWED_SSR_REGIONS = [
{ name: "us-central1 (Iowa)", value: "us-central1" },
{ name: "us-west1 (Oregon)", value: "us-west1" },
{ name: "us-east1 (South Carolina)", value: "us-east1" },
{ name: "europe-west1 (Belgium)", value: "europe-west1" },
{ name: "asia-east1 (Taiwan)", value: "asia-east1" },
{ name: "us-central1 (Iowa)", value: "us-central1", recommended: true },
{ name: "us-east1 (South Carolina)", value: "us-east1", recommended: true },
{ name: "us-east4 (Northern Virginia)", value: "us-east4" },
{ name: "us-west1 (Oregon)", value: "us-west1", recommended: true },
{ name: "us-west2 (Los Angeles)", value: "us-west2" },
{ name: "us-west3 (Salt Lake City)", value: "us-west3" },
{ name: "us-west4 (Las Vegas)", value: "us-west4" },
{ name: "asia-east1 (Taiwan)", value: "asia-east1", recommended: true },
{ name: "asia-east2 (Hong Kong)", value: "asia-east2" },
{ name: "asia-northeast1 (Tokyo)", value: "asia-northeast1" },
{ name: "asia-northeast2 (Osaka)", value: "asia-northeast2" },
{ name: "asia-northeast3 (Seoul)", value: "asia-northeast3" },
{ name: "asia-south1 (Mumbai)", value: "asia-south1" },
{ name: "asia-south2 (Delhi)", value: "asia-south2" },
{ name: "asia-southeast1 (Singapore)", value: "asia-southeast1" },
{ name: "asia-southeast2 (Jakarta)", value: "asia-southeast2" },
{ name: "australia-southeast1 (Sydney)", value: "australia-southeast1" },
{ name: "australia-southeast2 (Melbourne)", value: "australia-southeast2" },
{ name: "europe-central2 (Warsaw)", value: "europe-central2" },
{ name: "europe-north1 (Finland)", value: "europe-north1" },
{ name: "europe-west1 (Belgium)", value: "europe-west1", recommended: true },
{ name: "europe-west2 (London)", value: "europe-west2" },
{ name: "europe-west3 (Frankfurt)", value: "europe-west3" },
{ name: "europe-west4 (Netherlands)", value: "europe-west4" },
{ name: "europe-west6 (Zurich)", value: "europe-west6" },
{ name: "northamerica-northeast1 (Montreal)", value: "northamerica-northeast1" },
{ name: "northamerica-northeast2 (Toronto)", value: "northamerica-northeast2" },
{ name: "southamerica-east1 (São Paulo)", value: "southamerica-east1" },
{ name: "southamerica-west1 (Santiago)", value: "southamerica-west1" },
];

export const I18N_ROOT = "/";
Expand Down
2 changes: 1 addition & 1 deletion src/frameworks/docs/astro.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Before you get started deploying your app to Firebase,
review the following requirements and options:

- Firebase CLI version 12.1.0 or later. Make sure to
[install the CLI](/docs/cli#install_the_firebase_cli)
[install the CLI](https://firebase.google.com/docs/cli#install_the_firebase_cli)
using your preferred method.
- Optional: Billing enabled on your Firebase project
(required if you plan to use SSR)
Expand Down
61 changes: 61 additions & 0 deletions src/frameworks/docs/nuxt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Integrate Nuxt

Using the Firebase CLI, you can deploy your Nuxt apps to Firebase and
serve them with Firebase Hosting. The CLI respects your Nuxt settings and
translates them to Firebase settings with zero or minimal extra configuration on
your part. If your app includes dynamic server-side logic, the CLI deploys that
logic to Cloud Functions for Firebase.

Note: Framework-aware Hosting is an early public preview. This means
that the functionality might change in backward-incompatible ways. A preview
release is not subject to any SLA or deprecation policy and may receive limited
or no support.

## Before you begin

Before you get started deploying your app to Firebase,
review the following requirements and options:

- Firebase CLI version 12.1.0 or later. Make sure to
[install the CLI](https://firebase.google.com/docs/cli#install_the_firebase_cli)
using your preferred method.
- Optional: Billing enabled on your Firebase project
(required if you plan to use SSR)
- An existing Nuxt (version 3+) project. You can create one with `npx nuxi@latest init <project-name>`.


## Initialize Firebase

To get started, initialize Firebase for your framework project.
Use the Firebase CLI for a new project, or modify `firebase.json` for an
existing project.

### Initialize a new project

1. In the Firebase CLI, enable the web frameworks preview:
<pre class="devsite-terminal">firebase experiments:enable webframeworks</pre>
2. Run the initialization command from the CLI and then follow the prompts:
<pre class="devsite-terminal">firebase init hosting</pre>
If there is an existing Nuxt codebase, the CLI detects it.

## Deployment

After initializing Firebase, you can deploy your Nuxt app with the standard
deployment command:

```shell
firebase deploy
```

## Serve static content

If your Nuxt app uses [`ssr: false`](https://nuxt.com/docs/api/configuration/nuxt-config#ssr),
the Firebase CLI will correctly detect and configure your build to serve fully
static content on Firebase Hosting.

## Server-side rendering

The Firebase CLI will detect usage of [`ssr: true`](https://nuxt.com/docs/api/configuration/nuxt-config#ssr).
In such cases, the Firebase CLI will deploy functions to Cloud Functions for Firebase to run dynamic
server code. You can view information about these functions, such as their domain and runtime
configuration, in the [Firebase console](https://console.firebase.google.com/project/_/functions).
2 changes: 1 addition & 1 deletion src/frameworks/docs/sveltekit.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Before you get started deploying your app to Firebase,
review the following requirements and options:

- Firebase CLI version 12.1.0 or later. Make sure to
[install the CLI](/docs/cli#install_the_firebase_cli)
[install the CLI](https://firebase.google.com/docs/cli#install_the_firebase_cli)
using your preferred method.
- Optional: Billing enabled on your Firebase project
(required if you plan to use SSR)
Expand Down
2 changes: 1 addition & 1 deletion src/init/features/hosting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export async function doSetup(setup: any, config: any, options: Options): Promis
type: "list",
message: "In which region would you like to host server-side content, if applicable?",
default: DEFAULT_REGION,
choices: ALLOWED_SSR_REGIONS,
choices: ALLOWED_SSR_REGIONS.filter((region) => region.recommended),
},
setup.hosting
);
Expand Down

0 comments on commit 9098054

Please sign in to comment.