Skip to content
Closed
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
- Fixed bug where `esbuild` execution was throwing an error saying "Command line too long" on Windows (#7250, #6193). (#7395)
- Automatically detect app platform during `init dataconnect:sdk`.
- Support `sharp` ^0.33.x for web frameworks. (#7517)
- Update Firebase Data Connect toolkit to v1.3.4, which supports `offset`, cascade delete support, always all foreign fields and multiple generated SDK options. (#7545)
- Updated Firebase Data Connect toolkit to v1.3.4, which supports `offset`, cascade delete support, always all foreign fields and multiple generated SDK options. (#7545)
- Updated Data Connect SDK options default to avoid duplicate output path. (#7545)
14 changes: 7 additions & 7 deletions src/init/features/dataconnect/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from "../../../dataconnect/types";
import { DataConnectEmulator } from "../../../emulator/dataconnectEmulator";
import { FirebaseError } from "../../../error";
import { camelCase, snakeCase } from "lodash";
import { camelCase, snakeCase, upperFirst } from "lodash";
import { logSuccess, logBullet } from "../../../utils";

export type SDKInfo = {
Expand Down Expand Up @@ -110,10 +110,11 @@ async function askQuestions(setup: Setup, config: Config): Promise<SDKInfo> {
newConnectorYaml.generate.swiftSdk?.outputDir ||
path.relative(
connectorInfo.directory,
path.join(appDir, `generated/${newConnectorYaml.connectorId}`),
path.join(appDir, `generated/${newConnectorYaml.connectorId}/swift`),
);
const pkg =
newConnectorYaml.generate.swiftSdk?.package ?? camelCase(newConnectorYaml.connectorId);
newConnectorYaml.generate.swiftSdk?.package ??
upperFirst(camelCase(newConnectorYaml.connectorId));
const swiftSdk = { outputDir, package: pkg };
newConnectorYaml.generate.swiftSdk = swiftSdk;
displayIOSWarning = true;
Expand All @@ -124,7 +125,7 @@ async function askQuestions(setup: Setup, config: Config): Promise<SDKInfo> {
newConnectorYaml.generate.javascriptSdk?.outputDir ||
path.relative(
connectorInfo.directory,
path.join(appDir, `generated/${newConnectorYaml.connectorId}`),
path.join(appDir, `generated/${newConnectorYaml.connectorId}/javascript`),
);
const pkg =
newConnectorYaml.generate.javascriptSdk?.package ??
Expand All @@ -150,17 +151,16 @@ async function askQuestions(setup: Setup, config: Config): Promise<SDKInfo> {
// app/src/main/kotlin and app/src/main/java are conventional for Android,
// but not required or enforced. If one of them is present (preferring the
// "kotlin" directory), use it. Otherwise, fall back to the app directory.
let baseDir = path.join(appDir, "generated");
let baseDir = path.join(appDir, `generated/${newConnectorYaml.connectorId}/kotlin`);
for (const candidateSubdir of ["app/src/main/java", "app/src/main/kotlin"]) {
const candidateDir = path.join(appDir, candidateSubdir);
if (fs.existsSync(candidateDir)) {
baseDir = candidateDir;
}
}

const outputDir =
newConnectorYaml.generate.kotlinSdk?.outputDir ||
path.relative(connectorInfo.directory, baseDir);
path.relative(connectorInfo.directory, path.join(appDir, baseDir));
const pkg =
newConnectorYaml.generate.kotlinSdk?.package ??
`connectors.${snakeCase(connectorInfo.connectorYaml.connectorId)}`;
Expand Down