rn-firebase-onboard 1.0.3 → 1.0.4
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.
- package/README.md +37 -18
- package/build/commands/sha.d.ts.map +1 -1
- package/build/commands/sha.js +11 -6
- package/build/commands/sha.js.map +1 -1
- package/build/index.js +35 -29
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/sha.ts +12 -6
- package/src/index.ts +47 -37
package/README.md
CHANGED
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
- [Installation](#installation)
|
|
16
16
|
- [Quick Start](#quick-start)
|
|
17
17
|
- [Commands](#commands)
|
|
18
|
-
- [
|
|
19
|
-
- [
|
|
20
|
-
- [
|
|
21
|
-
- [
|
|
18
|
+
- [setup](#setup)
|
|
19
|
+
- [login](#login)
|
|
20
|
+
- [sha add](#sha-add)
|
|
21
|
+
- [enable](#enable)
|
|
22
22
|
- [Expo Support](#expo-support)
|
|
23
23
|
- [Step-by-Step Walkthrough](#step-by-step-walkthrough)
|
|
24
24
|
- [Troubleshooting](#troubleshooting)
|
|
@@ -75,7 +75,7 @@ npm install -g rn-firebase-onboard
|
|
|
75
75
|
### Or run directly with npx
|
|
76
76
|
|
|
77
77
|
```bash
|
|
78
|
-
npx rn-firebase-onboard
|
|
78
|
+
npx rn-firebase-onboard setup --full
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
### Install from source (development)
|
|
@@ -96,22 +96,33 @@ Navigate into your React Native or Expo project folder, then run:
|
|
|
96
96
|
|
|
97
97
|
```bash
|
|
98
98
|
cd /path/to/your/project
|
|
99
|
-
rn-firebase-onboard
|
|
99
|
+
rn-firebase-onboard setup --full
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
This single command runs the complete wizard — tools check, login, project selection, app creation, config download, SHA registration, and feature installation.
|
|
103
103
|
|
|
104
|
+
> **Note:** The `firebase` prefix is optional. Both `rn-firebase-onboard setup` and `rn-firebase-onboard firebase setup` work identically.
|
|
105
|
+
|
|
104
106
|
---
|
|
105
107
|
|
|
106
108
|
## Commands
|
|
107
109
|
|
|
108
|
-
|
|
110
|
+
All commands work with or without the `firebase` prefix:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
rn-firebase-onboard setup # top-level (recommended)
|
|
114
|
+
rn-firebase-onboard firebase setup # also works (backward compatible)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### `setup`
|
|
109
120
|
|
|
110
121
|
The main wizard. Walks you through all steps in the correct order.
|
|
111
122
|
|
|
112
123
|
```bash
|
|
113
|
-
rn-firebase-onboard
|
|
114
|
-
rn-firebase-onboard
|
|
124
|
+
rn-firebase-onboard setup # steps 1–5 only
|
|
125
|
+
rn-firebase-onboard setup --full # all steps including SHA key registration
|
|
115
126
|
```
|
|
116
127
|
|
|
117
128
|
**Steps performed:**
|
|
@@ -128,12 +139,12 @@ rn-firebase-onboard firebase setup --full # all steps including SHA key regis
|
|
|
128
139
|
|
|
129
140
|
---
|
|
130
141
|
|
|
131
|
-
### `
|
|
142
|
+
### `login`
|
|
132
143
|
|
|
133
144
|
Opens the account manager as a standalone command.
|
|
134
145
|
|
|
135
146
|
```bash
|
|
136
|
-
rn-firebase-onboard
|
|
147
|
+
rn-firebase-onboard login
|
|
137
148
|
```
|
|
138
149
|
|
|
139
150
|
**Menu options:**
|
|
@@ -168,12 +179,12 @@ After adding an account, all logged-in accounts are listed with the new one mark
|
|
|
168
179
|
|
|
169
180
|
---
|
|
170
181
|
|
|
171
|
-
### `
|
|
182
|
+
### `sha add`
|
|
172
183
|
|
|
173
184
|
Standalone SHA key registration — supports both **debug** and **release** keystores.
|
|
174
185
|
|
|
175
186
|
```bash
|
|
176
|
-
rn-firebase-onboard
|
|
187
|
+
rn-firebase-onboard sha add
|
|
177
188
|
```
|
|
178
189
|
|
|
179
190
|
**What it does:**
|
|
@@ -189,13 +200,13 @@ rn-firebase-onboard firebase sha add
|
|
|
189
200
|
|
|
190
201
|
---
|
|
191
202
|
|
|
192
|
-
### `
|
|
203
|
+
### `enable`
|
|
193
204
|
|
|
194
205
|
Installs additional `@react-native-firebase` feature packages.
|
|
195
206
|
|
|
196
207
|
```bash
|
|
197
|
-
rn-firebase-onboard
|
|
198
|
-
rn-firebase-onboard
|
|
208
|
+
rn-firebase-onboard enable # interactive checkbox menu
|
|
209
|
+
rn-firebase-onboard enable auth # install a specific feature directly
|
|
199
210
|
```
|
|
200
211
|
|
|
201
212
|
**Available features:**
|
|
@@ -258,7 +269,7 @@ For Expo projects, `npx expo install` is used automatically to ensure compatible
|
|
|
258
269
|
|
|
259
270
|
```bash
|
|
260
271
|
cd /path/to/MyApp
|
|
261
|
-
rn-firebase-onboard
|
|
272
|
+
rn-firebase-onboard setup --full
|
|
262
273
|
```
|
|
263
274
|
|
|
264
275
|
### 2. Tools are checked automatically
|
|
@@ -352,6 +363,14 @@ npx react-native run-android # React Native CLI
|
|
|
352
363
|
npx expo run:android # Expo
|
|
353
364
|
```
|
|
354
365
|
|
|
366
|
+
### "SHA keys not found in keystore output"
|
|
367
|
+
|
|
368
|
+
This was fixed in v1.0.4. Some Java/keytool versions write certificate fingerprints to stderr instead of stdout. Upgrade to the latest version:
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
npm install -g rn-firebase-onboard@latest
|
|
372
|
+
```
|
|
373
|
+
|
|
355
374
|
### "No existing accounts found" when logging in
|
|
356
375
|
|
|
357
376
|
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.
|
|
@@ -398,7 +417,7 @@ npm run build
|
|
|
398
417
|
npm link
|
|
399
418
|
|
|
400
419
|
# Run directly with ts-node (no build needed)
|
|
401
|
-
npm run dev --
|
|
420
|
+
npm run dev -- setup --full
|
|
402
421
|
|
|
403
422
|
# Rebuild and relink after changes
|
|
404
423
|
npm run build && npm link
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sha.d.ts","sourceRoot":"","sources":["../../src/commands/sha.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sha.d.ts","sourceRoot":"","sources":["../../src/commands/sha.ts"],"names":[],"mappings":"AA8BA,KAAK,iBAAiB,GAAG;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAUF,wBAAsB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmN/E"}
|
package/build/commands/sha.js
CHANGED
|
@@ -40,6 +40,7 @@ exports.shaCommand = shaCommand;
|
|
|
40
40
|
const os = __importStar(require("os"));
|
|
41
41
|
const path = __importStar(require("path"));
|
|
42
42
|
const fs_1 = require("fs");
|
|
43
|
+
const child_process_1 = require("child_process");
|
|
43
44
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
44
45
|
const runner_1 = require("../utils/runner");
|
|
45
46
|
const logger_1 = require("../utils/logger");
|
|
@@ -129,14 +130,18 @@ async function shaCommand(options = {}) {
|
|
|
129
130
|
}
|
|
130
131
|
// ── Extract SHA keys ─────────────────────────────────────────
|
|
131
132
|
logger_1.logger.step(`Extracting SHA-1 and SHA-256 from ${keystoreType} keystore...`);
|
|
132
|
-
const
|
|
133
|
+
const result = (0, child_process_1.spawnSync)(keytoolPath, [
|
|
133
134
|
'-list', '-v',
|
|
134
135
|
'-keystore', keystorePath,
|
|
135
136
|
'-alias', keystoreAlias,
|
|
136
137
|
'-storepass', storepass,
|
|
137
138
|
'-keypass', keypass,
|
|
138
|
-
]);
|
|
139
|
-
|
|
139
|
+
], { stdio: 'pipe' });
|
|
140
|
+
const stdout = result.stdout?.toString() ?? '';
|
|
141
|
+
const stderr = result.stderr?.toString() ?? '';
|
|
142
|
+
// Some keytool versions write fingerprints to stderr instead of stdout
|
|
143
|
+
const output = stdout + '\n' + stderr;
|
|
144
|
+
if (!output.trim()) {
|
|
140
145
|
if (keystoreType === 'debug') {
|
|
141
146
|
logger_1.logger.error('Could not read debug keystore. Make sure you have run your Android app at least once.');
|
|
142
147
|
}
|
|
@@ -146,12 +151,12 @@ async function shaCommand(options = {}) {
|
|
|
146
151
|
process.exit(1);
|
|
147
152
|
}
|
|
148
153
|
// ── Parse SHA-1 and SHA-256 ──────────────────────────────────
|
|
149
|
-
const sha1Match = output.match(/SHA-?1:\s+([A-
|
|
150
|
-
const sha256Match = output.match(/SHA-?256:\s+([A-
|
|
154
|
+
const sha1Match = output.match(/SHA-?1:\s+([A-Fa-f0-9:]+)/);
|
|
155
|
+
const sha256Match = output.match(/SHA-?256:\s+([A-Fa-f0-9:]+)/);
|
|
151
156
|
if (!sha1Match || !sha256Match) {
|
|
152
157
|
logger_1.logger.error('SHA keys not found in keystore output.');
|
|
153
158
|
logger_1.logger.info('Keystore output received (for debugging):');
|
|
154
|
-
console.log(output.substring(0,
|
|
159
|
+
console.log(output.substring(0, 800));
|
|
155
160
|
process.exit(1);
|
|
156
161
|
}
|
|
157
162
|
const sha1 = sha1Match[1].trim();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sha.js","sourceRoot":"","sources":["../../src/commands/sha.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"sha.js","sourceRoot":"","sources":["../../src/commands/sha.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,gCAmNC;AA9PD,uCAAyB;AACzB,2CAA6B;AAC7B,2BAAgC;AAChC,iDAA0C;AAC1C,wDAAgC;AAChC,4CAAsE;AACtE,4CAAyC;AAczC,SAAS,iBAAiB,CAAI,MAAc,EAAE,KAAa;IACzD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAqB,CAAC;QACtD,OAAO,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IAC7B,CAAC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AAC;IACzD,eAAM,CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAC;AACzF,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -10,50 +10,56 @@ const program = new commander_1.Command();
|
|
|
10
10
|
program
|
|
11
11
|
.name('rn-firebase-onboard')
|
|
12
12
|
.description('🔥 Elite Firebase setup orchestrator for React Native')
|
|
13
|
-
.version('1.0.
|
|
14
|
-
// ──
|
|
15
|
-
|
|
16
|
-
// firebase setup --full
|
|
17
|
-
firebase
|
|
18
|
-
.command('setup')
|
|
19
|
-
.description('The complete Pilot experience: Tools → Login → Project → Deps → SHA')
|
|
20
|
-
.option('--full', 'Run the complete setup including SHA key registration')
|
|
21
|
-
.action((options) => {
|
|
13
|
+
.version('1.0.4');
|
|
14
|
+
// ── Shared action handlers ───────────────────────────────────
|
|
15
|
+
function handleSetup(options) {
|
|
22
16
|
(0, setup_1.setupCommand)(options.full ?? false).catch((err) => {
|
|
23
17
|
console.error('Error:', err.message);
|
|
24
18
|
process.exit(1);
|
|
25
19
|
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
firebase
|
|
29
|
-
.command('login')
|
|
30
|
-
.description('Manage and switch between multiple Google accounts')
|
|
31
|
-
.action(() => {
|
|
20
|
+
}
|
|
21
|
+
function handleLogin() {
|
|
32
22
|
(0, login_1.loginCommand)().catch((err) => {
|
|
33
23
|
console.error('Error:', err.message);
|
|
34
24
|
process.exit(1);
|
|
35
25
|
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
firebase
|
|
39
|
-
.command('sha')
|
|
40
|
-
.command('add')
|
|
41
|
-
.description('Automatically extract and add SHA keys to your Firebase project')
|
|
42
|
-
.action(() => {
|
|
26
|
+
}
|
|
27
|
+
function handleSha() {
|
|
43
28
|
(0, sha_1.shaCommand)().catch((err) => {
|
|
44
29
|
console.error('Error:', err.message);
|
|
45
30
|
process.exit(1);
|
|
46
31
|
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
firebase
|
|
50
|
-
.command('enable [feature]')
|
|
51
|
-
.description('Quickly enable Firebase features (auth, firestore, storage, etc.)')
|
|
52
|
-
.action((feature) => {
|
|
32
|
+
}
|
|
33
|
+
function handleEnable(feature) {
|
|
53
34
|
(0, enable_1.enableCommand)(feature).catch((err) => {
|
|
54
35
|
console.error('Error:', err.message);
|
|
55
36
|
process.exit(1);
|
|
56
37
|
});
|
|
57
|
-
}
|
|
38
|
+
}
|
|
39
|
+
// ── Strip "firebase" prefix for backward compat ─────────────
|
|
40
|
+
// Allows both: rn-firebase-onboard setup
|
|
41
|
+
// and: rn-firebase-onboard firebase setup
|
|
42
|
+
if (process.argv[2] === 'firebase') {
|
|
43
|
+
process.argv.splice(2, 1);
|
|
44
|
+
}
|
|
45
|
+
// ── Commands ─────────────────────────────────────────────────
|
|
46
|
+
program
|
|
47
|
+
.command('setup')
|
|
48
|
+
.description('The complete setup wizard: Tools → Login → Project → Deps → SHA')
|
|
49
|
+
.option('--full', 'Run the complete setup including SHA key registration')
|
|
50
|
+
.action(handleSetup);
|
|
51
|
+
program
|
|
52
|
+
.command('login')
|
|
53
|
+
.description('Manage and switch between multiple Google accounts')
|
|
54
|
+
.action(handleLogin);
|
|
55
|
+
const sha = program.command('sha').description('SHA key commands');
|
|
56
|
+
sha
|
|
57
|
+
.command('add')
|
|
58
|
+
.description('Automatically extract and add SHA keys to your Firebase project')
|
|
59
|
+
.action(handleSha);
|
|
60
|
+
program
|
|
61
|
+
.command('enable [feature]')
|
|
62
|
+
.description('Quickly enable Firebase features (auth, firestore, storage, etc.)')
|
|
63
|
+
.action(handleEnable);
|
|
58
64
|
program.parse(process.argv);
|
|
59
65
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,4CAAiD;AACjD,4CAAiD;AACjD,wCAA+C;AAC/C,8CAAkD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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as os from 'os';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import { existsSync } from 'fs';
|
|
4
|
+
import { spawnSync } from 'child_process';
|
|
4
5
|
import inquirer from 'inquirer';
|
|
5
6
|
import { runLive, runSilent, resolveJavaTool } from '../utils/runner';
|
|
6
7
|
import { logger } from '../utils/logger';
|
|
@@ -123,15 +124,20 @@ export async function shaCommand(options: ShaCommandOptions = {}): Promise<void>
|
|
|
123
124
|
|
|
124
125
|
// ── Extract SHA keys ─────────────────────────────────────────
|
|
125
126
|
logger.step(`Extracting SHA-1 and SHA-256 from ${keystoreType} keystore...`);
|
|
126
|
-
const
|
|
127
|
+
const result = spawnSync(keytoolPath, [
|
|
127
128
|
'-list', '-v',
|
|
128
129
|
'-keystore', keystorePath,
|
|
129
130
|
'-alias', keystoreAlias,
|
|
130
131
|
'-storepass', storepass,
|
|
131
132
|
'-keypass', keypass,
|
|
132
|
-
]);
|
|
133
|
+
], { stdio: 'pipe' });
|
|
134
|
+
|
|
135
|
+
const stdout = result.stdout?.toString() ?? '';
|
|
136
|
+
const stderr = result.stderr?.toString() ?? '';
|
|
137
|
+
// Some keytool versions write fingerprints to stderr instead of stdout
|
|
138
|
+
const output = stdout + '\n' + stderr;
|
|
133
139
|
|
|
134
|
-
if (!output) {
|
|
140
|
+
if (!output.trim()) {
|
|
135
141
|
if (keystoreType === 'debug') {
|
|
136
142
|
logger.error('Could not read debug keystore. Make sure you have run your Android app at least once.');
|
|
137
143
|
} else {
|
|
@@ -141,13 +147,13 @@ export async function shaCommand(options: ShaCommandOptions = {}): Promise<void>
|
|
|
141
147
|
}
|
|
142
148
|
|
|
143
149
|
// ── Parse SHA-1 and SHA-256 ──────────────────────────────────
|
|
144
|
-
const sha1Match = output.match(/SHA-?1:\s+([A-
|
|
145
|
-
const sha256Match = output.match(/SHA-?256:\s+([A-
|
|
150
|
+
const sha1Match = output.match(/SHA-?1:\s+([A-Fa-f0-9:]+)/);
|
|
151
|
+
const sha256Match = output.match(/SHA-?256:\s+([A-Fa-f0-9:]+)/);
|
|
146
152
|
|
|
147
153
|
if (!sha1Match || !sha256Match) {
|
|
148
154
|
logger.error('SHA keys not found in keystore output.');
|
|
149
155
|
logger.info('Keystore output received (for debugging):');
|
|
150
|
-
console.log(output.substring(0,
|
|
156
|
+
console.log(output.substring(0, 800));
|
|
151
157
|
process.exit(1);
|
|
152
158
|
}
|
|
153
159
|
|
package/src/index.ts
CHANGED
|
@@ -11,55 +11,65 @@ const program = new Command();
|
|
|
11
11
|
program
|
|
12
12
|
.name('rn-firebase-onboard')
|
|
13
13
|
.description('🔥 Elite Firebase setup orchestrator for React Native')
|
|
14
|
-
.version('1.0.
|
|
14
|
+
.version('1.0.4');
|
|
15
15
|
|
|
16
|
-
// ──
|
|
17
|
-
|
|
16
|
+
// ── Shared action handlers ───────────────────────────────────
|
|
17
|
+
function handleSetup(options: { full?: boolean }) {
|
|
18
|
+
setupCommand(options.full ?? false).catch((err) => {
|
|
19
|
+
console.error('Error:', err.message);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function handleLogin() {
|
|
25
|
+
loginCommand().catch((err) => {
|
|
26
|
+
console.error('Error:', err.message);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function handleSha() {
|
|
32
|
+
shaCommand().catch((err) => {
|
|
33
|
+
console.error('Error:', err.message);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function handleEnable(feature?: string) {
|
|
39
|
+
enableCommand(feature).catch((err) => {
|
|
40
|
+
console.error('Error:', err.message);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ── Strip "firebase" prefix for backward compat ─────────────
|
|
46
|
+
// Allows both: rn-firebase-onboard setup
|
|
47
|
+
// and: rn-firebase-onboard firebase setup
|
|
48
|
+
if (process.argv[2] === 'firebase') {
|
|
49
|
+
process.argv.splice(2, 1);
|
|
50
|
+
}
|
|
18
51
|
|
|
19
|
-
//
|
|
20
|
-
|
|
52
|
+
// ── Commands ─────────────────────────────────────────────────
|
|
53
|
+
program
|
|
21
54
|
.command('setup')
|
|
22
|
-
.description('The complete
|
|
55
|
+
.description('The complete setup wizard: Tools → Login → Project → Deps → SHA')
|
|
23
56
|
.option('--full', 'Run the complete setup including SHA key registration')
|
|
24
|
-
.action(
|
|
25
|
-
setupCommand(options.full ?? false).catch((err) => {
|
|
26
|
-
console.error('Error:', err.message);
|
|
27
|
-
process.exit(1);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
57
|
+
.action(handleSetup);
|
|
30
58
|
|
|
31
|
-
|
|
32
|
-
firebase
|
|
59
|
+
program
|
|
33
60
|
.command('login')
|
|
34
61
|
.description('Manage and switch between multiple Google accounts')
|
|
35
|
-
.action(
|
|
36
|
-
loginCommand().catch((err) => {
|
|
37
|
-
console.error('Error:', err.message);
|
|
38
|
-
process.exit(1);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
62
|
+
.action(handleLogin);
|
|
41
63
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.command('sha')
|
|
64
|
+
const sha = program.command('sha').description('SHA key commands');
|
|
65
|
+
sha
|
|
45
66
|
.command('add')
|
|
46
67
|
.description('Automatically extract and add SHA keys to your Firebase project')
|
|
47
|
-
.action(
|
|
48
|
-
shaCommand().catch((err) => {
|
|
49
|
-
console.error('Error:', err.message);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
68
|
+
.action(handleSha);
|
|
53
69
|
|
|
54
|
-
|
|
55
|
-
firebase
|
|
70
|
+
program
|
|
56
71
|
.command('enable [feature]')
|
|
57
72
|
.description('Quickly enable Firebase features (auth, firestore, storage, etc.)')
|
|
58
|
-
.action(
|
|
59
|
-
enableCommand(feature).catch((err) => {
|
|
60
|
-
console.error('Error:', err.message);
|
|
61
|
-
process.exit(1);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
73
|
+
.action(handleEnable);
|
|
64
74
|
|
|
65
75
|
program.parse(process.argv);
|