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/static/public";
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();
@@ -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/static/public';
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
- /** Emulator ports default to the firebase.json values but can be overridden
29
- * by env vars so test runs (see firebase.test.json) can use dedicated ports
30
- * that don't collide with other running emulator suites. Dynamic env isn't
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(emulatorPort('PUBLIC_EMULATOR_FIRESTORE', '8080')));
32
+ connectFirestoreEmulator(db, 'localhost', parseInt(PUBLIC_EMULATOR_FIRESTORE ?? '8080'));
44
33
  if (auth)
45
- connectAuthEmulator(auth, `http://localhost:${emulatorPort('PUBLIC_EMULATOR_AUTH', '9099')}`);
34
+ connectAuthEmulator(auth, `http://localhost:${PUBLIC_EMULATOR_AUTH ?? '9099'}`);
46
35
  if (storage)
47
- connectStorageEmulator(storage, 'localhost', parseInt(emulatorPort('PUBLIC_EMULATOR_STORAGE', '9199')));
36
+ connectStorageEmulator(storage, 'localhost', parseInt(PUBLIC_EMULATOR_STORAGE ?? '9199'));
48
37
  if (functions)
49
- connectFunctionsEmulator(functions, 'localhost', parseInt(emulatorPort('PUBLIC_EMULATOR_FUNCTIONS', '5001')));
38
+ connectFunctionsEmulator(functions, 'localhost', parseInt(PUBLIC_EMULATOR_FUNCTIONS ?? '5001'));
50
39
  }
@@ -1,4 +1,4 @@
1
- import { PUBLIC_READER } from '$env/static/public';
1
+ import { PUBLIC_READER } from '$app/env/public';
2
2
  /**
3
3
  * Whether this build talks to Firebase. A bound book (bookish-reader) never
4
4
  * does, and the Firebase SDK is most of its JavaScript, so it must never load
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bookish-press",
3
3
  "private": false,
4
- "version": "0.10.0",
4
+ "version": "0.11.0",
5
5
  "type": "module",
6
6
  "description": "A platform for reading and writing readable, accessible, beautiful online books.",
7
7
  "license": "MIT",