Skip to content

Commit

Permalink
fix: options.project is mandatory for ui (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
muryoh committed Feb 14, 2022
1 parent a865eb3 commit fad3623
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-firebase",
"version": "0.2.3",
"version": "0.2.4",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
Expand Down
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ import { shutdownWhenKilled } from 'firebase-tools/lib/emulator/commandUtils.js'

export interface FirebasePluginOptions {
projectId: string | ((server: ViteDevServer) => string)
projectName: string | ((server: ViteDevServer) => string)
root?: string
materializeConfig?: boolean
targets: string[]
showUI: boolean
}

export default function firebasePlugin({projectId, root, materializeConfig, targets = ['hosting', 'functions'], showUI = false}: FirebasePluginOptions) {
export default function firebasePlugin({projectId, projectName = projectId, root, materializeConfig, targets = ['hosting', 'functions'], showUI = false}: FirebasePluginOptions) {
return {
name: "vite:firebase",
async configureServer(server: ViteDevServer) {
Expand All @@ -44,9 +45,11 @@ export default function firebasePlugin({projectId, root, materializeConfig, targ
shutdownWhenKilled({});
}
if (typeof projectId !== 'string') projectId = projectId(server);
if (typeof projectName !== 'string') projectName = projectName(server);
const account = getProjectDefaultAccount(projectDir);
const options = {
projectId,
project: projectName,
projectDir,
nonInteractive: true,
account,
Expand Down

0 comments on commit fad3623

Please sign in to comment.