-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add script to generate mock data for FriendlyEats
quickstart
#728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
}, | ||
prod: {} | ||
projectId: 'demo-friendly-eats', | ||
apiKey: '[FIREBASE_API_KEY]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This seems like we're inviting the developer to add their own, whereas any string value works here. Perhaps we should use something obviously fake like "api_key_unused"
@@ -0,0 +1,14 @@ | |||
{ | |||
"name": "scripts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to put this a level up in the root package.json? Also scripts at the top level beside src (instead of nested within it)
That helps keep all commands discoverable at a single level. Bonus if we can accomplish the same with functions
var city = getRandomItem(data.cities); | ||
var price = Math.floor(Math.random() * 4) + 1; | ||
var photoID = Math.floor(Math.random() * 22) + 1; | ||
var photo = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bypasses the storage emulator - which isn't a big deal but it removes the need to use the storage emulator in this case. Let's add a TODO to download/store the images in a follow-up PR
{ | ||
"name": "scripts", | ||
"version": "1.0.0", | ||
"description": "A script to send mock data to the prod firebase console", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this package.json anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so; I'm importing node modules using the import
syntax in PopulateFirestore.js
, and when I attempt to run the script after removing the package.json
, I get an error that reads
SyntaxError: Cannot use import statement outside a module
@@ -103,6 +103,14 @@ Follow these steps to have a working version of the quickstart running with the | |||
ng serve | |||
``` | |||
|
|||
11. (Optional) Populate production Firestore with mock data | |||
|
|||
Now that the application is live on the Firebase console, you likely want to add some data to your production Firestore database so that you can see the application in action. Rather than manually adding restaurants and reviews, a convenice script is available to populate your production Firestore database. Run the following command (defined in the `Firestore/` directory's `package.json`) to add mock data: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's note that this requires your configuration to exist in the config file
@@ -20,10 +20,8 @@ | |||
* and change the `initializeApp` value in `app.module.ts` to `environment.prod`. | |||
* Otherwise, leave untouched to enable connection to demo project and emulators. | |||
*/ | |||
|
|||
export const environment = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
projectConfig
This PR adds a new scripts directory (
scripts/
) that includes scripts toproduction
orlocal
)