Skip to content

Commit 61f2ba3

Browse files
jay-coxclaude
andcommitted
chore: migrate from Firebase v9 compat to v12 modular API
Replace deprecated firebase/compat/* imports with modular API equivalents from firebase/app, firebase/database, and firebase/auth. This enables proper tree-shaking and keeps the library on supported Firebase APIs. - Bump firebase to ^12.0.0 in package.json and demo/package.json - Update tsconfig target to ES2020 for Firebase v12 compatibility - Delete firebase-init.ts compat singleton wrapper - Rewrite database.ts, document.ts, collection.ts to modular imports - Fix collection.ts bug: limitToFirst variable reference → props.limitToFirst - Change signOut from static to instance method (requires Auth instance) - Add firebase/auth to rollup and build.js externals - Update CI workflows to Node.js 20 and actions v4 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent cedbf84 commit 61f2ba3

28 files changed

Lines changed: 5075 additions & 5862 deletions

.github/workflows/production.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v2
14-
- name: Use Node.js 14.18.3
15-
uses: actions/setup-node@v1
13+
- uses: actions/checkout@v4
14+
- name: Use Node.js 20
15+
uses: actions/setup-node@v4
1616
with:
1717
registry-url: https://npm.pkg.github.com/
18-
node-version: 14.18.3
18+
node-version: 20
1919
cache: 'npm'
2020
- name: Installing dependencies
2121
run: npm install

.github/workflows/pull_request.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v2
11-
- name: Use Node.js 14.18.3
12-
uses: actions/setup-node@v2
10+
- uses: actions/checkout@v4
11+
- name: Use Node.js 20
12+
uses: actions/setup-node@v4
1313
with:
1414
registry-url: https://npm.pkg.github.com/
15-
node-version: 14.18.3
15+
node-version: 20
1616
cache: 'npm'
1717
- name: Intstalling dependencies
1818
run: npm install
@@ -23,12 +23,12 @@ jobs:
2323
runs-on: ubuntu-latest
2424

2525
steps:
26-
- uses: actions/checkout@v2
27-
- name: Use Node.js 14.18.3
28-
uses: actions/setup-node@v2
26+
- uses: actions/checkout@v4
27+
- name: Use Node.js 20
28+
uses: actions/setup-node@v4
2929
with:
3030
registry-url: https://npm.pkg.github.com/
31-
node-version: 14.18.3
31+
node-version: 20
3232
cache: 'npm'
3333
- name: Installing dependencies
3434
run: npm install

.github/workflows/version.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
runs-on: ubuntu-latest
1818

1919
steps:
20-
- uses: actions/checkout@v2
21-
- name: Use Node.js 14.18.3
22-
uses: actions/setup-node@v1
20+
- uses: actions/checkout@v4
21+
- name: Use Node.js 20
22+
uses: actions/setup-node@v4
2323
with:
24-
node-version: 14.18.3
24+
node-version: 20
2525
- name: Auth github
2626
run: |
2727
git config user.email "ci@evite.com"

demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"firebase": "^5.3.0",
6+
"firebase": "^12.0.0",
77
"react": "^16.4.1",
88
"react-dom": "^16.4.1",
99
"react-scripts": "1.1.4",

dist/build/types/database.d.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

dist/build/types/firebase-init.d.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

dist/build/types/index.d.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { RTDatabase } from './database';
3-
declare type Args = {
3+
type Args = {
44
database?: RTDatabase;
55
path?: string;
66
orderByKey?: boolean;
@@ -9,7 +9,7 @@ declare type Args = {
99
limitToLast?: number;
1010
limitToFirst?: number;
1111
};
12-
declare type PropTypes = Args;
12+
type PropTypes = Args;
1313
/**
1414
* This function/decorator creates a HOC that wraps the given
1515
* component and listens to collection events.

dist/database.d.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import type { FirebaseOptions } from 'firebase/app';
2+
import { Database } from 'firebase/database';
3+
import { Auth } from 'firebase/auth';
4+
import type { Persistence, UserCredential } from 'firebase/auth';
5+
import { Document } from './document';
6+
type Args = FirebaseOptions & {
7+
persistence?: Persistence;
8+
};
9+
export declare class RTDatabase {
10+
TIMESTAMP: object;
11+
fdb: Database;
12+
auth: Auth;
13+
authPersistence: Persistence;
14+
constructor({ persistence, ...config }: Args);
15+
get: (path: string) => Document;
16+
signInWithCustomToken: (token: string) => Promise<UserCredential>;
17+
goOffline: () => void;
18+
goOnline: () => void;
19+
signOut: () => Promise<void>;
20+
}
21+
export {};

0 commit comments

Comments
 (0)