fire-pilot-rn 1.0.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.
- package/GoogleService-Info.plist +30 -0
- package/LICENSE +21 -0
- package/README.md +391 -0
- package/build/commands/enable.d.ts +2 -0
- package/build/commands/enable.d.ts.map +1 -0
- package/build/commands/enable.js +73 -0
- package/build/commands/enable.js.map +1 -0
- package/build/commands/login.d.ts +2 -0
- package/build/commands/login.d.ts.map +1 -0
- package/build/commands/login.js +117 -0
- package/build/commands/login.js.map +1 -0
- package/build/commands/setup.d.ts +2 -0
- package/build/commands/setup.d.ts.map +1 -0
- package/build/commands/setup.js +297 -0
- package/build/commands/setup.js.map +1 -0
- package/build/commands/sha.d.ts +7 -0
- package/build/commands/sha.d.ts.map +1 -0
- package/build/commands/sha.js +165 -0
- package/build/commands/sha.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +59 -0
- package/build/index.js.map +1 -0
- package/build/utils/checker.d.ts +2 -0
- package/build/utils/checker.d.ts.map +1 -0
- package/build/utils/checker.js +100 -0
- package/build/utils/checker.js.map +1 -0
- package/build/utils/logger.d.ts +11 -0
- package/build/utils/logger.d.ts.map +1 -0
- package/build/utils/logger.js +18 -0
- package/build/utils/logger.js.map +1 -0
- package/build/utils/runner.d.ts +7 -0
- package/build/utils/runner.d.ts.map +1 -0
- package/build/utils/runner.js +125 -0
- package/build/utils/runner.js.map +1 -0
- package/dist/commands/enable.d.ts +2 -0
- package/dist/commands/enable.d.ts.map +1 -0
- package/dist/commands/enable.js +65 -0
- package/dist/commands/enable.js.map +1 -0
- package/dist/commands/login.d.ts +2 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +86 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/setup.d.ts +2 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +133 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/sha.d.ts +2 -0
- package/dist/commands/sha.d.ts.map +1 -0
- package/dist/commands/sha.js +118 -0
- package/dist/commands/sha.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/checker.d.ts +2 -0
- package/dist/utils/checker.d.ts.map +1 -0
- package/dist/utils/checker.js +100 -0
- package/dist/utils/checker.js.map +1 -0
- package/dist/utils/logger.d.ts +11 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +18 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/runner.d.ts +4 -0
- package/dist/utils/runner.d.ts.map +1 -0
- package/dist/utils/runner.js +36 -0
- package/dist/utils/runner.js.map +1 -0
- package/google-services.json +48 -0
- package/package.json +51 -0
- package/src/commands/enable.ts +80 -0
- package/src/commands/login.ts +119 -0
- package/src/commands/setup.ts +313 -0
- package/src/commands/sha.ts +177 -0
- package/src/index.ts +65 -0
- package/src/utils/checker.ts +70 -0
- package/src/utils/logger.ts +13 -0
- package/src/utils/runner.ts +98 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as os from 'os';
|
|
2
|
+
import { commandExists, resolveJavaTool, runLive, runSilent } from './runner';
|
|
3
|
+
import { logger } from './logger';
|
|
4
|
+
|
|
5
|
+
// ─── Check Node.js ───────────────────────────────────────────
|
|
6
|
+
async function ensureNode(): Promise<void> {
|
|
7
|
+
if (commandExists('node')) {
|
|
8
|
+
const version = runSilent('node', ['--version']);
|
|
9
|
+
logger.success(`Node.js found: ${version}`);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
logger.warn('Node.js not found! Attempting to install...');
|
|
14
|
+
const platform = os.platform();
|
|
15
|
+
|
|
16
|
+
if (platform === 'win32') {
|
|
17
|
+
runLive('winget', ['install', 'OpenJS.NodeJS.LTS']);
|
|
18
|
+
} else if (platform === 'darwin') {
|
|
19
|
+
runLive('brew', ['install', 'node']);
|
|
20
|
+
} else {
|
|
21
|
+
logger.error('Please install Node.js manually: https://nodejs.org');
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
logger.success('Node.js installed successfully!');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// ─── Check NPM ───────────────────────────────────────────────
|
|
29
|
+
async function ensureNpm(): Promise<void> {
|
|
30
|
+
if (commandExists('npm')) {
|
|
31
|
+
const version = runSilent('npm', ['--version']);
|
|
32
|
+
logger.success(`NPM found: v${version}`);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
logger.error('NPM not found. Please reinstall Node.js from https://nodejs.org');
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ─── Check Firebase CLI ──────────────────────────────────────
|
|
40
|
+
async function ensureFirebaseCLI(): Promise<void> {
|
|
41
|
+
if (commandExists('firebase')) {
|
|
42
|
+
const version = runSilent('firebase', ['--version']);
|
|
43
|
+
logger.success(`Firebase CLI found: v${version}`);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
logger.warn('Firebase CLI not found! Installing...');
|
|
48
|
+
runLive('npm', ['install', '-g', 'firebase-tools']);
|
|
49
|
+
logger.success('Firebase CLI installed!');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ─── Check Java (needed for SHA key extraction) ──────────────
|
|
53
|
+
async function ensureJava(): Promise<void> {
|
|
54
|
+
if (resolveJavaTool('keytool')) {
|
|
55
|
+
logger.success('Java keytool found ✓');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
logger.warn('Java keytool not found. SHA extraction may not work.');
|
|
59
|
+
logger.info('Install Java from: https://adoptium.net');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ─── Main checker ────────────────────────────────────────────
|
|
63
|
+
export async function checkAllTools(): Promise<void> {
|
|
64
|
+
logger.title('Checking Required Tools');
|
|
65
|
+
await ensureNode();
|
|
66
|
+
await ensureNpm();
|
|
67
|
+
await ensureFirebaseCLI();
|
|
68
|
+
await ensureJava();
|
|
69
|
+
logger.success('All required tools are ready!\n');
|
|
70
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
|
|
4
|
+
export const logger = {
|
|
5
|
+
info: (msg: string) => console.log(chalk.cyan('ℹ️ ' + msg)),
|
|
6
|
+
success: (msg: string) => console.log(chalk.green('✅ ' + msg)),
|
|
7
|
+
error: (msg: string) => console.log(chalk.red('❌ ' + msg)),
|
|
8
|
+
warn: (msg: string) => console.log(chalk.yellow('⚠️ ' + msg)),
|
|
9
|
+
title: (msg: string) =>
|
|
10
|
+
console.log(chalk.bold.magenta('\n🚀 ' + msg + '\n')),
|
|
11
|
+
step: (msg: string) => console.log(chalk.bold.white('\n👉 ' + msg)),
|
|
12
|
+
running: (msg: string) => console.log(chalk.gray(' Running: ' + msg)),
|
|
13
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { execFileSync, spawnSync } from 'child_process';
|
|
2
|
+
import { existsSync } from 'fs';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
import { logger } from './logger';
|
|
5
|
+
|
|
6
|
+
function getShellOption(): boolean {
|
|
7
|
+
return process.platform === 'win32';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function resolveFromPath(command: string): string | null {
|
|
11
|
+
const lookupCommand = process.platform === 'win32' ? 'where' : 'which';
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
const output = execFileSync(lookupCommand, [command], { stdio: 'pipe' })
|
|
15
|
+
.toString()
|
|
16
|
+
.split(/\r?\n/)
|
|
17
|
+
.map((line) => line.trim())
|
|
18
|
+
.find(Boolean);
|
|
19
|
+
|
|
20
|
+
return output || null;
|
|
21
|
+
} catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function resolveFromJavaHome(command: string): string | null {
|
|
27
|
+
const executable = process.platform === 'win32' ? `${command}.exe` : command;
|
|
28
|
+
const candidates: string[] = [];
|
|
29
|
+
|
|
30
|
+
if (process.env.JAVA_HOME) {
|
|
31
|
+
candidates.push(path.join(process.env.JAVA_HOME, 'bin', executable));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (process.platform === 'darwin') {
|
|
35
|
+
try {
|
|
36
|
+
const javaHome = execFileSync('/usr/libexec/java_home', [], { stdio: 'pipe' })
|
|
37
|
+
.toString()
|
|
38
|
+
.trim();
|
|
39
|
+
|
|
40
|
+
if (javaHome) {
|
|
41
|
+
candidates.push(path.join(javaHome, 'bin', executable));
|
|
42
|
+
}
|
|
43
|
+
} catch {
|
|
44
|
+
// Ignore missing or misconfigured java_home output.
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return candidates.find((candidate) => existsSync(candidate)) || null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function resolveCommand(command: string): string | null {
|
|
52
|
+
return resolveFromPath(command);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function resolveJavaTool(command: string): string | null {
|
|
56
|
+
return resolveFromPath(command) || resolveFromJavaHome(command);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Run a command and stream output live to terminal
|
|
60
|
+
export function runLive(command: string, args: string[] = []): void {
|
|
61
|
+
logger.running(`${command} ${args.join(' ')}`);
|
|
62
|
+
const result = spawnSync(command, args, { stdio: 'inherit', shell: getShellOption() });
|
|
63
|
+
if (result.status !== 0) {
|
|
64
|
+
throw new Error(`Command failed: ${command} ${args.join(' ')}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Run a command silently and return the output as string
|
|
69
|
+
export function runSilent(command: string, args: string[] = []): string {
|
|
70
|
+
try {
|
|
71
|
+
const result = spawnSync(command, args, { stdio: 'pipe', shell: getShellOption() });
|
|
72
|
+
return result.stdout?.toString().trim() ?? '';
|
|
73
|
+
} catch {
|
|
74
|
+
return '';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Run a command silently and throw if it fails
|
|
79
|
+
export function runCheckedOutput(command: string, args: string[] = []): string {
|
|
80
|
+
logger.running(`${command} ${args.join(' ')}`);
|
|
81
|
+
const result = spawnSync(command, args, { stdio: 'pipe', shell: getShellOption() });
|
|
82
|
+
|
|
83
|
+
if (result.error) {
|
|
84
|
+
throw result.error;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (result.status !== 0) {
|
|
88
|
+
const stderr = result.stderr?.toString().trim();
|
|
89
|
+
throw new Error(stderr || `Command failed: ${command} ${args.join(' ')}`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return result.stdout?.toString().trim() ?? '';
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Check if a command/tool exists on the machine
|
|
96
|
+
export function commandExists(command: string): boolean {
|
|
97
|
+
return resolveCommand(command) !== null;
|
|
98
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ES2020"],
|
|
6
|
+
"outDir": "./build",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"types": ["node"],
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"declarationMap": true,
|
|
16
|
+
"sourceMap": true
|
|
17
|
+
},
|
|
18
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
19
|
+
"exclude": ["node_modules", "build"]
|
|
20
|
+
}
|