-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
56 lines (54 loc) · 1.45 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import yargs from 'yargs/yargs';
import {getAuth} from "firebase/auth"
import { initializeApp } from "firebase/app";
import {
signInWithEmailAndPassword,
} from "firebase/auth";
import {firebaseConfig} from "./firebaseconfig.js"
/**
* Firebase config example to import
* firebaseConfig = {
apiKey: "...,
authDomain: "yourdomain.firebaseapp.com",
databaseURL: "https://yourdomain.firebaseio.com",
projectId: "yourdomain",
storageBucket: "yourdomain.appspot.com", //default
messagingSenderId: "...",
appId: "..."
}
*/
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
const firebaseLoginUser = (
email,
password
) => {
return signInWithEmailAndPassword(auth, email, password);
};
yargs(process.argv.slice(2))
.scriptName("pirate-parser")
.usage('$0 <cmd> [args]')
.command('user [mail] [password]', 'welcome ter yargs!', (yargs) => {
yargs.positional('mail', {
type: 'string',
default: '',
describe: 'the user mail'
}),
yargs.positional('password', {
type: 'string',
default: '',
describe: 'the user password'
})
}, (argv) => {
firebaseLoginUser(argv.mail, argv.password)
.then((userCredential) => {
const user = userCredential.user;
console.log("user")
console.log(user)
}).catch((error)=>{
console.log("error")
console.log(error)
})
})
.help()
.argv