Skip to content

Commit

Permalink
PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
joehan committed Nov 22, 2024
1 parent 8468b5b commit 9de7611
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/emulator/initEmulators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Emulators } from "./types";
import { exportConfig } from "../apphosting/config";
import { detectProjectRoot } from "../detectProjectRoot";

type InitFn = () => Promise<Record<string, string> | null>;
type InitFn = (currentConfig?: Record<string, any>) => Promise<Record<string, string> | null>;

Check warning on line 11 in src/emulator/initEmulators.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
type AdditionalInitFnsType = Partial<Record<Emulators, InitFn>>;

export const AdditionalInitFns: AdditionalInitFnsType = {
Expand Down Expand Up @@ -46,11 +46,12 @@ export const AdditionalInitFns: AdditionalInitFnsType = {

return mapToObject(additionalConfigs);
},
[Emulators.DATACONNECT]: async () => {
[Emulators.DATACONNECT]: async (currentConfig?: Record<string, any>) => {

Check warning on line 49 in src/emulator/initEmulators.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
const defaultDataConnectDir = currentConfig?.dataconnect?.source || "dataconnect";

Check warning on line 50 in src/emulator/initEmulators.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value

Check warning on line 50 in src/emulator/initEmulators.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .source on an `any` value
const dataDir = await promptOnce({
name: "dataDir",
type: "input",
default: "./postgresData",
default: `./${defaultDataConnectDir}/.dataconnect/pgliteData`,

Check warning on line 54 in src/emulator/initEmulators.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Invalid type "any" of template literal expression
message:
"Where do you want to store Postgres data from the Data Connect emulator? " +
"If set, data will be saved between emulator runs. " +
Expand Down
5 changes: 4 additions & 1 deletion src/init/features/dataconnect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ export async function doSetup(setup: Setup, config: Config): Promise<void> {
}
const info = await askQuestions(setup, isBillingEnabled);
// Most users will want to perist data between emulator runs, so set this to a reasonable default.
config.set("emulators.dataconnect.dataDir", "./postgresData");

const dir: string = config.get("dataconnect.source", "dataconnect");

Check warning on line 84 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
const dataDir = config.get("emulators.dataconnect.dataDir", `${dir}/.dataconnect/pgliteData`);

Check warning on line 85 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
config.set("emulators.dataconnect.dataDir", dataDir);
await actuate(setup, config, info);

const cwdPlatformGuess = await getPlatformFromFolder(process.cwd());
Expand Down

0 comments on commit 9de7611

Please sign in to comment.