File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed
Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ node_modules
1313/test /* /build
1414/test /* /.firebaserc
1515/test /* /.env
16+ /test /* /secrets
1617
1718# Firebase
1819firebase-debug.log
Original file line number Diff line number Diff line change 1313 "firebase-admin" : " ^10.2.0" ,
1414 "firebase-functions" : " ^3.21.2" ,
1515 "firebase-tools" : " ^11.0.1"
16+ },
17+ "scripts" : {
18+ "seedUsers" : " env GOOGLE_APPLICATION_CREDENTIALS=secrets/backup-fire-playground-alt.json node scripts/seedUsers.js"
1619 }
1720}
Original file line number Diff line number Diff line change 1+ const admin = require ( 'firebase-admin' )
2+
3+ admin . initializeApp ( )
4+
5+ const number = parseInt ( process . env . NUMBER )
6+ if ( isNaN ( number ) )
7+ throw new Error ( 'The NUMBER environment variable must be a number' )
8+
9+ const auth = admin . auth ( )
10+
11+ async function main ( ) {
12+ for ( let bunch = 0 ; bunch < number ; bunch ++ ) {
13+ console . log ( `=== Creating users bunch #${ bunch } ===` )
14+
15+ await Promise . all (
16+ new Array ( 100 ) . fill ( undefined ) . map ( ( _ , i ) => {
17+ const email = `test${ bunch } ${ i } ${ Date . now ( ) } @backupfire.dev`
18+
19+ console . log ( `...creating user #${ bunch } /${ i } (${ email } )` )
20+
21+ return auth . createUser ( {
22+ email,
23+ password : Date . now ( ) . toString ( ) ,
24+ displayName : 'Sasha Clone' ,
25+ photoURL :
26+ 'https://pbs.twimg.com/profile_images/979030533719064576/rD33B86M_400x400.jpg' ,
27+ } )
28+ } )
29+ )
30+ }
31+ }
32+
33+ main ( )
You can’t perform that action at this time.
0 commit comments