-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85ae7a1
commit 225d12b
Showing
43 changed files
with
12,477 additions
and
12,139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
language: node_js | ||
node_js: | ||
- 11 | ||
- 12 | ||
sudo: false | ||
install: | ||
- npm install | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. | ||
# For additional information regarding the format and rule options, please see: | ||
# https://github.com/browserslist/browserslist#queries | ||
|
||
# You can see what browsers were selected by your queries by running: | ||
# npx browserslist | ||
|
||
> 0.5% | ||
last 2 versions | ||
Firefox ESR | ||
not dead | ||
not IE 9-11 # For IE 9-11 support, remove 'not'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,64 @@ | ||
import * as admin from 'firebase-admin'; | ||
import { ensureDir, readFileSync, writeFileSync, unlinkSync } from 'fs-extra'; | ||
import { join } from 'path'; | ||
import { asyncForEach, filter, parse } from './utils'; | ||
import * as admin from "firebase-admin"; | ||
import { ensureDir, readFileSync, writeFileSync, unlinkSync } from "fs-extra"; | ||
import { join } from "path"; | ||
import { asyncForEach, filter, parse } from "./utils"; | ||
|
||
const serviceAccount = require('../serviceAccountKey.json'); | ||
const serviceAccount = require("../serviceAccountKey.json"); | ||
admin.initializeApp({ | ||
credential: admin.credential.cert(serviceAccount), | ||
databaseURL: 'https://' + serviceAccount['project_id'] + '.firebaseio.com' | ||
databaseURL: "https://" + serviceAccount["project_id"] + ".firebaseio.com", | ||
}); | ||
const collection: FirebaseFirestore.CollectionReference = admin.firestore().collection('restaurants'); | ||
const collection: FirebaseFirestore.CollectionReference = admin | ||
.firestore() | ||
.collection("restaurants"); | ||
|
||
// https://data.austintexas.gov/Health-and-Community-Services/Food-Establishment-Inspection-Scores/ecmv-9xxi | ||
const austin = JSON.parse(readFileSync(join(__dirname, '../', 'cities/austin.json'))); | ||
const austin = JSON.parse( | ||
readFileSync(join(__dirname, "../", "cities/austin.json"), "utf8") | ||
); | ||
// https://data.cityofchicago.org/Health-Human-Services/Restaurant/5udb-dr6f/data | ||
const chicago = JSON.parse(readFileSync(join(__dirname, '../', 'cities/chicago.json'))); | ||
const chicago = JSON.parse( | ||
readFileSync(join(__dirname, "../", "cities/chicago.json"), "utf8") | ||
); | ||
// https://docs.mongodb.com/getting-started/shell/import-data/ | ||
const newYork = JSON.parse(readFileSync(join(__dirname, '../', 'cities/new-york.json'))); | ||
const newYork = JSON.parse( | ||
readFileSync(join(__dirname, "../", "cities/new-york.json"), "utf8") | ||
); | ||
|
||
const cacheFiles: string[] = []; | ||
const restaurants: any[] = [ | ||
...filter(austin), | ||
...filter(chicago), | ||
...filter(newYork) | ||
...filter(newYork), | ||
]; | ||
let length = restaurants.length; | ||
const folder = join(__dirname, '../', 'temp'); | ||
const folder = join(__dirname, "../", "temp"); | ||
console.log(`Inserting ${length} restaurants`); | ||
|
||
|
||
ensureDir(folder, () => { | ||
ensureDir(folder).then(() => { | ||
while (restaurants.length) { | ||
const temp = restaurants.splice(0, 500); | ||
const path = join(folder, (Date.now() + Math.random() + '.json')); | ||
const path = join(folder, Date.now() + Math.random() + ".json"); | ||
writeFileSync(path, JSON.stringify(temp)); | ||
cacheFiles.push(path); | ||
} | ||
|
||
(async () => { | ||
asyncForEach(cacheFiles, async (path) => { | ||
// @ts-ignore | ||
const batchedData: any[] = parse(JSON.parse(readFileSync(path))); | ||
const batchedData: any[] = parse(JSON.parse(readFileSync(path, "UTF8"))); | ||
const batch: FirebaseFirestore.WriteBatch = admin.firestore().batch(); | ||
batchedData.forEach((item) => { | ||
const insert = collection.doc(); | ||
batch.create(insert, item); | ||
}); | ||
await batch.commit() | ||
.then(() => { | ||
length -= batchedData.length; | ||
console.log(`Inserted ${batchedData.length} docs, ${length} docs remaining`); | ||
console.log(`Deleting ${path}`); | ||
unlinkSync(path); | ||
}); | ||
await batch.commit().then(() => { | ||
length -= batchedData.length; | ||
console.log( | ||
`Inserted ${batchedData.length} docs, ${length} docs remaining` | ||
); | ||
console.log(`Deleting ${path}`); | ||
unlinkSync(path); | ||
}); | ||
}); | ||
})(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { browser, by, element } from 'protractor'; | ||
|
||
export class AppPage { | ||
navigateTo() { | ||
return browser.get('/'); | ||
navigateTo(): Promise<unknown> { | ||
return browser.get(browser.baseUrl) as Promise<unknown>; | ||
} | ||
|
||
getParagraphText() { | ||
return element(by.css('app-root h1')).getText(); | ||
getTitleText(): Promise<string> { | ||
return element(by.css('app-root .content span')).getText() as Promise<string>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.