rn-firebase-onboard 1.0.1

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.
Files changed (78) hide show
  1. package/GoogleService-Info.plist +30 -0
  2. package/LICENSE +21 -0
  3. package/README.md +427 -0
  4. package/build/commands/enable.d.ts +2 -0
  5. package/build/commands/enable.d.ts.map +1 -0
  6. package/build/commands/enable.js +83 -0
  7. package/build/commands/enable.js.map +1 -0
  8. package/build/commands/login.d.ts +2 -0
  9. package/build/commands/login.d.ts.map +1 -0
  10. package/build/commands/login.js +159 -0
  11. package/build/commands/login.js.map +1 -0
  12. package/build/commands/setup.d.ts +2 -0
  13. package/build/commands/setup.d.ts.map +1 -0
  14. package/build/commands/setup.js +347 -0
  15. package/build/commands/setup.js.map +1 -0
  16. package/build/commands/sha.d.ts +7 -0
  17. package/build/commands/sha.d.ts.map +1 -0
  18. package/build/commands/sha.js +227 -0
  19. package/build/commands/sha.js.map +1 -0
  20. package/build/index.d.ts +3 -0
  21. package/build/index.d.ts.map +1 -0
  22. package/build/index.js +59 -0
  23. package/build/index.js.map +1 -0
  24. package/build/utils/checker.d.ts +2 -0
  25. package/build/utils/checker.d.ts.map +1 -0
  26. package/build/utils/checker.js +100 -0
  27. package/build/utils/checker.js.map +1 -0
  28. package/build/utils/logger.d.ts +11 -0
  29. package/build/utils/logger.d.ts.map +1 -0
  30. package/build/utils/logger.js +18 -0
  31. package/build/utils/logger.js.map +1 -0
  32. package/build/utils/runner.d.ts +8 -0
  33. package/build/utils/runner.d.ts.map +1 -0
  34. package/build/utils/runner.js +149 -0
  35. package/build/utils/runner.js.map +1 -0
  36. package/dist/commands/enable.d.ts +2 -0
  37. package/dist/commands/enable.d.ts.map +1 -0
  38. package/dist/commands/enable.js +65 -0
  39. package/dist/commands/enable.js.map +1 -0
  40. package/dist/commands/login.d.ts +2 -0
  41. package/dist/commands/login.d.ts.map +1 -0
  42. package/dist/commands/login.js +86 -0
  43. package/dist/commands/login.js.map +1 -0
  44. package/dist/commands/setup.d.ts +2 -0
  45. package/dist/commands/setup.d.ts.map +1 -0
  46. package/dist/commands/setup.js +133 -0
  47. package/dist/commands/setup.js.map +1 -0
  48. package/dist/commands/sha.d.ts +2 -0
  49. package/dist/commands/sha.d.ts.map +1 -0
  50. package/dist/commands/sha.js +118 -0
  51. package/dist/commands/sha.js.map +1 -0
  52. package/dist/index.d.ts +3 -0
  53. package/dist/index.d.ts.map +1 -0
  54. package/dist/index.js +59 -0
  55. package/dist/index.js.map +1 -0
  56. package/dist/utils/checker.d.ts +2 -0
  57. package/dist/utils/checker.d.ts.map +1 -0
  58. package/dist/utils/checker.js +100 -0
  59. package/dist/utils/checker.js.map +1 -0
  60. package/dist/utils/logger.d.ts +11 -0
  61. package/dist/utils/logger.d.ts.map +1 -0
  62. package/dist/utils/logger.js +18 -0
  63. package/dist/utils/logger.js.map +1 -0
  64. package/dist/utils/runner.d.ts +4 -0
  65. package/dist/utils/runner.d.ts.map +1 -0
  66. package/dist/utils/runner.js +36 -0
  67. package/dist/utils/runner.js.map +1 -0
  68. package/google-services.json +29 -0
  69. package/package.json +56 -0
  70. package/src/commands/enable.ts +89 -0
  71. package/src/commands/login.ts +162 -0
  72. package/src/commands/setup.ts +354 -0
  73. package/src/commands/sha.ts +240 -0
  74. package/src/index.ts +65 -0
  75. package/src/utils/checker.ts +70 -0
  76. package/src/utils/logger.ts +13 -0
  77. package/src/utils/runner.ts +123 -0
  78. package/tsconfig.json +20 -0
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>API_KEY</key>
6
+ <string>AIzaSyCqnWBkKkiYnGVWYK9cmNlL-LV8LW9Tgws</string>
7
+ <key>GCM_SENDER_ID</key>
8
+ <string>327777058655</string>
9
+ <key>PLIST_VERSION</key>
10
+ <string>1</string>
11
+ <key>BUNDLE_ID</key>
12
+ <string>com.fireshort</string>
13
+ <key>PROJECT_ID</key>
14
+ <string>abc963</string>
15
+ <key>STORAGE_BUCKET</key>
16
+ <string>abc963.firebasestorage.app</string>
17
+ <key>IS_ADS_ENABLED</key>
18
+ <false></false>
19
+ <key>IS_ANALYTICS_ENABLED</key>
20
+ <false></false>
21
+ <key>IS_APPINVITE_ENABLED</key>
22
+ <true></true>
23
+ <key>IS_GCM_ENABLED</key>
24
+ <true></true>
25
+ <key>IS_SIGNIN_ENABLED</key>
26
+ <true></true>
27
+ <key>GOOGLE_APP_ID</key>
28
+ <string>1:327777058655:ios:078cdf39ac42913d5140ea</string>
29
+ </dict>
30
+ </plist>
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Your Name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,427 @@
1
+ # 🔥 rn-firebase-onboard
2
+
3
+ > Elite Firebase setup orchestrator for React Native & Expo — automates account login, project selection, app creation, config file download, SHA key registration (debug + release), and feature installation in one guided wizard.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/rn-firebase-onboard.svg)](https://www.npmjs.com/package/rn-firebase-onboard)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ---
9
+
10
+ ## Table of Contents
11
+
12
+ - [Overview](#overview)
13
+ - [Features](#features)
14
+ - [Prerequisites](#prerequisites)
15
+ - [Installation](#installation)
16
+ - [Quick Start](#quick-start)
17
+ - [Commands](#commands)
18
+ - [firebase setup](#firebase-setup)
19
+ - [firebase login](#firebase-login)
20
+ - [firebase sha add](#firebase-sha-add)
21
+ - [firebase enable](#firebase-enable)
22
+ - [Expo Support](#expo-support)
23
+ - [Step-by-Step Walkthrough](#step-by-step-walkthrough)
24
+ - [Troubleshooting](#troubleshooting)
25
+ - [Development](#development)
26
+ - [License](#license)
27
+
28
+ ---
29
+
30
+ ## Overview
31
+
32
+ `rn-firebase-onboard` is a CLI tool that eliminates the repetitive manual work of wiring Firebase into a React Native or Expo project. Instead of switching between the Firebase Console, terminal, and documentation, you run a single command and follow the prompts.
33
+
34
+ ---
35
+
36
+ ## Features
37
+
38
+ - **Works with both React Native CLI and Expo** — auto-detects your project type
39
+ - Checks and installs required tools (Node.js, Firebase CLI, Java)
40
+ - Manages multiple Firebase / Google accounts (login, switch, list, logout)
41
+ - Smart login — uses `firebase login` for first account, `firebase login:add` for additional accounts
42
+ - Copy-paste URL fallback for systems where the browser can't auto-open (SSH, WSL, VMs)
43
+ - Lists your real Firebase projects — no typing project IDs by hand
44
+ - **Validates project IDs** with clear format rules before hitting Firebase
45
+ - Creates Android and iOS Firebase apps if they don't exist yet
46
+ - Downloads `google-services.json` and `GoogleService-Info.plist` to the **correct paths**
47
+ - Extracts SHA-1 and SHA-256 from **debug or release** keystores
48
+ - Registers those SHA keys with Firebase
49
+ - Installs `@react-native-firebase` feature packages (uses `npx expo install` for Expo projects)
50
+
51
+ ---
52
+
53
+ ## Prerequisites
54
+
55
+ | Tool | Required For | Install |
56
+ |---|---|---|
57
+ | **Node.js** v16+ | Running the CLI | https://nodejs.org |
58
+ | **npm** | Installing packages | Comes with Node.js |
59
+ | **Firebase CLI** | All Firebase operations | `npm install -g firebase-tools` |
60
+ | **Java JDK** (keytool) | SHA key extraction | https://adoptium.net |
61
+ | **React Native or Expo project** | Running setup inside a project | https://reactnative.dev / https://expo.dev |
62
+
63
+ > The CLI will attempt to auto-install Node.js (via `brew` on macOS, `winget` on Windows) and the Firebase CLI if they are missing. Java must be installed manually.
64
+
65
+ ---
66
+
67
+ ## Installation
68
+
69
+ ### Global install from npm
70
+
71
+ ```bash
72
+ npm install -g rn-firebase-onboard
73
+ ```
74
+
75
+ ### Or run directly with npx
76
+
77
+ ```bash
78
+ npx rn-firebase-onboard firebase setup --full
79
+ ```
80
+
81
+ ### Install from source (development)
82
+
83
+ ```bash
84
+ git clone https://github.com/Sonam401/rn-firebase-onboard.git
85
+ cd rn-firebase-onboard
86
+ npm install
87
+ npm run build
88
+ npm link
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Quick Start
94
+
95
+ Navigate into your React Native or Expo project folder, then run:
96
+
97
+ ```bash
98
+ cd /path/to/your/project
99
+ rn-firebase-onboard firebase setup --full
100
+ ```
101
+
102
+ This single command runs the complete wizard — tools check, login, project selection, app creation, config download, SHA registration, and feature installation.
103
+
104
+ ---
105
+
106
+ ## Commands
107
+
108
+ ### `firebase setup`
109
+
110
+ The main wizard. Walks you through all steps in the correct order.
111
+
112
+ ```bash
113
+ rn-firebase-onboard firebase setup # steps 1–5 only
114
+ rn-firebase-onboard firebase setup --full # all steps including SHA key registration
115
+ ```
116
+
117
+ **Steps performed:**
118
+
119
+ | Step | What Happens |
120
+ |---|---|
121
+ | **1 — Tools Check** | Verifies Node.js, npm, Firebase CLI, and Java are installed. Installs missing tools automatically where possible. |
122
+ | **2 — Firebase Login** | Opens the account manager. Login, switch accounts, list accounts, or skip. |
123
+ | **3 — Firebase Project** | Lists all your existing Firebase projects. Choose one or create a new project (with format validation). |
124
+ | **4 — Install Core Package** | Runs `npm install @react-native-firebase/app` (or `npx expo install` for Expo projects). |
125
+ | **5 — App Setup** | Asks which platforms (Android / iOS), your package name / bundle ID, then creates the Firebase app if needed and downloads config files. |
126
+ | **6 — SHA Keys** *(--full only)* | Choose debug or release keystore → extracts SHA-1 and SHA-256 → registers them with Firebase. |
127
+ | **7 — Enable Features** | Interactive checkbox to install additional Firebase packages (Auth, Firestore, etc). |
128
+
129
+ ---
130
+
131
+ ### `firebase login`
132
+
133
+ Opens the account manager as a standalone command.
134
+
135
+ ```bash
136
+ rn-firebase-onboard firebase login
137
+ ```
138
+
139
+ **Menu options:**
140
+
141
+ | Option | What It Does |
142
+ |---|---|
143
+ | 🔑 Login with a new Google account | First account → `firebase login`. Additional accounts → `firebase login:add`. Offers browser or copy-paste URL mode. |
144
+ | 🔄 Switch to a different account | Shows all registered accounts to switch between |
145
+ | 📋 List all logged-in accounts | Displays all currently registered accounts, refreshed live |
146
+ | 🚪 Logout from current account | Logs out with a confirmation prompt |
147
+ | ⬅️ Continue to next step | Exits the menu |
148
+
149
+ **Authentication modes:**
150
+
151
+ | Mode | When to use |
152
+ |---|---|
153
+ | 🌐 Auto-open browser | Default — works on most systems |
154
+ | 🔗 Copy-paste URL | For SSH sessions, WSL, VMs, or systems where the browser doesn't auto-open |
155
+
156
+ > **Note:** The Firebase CLI and your browser use separate account stores. Accounts logged in via Chrome are not automatically available in the CLI. Use **"Login with a new Google account"** to register each account.
157
+
158
+ After adding an account, all logged-in accounts are listed with the new one marked:
159
+
160
+ ```
161
+ ✅ Account added: newperson@gmail.com
162
+
163
+ ℹ️ All logged-in accounts:
164
+ • sonam401gupta@gmail.com
165
+ • reacttest9@gmail.com
166
+ 🆕 newperson@gmail.com ← just added
167
+ ```
168
+
169
+ ---
170
+
171
+ ### `firebase sha add`
172
+
173
+ Standalone SHA key registration — supports both **debug** and **release** keystores.
174
+
175
+ ```bash
176
+ rn-firebase-onboard firebase sha add
177
+ ```
178
+
179
+ **What it does:**
180
+
181
+ 1. Asks which keystore to use: **debug** (default) or **release** (for production)
182
+ 2. For debug: auto-reads `~/.android/debug.keystore`
183
+ 3. For release: prompts for keystore path, alias, and passwords
184
+ 4. Extracts SHA-1 and SHA-256 fingerprints
185
+ 5. Shows your Firebase projects and Android apps to select from
186
+ 6. Registers both SHA keys with Firebase
187
+
188
+ > Run `npx react-native run-android` (or `npx expo run:android`) at least once to generate the debug keystore.
189
+
190
+ ---
191
+
192
+ ### `firebase enable`
193
+
194
+ Installs additional `@react-native-firebase` feature packages.
195
+
196
+ ```bash
197
+ rn-firebase-onboard firebase enable # interactive checkbox menu
198
+ rn-firebase-onboard firebase enable auth # install a specific feature directly
199
+ ```
200
+
201
+ **Available features:**
202
+
203
+ | Key | Feature | Package |
204
+ |---|---|---|
205
+ | `auth` | 🔐 Authentication | `@react-native-firebase/auth` |
206
+ | `firestore` | 🗄️ Firestore Database | `@react-native-firebase/firestore` |
207
+ | `storage` | 📦 Cloud Storage | `@react-native-firebase/storage` |
208
+ | `messaging` | 📲 Cloud Messaging (FCM) | `@react-native-firebase/messaging` |
209
+ | `analytics` | 📈 Analytics | `@react-native-firebase/analytics` |
210
+ | `crashlytics` | 💥 Crashlytics | `@react-native-firebase/crashlytics` |
211
+ | `database` | ⚡ Realtime Database | `@react-native-firebase/database` |
212
+ | `functions` | ☁️ Cloud Functions | `@react-native-firebase/functions` |
213
+ | `remote` | 🎛️ Remote Config | `@react-native-firebase/remote-config` |
214
+ | `perf` | ⏱️ Performance Monitoring | `@react-native-firebase/perf` |
215
+
216
+ For Expo projects, `npx expo install` is used automatically to ensure compatible versions.
217
+
218
+ ---
219
+
220
+ ## Expo Support
221
+
222
+ `rn-firebase-onboard` auto-detects Expo projects by checking for:
223
+ - An `"expo"` key in `app.json`
224
+ - `expo` in your `package.json` dependencies
225
+
226
+ **When an Expo project is detected:**
227
+
228
+ | What changes | Expo behavior |
229
+ |---|---|
230
+ | Package installation | Uses `npx expo install` instead of `npm install` |
231
+ | Config file placement | Places `google-services.json` and `GoogleService-Info.plist` at project root (for Expo config plugins) |
232
+ | Post-setup instructions | Shows Expo-specific next steps |
233
+
234
+ **After setup in an Expo project:**
235
+
236
+ 1. Add the Firebase config plugin to your `app.json`:
237
+ ```json
238
+ {
239
+ "expo": {
240
+ "plugins": ["@react-native-firebase/app"],
241
+ "android": {
242
+ "googleServicesFile": "./google-services.json"
243
+ },
244
+ "ios": {
245
+ "googleServicesFile": "./GoogleService-Info.plist"
246
+ }
247
+ }
248
+ }
249
+ ```
250
+ 2. Run `npx expo prebuild` to generate native folders
251
+ 3. Run `npx expo run:android` or `npx expo run:ios`
252
+
253
+ ---
254
+
255
+ ## Step-by-Step Walkthrough
256
+
257
+ ### 1. Run the wizard
258
+
259
+ ```bash
260
+ cd /path/to/MyApp
261
+ rn-firebase-onboard firebase setup --full
262
+ ```
263
+
264
+ ### 2. Tools are checked automatically
265
+
266
+ ```
267
+ ✅ Node.js found: v23.11.0
268
+ ✅ NPM found: v10.9.2
269
+ ✅ Firebase CLI found: v15.12.0
270
+ ✅ Java keytool found ✓
271
+ ```
272
+
273
+ ### 3. Manage your Firebase login
274
+
275
+ ```
276
+ ? Do you want to manage your Firebase login now? Yes
277
+
278
+ ? What do you want to do?
279
+ ❯ 🔑 Login with a new Google account
280
+ 🔄 Switch to a different account
281
+ 📋 List all logged-in accounts
282
+ 🚪 Logout from current account
283
+ ⬅️ Continue to next step
284
+ ```
285
+
286
+ ### 4. Select or create a Firebase project
287
+
288
+ ```
289
+ ? What do you want to do?
290
+ ❯ ➕ Create a new Firebase project
291
+ ✅ Use an existing project
292
+ ```
293
+
294
+ Project ID is validated before creation:
295
+ - 6–30 characters, starts with lowercase letter
296
+ - Only lowercase letters, numbers, and hyphens
297
+ - No trailing hyphens or consecutive hyphens
298
+
299
+ ### 5. Firebase app setup
300
+
301
+ ```
302
+ ? Create or configure Firebase apps for:
303
+ ❯ ◉ Android
304
+ ◉ iOS
305
+
306
+ ? Enter the Android package name: com.company.myapp
307
+ ? Enter the iOS bundle identifier: com.company.myapp
308
+ ```
309
+
310
+ Config files are written to the correct paths:
311
+ - **React Native CLI:** `android/app/google-services.json` and `ios/MyApp/GoogleService-Info.plist`
312
+ - **Expo:** Project root (picked up by config plugins)
313
+
314
+ ### 6. SHA key registration (--full)
315
+
316
+ ```
317
+ ? Which keystore do you want to extract SHA keys from?
318
+ ❯ 🐛 Debug keystore (default, for development)
319
+ 🚀 Release keystore (for production / Play Store)
320
+
321
+ ✅ SHA-1: AA:BB:CC:...
322
+ ✅ SHA-256: 11:22:33:...
323
+ ✅ Both SHA keys registered successfully!
324
+ ```
325
+
326
+ ### 7. Enable Firebase features
327
+
328
+ ```
329
+ ? Select Firebase features to enable:
330
+ ❯ ◉ 🔐 Authentication
331
+ ◉ 🗄️ Firestore Database
332
+ ◯ 📦 Cloud Storage
333
+ ...
334
+ ```
335
+
336
+ ---
337
+
338
+ ## Troubleshooting
339
+
340
+ ### "Java keytool not found"
341
+
342
+ 1. Install Java from https://adoptium.net
343
+ 2. Make sure `JAVA_HOME` is set, or that `keytool` is on your `PATH`
344
+ 3. Verify with: `which keytool`
345
+
346
+ ### "Could not read debug keystore"
347
+
348
+ The debug keystore is created the first time you build the Android app:
349
+
350
+ ```bash
351
+ npx react-native run-android # React Native CLI
352
+ npx expo run:android # Expo
353
+ ```
354
+
355
+ ### "No existing accounts found" when logging in
356
+
357
+ This means no Firebase account is registered yet. The CLI handles this automatically — it uses `firebase login` for the first account and `firebase login:add` for subsequent ones.
358
+
359
+ ### Browser doesn't open during login
360
+
361
+ Select **🔗 Copy-paste URL** mode — a URL will be printed that you can open in any browser manually.
362
+
363
+ ### Project ID validation errors
364
+
365
+ Firebase project IDs must be:
366
+ - 6–30 characters long
367
+ - Start with a lowercase letter (a–z)
368
+ - Only lowercase letters, numbers, and hyphens
369
+ - Example: `my-app-12345`
370
+
371
+ ### npm peer dependency errors
372
+
373
+ The `enable` command handles this by upgrading `@react-native-firebase/app` first. If issues persist:
374
+
375
+ ```bash
376
+ npm install @react-native-firebase/app@latest
377
+ npm install @react-native-firebase/auth
378
+ ```
379
+
380
+ ### Firebase project quota exceeded
381
+
382
+ Free accounts have a project limit. Delete unused projects at https://console.firebase.google.com.
383
+
384
+ ---
385
+
386
+ ## Development
387
+
388
+ ```bash
389
+ # Clone and install
390
+ git clone https://github.com/Sonam401/rn-firebase-onboard.git
391
+ cd rn-firebase-onboard
392
+ npm install
393
+
394
+ # Build TypeScript → build/
395
+ npm run build
396
+
397
+ # Link globally for local testing
398
+ npm link
399
+
400
+ # Run directly with ts-node (no build needed)
401
+ npm run dev -- firebase setup --full
402
+
403
+ # Rebuild and relink after changes
404
+ npm run build && npm link
405
+ ```
406
+
407
+ ### Project Structure
408
+
409
+ ```
410
+ src/
411
+ ├── index.ts # CLI entry point (commander setup)
412
+ ├── commands/
413
+ │ ├── setup.ts # Main setup wizard
414
+ │ ├── login.ts # Firebase account manager
415
+ │ ├── sha.ts # SHA key extraction & registration
416
+ │ └── enable.ts # Feature package installer
417
+ └── utils/
418
+ ├── checker.ts # Tool detection & auto-install
419
+ ├── runner.ts # Command execution helpers + Expo detection
420
+ └── logger.ts # Colored console output
421
+ ```
422
+
423
+ ---
424
+
425
+ ## License
426
+
427
+ MIT — see [LICENSE](LICENSE) for details.
@@ -0,0 +1,2 @@
1
+ export declare function enableCommand(feature?: string): Promise<void>;
2
+ //# sourceMappingURL=enable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enable.d.ts","sourceRoot":"","sources":["../../src/commands/enable.ts"],"names":[],"mappings":"AAqBA,wBAAsB,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuCnE"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.enableCommand = enableCommand;
7
+ const inquirer_1 = __importDefault(require("inquirer"));
8
+ const runner_1 = require("../utils/runner");
9
+ const logger_1 = require("../utils/logger");
10
+ // Always keep the core package in sync with installed feature packages.
11
+ const CORE_PACKAGE = '@react-native-firebase/app';
12
+ // All supported RN Firebase packages
13
+ const FEATURES = {
14
+ auth: { label: '🔐 Authentication', pkg: '@react-native-firebase/auth' },
15
+ firestore: { label: '🗄️ Firestore Database', pkg: '@react-native-firebase/firestore' },
16
+ storage: { label: '📦 Cloud Storage', pkg: '@react-native-firebase/storage' },
17
+ messaging: { label: '📲 Cloud Messaging (FCM)', pkg: '@react-native-firebase/messaging' },
18
+ analytics: { label: '📈 Analytics', pkg: '@react-native-firebase/analytics' },
19
+ crashlytics: { label: '💥 Crashlytics', pkg: '@react-native-firebase/crashlytics' },
20
+ database: { label: '⚡ Realtime Database', pkg: '@react-native-firebase/database' },
21
+ functions: { label: '☁️ Cloud Functions', pkg: '@react-native-firebase/functions' },
22
+ remote: { label: '🎛️ Remote Config', pkg: '@react-native-firebase/remote-config' },
23
+ perf: { label: '⏱️ Performance Monitoring', pkg: '@react-native-firebase/perf' },
24
+ };
25
+ async function enableCommand(feature) {
26
+ logger_1.logger.title('Enable Firebase Feature');
27
+ let selectedKey = feature;
28
+ // ── If no feature passed, show interactive menu ──────────────
29
+ if (!selectedKey) {
30
+ const choices = Object.entries(FEATURES).map(([key, val]) => ({
31
+ name: val.label,
32
+ value: key,
33
+ }));
34
+ // Allow selecting multiple features at once
35
+ const { selected } = await inquirer_1.default.prompt([
36
+ {
37
+ type: 'checkbox',
38
+ name: 'selected',
39
+ message: 'Select Firebase features to enable (Space to select, Enter to confirm):',
40
+ choices,
41
+ validate: (val) => val.length > 0 ? true : 'Please select at least one feature',
42
+ },
43
+ ]);
44
+ // Install all selected features
45
+ for (const key of selected) {
46
+ await installFeature(key);
47
+ }
48
+ return;
49
+ }
50
+ // ── If feature passed directly (e.g. firebase enable auth) ───
51
+ if (!FEATURES[selectedKey]) {
52
+ logger_1.logger.error(`Unknown feature: "${selectedKey}"`);
53
+ logger_1.logger.info(`Available features: ${Object.keys(FEATURES).join(', ')}`);
54
+ process.exit(1);
55
+ }
56
+ await installFeature(selectedKey);
57
+ }
58
+ async function installFeature(key) {
59
+ const feature = FEATURES[key];
60
+ const expo = (0, runner_1.isExpoProject)();
61
+ logger_1.logger.step(`Installing ${feature.label}...`);
62
+ logger_1.logger.info(`Package: ${feature.pkg}`);
63
+ if (expo) {
64
+ // For Expo, use `npx expo install` which resolves compatible versions automatically.
65
+ logger_1.logger.info(`Upgrading ${CORE_PACKAGE} to latest (Expo)...`);
66
+ (0, runner_1.runLive)('npx', ['expo', 'install', `${CORE_PACKAGE}@latest`]);
67
+ logger_1.logger.info(`Installing ${feature.pkg} (Expo)...`);
68
+ (0, runner_1.runLive)('npx', ['expo', 'install', feature.pkg]);
69
+ }
70
+ else {
71
+ // Step 1: upgrade the core package to the latest version first so it
72
+ // satisfies any peer dep the feature package requires.
73
+ logger_1.logger.info(`Upgrading ${CORE_PACKAGE} to latest...`);
74
+ (0, runner_1.runLive)('npm', ['install', `${CORE_PACKAGE}@latest`]);
75
+ // Step 2: now install the feature package against the upgraded core.
76
+ logger_1.logger.info(`Installing ${feature.pkg}...`);
77
+ (0, runner_1.runLive)('npm', ['install', feature.pkg]);
78
+ }
79
+ logger_1.logger.success(`${feature.label} installed!`);
80
+ logger_1.logger.info(`Docs: https://rnfirebase.io/${key === 'auth' ? 'auth' : key}`);
81
+ console.log('');
82
+ }
83
+ //# sourceMappingURL=enable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enable.js","sourceRoot":"","sources":["../../src/commands/enable.ts"],"names":[],"mappings":";;;;;AAqBA,sCAuCC;AA5DD,wDAAgC;AAChC,4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AAE,CAAC;QACT,qFAAqF;QACrF,eAAM,CAAC,IAAI,CAAC,aAAa,YAAY,sBAAsB,CAAC,CAAC;QAC7D,IAAA,gBAAO,EAAC,KAAK,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,YAAY,SAAS,CAAC,CAAC,CAAC;QAC9D,eAAM,CAAC,IAAI,CAAC,cAAc,OAAO,CAAC,GAAG,YAAY,CAAC,CAAC;QACnD,IAAA,gBAAO,EAAC,KAAK,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IACnD,CAAC;SAAM,CAAC;QACN,qEAAqE;QACrE,uDAAuD;QACvD,eAAM,CAAC,IAAI,CAAC,aAAa,YAAY,eAAe,CAAC,CAAC;QACtD,IAAA,gBAAO,EAAC,KAAK,EAAE,CAAC,SAAS,EAAE,GAAG,YAAY,SAAS,CAAC,CAAC,CAAC;QAEtD,qEAAqE;QACrE,eAAM,CAAC,IAAI,CAAC,cAAc,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;QAC5C,IAAA,gBAAO,EAAC,KAAK,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,eAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,KAAK,aAAa,CAAC,CAAC;IAC9C,eAAM,CAAC,IAAI,CAAC,+BAA+B,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5E,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function loginCommand(): Promise<void>;
2
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAIA,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CA6JlD"}