Skip to content

Commit dc8ee41

Browse files
Juan Pablo Díaz S.claude
andcommitted
feat: add named Firestore database support and migrate CI to pnpm
- Add optional Database ID field in the Service Account connection dialog, enabling connections to named Firestore databases instead of only (default) - Propagate databaseId through the full chain: UI → Redux → preload → backend - Persist databaseId in localStorage for automatic reconnection - Expose FieldValue, Filter, Timestamp, and GeoPoint in JS Query sandbox - Migrate GitHub Actions workflows (CI + Build & Release) from npm to pnpm - Update README, SECURITY.md, husky hooks, and error messages for pnpm - Add unit tests for controllers and Redux slices with vitest - Add test step to CI workflow Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 65df4aa commit dc8ee41

31 files changed

Lines changed: 9699 additions & 12214 deletions

.github/workflows/build.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@ jobs:
1313
- name: Checkout
1414
uses: actions/checkout@v4
1515

16+
- name: Setup pnpm
17+
uses: pnpm/action-setup@v4
18+
1619
- name: Setup Node.js
1720
uses: actions/setup-node@v4
1821
with:
1922
node-version: '22'
20-
cache: 'npm'
23+
cache: 'pnpm'
2124

2225
- name: Install dependencies
23-
run: npm ci
26+
run: pnpm install --frozen-lockfile
2427

2528
- name: Create .env file
2629
run: |
@@ -29,11 +32,11 @@ jobs:
2932
3033
- name: Build Windows (unsigned)
3134
if: vars.ENABLE_CODE_SIGNING != 'true'
32-
run: npm run build:win
35+
run: pnpm run build:win
3336

3437
- name: Build Windows (signed)
3538
if: vars.ENABLE_CODE_SIGNING == 'true'
36-
run: npm run build:win
39+
run: pnpm run build:win
3740
env:
3841
CSC_LINK: ${{ secrets.WINDOWS_CERTIFICATE }}
3942
CSC_KEY_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
@@ -53,14 +56,17 @@ jobs:
5356
- name: Checkout
5457
uses: actions/checkout@v4
5558

59+
- name: Setup pnpm
60+
uses: pnpm/action-setup@v4
61+
5662
- name: Setup Node.js
5763
uses: actions/setup-node@v4
5864
with:
5965
node-version: '22'
60-
cache: 'npm'
66+
cache: 'pnpm'
6167

6268
- name: Install dependencies
63-
run: npm ci
69+
run: pnpm install --frozen-lockfile
6470

6571
- name: Create .env file
6672
run: |
@@ -69,11 +75,11 @@ jobs:
6975
7076
- name: Build macOS (unsigned)
7177
if: vars.ENABLE_CODE_SIGNING != 'true'
72-
run: npm run build:mac
78+
run: pnpm run build:mac
7379

7480
- name: Build macOS (signed)
7581
if: vars.ENABLE_CODE_SIGNING == 'true'
76-
run: npm run build:mac
82+
run: pnpm run build:mac
7783
env:
7884
CSC_LINK: ${{ secrets.APPLE_CERTIFICATE }}
7985
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
@@ -96,22 +102,25 @@ jobs:
96102
- name: Checkout
97103
uses: actions/checkout@v4
98104

105+
- name: Setup pnpm
106+
uses: pnpm/action-setup@v4
107+
99108
- name: Setup Node.js
100109
uses: actions/setup-node@v4
101110
with:
102111
node-version: '22'
103-
cache: 'npm'
112+
cache: 'pnpm'
104113

105114
- name: Install dependencies
106-
run: npm ci
115+
run: pnpm install --frozen-lockfile
107116

108117
- name: Create .env file
109118
run: |
110119
echo "GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}" > .env
111120
echo "GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }}" >> .env
112121
113122
- name: Build Linux
114-
run: npm run build:linux
123+
run: pnpm run build:linux
115124

116125
- name: Upload Linux artifacts
117126
uses: actions/upload-artifact@v4

.github/workflows/ci.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,26 @@ jobs:
1212
- name: Checkout
1313
uses: actions/checkout@v4
1414

15+
- name: Setup pnpm
16+
uses: pnpm/action-setup@v4
17+
1518
- name: Setup Node.js
1619
uses: actions/setup-node@v4
1720
with:
1821
node-version: '22'
19-
cache: 'npm'
22+
cache: 'pnpm'
2023

2124
- name: Install dependencies
22-
run: npm ci
25+
run: pnpm install --frozen-lockfile
2326

2427
- name: Lint
25-
run: npm run lint
28+
run: pnpm run lint
2629

2730
- name: Format check
28-
run: npm run format:check
31+
run: pnpm run format:check
2932

3033
- name: Typecheck
31-
run: npm run typecheck
34+
run: pnpm run typecheck
35+
36+
- name: Tests
37+
run: pnpm run test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Dependencies
22
node_modules/
3+
package-lock.json
34

45
# Build outputs
56
dist/

.husky/pre-commit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
npx lint-staged
2-
npm run typecheck
1+
pnpm exec lint-staged
2+
pnpm run typecheck

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node-linker=hoisted

