Skip to content

add nuxt init method for firebase hosting #6309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
- 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)
12 changes: 12 additions & 0 deletions src/frameworks/nuxt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const supportedRange = "3";
import { nuxtConfigFilesExist } from "./utils";
import type { NuxtOptions } from "./interfaces";
import { FirebaseError } from "../../error";
import { execSync } from "child_process";

const DEFAULT_BUILD_SCRIPT = ["nuxt build", "nuxi build"];

Expand Down Expand Up @@ -112,3 +113,14 @@ export async function getConfig(dir: string): Promise<NuxtOptions> {
const { loadNuxtConfig } = await relativeRequire(dir, "@nuxt/kit");
return await loadNuxtConfig(dir);
}

/**
* Utility method used during project initialization.
*/
export function init(setup: any, config: any) {
execSync(`npx --yes nuxi@"${supportedRange}" init ${setup.hosting.source}`, {
stdio: "inherit",
cwd: config.projectDir,
});
return Promise.resolve();
}