Skip to content

Commit

Permalink
add nuxt init method for firebase hosting (#6309)
Browse files Browse the repository at this point in the history
* add nuxt init method for firebase init hosting
* Changelog, supportedRange, and address feedback

---------

Co-authored-by: Leonardo Ortiz <leo@monogram.io>
Co-authored-by: James Daniels <jamesdaniels@google.com>
  • Loading branch information
3 people authored Dec 7, 2023
1 parent b8ef5fa commit 9038f6d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
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();
}

0 comments on commit 9038f6d

Please sign in to comment.