README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ async function run() {
117117
### Prerequisites
118118

119119
- **Node.js** 18 or higher
120-
- **npm** or **yarn**
120+
- **pnpm** (`npm install -g pnpm`)
121121
- A **Firebase project**
122122

123123
### Installation
@@ -157,10 +157,10 @@ git clone https://github.com/Flowdesktech/firestudio.git
157157
cd firestudio
158158

159159
# Install dependencies
160-
npm install
160+
pnpm install
161161

162162
# Start the application
163-
npm run dev
163+
pnpm run dev
164164
```
165165

166166
### Connecting to Your Firebase Project
@@ -196,26 +196,26 @@ See detailed OAuth setup guide in the [Google Sign-In Setup](#google-sign-in-set
196196

197197
### Development
198198

199-
| Command | Description |
200-
| ------------------ | ------------------------------------------- |
201-
| `npm run dev` | Start the full Electron app with hot reload |
202-
| `npm run dev:vite` | Start browser-only mode (limited features) |
203-
| `npm run build` | Build the React app for production |
199+
| Command | Description |
200+
| ------------------- | ------------------------------------------- |
201+
| `pnpm run dev` | Start the full Electron app with hot reload |
202+
| `pnpm run dev:vite` | Start browser-only mode (limited features) |
203+
| `pnpm run build` | Build the React app for production |
204204

205205
### Building Releases
206206

207-
| Command | Description |
208-
| --------------------- | -------------------------------------------------- |
209-
| `npm run build:win` | Build for Windows (`.exe` installer + portable) |
210-
| `npm run build:mac` | Build for macOS (`.dmg` + `.zip`) |
211-
| `npm run build:linux` | Build for Linux (`.AppImage` + `.deb` + `.tar.gz`) |
212-
| `npm run build:all` | Build for all platforms |
207+
| Command | Description |
208+
| ---------------------- | -------------------------------------------------- |
209+
| `pnpm run build:win` | Build for Windows (`.exe` installer + portable) |
210+
| `pnpm run build:mac` | Build for macOS (`.dmg` + `.zip`) |
211+
| `pnpm run build:linux` | Build for Linux (`.AppImage` + `.deb` + `.tar.gz`) |
212+
| `pnpm run build:all` | Build for all platforms |
213213

214214
### Utilities
215215

216-
| Command | Description |
217-
| ----------------------- | ----------------------------- |
218-
| `npm run generate-icon` | Regenerate app icons from SVG |
216+
| Command | Description |
217+
| ------------------------ | ----------------------------- |
218+
| `pnpm run generate-icon` | Regenerate app icons from SVG |
219219

220220
---
221221

@@ -225,16 +225,16 @@ See detailed OAuth setup guide in the [Google Sign-In Setup](#google-sign-in-set
225225

226226
```bash
227227
# Windows
228-
npm run build:win
228+
pnpm run build:win
229229

230230
# macOS
231-
npm run build:mac
231+
pnpm run build:mac
232232

233233
# Linux
234-
npm run build:linux
234+
pnpm run build:linux
235235

236236
# All platforms (requires cross-compilation setup)
237-
npm run build:all
237+
pnpm run build:all
238238
```
239239

240240
**Output files are saved to the `release/` directory:**
@@ -269,7 +269,7 @@ npm run build:all
269269

270270
4. **Build and publish:**
271271
```bash
272-
npm run release
272+
pnpm run release
273273
```
274274

275275
### Cross-Platform Building Notes

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ Security patches will be released as soon as possible after a vulnerability is c
117117

118118
## Third-Party Dependencies
119119

120-
This project depends on several npm packages. We recommend:
120+
This project depends on several packages. We recommend:
121121

122-
- Running `npm audit` regularly to check for vulnerabilities
122+
- Running `pnpm audit` regularly to check for vulnerabilities
123123
- Keeping dependencies updated
124124
- Reviewing dependency changes before updating
125125

electron/controllers/firebaseController.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ function setConnectionChangeCallback(callback) {
2929
*/
3030
function registerHandlers() {
3131
// Connect to Firebase with service account
32-
ipcMain.handle('firebase:connect', async (event, serviceAccountPath) => {
32+
ipcMain.handle('firebase:connect', async (event, params) => {
3333
try {
34+
// Support both object params and legacy string path
35+
const serviceAccountPath = typeof params === 'string' ? params : params.serviceAccountPath;
36+
const databaseId = typeof params === 'string' ? undefined : params.databaseId;
37+
3438
if (admin) {
3539
await admin.app().delete();
3640
}
@@ -44,12 +48,16 @@ function registerHandlers() {
4448

4549
db = admin.firestore();
4650

51+
if (databaseId) {
52+
db.settings({ databaseId });
53+
}
54+
4755
// Notify other controllers about the connection change
4856
if (onConnectionChange) {
4957
onConnectionChange(admin, db);
5058
}
5159

52-
return { success: true, projectId: serviceAccount.project_id };
60+
return { success: true, projectId: serviceAccount.project_id, databaseId };
5361
} catch (error) {
5462
return { success: false, error: error.message };
5563
}

0 commit comments

Comments
 (0)