Skip to content

Commit 0f617f3

Browse files
joehanfredzqm
andauthored
Cleaning up cses where project id is not set (#7760)
Co-authored-by: Fred Zhang <[email protected]>
1 parent e486727 commit 0f617f3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

firebase-vscode/src/core/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,16 @@ export async function registerCore(
5555
return;
5656
}
5757
const workspaceFolder = vscode.workspace.workspaceFolders[0];
58+
const initCommand = currentProjectId.value ?
59+
`${settings.firebasePath} init dataconnect --project ${currentProjectId.value}` :
60+
`${settings.firebasePath} init dataconnect`;
5861
vscode.tasks.executeTask(
5962
new vscode.Task(
6063
{ type: "shell" }, // this is the same type as in tasks.json
6164
workspaceFolder, // The workspace folder
6265
"firebase init dataconnect", // how you name the task
6366
"firebase init dataconnect", // Shows up as MyTask: name
64-
new vscode.ShellExecution(`${settings.firebasePath} init dataconnect --project ${currentProjectId.value}`),
67+
new vscode.ShellExecution(initCommand),
6568
),
6669
);
6770
});

firebase-vscode/src/data-connect/terminal.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ export function runCommand(command: string) {
2727
// TODO: This fails if the interactive shell is not expecting a command, such
2828
// as when oh-my-zsh asking for (Y/n) to updates during startup.
2929
// Consider using an non-interactive shell.
30-
terminal.sendText(`${command} -P ${currentProjectId.value}`);
30+
if (currentProjectId.value) {
31+
command = `${command} --project ${currentProjectId.value}`;
32+
}
33+
terminal.sendText(command);
3134
}
3235

3336
export function runTerminalTask(

0 commit comments

Comments
 (0)