bookish-press 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,7 +6,7 @@ import Format from "../chapter/Format.svelte";
|
|
|
6
6
|
import Note from "../editor/Note.svelte";
|
|
7
7
|
import Instructions from "./Instructions.svelte";
|
|
8
8
|
import Link from "../Link.svelte";
|
|
9
|
-
import { PUBLIC_CONTEXT } from "$env/
|
|
9
|
+
import { PUBLIC_CONTEXT } from "$app/env/public";
|
|
10
10
|
import Button from "../app/Button.svelte";
|
|
11
11
|
import Feedback from "../app/Feedback.svelte";
|
|
12
12
|
let auth = getUser();
|
package/dist/models/Firebase.js
CHANGED
|
@@ -3,8 +3,7 @@ import { connectAuthEmulator, getAuth } from 'firebase/auth';
|
|
|
3
3
|
import { connectFirestoreEmulator, getFirestore } from 'firebase/firestore';
|
|
4
4
|
import { connectFunctionsEmulator, getFunctions } from 'firebase/functions';
|
|
5
5
|
import { connectStorageEmulator, getStorage } from 'firebase/storage';
|
|
6
|
-
import { PUBLIC_READER, PUBLIC_CONTEXT, PUBLIC_FIREBASE_API_KEY, PUBLIC_FIREBASE_AUTH_DOMAIN, PUBLIC_FIREBASE_PROJECT_ID, PUBLIC_FIREBASE_STORAGE_BUCKET, PUBLIC_FIREBASE_MESSAGING_SENDER_ID, PUBLIC_FIREBASE_APP_ID, } from '$env/
|
|
7
|
-
import { env } from '$env/dynamic/public';
|
|
6
|
+
import { PUBLIC_READER, PUBLIC_CONTEXT, PUBLIC_FIREBASE_API_KEY, PUBLIC_FIREBASE_AUTH_DOMAIN, PUBLIC_FIREBASE_PROJECT_ID, PUBLIC_FIREBASE_STORAGE_BUCKET, PUBLIC_FIREBASE_MESSAGING_SENDER_ID, PUBLIC_FIREBASE_APP_ID, PUBLIC_EMULATOR_AUTH, PUBLIC_EMULATOR_FIRESTORE, PUBLIC_EMULATOR_STORAGE, PUBLIC_EMULATOR_FUNCTIONS, } from '$app/env/public';
|
|
8
7
|
const isReader = PUBLIC_READER === 'true';
|
|
9
8
|
// Some feedback about context
|
|
10
9
|
if (!isReader && PUBLIC_CONTEXT !== 'prod')
|
|
@@ -25,26 +24,16 @@ export const auth = isReader ? undefined : getAuth(app);
|
|
|
25
24
|
export const db = isReader ? undefined : getFirestore();
|
|
26
25
|
export const storage = isReader ? undefined : getStorage(app);
|
|
27
26
|
export const functions = isReader ? undefined : getFunctions(app);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* available in every context (e.g. unit tests), hence the guard. */
|
|
32
|
-
function emulatorPort(name, fallback) {
|
|
33
|
-
try {
|
|
34
|
-
return (env?.[name] ??
|
|
35
|
-
fallback);
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
return fallback;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
27
|
+
// Emulator ports default to the firebase.json values, but test runs override
|
|
28
|
+
// them (see firebase.test.json) so they don't collide with other emulator
|
|
29
|
+
// suites running on this machine.
|
|
41
30
|
if (!isReader && PUBLIC_CONTEXT === 'local') {
|
|
42
31
|
if (db)
|
|
43
|
-
connectFirestoreEmulator(db, 'localhost', parseInt(
|
|
32
|
+
connectFirestoreEmulator(db, 'localhost', parseInt(PUBLIC_EMULATOR_FIRESTORE ?? '8080'));
|
|
44
33
|
if (auth)
|
|
45
|
-
connectAuthEmulator(auth, `http://localhost:${
|
|
34
|
+
connectAuthEmulator(auth, `http://localhost:${PUBLIC_EMULATOR_AUTH ?? '9099'}`);
|
|
46
35
|
if (storage)
|
|
47
|
-
connectStorageEmulator(storage, 'localhost', parseInt(
|
|
36
|
+
connectStorageEmulator(storage, 'localhost', parseInt(PUBLIC_EMULATOR_STORAGE ?? '9199'));
|
|
48
37
|
if (functions)
|
|
49
|
-
connectFunctionsEmulator(functions, 'localhost', parseInt(
|
|
38
|
+
connectFunctionsEmulator(functions, 'localhost', parseInt(PUBLIC_EMULATOR_FUNCTIONS ?? '5001'));
|
|
50
39
|
}
|