From 699a2886db78b3454817605c377b8ee966e1f74b Mon Sep 17 00:00:00 2001 From: Ahmad Kayyali Date: Tue, 11 Dec 2018 14:39:32 -0700 Subject: [PATCH 01/13] Fix add city website patch --- server.js | 400 ++++++++++++++++++++---------------- test/server.test.js | 485 ++++++++++++++++++++++++-------------------- 2 files changed, 483 insertions(+), 402 deletions(-) diff --git a/server.js b/server.js index d9272bd..66c80ea 100644 --- a/server.js +++ b/server.js @@ -1,198 +1,238 @@ -const express = require('express') -const bodyParser = require('body-parser') -const environment = process.env.NODE_ENV || 'development' -const config = require('./knexfile')[environment] -const database = require('knex')(config) -const app = express() - -app.use(bodyParser.json()) -app.set('port', process.env.PORT || 3000); -app.locals.title = 'BYOB'; -app.use(express.static('public')); - - app.get('/api/v1/cities', (request, response) => { - - if(request.query.city) { - let nameQuery = request.query.city - - database('cities').where("city", nameQuery).select() +const express = require("express"); +const bodyParser = require("body-parser"); +const environment = process.env.NODE_ENV || "development"; +const config = require("./knexfile")[environment]; +const database = require("knex")(config); +const app = express(); + +app.use(bodyParser.json()); +app.set("port", process.env.PORT || 3000); +app.locals.title = "BYOB"; +app.use(express.static("public")); + +app.get("/api/v1/cities", (request, response) => { + if (request.query.city) { + let nameQuery = request.query.city; + + database("cities") + .where("city", nameQuery) + .select() .then(city => { - response.status(200).json(city) - }) - } else { - database('cities').select() + response.status(200).json(city); + }); + } else { + database("cities") + .select() .then(cities => { - response.status(200).json(cities) + response.status(200).json(cities); }) .catch(error => { - response.status(500).json({ error: error.message }) - }) - } - }) + response.status(500).json({ error: error.message }); + }); + } +}); - app.post('/api/v1/cities', (request, response) => { - const city = request.body - - let missingProp = [] +app.post("/api/v1/cities", (request, response) => { + const city = request.body; - for(let requiredParam of ['city', 'state', 'primary_airport', 'population', 'tourism_website']) { - if(!city[requiredParam]) { - missingProp = [...missingProp, requiredParam] - } + let missingProp = []; + + for (let requiredParam of [ + "city", + "state", + "primary_airport", + "population", + "tourism_website" + ]) { + if (!city[requiredParam]) { + missingProp = [...missingProp, requiredParam]; } - - if (missingProp.length) { - response.status(422).json({error: error.message}) + } + + if (missingProp.length) { + response.status(422).json({ error: error.message }); + } + + database("cities") + .insert(city, "id") + .then(cityIds => { + response.status(201).json({ id: cityIds[0] }); + }) + .catch(error => { + response.status(500).json({ error: error.message }); + }); +}); + +app.get("/api/v1/cities/:id", (request, response) => { + const { id } = request.params; + + database("cities") + .where("id", id) + .select() + .then(city => response.status(200).json(city)) + .catch(error => + response.status(500).json(`Error fetching city: ${error.message}`) + ); +}); + +app.patch("/api/v1/cities/:id", (request, response) => { + const { id } = request.params; + const tourism_website = request.body; + + let missingProp = []; + + for (let requiredParam of ["tourism_website"]) { + if (!tourism_website[requiredParam]) { + missingProp = [...missingProp, requiredParam]; } + } + + if (missingProp.length) { + response.status(415).json({ error: error.message }); + } + + database("cities") + .where("id", id) + .update({ tourism_website }) + .then(row => { + response + .status(201) + .json( + `City ${id}'s website has been updated to ${ + tourism_website.tourism_website + }` + ); + }) + .catch(error => { + response.status(500).json({ error: error.message }); + }); +}); - database('cities').insert(city, 'id') - .then(cityIds => { - response.status(201).json({id: cityIds[0]}) - }) - .catch(error => { - response.status(500).json({error: error.message}) - }) - }) - - app.get('/api/v1/cities/:id', (request, response) => { - const { id } = request.params - - database('cities').where('id', id).select() - .then(city => response.status(200).json(city)) - .catch(error => response.status(500).json(`Error fetching city: ${error.message}`)) - }) - - app.patch('/api/v1/cities/:id', (request, response) => { - const { id } = request.params - const tourismWeb = request.body - - let missingProp = [] - - for(let requiredParam of ['tourism_website']) { - if(!tourismWeb[requiredParam]) { - missingProp = [...missingProp, requiredParam] - } - } - - if (missingProp.length) { - response.status(415).json({error: error.message}) - } - - database('cities').where('id', id) - .update(tourismWeb) - .then(tourismWeb => { - response.status(204).json(tourismWeb) - }) - .catch(error => { - response.status(500).json({ error: error.message }) - }) - }) - - app.get('/api/v1/comedy_clubs/:club_id', (request, response) => { - const { club_id } = request.params - - database('comedy_clubs').where('id', club_id).select() - .then(club => response.status(200).json(club)) - .catch(error => response.status(500).json(`Error fetching city: ${error.message}`)) - }) - - app.patch('/api/v1/comedy_clubs/:club_id', (request, response) => { - const { club_id } = request.params - const rating = request.body - - let missingProp = [] - - for(let requiredParam of ['rating']) { - if(!rating[requiredParam]) { - missingProp = [...missingProp, requiredParam] - } - } - - if (missingProp.length) { - response.status(415).json({error: error.message}) - } - - database('comedy_clubs').where('id', club_id) - .update(rating) - .then(rating => { - response.status(204).json(rating) - }) - .catch(error => { - response.status(500).json({ error: error.message }) - }) - }) - - app.get('/api/v1/comedy_clubs', (request, response) => { - database('comedy_clubs').select() - .then(clubs => { - response.status(200).json(clubs) - }) - .catch(error => { - response.status(500).json({ error: error.message }); - }) - }) - - app.post('/api/v1/cities/:city_id/comedy_clubs', (request, response) => { - const club = request.body - - let missingProp = [] - - for(let requiredParam of ['name', 'street_address', 'zip_code', 'rating']) { - if(club[requiredParam] === undefined) { - missingProp = [...missingProp, requiredParam] - } +app.get("/api/v1/comedy_clubs/:club_id", (request, response) => { + const { club_id } = request.params; + + database("comedy_clubs") + .where("id", club_id) + .select() + .then(club => response.status(200).json(club)) + .catch(error => + response.status(500).json(`Error fetching city: ${error.message}`) + ); +}); + +app.patch("/api/v1/comedy_clubs/:club_id", (request, response) => { + const { club_id } = request.params; + const rating = request.body; + + let missingProp = []; + + for (let requiredParam of ["rating"]) { + if (!rating[requiredParam]) { + missingProp = [...missingProp, requiredParam]; } - - if (missingProp.length) { - response.status(422).json({error: error.message}) + } + + if (missingProp.length) { + response.status(415).json({ error: error.message }); + } + + database("comedy_clubs") + .where("id", club_id) + .update(rating) + .then(rating => { + response.status(204).json(rating); + }) + .catch(error => { + response.status(500).json({ error: error.message }); + }); +}); + +app.get("/api/v1/comedy_clubs", (request, response) => { + database("comedy_clubs") + .select() + .then(clubs => { + response.status(200).json(clubs); + }) + .catch(error => { + response.status(500).json({ error: error.message }); + }); +}); + +app.post("/api/v1/cities/:city_id/comedy_clubs", (request, response) => { + const club = request.body; + + let missingProp = []; + + for (let requiredParam of ["name", "street_address", "zip_code", "rating"]) { + if (club[requiredParam] === undefined) { + missingProp = [...missingProp, requiredParam]; } - - database('comedy_clubs').insert(club, 'id') - .then(club => { - response.status(201).json(club) - }) - .catch(error => { - response.status(500).json({error: error.message}) - }) - }) - - - - app.get('/api/v1/cities/:city_id/comedy_clubs', (request, response) => { - const { city_id } = request.params - - database('comedy_clubs').where('city_id', city_id).select() - .then(clubs => response.status(200).json(clubs)) - .catch(error => response.status(500).json(`Error fetching cities clubs: ${error.message}`)) - }) - - app.delete('/api/v1/cities/:id', (request, response) => { - const { id } = request.params - - database('comedy_clubs').where('city_id', id).del() - .then(() => database('cities').where('id', id).del()) - .then(city => { - response.status(202).json(id) - }) - .catch(error => { - response.status(500).json({error: error.message}) - }) - }) - - app.delete('/api/v1/cities/:city_id/comedy_clubs/:club_id', (request, response) => { - const { club_id } = request.params - - database('comedy_clubs').where('id', club_id).del() + } + + if (missingProp.length) { + response.status(422).json({ error: error.message }); + } + + database("comedy_clubs") + .insert(club, "id") .then(club => { - response.status(202).json(club_id) + response.status(201).json(club); }) .catch(error => { - response.status(500).json({error: error.message}) + response.status(500).json({ error: error.message }); + }); +}); + +app.get("/api/v1/cities/:city_id/comedy_clubs", (request, response) => { + const { city_id } = request.params; + + database("comedy_clubs") + .where("city_id", city_id) + .select() + .then(clubs => response.status(200).json(clubs)) + .catch(error => + response.status(500).json(`Error fetching cities clubs: ${error.message}`) + ); +}); + +app.delete("/api/v1/cities/:id", (request, response) => { + const { id } = request.params; + + database("comedy_clubs") + .where("city_id", id) + .del() + .then(() => + database("cities") + .where("id", id) + .del() + ) + .then(city => { + response.status(202).json(id); }) - }) + .catch(error => { + response.status(500).json({ error: error.message }); + }); +}); + +app.delete( + "/api/v1/cities/:city_id/comedy_clubs/:club_id", + (request, response) => { + const { club_id } = request.params; + + database("comedy_clubs") + .where("id", club_id) + .del() + .then(club => { + response.status(202).json(club_id); + }) + .catch(error => { + response.status(500).json({ error: error.message }); + }); + } +); -app.listen(app.get('port'), () => { - console.log(`${app.locals.title} is running on ${app.get('port')}.`); +app.listen(app.get("port"), () => { + console.log(`${app.locals.title} is running on ${app.get("port")}.`); }); -module.exports = app \ No newline at end of file +module.exports = app; diff --git a/test/server.test.js b/test/server.test.js index 50b810b..799a409 100644 --- a/test/server.test.js +++ b/test/server.test.js @@ -1,240 +1,281 @@ -process.env.NODE_ENV = 'test' - -const chai = require('chai'); -const chaiHttp = require('chai-http'); -const app = require('../server.js'); -const expect = chai.expect -const config = require('../knexfile')['test'] -const database = require('knex')(config) -chai.use(chaiHttp) - - -describe('Server file', () => { - - beforeEach(() => database.migrate.rollback() - .then(() => database.migrate.latest()) - .then(() => database.seed.run()) +process.env.NODE_ENV = "test"; + +const chai = require("chai"); +const chaiHttp = require("chai-http"); +const app = require("../server.js"); +const expect = chai.expect; +const config = require("../knexfile")["test"]; +const database = require("knex")(config); +chai.use(chaiHttp); + +describe("Server file", () => { + beforeEach(() => + database.migrate + .rollback() + .then(() => database.migrate.latest()) + .then(() => database.seed.run()) ); - describe('/api/v1/cities', () => { - - it('should return return status of 200 on a get request', (done) => { - chai.request(app) - .get('/api/v1/cities') + describe("/api/v1/cities", () => { + it("should return return status of 200 on a get request", done => { + chai + .request(app) + .get("/api/v1/cities") .end((error, response) => { - expect(response).to.have.status(200) - done() - }) - }) - - it('should return an array of cities', (done) => { - - chai.request(app) - .get('/api/v1/cities') + expect(response).to.have.status(200); + done(); + }); + }); + + it("should return an array of cities", done => { + chai + .request(app) + .get("/api/v1/cities") .end((error, response) => { - expect(response.body[0].city).to.equal('Denver') - expect(response.body[1].city).to.equal('New York City') - expect(response.body[2].city).to.equal('Austin') - done() - }) - }) - - it('should return requested city based off of search query', (done) => { - - chai.request(app) - .get('/api/v1/cities?city=Austin') + expect(response.body[0].city).to.equal("Denver"); + expect(response.body[1].city).to.equal("New York City"); + expect(response.body[2].city).to.equal("Austin"); + done(); + }); + }); + + it("should return requested city based off of search query", done => { + chai + .request(app) + .get("/api/v1/cities?city=Austin") .end((error, response) => { - expect(response.body[0].city).to.equal('Austin') - done() - }) - }) - - it('should return empty array if the search query is not included in the database', (done) => { - - chai.request(app) - .get('/api/v1/cities?city=Williamsport') + expect(response.body[0].city).to.equal("Austin"); + done(); + }); + }); + + it("should return empty array if the search query is not included in the database", done => { + chai + .request(app) + .get("/api/v1/cities?city=Williamsport") .end((error, response) => { - expect(response.body).to.deep.equal([]) - done() - }) - }) - - it('should post a new city', (done) => { - const newCity = { id: 4, city: 'Tulsa', state: 'OK', primary_airport: 'Tulsa Airport', population: 2, tourism_website: 'www.tulsaisawesome.com' } - - chai.request(app) - .post('/api/v1/cities') + expect(response.body).to.deep.equal([]); + done(); + }); + }); + + it("should post a new city", done => { + const newCity = { + id: 4, + city: "Tulsa", + state: "OK", + primary_airport: "Tulsa Airport", + population: 2, + tourism_website: "www.tulsaisawesome.com" + }; + + chai + .request(app) + .post("/api/v1/cities") .send(newCity) .end((error, response) => { - expect(response).to.have.status(201) - expect(response.body.id).to.equal(4) - done() - }) - }) - - it('should error is a required param is missing', (done) => { - const newCity = { id: 4, city: 'Tulsa', state: 'OK', population: 2, tourism_website: 'www.tulsaisawesome.com' } - - chai.request(app) - .post('/api/v1/cities') + expect(response).to.have.status(201); + expect(response.body.id).to.equal(4); + done(); + }); + }); + + it("should error is a required param is missing", done => { + const newCity = { + id: 4, + city: "Tulsa", + state: "OK", + population: 2, + tourism_website: "www.tulsaisawesome.com" + }; + + chai + .request(app) + .post("/api/v1/cities") .send(newCity) .end((error, response) => { - expect(response).to.have.status(422) - done() - }) - }) - }) - - describe('/api/v1/cities/:id', () => { - - it('should return a status of 200 on a get request', (done) => { - chai.request(app) - .get('/api/v1/cities/2') - .end((error, response) => { - expect(response).to.have.status(200) - done() - }) - }) - - it('should return a single city', (done) => { - chai.request(app) - .get('/api/v1/cities/2') - .end((error, response) => { - expect(response.body[0].city).to.equal('New York City') - done() - }) - }) - - it('should be return a 204 status on successful PATCH request', (done) => { - chai.request(app) - .patch('/api/v1/cities/2') - .send({ tourism_website: 'www.ben.com' }) - .end((error, response) => { - expect(response).to.have.status(204) - done() - }) - }) - - it('should return 415 status updatable field is not changed', (done) => { - chai.request(app) - .patch('/api/v1/cities/2') - .send({ city: 'Ben' }) - .end((error, response) => { - expect(response).to.have.status(415) - done() - }) - }) - }) - - describe('/api/v1/comedy_clubs', () => { - - it('should return a status of 200 with a get request', (done) => { - chai.request(app) - .get('/api/v1/comedy_clubs') - .end((error, response) => { - expect(response).to.have.status(200) - done() - }) - }) - - it('should return array of comedy clubs', (done) => { - chai.request(app) - .get('/api/v1/comedy_clubs') - .end((error, response) => { - expect(response.body[0].name).to.equal('Denver Comedy') - expect(response.body[1].name).to.equal('Other Denver Comedy') - expect(response.body[2].name).to.equal('NYC Comedy') - expect(response.body[3].name).to.equal('Austin Comedy') - expect(response.body[4].name).to.equal('Texas Comedy') - done() - }) - }) - - it('should post a new comedy club', (done) => { - let newClub = { id: 6, name: 'The New Club', street_address: '545 Something St.', zip_code: 88099, rating: 0, city_id: 3 } - - chai.request(app) - .post('/api/v1/cities/3/comedy_clubs') + expect(response).to.have.status(422); + done(); + }); + }); + }); + + describe("/api/v1/cities/:id", () => { + it("should return a status of 200 on a get request", done => { + chai + .request(app) + .get("/api/v1/cities/2") + .end((error, response) => { + expect(response).to.have.status(200); + done(); + }); + }); + + it("should return a single city", done => { + chai + .request(app) + .get("/api/v1/cities/2") + .end((error, response) => { + expect(response.body[0].city).to.equal("New York City"); + done(); + }); + }); + + it("should be return a 204 status on successful PATCH request", done => { + const expected = `City 2's website has been updated to www.ben.com`; + + chai + .request(app) + .patch("/api/v1/cities/2") + .send({ tourism_website: "www.ben.com" }) + .end((error, response) => { + expect(response).to.have.status(201); + expect(response.body).to.equal(expected); + done(); + }); + }); + + it("should return 415 status updatable field is not changed", done => { + chai + .request(app) + .patch("/api/v1/cities/2") + .send({ city: "Ben" }) + .end((error, response) => { + expect(response).to.have.status(415); + done(); + }); + }); + }); + + describe("/api/v1/comedy_clubs", () => { + it("should return a status of 200 with a get request", done => { + chai + .request(app) + .get("/api/v1/comedy_clubs") + .end((error, response) => { + expect(response).to.have.status(200); + done(); + }); + }); + + it("should return array of comedy clubs", done => { + chai + .request(app) + .get("/api/v1/comedy_clubs") + .end((error, response) => { + expect(response.body[0].name).to.equal("Denver Comedy"); + expect(response.body[1].name).to.equal("Other Denver Comedy"); + expect(response.body[2].name).to.equal("NYC Comedy"); + expect(response.body[3].name).to.equal("Austin Comedy"); + expect(response.body[4].name).to.equal("Texas Comedy"); + done(); + }); + }); + + it("should post a new comedy club", done => { + let newClub = { + id: 6, + name: "The New Club", + street_address: "545 Something St.", + zip_code: 88099, + rating: 0, + city_id: 3 + }; + + chai + .request(app) + .post("/api/v1/cities/3/comedy_clubs") .send(newClub) .end((error, response) => { - expect(response).to.have.status(201) - expect(response.body[0]).to.equal(6) - done() - }) - }) - - it('should error with 422 if a required param is missing', (done) => { - let newClub = { id: 6, name: 'The New Club', zip_code: 88099, rating: 0, city_id: 3 } - - chai.request(app) - .post('/api/v1/cities/3/comedy_clubs') + expect(response).to.have.status(201); + expect(response.body[0]).to.equal(6); + done(); + }); + }); + + it("should error with 422 if a required param is missing", done => { + let newClub = { + id: 6, + name: "The New Club", + zip_code: 88099, + rating: 0, + city_id: 3 + }; + + chai + .request(app) + .post("/api/v1/cities/3/comedy_clubs") .send(newClub) .end((error, response) => { - expect(response).to.have.status(422) - done() - }) - }) - }) - - describe('/api/v1/comedy_clubs/:club_id', () => { - - it('should return status of 200 on successful GET request', (done) => { - chai.request(app) - .get('/api/v1/comedy_clubs/3') + expect(response).to.have.status(422); + done(); + }); + }); + }); + + describe("/api/v1/comedy_clubs/:club_id", () => { + it("should return status of 200 on successful GET request", done => { + chai + .request(app) + .get("/api/v1/comedy_clubs/3") .end((error, response) => { - expect(response).to.have.status(200) - done() - }) - }) - - it('should return one comedy club', (done) => { - chai.request(app) - .get('/api/v1/comedy_clubs/3') + expect(response).to.have.status(200); + done(); + }); + }); + + it("should return one comedy club", done => { + chai + .request(app) + .get("/api/v1/comedy_clubs/3") .end((error, response) => { - expect(response.body[0].name).to.equal('NYC Comedy') - done() - }) - }) - - it('should return status of 204 of PATCH request successful', (done) => { - chai.request(app) - .patch('/api/v1/comedy_clubs/5') + expect(response.body[0].name).to.equal("NYC Comedy"); + done(); + }); + }); + + it("should return status of 204 of PATCH request successful", done => { + chai + .request(app) + .patch("/api/v1/comedy_clubs/5") .send({ rating: 4 }) .end((error, response) => { - expect(response).to.have.status(204) - done() - }) - }) - - it('should return status of 415 if required param is missing', (done) => { - chai.request(app) - .patch('/api/v1/comedy_clubs/5') - .send({ name: 'Ben' }) - .end((error, response) => { - expect(response).to.have.status(415) - done() - }) - }) - }) - - describe('/api/v1/cities/:city_id/comedy_clubs/:club_id', () => { - - it('should return status of 202 upon successful delete', (done) => { - chai.request(app) - .delete('/api/v1/cities/1/comedy_clubs/2') - .end((error, response) => { - expect(response).to.have.status(202) - done() - }) - }) - - it('should delete specified club', (done) => { - chai.request(app) - .delete('/api/v1/cities/1/comedy_clubs/2') - .end((error, response) => { - expect(response.body).to.equal('2') - done() - }) - }) - }) -}) + expect(response).to.have.status(204); + done(); + }); + }); + + it("should return status of 415 if required param is missing", done => { + chai + .request(app) + .patch("/api/v1/comedy_clubs/5") + .send({ name: "Ben" }) + .end((error, response) => { + expect(response).to.have.status(415); + done(); + }); + }); + }); + + describe("/api/v1/cities/:city_id/comedy_clubs/:club_id", () => { + it("should return status of 202 upon successful delete", done => { + chai + .request(app) + .delete("/api/v1/cities/1/comedy_clubs/2") + .end((error, response) => { + expect(response).to.have.status(202); + done(); + }); + }); + + it("should delete specified club", done => { + chai + .request(app) + .delete("/api/v1/cities/1/comedy_clubs/2") + .end((error, response) => { + expect(response.body).to.equal("2"); + done(); + }); + }); + }); +}); From b7650314a745dd2f9a683d2ab1256ed014ca1ee7 Mon Sep 17 00:00:00 2001 From: Ahmad Kayyali Date: Tue, 11 Dec 2018 14:44:12 -0700 Subject: [PATCH 02/13] Complete patch fixes for all endpoint and add corresponding tests --- server.js | 6 ++++-- test/server.test.js | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index 66c80ea..e86c13d 100644 --- a/server.js +++ b/server.js @@ -139,8 +139,10 @@ app.patch("/api/v1/comedy_clubs/:club_id", (request, response) => { database("comedy_clubs") .where("id", club_id) .update(rating) - .then(rating => { - response.status(204).json(rating); + .then(row => { + response + .status(201) + .json(`Club ${club_id}'s rating has been updated to ${rating.rating}`); }) .catch(error => { response.status(500).json({ error: error.message }); diff --git a/test/server.test.js b/test/server.test.js index 799a409..4e67654 100644 --- a/test/server.test.js +++ b/test/server.test.js @@ -235,12 +235,14 @@ describe("Server file", () => { }); it("should return status of 204 of PATCH request successful", done => { + const expected = `Club 5's rating has been updated to 4`; chai .request(app) .patch("/api/v1/comedy_clubs/5") .send({ rating: 4 }) .end((error, response) => { - expect(response).to.have.status(204); + expect(response).to.have.status(201); + expect(response.body).to.equal(expected); done(); }); }); From df5f4d3723bad9e5ad6da28c1d8a2b80e31f7bdc Mon Sep 17 00:00:00 2001 From: Ahmad Kayyali Date: Tue, 11 Dec 2018 15:06:04 -0700 Subject: [PATCH 03/13] Add express middleware succesfully to the comedy club patch endpoint --- server.js | 53 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/server.js b/server.js index e86c13d..1e4c1ba 100644 --- a/server.js +++ b/server.js @@ -120,33 +120,44 @@ app.get("/api/v1/comedy_clubs/:club_id", (request, response) => { ); }); -app.patch("/api/v1/comedy_clubs/:club_id", (request, response) => { - const { club_id } = request.params; - const rating = request.body; +app.patch( + "/api/v1/comedy_clubs/:club_id", + (request, response, next) => { + const rating = request.body; - let missingProp = []; + let missingProp = []; - for (let requiredParam of ["rating"]) { - if (!rating[requiredParam]) { - missingProp = [...missingProp, requiredParam]; + for (let requiredParam of ["rating"]) { + if (!rating[requiredParam]) { + missingProp = [...missingProp, requiredParam]; + } } - } - if (missingProp.length) { - response.status(415).json({ error: error.message }); + if (missingProp.length) next("route"); + else next(); + }, + function(request, response, next) { + const { club_id } = request.params; + const rating = request.body; + + database("comedy_clubs") + .where("id", club_id) + .update(rating) + .then(row => { + response + .status(201) + .json( + `Club ${club_id}'s rating has been updated to ${rating.rating}` + ); + }) + .catch(error => { + response.status(500).json({ error: error.message }); + }); } +); - database("comedy_clubs") - .where("id", club_id) - .update(rating) - .then(row => { - response - .status(201) - .json(`Club ${club_id}'s rating has been updated to ${rating.rating}`); - }) - .catch(error => { - response.status(500).json({ error: error.message }); - }); +app.patch("/api/v1/comedy_clubs/:club_id", (request, response, next) => { + response.status(415).json({ error: error.message }); }); app.get("/api/v1/comedy_clubs", (request, response) => { From 35e94ea9f18de25c200fc731d07ea5da824b0f43 Mon Sep 17 00:00:00 2001 From: Ahmad Kayyali Date: Tue, 11 Dec 2018 15:11:08 -0700 Subject: [PATCH 04/13] Refactor server to use middleware on patch enpoints - tests passing --- server.js | 61 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/server.js b/server.js index 1e4c1ba..81ca940 100644 --- a/server.js +++ b/server.js @@ -75,21 +75,30 @@ app.get("/api/v1/cities/:id", (request, response) => { ); }); -app.patch("/api/v1/cities/:id", (request, response) => { - const { id } = request.params; - const tourism_website = request.body; +app.patch( + "/api/v1/cities/:id", + (request, response, next) => { + const tourism_website = request.body; - let missingProp = []; + let missingProp = []; - for (let requiredParam of ["tourism_website"]) { - if (!tourism_website[requiredParam]) { - missingProp = [...missingProp, requiredParam]; + for (let requiredParam of ["tourism_website"]) { + if (!tourism_website[requiredParam]) { + missingProp = [...missingProp, requiredParam]; + } } - } - if (missingProp.length) { + if (!missingProp.length) next("route"); + else next(); + }, + function(request, response, next) { response.status(415).json({ error: error.message }); } +); + +app.patch("/api/v1/cities/:id", (request, response, next) => { + const { id } = request.params; + const tourism_website = request.body; database("cities") .where("id", id) @@ -133,31 +142,29 @@ app.patch( } } - if (missingProp.length) next("route"); + if (!missingProp.length) next("route"); else next(); }, function(request, response, next) { - const { club_id } = request.params; - const rating = request.body; - - database("comedy_clubs") - .where("id", club_id) - .update(rating) - .then(row => { - response - .status(201) - .json( - `Club ${club_id}'s rating has been updated to ${rating.rating}` - ); - }) - .catch(error => { - response.status(500).json({ error: error.message }); - }); + response.status(415).json({ error: error.message }); } ); app.patch("/api/v1/comedy_clubs/:club_id", (request, response, next) => { - response.status(415).json({ error: error.message }); + const { club_id } = request.params; + const rating = request.body; + + database("comedy_clubs") + .where("id", club_id) + .update(rating) + .then(row => { + response + .status(201) + .json(`Club ${club_id}'s rating has been updated to ${rating.rating}`); + }) + .catch(error => { + response.status(500).json({ error: error.message }); + }); }); app.get("/api/v1/comedy_clubs", (request, response) => { From f57fae6d4bc80a4b0b2c7bacabda6da18697488f Mon Sep 17 00:00:00 2001 From: Ahmad Kayyali Date: Tue, 11 Dec 2018 15:12:26 -0700 Subject: [PATCH 05/13] Add cors to project --- package-lock.json | 14 ++++++++++++++ package.json | 1 + server.js | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 945fb9b..7838a83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -432,6 +432,15 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, + "cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -1413,6 +1422,11 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, "object-copy": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", diff --git a/package.json b/package.json index 4773a1e..6109255 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "", "dependencies": { "body-parser": "^1.18.3", + "cors": "^2.8.5", "express": "^4.16.4", "knex": "^0.15.2", "pg": "^7.7.1" diff --git a/server.js b/server.js index 81ca940..8f8fe91 100644 --- a/server.js +++ b/server.js @@ -1,11 +1,12 @@ const express = require("express"); +const cors = require("cors"); const bodyParser = require("body-parser"); const environment = process.env.NODE_ENV || "development"; const config = require("./knexfile")[environment]; const database = require("knex")(config); const app = express(); -app.use(bodyParser.json()); +app.use(bodyParser.json(), cors()); app.set("port", process.env.PORT || 3000); app.locals.title = "BYOB"; app.use(express.static("public")); From 5e41500ba4869ab81d8717128f21205df14f25d0 Mon Sep 17 00:00:00 2001 From: Ahmad Kayyali Date: Wed, 12 Dec 2018 11:20:50 -0700 Subject: [PATCH 06/13] Succesfully scrape the states with amusement parks --- package-lock.json | 1040 ++++++++++++++++++++++++++++++++++++++++-- package.json | 1 + utils/parkScraper.js | 20 + 3 files changed, 1032 insertions(+), 29 deletions(-) create mode 100644 utils/parkScraper.js diff --git a/package-lock.json b/package-lock.json index 7838a83..acc943a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,6 +41,22 @@ "negotiator": "0.6.1" } }, + "ajv": { + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.6.1.tgz", + "integrity": "sha512-ZoJjft5B+EJBjUyu9C9Hc0OZyPZSSlOF+plzouTrg6UlA8f+e/n8NIgBFG/9tppJtpPWfthHakK7juJdNDODww==", + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -69,6 +85,11 @@ "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=" }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=" + }, "array-flatten": { "version": "1.1.1", "resolved": "http://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -84,6 +105,19 @@ "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=" }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -98,14 +132,23 @@ "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, "babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", @@ -118,8 +161,7 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "base": { "version": "0.11.2", @@ -171,6 +213,14 @@ } } }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, "bluebird": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.3.tgz", @@ -212,7 +262,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -251,11 +300,21 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + }, "buffer-writer": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz", "integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==" }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=" + }, "bytes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", @@ -277,6 +336,25 @@ "unset-value": "^1.0.0" } }, + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=" + }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "requires": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, "chai": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", @@ -343,6 +421,16 @@ } } }, + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=" + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + }, "collection-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", @@ -369,7 +457,6 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", - "dev": true, "requires": { "delayed-stream": "~1.0.0" } @@ -387,8 +474,18 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } }, "content-disposition": { "version": "0.5.2", @@ -429,8 +526,7 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cors": { "version": "2.8.5", @@ -441,6 +537,22 @@ "vary": "^1" } }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "requires": { + "array-find-index": "^1.0.1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -449,11 +561,24 @@ "ms": "2.0.0" } }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + }, "decode-uri-component": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" }, + "deep-defaults": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/deep-defaults/-/deep-defaults-1.0.5.tgz", + "integrity": "sha512-5ev/sNkiHTmeTqbDJEDgdQa/Ub0eOMQNix9l+dLLGbwOos7/in5HdvHXI014wqxsET4YeJG9Eq4qj0PJRL8rSw==", + "requires": { + "lodash": "^4.17.5" + } + }, "deep-eql": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", @@ -463,6 +588,19 @@ "type-detect": "^4.0.0" } }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" + }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "requires": { + "clone": "^1.0.2" + } + }, "define-property": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", @@ -503,8 +641,7 @@ "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, "depd": { "version": "1.1.2", @@ -527,16 +664,93 @@ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, + "electron": { + "version": "1.8.8", + "resolved": "https://registry.npmjs.org/electron/-/electron-1.8.8.tgz", + "integrity": "sha512-1f9zJehcTTGjrkb06o6ds+gsRq6SYhZJyxOk6zIWjRH8hVy03y/RzUDELzNas71f5vcvXmfGVvyjeEsadDI8tg==", + "requires": { + "@types/node": "^8.0.24", + "electron-download": "^3.0.1", + "extract-zip": "^1.0.3" + }, + "dependencies": { + "@types/node": { + "version": "8.10.38", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.38.tgz", + "integrity": "sha512-EibsnbJerd0hBFaDjJStFrVbVBAtOy4dgL8zZFw0uOvPqzBAX59Ci8cgjg3+RgJIWhsB5A4c+pi+D4P9tQQh/A==" + } + } + }, + "electron-download": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/electron-download/-/electron-download-3.3.0.tgz", + "integrity": "sha1-LP1U1pZsAZxNSa1l++Zcyc3vaMg=", + "requires": { + "debug": "^2.2.0", + "fs-extra": "^0.30.0", + "home-path": "^1.0.1", + "minimist": "^1.2.0", + "nugget": "^2.0.0", + "path-exists": "^2.1.0", + "rc": "^1.1.2", + "semver": "^5.3.0", + "sumchecker": "^1.2.0" + }, + "dependencies": { + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" + } + } + }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" }, + "enqueue": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/enqueue/-/enqueue-1.0.2.tgz", + "integrity": "sha1-kBTpvOVw7pPKlubI5jrVTBkra8g=", + "requires": { + "sliced": "0.0.5" + }, + "dependencies": { + "sliced": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/sliced/-/sliced-0.0.5.tgz", + "integrity": "sha1-XtwETKTrb3gW1Qui/GPiXY/kcH8=" + } + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es6-promise": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz", + "integrity": "sha512-n6wvpdE43VFtJq+lUDYDBFUwV8TZbuGXLV4D6wKafg13ldznKsyEvatubnmUe31zcvelSzOHF+XbaT+Bl9ObDg==" + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -732,6 +946,40 @@ } } }, + "extract-zip": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", + "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", + "requires": { + "concat-stream": "1.6.2", + "debug": "2.6.9", + "mkdirp": "0.5.1", + "yauzl": "2.4.1" + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "fd-slicer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", + "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "requires": { + "pend": "~1.2.0" + } + }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -774,6 +1022,15 @@ } } }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, "findup-sync": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz", @@ -815,11 +1072,15 @@ "for-in": "^1.0.1" } }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, "form-data": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "dev": true, "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", @@ -850,11 +1111,27 @@ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" }, + "fs-extra": { + "version": "0.30.0", + "resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", + "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^2.1.0", + "klaw": "^1.0.0", + "path-is-absolute": "^1.0.0", + "rimraf": "^2.2.8" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "function-source": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/function-source/-/function-source-0.1.0.tgz", + "integrity": "sha1-2RBL8+RniLVUaMAr8bL6vPj8Ga8=" }, "get-func-name": { "version": "2.0.0", @@ -862,16 +1139,28 @@ "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=" + }, "get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=" }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -903,12 +1192,31 @@ "which": "^1.2.14" } }, + "graceful-fs": { + "version": "4.1.15", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", + "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==" + }, "growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -949,6 +1257,11 @@ "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", "dev": true }, + "home-path": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/home-path/-/home-path-1.0.6.tgz", + "integrity": "sha512-wo+yjrdAtoXt43Vy92a+0IPCYViiyLAHyp0QVS4xL/tfvVz5sXIW1ubLZk3nhVkD92fQpUMKX+fzMjr5F489vw==" + }, "homedir-polyfill": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz", @@ -957,6 +1270,11 @@ "parse-passwd": "^1.0.0" } }, + "hosted-git-info": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==" + }, "http-errors": { "version": "1.6.3", "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", @@ -968,6 +1286,16 @@ "statuses": ">= 1.4.0 < 2" } }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, "iconv-lite": { "version": "0.4.23", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", @@ -976,11 +1304,18 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "requires": { + "repeating": "^2.0.0" + } + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -1039,11 +1374,24 @@ } } }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "requires": { + "builtin-modules": "^1.0.0" + } + }, "is-data-descriptor": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", @@ -1089,6 +1437,22 @@ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, "is-glob": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", @@ -1140,6 +1504,11 @@ "is-unc-path": "^1.0.0" } }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, "is-unc-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", @@ -1148,6 +1517,11 @@ "unc-path-regex": "^0.1.2" } }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" + }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -1168,11 +1542,73 @@ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "jsesc": { + "version": "0.5.0", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsonfile": { + "version": "2.4.0", + "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keypress": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz", + "integrity": "sha1-SjGI1CkbZrT2XtuZ+AaqmuKTWSo=" + }, "kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" }, + "klaw": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", + "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", + "requires": { + "graceful-fs": "^4.1.9" + } + }, "knex": { "version": "0.15.2", "resolved": "https://registry.npmjs.org/knex/-/knex-0.15.2.tgz", @@ -1221,11 +1657,32 @@ "resolve": "^1.1.7" } }, + "load-json-file": { + "version": "1.1.0", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, "lodash": { "version": "4.17.11", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, "make-iterator": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", @@ -1239,6 +1696,11 @@ "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=" + }, "map-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", @@ -1252,6 +1714,23 @@ "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, + "meow": { + "version": "3.7.0", + "resolved": "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "requires": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + } + }, "merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", @@ -1305,7 +1784,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -1315,6 +1793,24 @@ "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" }, + "minstache": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minstache/-/minstache-1.2.0.tgz", + "integrity": "sha1-/xzEA6woRPaNvxjGYhKb5+sO/EE=", + "requires": { + "commander": "1.0.4" + }, + "dependencies": { + "commander": { + "version": "1.0.4", + "resolved": "http://registry.npmjs.org/commander/-/commander-1.0.4.tgz", + "integrity": "sha1-Xt6xruI8T7VBprcNaSq+8ZZpotM=", + "requires": { + "keypress": "0.1.x" + } + } + } + }, "mixin-deep": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", @@ -1399,6 +1895,14 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, + "multiline": { + "version": "1.0.2", + "resolved": "http://registry.npmjs.org/multiline/-/multiline-1.0.2.tgz", + "integrity": "sha1-abHyX/B00oKJBPJE3dBrfZbvbJM=", + "requires": { + "strip-indent": "^1.0.0" + } + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -1422,6 +1926,62 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" }, + "nightmare": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/nightmare/-/nightmare-3.0.1.tgz", + "integrity": "sha512-WptvyPfp5mHRRYHzt6+4xazaR9cc437BuLJI6cLFnqwwgxgdtsFImfBVDeTUCPAeLrkp5VryX5jlw7Wwg+UnFQ==", + "requires": { + "debug": "^2.2.0", + "deep-defaults": "^1.0.3", + "defaults": "^1.0.2", + "electron": "^1.8.4", + "enqueue": "^1.0.2", + "function-source": "^0.1.0", + "jsesc": "^0.5.0", + "minstache": "^1.2.0", + "mkdirp": "^0.5.1", + "multiline": "^1.0.2", + "once": "^1.3.3", + "rimraf": "^2.4.3", + "sliced": "1.0.1", + "split2": "^2.0.1" + } + }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "nugget": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/nugget/-/nugget-2.0.1.tgz", + "integrity": "sha1-IBCVpIfhrTYIGzQy+jytpPjQcbA=", + "requires": { + "debug": "^2.1.3", + "minimist": "^1.1.0", + "pretty-bytes": "^1.0.2", + "progress-stream": "^1.1.0", + "request": "^2.45.0", + "single-line-log": "^1.1.2", + "throttleit": "0.0.2" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -1455,6 +2015,11 @@ } } }, + "object-keys": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz", + "integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=" + }, "object-visit": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", @@ -1503,7 +2068,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1" } @@ -1528,6 +2092,14 @@ "path-root": "^0.1.1" } }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "requires": { + "error-ex": "^1.2.0" + } + }, "parse-passwd": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", @@ -1543,11 +2115,18 @@ "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=" }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "requires": { + "pinkie-promise": "^2.0.0" + } + }, "path-is-absolute": { "version": "1.0.1", "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "path-parse": { "version": "1.0.6", @@ -1572,12 +2151,32 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, "pathval": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "dev": true }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, "pg": { "version": "7.7.1", "resolved": "https://registry.npmjs.org/pg/-/pg-7.7.1.tgz", @@ -1628,6 +2227,24 @@ "split": "^1.0.0" } }, + "pify": { + "version": "2.3.0", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "requires": { + "pinkie": "^2.0.0" + } + }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -1656,11 +2273,28 @@ "xtend": "^4.0.0" } }, + "pretty-bytes": { + "version": "1.0.4", + "resolved": "http://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", + "integrity": "sha1-CiLoIQYJrTVUL4yNXSFZr/B1HIQ=", + "requires": { + "get-stdin": "^4.0.1", + "meow": "^3.1.0" + } + }, "process-nextick-args": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" + }, + "progress-stream": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/progress-stream/-/progress-stream-1.2.0.tgz", + "integrity": "sha1-LNPP6jO6OonJwSHsM0er6asSX3c=", + "requires": { + "speedometer": "~0.1.2", + "through2": "~0.2.3" + } }, "proxy-addr": { "version": "2.0.4", @@ -1671,6 +2305,16 @@ "ipaddr.js": "1.8.0" } }, + "psl": { + "version": "1.1.31", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", + "integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==" + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, "qs": { "version": "6.6.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.6.0.tgz", @@ -1693,11 +2337,40 @@ "unpipe": "1.0.0" } }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + } + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + } + }, "readable-stream": { "version": "2.3.6", "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -1716,6 +2389,15 @@ "resolve": "^1.1.6" } }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "requires": { + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + } + }, "regenerator-runtime": { "version": "0.11.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", @@ -1740,6 +2422,48 @@ "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "requires": { + "is-finite": "^1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + } + } + }, "resolve": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", @@ -1767,6 +2491,14 @@ "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "requires": { + "glob": "^7.0.5" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -1859,6 +2591,24 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + }, + "single-line-log": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/single-line-log/-/single-line-log-1.1.2.tgz", + "integrity": "sha1-wvg/Jzo+GhbtsJlWYdoO1e8DM2Q=", + "requires": { + "string-width": "^1.0.1" + } + }, + "sliced": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", + "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" + }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -1986,6 +2736,39 @@ "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" }, + "spdx-correct": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==" + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.2.tgz", + "integrity": "sha512-qky9CVt0lVIECkEsYbNILVnPvycuEBkXoMFLRWsREkomQLevYhtRKC+R91a5TOAQ3bCMjikRwhyaRqj1VYatYg==" + }, + "speedometer": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/speedometer/-/speedometer-0.1.4.tgz", + "integrity": "sha1-mHbb0qFp0xFUAtSObqYynIgWpQ0=" + }, "split": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", @@ -2002,6 +2785,41 @@ "extend-shallow": "^3.0.0" } }, + "split2": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", + "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", + "requires": { + "through2": "^2.0.2" + }, + "dependencies": { + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } + } + }, + "sshpk": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.2.tgz", + "integrity": "sha512-Ra/OXQtuh0/enyl4ETZAfTaeksa6BXks5ZcjpSUNrjBr0DvrJKX+1fsKDPpT9TBXgHAFsa4510aNVgI8g/+SzA==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, "static-extend": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", @@ -2026,15 +2844,62 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, "string_decoder": { "version": "1.1.1", "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, "requires": { "safe-buffer": "~5.1.0" } }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "requires": { + "get-stdin": "^4.0.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" + }, + "sumchecker": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-1.3.1.tgz", + "integrity": "sha1-ebs7RFbdBPGOvbwNcDodHa7FEF0=", + "requires": { + "debug": "^2.2.0", + "es6-promise": "^4.0.5" + } + }, "superagent": { "version": "3.8.3", "resolved": "https://registry.npmjs.org/superagent/-/superagent-3.8.3.tgz", @@ -2083,11 +2948,56 @@ "resolved": "https://registry.npmjs.org/tarn/-/tarn-1.1.4.tgz", "integrity": "sha512-j4samMCQCP5+6Il9/cxCqBd3x4vvlLeVdoyGex0KixPKl4F8LpNbDSC6NDhjianZgUngElRr9UI1ryZqJDhwGg==" }, + "throttleit": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-0.0.2.tgz", + "integrity": "sha1-z+34jmDADdlpe2H90qg0OptoDq8=" + }, "through": { "version": "2.3.8", "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, + "through2": { + "version": "0.2.3", + "resolved": "http://registry.npmjs.org/through2/-/through2-0.2.3.tgz", + "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=", + "requires": { + "readable-stream": "~1.1.9", + "xtend": "~2.1.1" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, + "xtend": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz", + "integrity": "sha1-bv7MKk2tjmlixJAbM3znuoe10os=", + "requires": { + "object-keys": "~0.4.0" + } + } + } + }, "tildify": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/tildify/-/tildify-1.2.0.tgz", @@ -2134,6 +3044,40 @@ "repeat-string": "^1.6.1" } }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + } + } + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -2149,6 +3093,11 @@ "mime-types": "~2.1.18" } }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + }, "unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", @@ -2227,6 +3176,14 @@ } } }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "requires": { + "punycode": "^2.1.0" + } + }, "urix": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", @@ -2240,8 +3197,7 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "utils-merge": { "version": "1.0.1", @@ -2261,11 +3217,30 @@ "homedir-polyfill": "^1.0.1" } }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -2277,13 +3252,20 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, + "yauzl": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", + "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", + "requires": { + "fd-slicer": "~1.0.1" + } } } } diff --git a/package.json b/package.json index 6109255..c9e36f3 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "cors": "^2.8.5", "express": "^4.16.4", "knex": "^0.15.2", + "nightmare": "^3.0.1", "pg": "^7.7.1" }, "devDependencies": { diff --git a/utils/parkScraper.js b/utils/parkScraper.js new file mode 100644 index 0000000..e507cf3 --- /dev/null +++ b/utils/parkScraper.js @@ -0,0 +1,20 @@ +const Nightmare = require("nightmare"); +const nightmare = Nightmare({ show: true }); +const fs = require("fs"); + +nightmare + .viewport(1025, 1500) + .goto("https://www.ultimaterollercoaster.com/coasters/parks/states") + .evaluate(() => { + let state = document.querySelectorAll("h3.new"); + state = [].slice.call(state); + + state = state.map(location => location.innerText); + + return state; + }) + .end() + .then(result => { + console.log(JSON.stringify(result, null, 4)); + }) + .catch(error => console.error("Here is your error", error)); From fc1cc89f62240aede9f56914b882fe11424b8dc2 Mon Sep 17 00:00:00 2001 From: Alexander Rau <38387912+raualex@users.noreply.github.com> Date: Wed, 12 Dec 2018 11:44:58 -0700 Subject: [PATCH 07/13] Update server.js --- server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 491e44b..399fedb 100644 --- a/server.js +++ b/server.js @@ -63,7 +63,7 @@ app.patch("/api/v1/cities/:id", (request, response, next) => { .update({ tourism_website }) .then(row => { response - .status(201) + .status(204) .json( `City ${id}'s website has been updated to ${ tourism_website.tourism_website @@ -146,7 +146,7 @@ app.get("/api/v1/comedy_clubs/:club_id", (request, response) => { database("comedy_clubs") .where("id", club_id) .select() - .then(club => response.status(200).json(club)) + .then(club => response.status(204).json(club)) .catch(error => response.status(500).json(`Error fetching city: ${error.message}`) ); From a4aaf37d71d033dff15e56a2edb0aa164d2a3d8e Mon Sep 17 00:00:00 2001 From: Alexander Rau <38387912+raualex@users.noreply.github.com> Date: Wed, 12 Dec 2018 11:52:13 -0700 Subject: [PATCH 08/13] Update server.test.js --- test/server.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/server.test.js b/test/server.test.js index 4e67654..e4d04d5 100644 --- a/test/server.test.js +++ b/test/server.test.js @@ -129,7 +129,7 @@ describe("Server file", () => { .patch("/api/v1/cities/2") .send({ tourism_website: "www.ben.com" }) .end((error, response) => { - expect(response).to.have.status(201); + expect(response).to.have.status(204); expect(response.body).to.equal(expected); done(); }); @@ -241,7 +241,7 @@ describe("Server file", () => { .patch("/api/v1/comedy_clubs/5") .send({ rating: 4 }) .end((error, response) => { - expect(response).to.have.status(201); + expect(response).to.have.status(204); expect(response.body).to.equal(expected); done(); }); From eef3861fa7fc876f1fc1eb6a9ed7d1cd56011740 Mon Sep 17 00:00:00 2001 From: Ahmad Kayyali Date: Wed, 12 Dec 2018 12:10:17 -0700 Subject: [PATCH 09/13] Pull data for cities with Amusement Parks --- package-lock.json | 17 +++++++++++++++++ package.json | 1 + utils/dataCleaner.js | 19 +++++++++++++++++++ utils/parkScraper.js | 17 ++++++++++++----- 4 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 utils/dataCleaner.js diff --git a/package-lock.json b/package-lock.json index acc943a..d4b60fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -315,6 +315,14 @@ "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=" }, + "bulk-require": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bulk-require/-/bulk-require-1.0.1.tgz", + "integrity": "sha1-yz0DnmmBOaRE/FdLJh1rOyz0TIk=", + "requires": { + "glob": "^7.1.1" + } + }, "bytes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", @@ -537,6 +545,15 @@ "vary": "^1" } }, + "countrystatesjs": { + "version": "0.0.12", + "resolved": "https://registry.npmjs.org/countrystatesjs/-/countrystatesjs-0.0.12.tgz", + "integrity": "sha1-EkMC9bgG4qIiS3ZcT/jOtRj34a0=", + "requires": { + "bulk-require": "^1.0.0", + "lodash": "^4.2.1" + } + }, "currently-unhandled": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", diff --git a/package.json b/package.json index c9e36f3..b2a30eb 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "dependencies": { "body-parser": "^1.18.3", "cors": "^2.8.5", + "countrystatesjs": "0.0.12", "express": "^4.16.4", "knex": "^0.15.2", "nightmare": "^3.0.1", diff --git a/utils/dataCleaner.js b/utils/dataCleaner.js new file mode 100644 index 0000000..707b379 --- /dev/null +++ b/utils/dataCleaner.js @@ -0,0 +1,19 @@ +function parkCleaner(info) { + let parks = info[0]; + let cities = info[1]; + let cleaned = parks.reduce((acc, park, index) => { + let city = cities[index]; + if (acc[city]) { + let parks = [acc[city].parks]; + acc[city] = { parks: [...parks, park] }; + } + + acc[city] = { parks: park }; + + return acc; + }, {}); + + return cleaned; +} + +module.exports.parkCleaner = parkCleaner; diff --git a/utils/parkScraper.js b/utils/parkScraper.js index e507cf3..851e8d1 100644 --- a/utils/parkScraper.js +++ b/utils/parkScraper.js @@ -2,19 +2,26 @@ const Nightmare = require("nightmare"); const nightmare = Nightmare({ show: true }); const fs = require("fs"); +var cleaner = require("./dataCleaner.js").parkCleaner; + nightmare .viewport(1025, 1500) .goto("https://www.ultimaterollercoaster.com/coasters/parks/states") .evaluate(() => { - let state = document.querySelectorAll("h3.new"); - state = [].slice.call(state); + let parks = document.querySelectorAll(".tpList li a"); + let cities = document.querySelectorAll(".tpList li i"); + + parks = [].slice.call(parks); + cities = [].slice.call(cities); - state = state.map(location => location.innerText); + parks = parks.map(park => park.innerText); + cities = cities.map(city => city.innerText); - return state; + return [parks, cities]; }) .end() .then(result => { - console.log(JSON.stringify(result, null, 4)); + let cleaned = cleaner(result); + console.log(JSON.stringify(cleaned, null, 4)); }) .catch(error => console.error("Here is your error", error)); From 67ec784c86c827aa424860dbec14acbf537ce27e Mon Sep 17 00:00:00 2001 From: Ahmad Kayyali Date: Wed, 12 Dec 2018 14:06:25 -0700 Subject: [PATCH 10/13] Write parks to js file for seeding --- data/parkData.js | 215 +++++++++++++++++++++++++++++++++++++++++++ utils/parkScraper.js | 4 + 2 files changed, 219 insertions(+) create mode 100644 data/parkData.js diff --git a/data/parkData.js b/data/parkData.js new file mode 100644 index 0000000..d9ec7f8 --- /dev/null +++ b/data/parkData.js @@ -0,0 +1,215 @@ +const data = { + Bessemer: { parks: "Alabama Splash Adventure" }, + Foley: { parks: "OWA" }, + Huntsville: { parks: "Southern Adventures" }, + Tuscumbia: { parks: "Spring Park" }, + "Gulf Shores": { parks: "Waterville USA" }, + Phoenix: { parks: "Enchanted Island" }, + Tucson: { parks: "Funtasticks Family Fun Park" }, + "Queen Creek": { parks: "Schnepf Farms" }, + "North Little Rock": { parks: "Funland" }, + "Hot Springs": { parks: "Magic Springs & Crystal Falls" }, + Stanton: { parks: "Adventure City" }, + "San Diego": { parks: "SeaWorld San Diego" }, + Fresno: { parks: "Rotary Storyland & Playland" }, + "El Cajon": { parks: "Boomers! El Cajon" }, + "Fountain Valley": { parks: "Boomers! Fountain Valley" }, + Upland: { parks: "Boomers! Upland" }, + "Santa Clara": { parks: "California's Great America" }, + Riverside: { parks: "John's Incredible Pizza Company" }, + Anaheim: { parks: "Disneyland Park" }, + Lodi: { parks: "Fun Town at Micke Grove" }, + Sacramento: { parks: "Scandia Family Fun Center" }, + Gilroy: { parks: "Gilroy Gardens Family Theme Park" }, + "San Jose": { parks: "Happy Hollow Park & Zoo" }, + Roseville: { parks: "John's Incredible Pizza Company" }, + Merced: { parks: "Kiddieland" }, + "Buena Park": { parks: "Knott's Berry Farm" }, + Carlsbad: { parks: "LEGOLAND California" }, + Vacaville: { parks: "Nut Tree Family Park" }, + Oakland: { parks: "Oakland Zoo" }, + "Santa Monica": { parks: "Pacific Park" }, + Concord: { parks: "Pixieland Park" }, + "Santa Cruz": { parks: "Santa Cruz Beach Boardwalk" }, + Ontario: { parks: "Scandia Fun Center" }, + Vallejo: { parks: "Six Flags Discovery Kingdom" }, + Valencia: { parks: "Six Flags Magic Mountain" }, + Sonoma: { parks: "Sonoma TrainTown Railroad" }, + "Universal City": { parks: "Universal Studios Hollywood" }, + Golden: { parks: "Amusement Park at Heritage Square" }, + Pueblo: { parks: "City Park" }, + Denver: { parks: "Lakeside Amusement Park" }, + "Glenwood Springs": { parks: "Glenwood Caverns Adventure Park" }, + Henderson: { parks: "Mile High Flea Market" }, + Cascade: { parks: "Santa's Workshop" }, + Bristol: { parks: "Lake Compounce" }, + "New London": { parks: "Ocean Beach Park" }, + Middlebury: { parks: "Quassy Amusement Park" }, + "Jacksonville Beach": { parks: "Adventure Landing" }, + "Altamonte Springs": { parks: "Birthday World" }, + "Daytona Beach": { parks: "Boardwalk Amusements" }, + Dania: { parks: "Boomers! Dania Beach" }, + Tampa: { parks: "Lowry Park Zoo" }, + Clearwater: { parks: "Celebration Station" }, + "Panama City Beach": { parks: "Race City PCB" }, + "Lake Buena Vista": { parks: "EPCOT" }, + Kissimmee: { parks: "Old Town" }, + Orlando: { parks: "Universal's Islands of Adventure" }, + "Port Charlotte": { parks: "Kidstar Park" }, + Naples: { parks: "King Richard's Family Fun Park" }, + "Winter Haven": { parks: "LEGOLAND Florida" }, + Pensacola: { parks: "Sam's Fun City" }, + "Fort Lauderdale": { parks: "Uncle Bernie's Amusement Park" }, + Augusta: { parks: "Adventure Crossing" }, + Fayetteville: { parks: "Fun Junction USA" }, + Rossville: { parks: "Lake Winnepesaukah" }, + Austell: { parks: "Six Flags Over Georgia" }, + Valdosta: { parks: "Wild Adventures" }, + Athol: { parks: "Silverwood Theme Park" }, + Rexburg: { parks: "Yellowstone Bear World" }, + Union: { parks: "Donley's Wild West Town" }, + Utica: { parks: "Enchanted Forest" }, + Norridge: { parks: "Go Bananas" }, + Bloomington: { parks: "Nickelodeon Universe" }, + Burbank: { parks: "Haunted Trails" }, + Joliet: { parks: "Haunted Trails" }, + "Villa Park": { parks: "Safari Land" }, + "East Dundee": { parks: "Santa's Village Azoosment Park" }, + Gurnee: { parks: "Six Flags Great America" }, + "Columbia City": { parks: "Fun Center Paiges Crossing" }, + "Santa Claus": { parks: "Holiday World & Splashin' Safari" }, + Monticello: { parks: "Indiana Beach" }, + Indianapolis: { parks: "Indianapolis Zoo" }, + Greenfield: { parks: "That Fun Place" }, + Altoona: { parks: "Lakemont Park" }, + "Arnolds Park": { parks: "Arnolds Park" }, + Wichita: { parks: "All Star Adventures" }, + Pittsburg: { parks: "Kiddieland Lincoln Park" }, + Olathe: { parks: "Zonkers" }, + "Bowling Green": { parks: "Beech Bend Park" }, + Louisville: { parks: "Kentucky Kingdom" }, + "New Orleans": { parks: "Carousel Gardens" }, + "Baton Rouge": { parks: "Dixie Landin' & Blue Bayou Waterpark" }, + Saco: { parks: "Funtown Splashtown USA" }, + "Old Orchard Beach": { parks: "Palace Playland" }, + York: { parks: "York's Wild Kingdom" }, + "New Market": { parks: "Adventure Park USA" }, + "West Ocean City": { parks: "Baja Amusements" }, + "Ocean City": { parks: "Playland's Castaway Cove" }, + "Upper Marlboro": { parks: "Six Flags America" }, + "East Falmouth": { parks: "Barnstable County Fair" }, + Carver: { parks: "Edaville USA" }, + Agawam: { parks: "Six Flags New England" }, + "Houghton Lake": { parks: "Funland Amusement Park" }, + Saginaw: { parks: "Kokomo's Family Fun Center" }, + Muskegon: { parks: "Michigan's Adventure" }, + Chesaning: { parks: "Saginaw County Fairgrounds" }, + "St. Paul": { parks: "Como Town" }, + Brainerd: { parks: "Paul Bunyan Land" }, + Shakopee: { parks: "Valleyfair" }, + Brookhaven: { parks: "Exchange Club Fair" }, + "Osage Beach": { parks: "Miner Mike's Adventure Town" }, + "Kansas City": { parks: "Worlds of Fun" }, + Branson: { parks: "Silver Dollar City" }, + Eureka: { parks: "Six Flags St. Louis" }, + Laurel: { parks: "Amusement Park Drive-In" }, + Omaha: { parks: "Skateland" }, + Wahoo: { parks: "Saunders County Fairgrounds" }, + "Las Vegas": { parks: "Stratosphere Tower Hotel & Casino" }, + Jean: { parks: "Buffalo Bill's Hotel and Casino" }, + Sparks: { parks: "Wild Island Family Adventure Park" }, + Salem: { parks: "Canobie Lake Park" }, + Jefferson: { parks: "Santa's Village" }, + Nashua: { parks: "FunWorld" }, + Glen: { parks: "Story Land" }, + Bayville: { parks: "Blackbeard's Cave" }, + "Scotch Plains": { parks: "Bowcraft Amusement Park" }, + "Seaside Heights": { parks: "Casino Pier" }, + Clementon: { parks: "Clementon Park & Splash World" }, + "Beach Haven": { parks: "Fantasy Island" }, + "Point Pleasant Beach": { parks: "Jenkinson's Boardwalk" }, + Keansburg: { parks: "Keansburg Amusement Park" }, + Hope: { parks: "Land of Make Believe & Pirates Cove" }, + Wildwood: { parks: "Morey's Surfside Pier" }, + Jackson: { parks: "Six Flags Great Adventure" }, + "Atlantic City": { parks: "Steel Pier" }, + "Egg Harbor Township": { parks: "Storybook Land" }, + "Mt. Laurel": { parks: "The Funplex" }, + Albuquerque: { parks: "iT'Z" }, + "Sunland Park": { parks: "Western Playland" }, + Farmingdale: { parks: "Adventureland" }, + Brooklyn: { parks: "Memphis Kiddie Park" }, + Medford: { parks: "Boomers! Medford" }, + "Darien Center": { parks: "Darien Lake" }, + Queens: { parks: "Fantasy Forest" }, + "Grand Island": { parks: "Fantasy Island" }, + "Staten Island": { parks: "Fantasy Shore Amusement Park" }, + Latham: { parks: "Hoffman's Playland" }, + "Lake George": { parks: "The Great Escape & Splashwater Kingdom" }, + "Bemus Point": { parks: "Midway Park" }, + Rye: { parks: "Playland" }, + "North Pole": { parks: "Santa's Workshop" }, + Rochester: { parks: "Seabreeze Amusement Park" }, + "Sylvan Beach": { parks: "Sylvan Beach Amusement Park" }, + "New York": { parks: "Victorian Gardens at Wollman Rink" }, + Charlotte: { parks: "Carowinds" }, + Cherokee: { parks: "Santa's Land" }, + Williamston: { parks: "Deadwood" }, + Sandusky: { parks: "Cedar Point" }, + Powell: { parks: "Columbus Zoo and Aquarium" }, + Cincinnati: { parks: "Coney Island" }, + Aurora: { parks: "Geauga Lake's Wildwater Kingdom" }, + Mason: { parks: "Kings Island" }, + Ross: { parks: "Stricker's Grove" }, + "New Philadelphia": { parks: "Tuscora Park" }, + Bartlesville: { parks: "Bartlesville Kiddie Park" }, + "Oklahoma City": { parks: "Frontier City" }, + Turner: { parks: "Enchanted Forest" }, + Portland: { parks: "Oaks Park" }, + "Conneaut Lake": { parks: "Conneaut Lake Park" }, + Tipton: { parks: "DelGrosso's Amusement Park" }, + Allentown: { parks: "Dorney Park & Wildwater Kingdom" }, + Lancaster: { parks: "Dutch Wonderland" }, + "Cranberry Township": { parks: "Fun Fore All" }, + Hershey: { parks: "Hersheypark" }, + Ligonier: { parks: "Idlewild & Soak Zone" }, + "West Mifflin": { parks: "Kennywood" }, + Elysburg: { parks: "Knoebels Amusement Park" }, + "East Stroudsburg": { parks: "Pocono Mt. Go-Karts & Play Park" }, + Langhorne: { parks: "Sesame Place" }, + Erie: { parks: "Waldameer Park" }, + "Myrtle Beach": { parks: "Family Kingdom Amusement Park" }, + "North Myrtle Beach": { parks: "O.D. Pavilion Amusement Park" }, + Deadwood: { parks: "Boondocks" }, + "Sioux Falls": { parks: "Thunder Road" }, + "Pigeon Forge": { parks: "Dollywood" }, + Sevierville: { parks: "NASCAR SpeedPark" }, + Chattanooga: { parks: "Sir Goony's Family Fun Center" }, + Pflugerville: { parks: "Austin's Park n' Pizza" }, + Galveston: { parks: "Galveston Island Pleasure Pier" }, + Houston: { parks: "Zuma Fun Center" }, + Lubbock: { parks: "Joyland Amusement Park" }, + Kemah: { parks: "Kemah Boardwalk Amusements" }, + "San Antonio": { parks: "Six Flags Fiesta Texas" }, + "El Paso": { parks: "Oasis Lanes" }, + Carrollton: { parks: "Sandy Lake Amusement Park" }, + Arlington: { parks: "Six Flags Over Texas" }, + Amarillo: { parks: "Wonderland Park" }, + Canton: { parks: "YesterLand Farm" }, + Seguin: { parks: "ZDT's Amusement Park" }, + Farmington: { parks: "Lagoon" }, + Lehi: { parks: "Seven Peaks Fun Center" }, + Williamsburg: { parks: "Go-Karts Plus" }, + Fredericksburg: { parks: "Central Park Funland" }, + Doswell: { parks: "Kings Dominion" }, + "Virginia Beach": { parks: "Motor World Virginia Beach" }, + Pasco: { parks: "Country Mercantile" }, + Puyallup: { parks: "Puyallup Fair" }, + Carnation: { parks: "Remlinger Farms" }, + Spokane: { parks: "Riverfront Park" }, + "Federal Way": { parks: "Wild Waves & Enchanted Forest" }, + Huntington: { parks: "Camden Park" }, + "Green Bay": { parks: "Bay Beach" }, + "Wisconsin Dells": { parks: "Timber Falls Adventure Golf" }, + Marshall: { parks: "Little Amerricka" } +}; diff --git a/utils/parkScraper.js b/utils/parkScraper.js index 851e8d1..28efa45 100644 --- a/utils/parkScraper.js +++ b/utils/parkScraper.js @@ -22,6 +22,10 @@ nightmare .end() .then(result => { let cleaned = cleaner(result); + fs.writeFileSync("./data/parkData.js", JSON.stringify(cleaned), err => { + if (err) throw err; + console.log("file saved"); + }); console.log(JSON.stringify(cleaned, null, 4)); }) .catch(error => console.error("Here is your error", error)); From 1705000eab35f65d9fd1f4a5de86883a822adbef Mon Sep 17 00:00:00 2001 From: Ahmad Kayyali Date: Wed, 12 Dec 2018 14:09:23 -0700 Subject: [PATCH 11/13] Create migration for theme_parks --- db/migrations/20181212140640_add_parks.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 db/migrations/20181212140640_add_parks.js diff --git a/db/migrations/20181212140640_add_parks.js b/db/migrations/20181212140640_add_parks.js new file mode 100644 index 0000000..bb14ca7 --- /dev/null +++ b/db/migrations/20181212140640_add_parks.js @@ -0,0 +1,11 @@ +exports.up = function(knex, Promise) { + return knex.schema.table("cities", table => { + table.string("theme_parks"); + }); +}; + +exports.down = function(knex, Promise) { + return knex.schema.table("cities", table => { + table.dropColumn("theme_parks"); + }); +}; From 4cb6382dc0fc317a2037258468f9faefe399b395 Mon Sep 17 00:00:00 2001 From: Ahmad Kayyali Date: Wed, 12 Dec 2018 14:26:10 -0700 Subject: [PATCH 12/13] Commit to save --- data/citiesdata.js | 454 +++++++++++++++++++++------------------- data/dataCleaner.js | 42 ++-- data/parkData.js | 457 ++++++++++++++++++++++------------------- db/seeds/dev/cities.js | 71 ++++--- utils/parkScraper.js | 11 +- 5 files changed, 554 insertions(+), 481 deletions(-) diff --git a/data/citiesdata.js b/data/citiesdata.js index 0e39897..4a69b0b 100644 --- a/data/citiesdata.js +++ b/data/citiesdata.js @@ -1,214 +1,242 @@ const cities = [ - { - city: 'Denver', - state: 'CO', - primary_airport: 'Denver International Airport', - population: 704621, - tourism_website: 'https://www.denver.org' - }, - { - city: 'New York City', - state: 'NY', - primary_airport: 'LaGuardia Airport', - population: 8623000, - tourism_website: 'https://www.nyc.com' - }, - { - city: 'Chicago', - state: 'IL', - primary_airport: 'O\'Hare International Airport', - population: 2716000, - tourism_website: 'https://www.cityofchicago.org' - }, - { - city: 'Atlanta', - state: 'GA', - primary_airport: 'Hartsfield-Jackson Atlanta International Airport', - population: 486290, - tourism_website: 'https://www.atlanta.com' - }, - { - city: 'Detroit', - state: 'MI', - primary_airport: 'Detroit Metropolitan Airport', - population: 673104, - tourism_website: 'https://www.visitdetroit.com' - }, - { - city: 'Los Angeles', - state: 'CA', - primary_airport: 'Los Angeles International Airport', - population: 4000000, - tourism_website: 'https://www.discoverlosangeles.com' - }, - { - city: 'Philadelphia', - state: 'PA', - primary_airport: 'Philadelphia International Airport', - population: 1581000, - tourism_website: 'https://www.visitphilly.com' - }, - { - city: 'Boston', - state: 'MA', - primary_airport: 'Logan International Airport', - population: 685094, - tourism_website: 'https://www.bostonusa.com' - }, - { - city: 'Miami', - state: 'FL', - primary_airport: 'Miami International Airport', - population: 463347, - tourism_website: 'https://www.visitflorida.com' - }, - { - city: 'Minneapolis', - state: 'MN', - primary_airport: 'Minneapolis-Saint Paul International Airport', - population: 422331, - tourism_website: 'https://www.minneapolis.org' - }, - { - city: 'Austin', - state: 'TX', - primary_airport: 'Austin-Bergstrom International Airport', - population: 950715, - tourism_website: 'https://www.austintexas.org' - }, - { - city: 'Dallas', - state: 'TX', - primary_airport: 'Dallas/Fort Worth International Airport', - population: 1341000, - tourism_website: 'https://www.visitdallas.com' - }, - { - city: 'Seattle', - state: 'WA', - primary_airport: 'Seattle-Tacoma International Airport', - population: 724745, - tourism_website: 'https://www.visitseattle.org' - }, - { - city: 'San Diego', - state: 'CA', - primary_airport: 'San Diego International Airport', - population: 1420000, - tourism_website: 'https://www.sandiego.org' - }, - { - city: 'Las Vegas', - state: 'NV', - primary_airport: 'McCarran International Airport', - population: 641676, - tourism_website: 'https://www.visitlasvegas.com' - }, - { - city: 'Baltimore', - state: 'MD', - primary_airport: 'Baltimore-Washington International Airport', - population: 611648, - tourism_website: 'https://www.baltimore.org' - }, - { - city: 'Nashville', - state: 'TN', - primary_airport: 'Nashville International Airport', - population: 691243, - tourism_website: 'https://www.visitmusiccity.com' - }, - { - city: 'Louisville', - state: 'KY', - primary_airport: 'Louisville International Airport', - population: 616261, - tourism_website: 'https://www.gotolouisville.com' - }, - { - city: 'New Orleans', - state: 'LA', - primary_airport: 'Louis Armstrong New Orleans International Airport', - population: 393292, - tourism_website: 'https://www.neworleans.com' - }, - { - city: 'Charlotte', - state: 'NC', - primary_airport: 'Charlotte Douglas International Airport', - population: 859035, - tourism_website: 'https://www.visitnc.com' - }, - { - city: 'Cleveland', - state: 'OH', - primary_airport: 'Cleveland Hopkins International Airport', - population: 385525, - tourism_website: 'https://www.thisiscleveland.com' - }, - { - city: 'Indianapolis', - state: 'IN', - primary_airport: 'Indianapolis International Airport', - population: 872680, - tourism_website: 'https://www.visitindy.com' - }, - { - city: 'Phoenix', - state: 'AZ', - primary_airport: 'Phoenix Sky Harbor International Airport', - population: 1626000, - tourism_website: 'https://www.visitphoenix.com' - }, - { - city: 'Kansas City', - state: 'MO', - primary_airport: 'Kansas City International Airport', - population: 488943, - tourism_website: 'https://www.visitkc.com' - }, - { - city: 'Cincinnati', - state: 'OH', - primary_airport: 'Cincinnati Municipal Airport', - population: 301301, - tourism_website: 'https://www.cincinnatiusa.com' - }, - { - city: 'Oklahoma City', - state: 'OK', - primary_airport: 'Will Rogers World Airport', - population: 643648, - tourism_website: 'https://www.visitokc.com' - }, - { - city: 'Houston', - state: 'TX', - primary_airport: 'George Bush International Airport', - population: 2313000, - tourism_website: 'https://www.visithoustontexas.com' - }, - { - city: 'San Francisco', - state: 'CA', - primary_airport: 'San Francisco International Airport', - population: 884363, - tourism_website: 'https://www.sftravel.com' - }, - { - city: 'Portland', - state: 'OR', - primary_airport: 'Portland International Airport', - population: 647805, - tourism_website: 'https://www.travelportland.com' - }, - { - city: 'Milwaukee', - state: 'WI', - primary_airport: 'General Mitchell International Airport', - population: 595351, - tourism_website: 'https://www.visitmilwaukee.org' - } -] - -module.exports = cities; \ No newline at end of file + { + city: "Denver", + state: "CO", + primary_airport: "Denver International Airport", + population: 704621, + tourism_website: "https://www.denver.org", + theme_parks: "Lakeside Amusement Park" + }, + { + city: "New York City", + state: "NY", + primary_airport: "LaGuardia Airport", + population: 8623000, + tourism_website: "https://www.nyc.com", + theme_parks: "None" + }, + { + city: "Chicago", + state: "IL", + primary_airport: "O'Hare International Airport", + population: 2716000, + tourism_website: "https://www.cityofchicago.org", + theme_parks: "None" + }, + { + city: "Atlanta", + state: "GA", + primary_airport: "Hartsfield-Jackson Atlanta International Airport", + population: 486290, + tourism_website: "https://www.atlanta.com", + theme_parks: "None" + }, + { + city: "Detroit", + state: "MI", + primary_airport: "Detroit Metropolitan Airport", + population: 673104, + tourism_website: "https://www.visitdetroit.com", + theme_parks: "None" + }, + { + city: "Los Angeles", + state: "CA", + primary_airport: "Los Angeles International Airport", + population: 4000000, + tourism_website: "https://www.discoverlosangeles.com", + theme_parks: "None" + }, + { + city: "Philadelphia", + state: "PA", + primary_airport: "Philadelphia International Airport", + population: 1581000, + tourism_website: "https://www.visitphilly.com", + theme_parks: "None" + }, + { + city: "Boston", + state: "MA", + primary_airport: "Logan International Airport", + population: 685094, + tourism_website: "https://www.bostonusa.com", + theme_parks: "None" + }, + { + city: "Miami", + state: "FL", + primary_airport: "Miami International Airport", + population: 463347, + tourism_website: "https://www.visitflorida.com", + theme_parks: "None" + }, + { + city: "Minneapolis", + state: "MN", + primary_airport: "Minneapolis-Saint Paul International Airport", + population: 422331, + tourism_website: "https://www.minneapolis.org", + theme_parks: "None" + }, + { + city: "Austin", + state: "TX", + primary_airport: "Austin-Bergstrom International Airport", + population: 950715, + tourism_website: "https://www.austintexas.org", + theme_parks: "None" + }, + { + city: "Dallas", + state: "TX", + primary_airport: "Dallas/Fort Worth International Airport", + population: 1341000, + tourism_website: "https://www.visitdallas.com", + theme_parks: "None" + }, + { + city: "Seattle", + state: "WA", + primary_airport: "Seattle-Tacoma International Airport", + population: 724745, + tourism_website: "https://www.visitseattle.org", + theme_parks: "None" + }, + { + city: "San Diego", + state: "CA", + primary_airport: "San Diego International Airport", + population: 1420000, + tourism_website: "https://www.sandiego.org", + theme_parks: "SeaWorld San Diego" + }, + { + city: "Las Vegas", + state: "NV", + primary_airport: "McCarran International Airport", + population: 641676, + tourism_website: "https://www.visitlasvegas.com", + theme_parks: "Stratosphere Tower Hotel & Casino" + }, + { + city: "Baltimore", + state: "MD", + primary_airport: "Baltimore-Washington International Airport", + population: 611648, + tourism_website: "https://www.baltimore.org", + theme_parks: "None" + }, + { + city: "Nashville", + state: "TN", + primary_airport: "Nashville International Airport", + population: 691243, + tourism_website: "https://www.visitmusiccity.com", + theme_parks: "None" + }, + { + city: "Louisville", + state: "KY", + primary_airport: "Louisville International Airport", + population: 616261, + tourism_website: "https://www.gotolouisville.com", + theme_parks: "Kentucky Kingdom" + }, + { + city: "New Orleans", + state: "LA", + primary_airport: "Louis Armstrong New Orleans International Airport", + population: 393292, + tourism_website: "https://www.neworleans.com", + theme_parks: "Carousel Gardens" + }, + { + city: "Charlotte", + state: "NC", + primary_airport: "Charlotte Douglas International Airport", + population: 859035, + tourism_website: "https://www.visitnc.com", + theme_parks: "Carowinds" + }, + { + city: "Cleveland", + state: "OH", + primary_airport: "Cleveland Hopkins International Airport", + population: 385525, + tourism_website: "https://www.thisiscleveland.com", + theme_parks: "None" + }, + { + city: "Indianapolis", + state: "IN", + primary_airport: "Indianapolis International Airport", + population: 872680, + tourism_website: "https://www.visitindy.com", + theme_parks: "Indianapolis Zoo" + }, + { + city: "Phoenix", + state: "AZ", + primary_airport: "Phoenix Sky Harbor International Airport", + population: 1626000, + tourism_website: "https://www.visitphoenix.com", + theme_parks: "Enchanted Island" + }, + { + city: "Kansas City", + state: "MO", + primary_airport: "Kansas City International Airport", + population: 488943, + tourism_website: "https://www.visitkc.com", + theme_parks: "Worlds of Fun" + }, + { + city: "Cincinnati", + state: "OH", + primary_airport: "Cincinnati Municipal Airport", + population: 301301, + tourism_website: "https://www.cincinnatiusa.com", + theme_parks: "Coney Island" + }, + { + city: "Oklahoma City", + state: "OK", + primary_airport: "Will Rogers World Airport", + population: 643648, + tourism_website: "https://www.visitokc.com", + theme_parks: "Frontier City" + }, + { + city: "Houston", + state: "TX", + primary_airport: "George Bush International Airport", + population: 2313000, + tourism_website: "https://www.visithoustontexas.com", + theme_parks: "Zuma Fun Center" + }, + { + city: "San Francisco", + state: "CA", + primary_airport: "San Francisco International Airport", + population: 884363, + tourism_website: "https://www.sftravel.com", + theme_parks: "None" + }, + { + city: "Portland", + state: "OR", + primary_airport: "Portland International Airport", + population: 647805, + tourism_website: "https://www.travelportland.com", + theme_parks: "Oaks Park" + }, + { + city: "Milwaukee", + state: "WI", + primary_airport: "General Mitchell International Airport", + population: 595351, + tourism_website: "https://www.visitmilwaukee.org", + theme_parks: "None" + } +]; diff --git a/data/dataCleaner.js b/data/dataCleaner.js index 082b4e3..83f32e6 100644 --- a/data/dataCleaner.js +++ b/data/dataCleaner.js @@ -1,22 +1,26 @@ -const cities = require('./citiesdata.js'); +const cities = require("./citiesdata.js"); const clubArray = () => { - cities.map(async (city) => { - const response = await fetch(`https://api.foursquare.com/v2/venues/search?client_id=LXVIOUKRYFT2QZAVED2QULSNELFHKTUJZIM21U2QQADH2XPU&client_secret=VMRLTF5IPLQ1ZUCYBSQP3MGRFKSCPS2MNIZOAX1SFMOBYYOD&v=20180323&near='${city.city}, ${city.state}'&categoryId=4bf58dd8d48988d18e941735`) - const data = await response.json() - return cleanComedyClubData(data) - }) - } - - const cleanComedyClubData = (comedyClubs) => { - comedyClubs.response.venues.map((club) => { - return { - name: club.name, - street_address: club.location.address, - zip_code: club.location.postalCode, - rating: 0 - } - }) - } + cities.map(async city => { + const response = await fetch( + `https://api.foursquare.com/v2/venues/search?client_id=LXVIOUKRYFT2QZAVED2QULSNELFHKTUJZIM21U2QQADH2XPU&client_secret=VMRLTF5IPLQ1ZUCYBSQP3MGRFKSCPS2MNIZOAX1SFMOBYYOD&v=20180323&near='${ + city.city + }, ${city.state}'&categoryId=4bf58dd8d48988d18e941735` + ); + const data = await response.json(); + return cleanComedyClubData(data); + }); +}; - module.exports = clubArray \ No newline at end of file +const cleanComedyClubData = comedyClubs => { + comedyClubs.response.venues.map(club => { + return { + name: club.name, + street_address: club.location.address, + zip_code: club.location.postalCode, + rating: 0 + }; + }); +}; + +module.exports = clubArray; diff --git a/data/parkData.js b/data/parkData.js index d9ec7f8..5555e83 100644 --- a/data/parkData.js +++ b/data/parkData.js @@ -1,215 +1,242 @@ -const data = { - Bessemer: { parks: "Alabama Splash Adventure" }, - Foley: { parks: "OWA" }, - Huntsville: { parks: "Southern Adventures" }, - Tuscumbia: { parks: "Spring Park" }, - "Gulf Shores": { parks: "Waterville USA" }, - Phoenix: { parks: "Enchanted Island" }, - Tucson: { parks: "Funtasticks Family Fun Park" }, - "Queen Creek": { parks: "Schnepf Farms" }, - "North Little Rock": { parks: "Funland" }, - "Hot Springs": { parks: "Magic Springs & Crystal Falls" }, - Stanton: { parks: "Adventure City" }, - "San Diego": { parks: "SeaWorld San Diego" }, - Fresno: { parks: "Rotary Storyland & Playland" }, - "El Cajon": { parks: "Boomers! El Cajon" }, - "Fountain Valley": { parks: "Boomers! Fountain Valley" }, - Upland: { parks: "Boomers! Upland" }, - "Santa Clara": { parks: "California's Great America" }, - Riverside: { parks: "John's Incredible Pizza Company" }, - Anaheim: { parks: "Disneyland Park" }, - Lodi: { parks: "Fun Town at Micke Grove" }, - Sacramento: { parks: "Scandia Family Fun Center" }, - Gilroy: { parks: "Gilroy Gardens Family Theme Park" }, - "San Jose": { parks: "Happy Hollow Park & Zoo" }, - Roseville: { parks: "John's Incredible Pizza Company" }, - Merced: { parks: "Kiddieland" }, - "Buena Park": { parks: "Knott's Berry Farm" }, - Carlsbad: { parks: "LEGOLAND California" }, - Vacaville: { parks: "Nut Tree Family Park" }, - Oakland: { parks: "Oakland Zoo" }, - "Santa Monica": { parks: "Pacific Park" }, - Concord: { parks: "Pixieland Park" }, - "Santa Cruz": { parks: "Santa Cruz Beach Boardwalk" }, - Ontario: { parks: "Scandia Fun Center" }, - Vallejo: { parks: "Six Flags Discovery Kingdom" }, - Valencia: { parks: "Six Flags Magic Mountain" }, - Sonoma: { parks: "Sonoma TrainTown Railroad" }, - "Universal City": { parks: "Universal Studios Hollywood" }, - Golden: { parks: "Amusement Park at Heritage Square" }, - Pueblo: { parks: "City Park" }, - Denver: { parks: "Lakeside Amusement Park" }, - "Glenwood Springs": { parks: "Glenwood Caverns Adventure Park" }, - Henderson: { parks: "Mile High Flea Market" }, - Cascade: { parks: "Santa's Workshop" }, - Bristol: { parks: "Lake Compounce" }, - "New London": { parks: "Ocean Beach Park" }, - Middlebury: { parks: "Quassy Amusement Park" }, - "Jacksonville Beach": { parks: "Adventure Landing" }, - "Altamonte Springs": { parks: "Birthday World" }, - "Daytona Beach": { parks: "Boardwalk Amusements" }, - Dania: { parks: "Boomers! Dania Beach" }, - Tampa: { parks: "Lowry Park Zoo" }, - Clearwater: { parks: "Celebration Station" }, - "Panama City Beach": { parks: "Race City PCB" }, - "Lake Buena Vista": { parks: "EPCOT" }, - Kissimmee: { parks: "Old Town" }, - Orlando: { parks: "Universal's Islands of Adventure" }, - "Port Charlotte": { parks: "Kidstar Park" }, - Naples: { parks: "King Richard's Family Fun Park" }, - "Winter Haven": { parks: "LEGOLAND Florida" }, - Pensacola: { parks: "Sam's Fun City" }, - "Fort Lauderdale": { parks: "Uncle Bernie's Amusement Park" }, - Augusta: { parks: "Adventure Crossing" }, - Fayetteville: { parks: "Fun Junction USA" }, - Rossville: { parks: "Lake Winnepesaukah" }, - Austell: { parks: "Six Flags Over Georgia" }, - Valdosta: { parks: "Wild Adventures" }, - Athol: { parks: "Silverwood Theme Park" }, - Rexburg: { parks: "Yellowstone Bear World" }, - Union: { parks: "Donley's Wild West Town" }, - Utica: { parks: "Enchanted Forest" }, - Norridge: { parks: "Go Bananas" }, - Bloomington: { parks: "Nickelodeon Universe" }, - Burbank: { parks: "Haunted Trails" }, - Joliet: { parks: "Haunted Trails" }, - "Villa Park": { parks: "Safari Land" }, - "East Dundee": { parks: "Santa's Village Azoosment Park" }, - Gurnee: { parks: "Six Flags Great America" }, - "Columbia City": { parks: "Fun Center Paiges Crossing" }, - "Santa Claus": { parks: "Holiday World & Splashin' Safari" }, - Monticello: { parks: "Indiana Beach" }, - Indianapolis: { parks: "Indianapolis Zoo" }, - Greenfield: { parks: "That Fun Place" }, - Altoona: { parks: "Lakemont Park" }, - "Arnolds Park": { parks: "Arnolds Park" }, - Wichita: { parks: "All Star Adventures" }, - Pittsburg: { parks: "Kiddieland Lincoln Park" }, - Olathe: { parks: "Zonkers" }, - "Bowling Green": { parks: "Beech Bend Park" }, - Louisville: { parks: "Kentucky Kingdom" }, - "New Orleans": { parks: "Carousel Gardens" }, - "Baton Rouge": { parks: "Dixie Landin' & Blue Bayou Waterpark" }, - Saco: { parks: "Funtown Splashtown USA" }, - "Old Orchard Beach": { parks: "Palace Playland" }, - York: { parks: "York's Wild Kingdom" }, - "New Market": { parks: "Adventure Park USA" }, - "West Ocean City": { parks: "Baja Amusements" }, - "Ocean City": { parks: "Playland's Castaway Cove" }, - "Upper Marlboro": { parks: "Six Flags America" }, - "East Falmouth": { parks: "Barnstable County Fair" }, - Carver: { parks: "Edaville USA" }, - Agawam: { parks: "Six Flags New England" }, - "Houghton Lake": { parks: "Funland Amusement Park" }, - Saginaw: { parks: "Kokomo's Family Fun Center" }, - Muskegon: { parks: "Michigan's Adventure" }, - Chesaning: { parks: "Saginaw County Fairgrounds" }, - "St. Paul": { parks: "Como Town" }, - Brainerd: { parks: "Paul Bunyan Land" }, - Shakopee: { parks: "Valleyfair" }, - Brookhaven: { parks: "Exchange Club Fair" }, - "Osage Beach": { parks: "Miner Mike's Adventure Town" }, - "Kansas City": { parks: "Worlds of Fun" }, - Branson: { parks: "Silver Dollar City" }, - Eureka: { parks: "Six Flags St. Louis" }, - Laurel: { parks: "Amusement Park Drive-In" }, - Omaha: { parks: "Skateland" }, - Wahoo: { parks: "Saunders County Fairgrounds" }, - "Las Vegas": { parks: "Stratosphere Tower Hotel & Casino" }, - Jean: { parks: "Buffalo Bill's Hotel and Casino" }, - Sparks: { parks: "Wild Island Family Adventure Park" }, - Salem: { parks: "Canobie Lake Park" }, - Jefferson: { parks: "Santa's Village" }, - Nashua: { parks: "FunWorld" }, - Glen: { parks: "Story Land" }, - Bayville: { parks: "Blackbeard's Cave" }, - "Scotch Plains": { parks: "Bowcraft Amusement Park" }, - "Seaside Heights": { parks: "Casino Pier" }, - Clementon: { parks: "Clementon Park & Splash World" }, - "Beach Haven": { parks: "Fantasy Island" }, - "Point Pleasant Beach": { parks: "Jenkinson's Boardwalk" }, - Keansburg: { parks: "Keansburg Amusement Park" }, - Hope: { parks: "Land of Make Believe & Pirates Cove" }, - Wildwood: { parks: "Morey's Surfside Pier" }, - Jackson: { parks: "Six Flags Great Adventure" }, - "Atlantic City": { parks: "Steel Pier" }, - "Egg Harbor Township": { parks: "Storybook Land" }, - "Mt. Laurel": { parks: "The Funplex" }, - Albuquerque: { parks: "iT'Z" }, - "Sunland Park": { parks: "Western Playland" }, - Farmingdale: { parks: "Adventureland" }, - Brooklyn: { parks: "Memphis Kiddie Park" }, - Medford: { parks: "Boomers! Medford" }, - "Darien Center": { parks: "Darien Lake" }, - Queens: { parks: "Fantasy Forest" }, - "Grand Island": { parks: "Fantasy Island" }, - "Staten Island": { parks: "Fantasy Shore Amusement Park" }, - Latham: { parks: "Hoffman's Playland" }, - "Lake George": { parks: "The Great Escape & Splashwater Kingdom" }, - "Bemus Point": { parks: "Midway Park" }, - Rye: { parks: "Playland" }, - "North Pole": { parks: "Santa's Workshop" }, - Rochester: { parks: "Seabreeze Amusement Park" }, - "Sylvan Beach": { parks: "Sylvan Beach Amusement Park" }, - "New York": { parks: "Victorian Gardens at Wollman Rink" }, - Charlotte: { parks: "Carowinds" }, - Cherokee: { parks: "Santa's Land" }, - Williamston: { parks: "Deadwood" }, - Sandusky: { parks: "Cedar Point" }, - Powell: { parks: "Columbus Zoo and Aquarium" }, - Cincinnati: { parks: "Coney Island" }, - Aurora: { parks: "Geauga Lake's Wildwater Kingdom" }, - Mason: { parks: "Kings Island" }, - Ross: { parks: "Stricker's Grove" }, - "New Philadelphia": { parks: "Tuscora Park" }, - Bartlesville: { parks: "Bartlesville Kiddie Park" }, - "Oklahoma City": { parks: "Frontier City" }, - Turner: { parks: "Enchanted Forest" }, - Portland: { parks: "Oaks Park" }, - "Conneaut Lake": { parks: "Conneaut Lake Park" }, - Tipton: { parks: "DelGrosso's Amusement Park" }, - Allentown: { parks: "Dorney Park & Wildwater Kingdom" }, - Lancaster: { parks: "Dutch Wonderland" }, - "Cranberry Township": { parks: "Fun Fore All" }, - Hershey: { parks: "Hersheypark" }, - Ligonier: { parks: "Idlewild & Soak Zone" }, - "West Mifflin": { parks: "Kennywood" }, - Elysburg: { parks: "Knoebels Amusement Park" }, - "East Stroudsburg": { parks: "Pocono Mt. Go-Karts & Play Park" }, - Langhorne: { parks: "Sesame Place" }, - Erie: { parks: "Waldameer Park" }, - "Myrtle Beach": { parks: "Family Kingdom Amusement Park" }, - "North Myrtle Beach": { parks: "O.D. Pavilion Amusement Park" }, - Deadwood: { parks: "Boondocks" }, - "Sioux Falls": { parks: "Thunder Road" }, - "Pigeon Forge": { parks: "Dollywood" }, - Sevierville: { parks: "NASCAR SpeedPark" }, - Chattanooga: { parks: "Sir Goony's Family Fun Center" }, - Pflugerville: { parks: "Austin's Park n' Pizza" }, - Galveston: { parks: "Galveston Island Pleasure Pier" }, - Houston: { parks: "Zuma Fun Center" }, - Lubbock: { parks: "Joyland Amusement Park" }, - Kemah: { parks: "Kemah Boardwalk Amusements" }, - "San Antonio": { parks: "Six Flags Fiesta Texas" }, - "El Paso": { parks: "Oasis Lanes" }, - Carrollton: { parks: "Sandy Lake Amusement Park" }, - Arlington: { parks: "Six Flags Over Texas" }, - Amarillo: { parks: "Wonderland Park" }, - Canton: { parks: "YesterLand Farm" }, - Seguin: { parks: "ZDT's Amusement Park" }, - Farmington: { parks: "Lagoon" }, - Lehi: { parks: "Seven Peaks Fun Center" }, - Williamsburg: { parks: "Go-Karts Plus" }, - Fredericksburg: { parks: "Central Park Funland" }, - Doswell: { parks: "Kings Dominion" }, - "Virginia Beach": { parks: "Motor World Virginia Beach" }, - Pasco: { parks: "Country Mercantile" }, - Puyallup: { parks: "Puyallup Fair" }, - Carnation: { parks: "Remlinger Farms" }, - Spokane: { parks: "Riverfront Park" }, - "Federal Way": { parks: "Wild Waves & Enchanted Forest" }, - Huntington: { parks: "Camden Park" }, - "Green Bay": { parks: "Bay Beach" }, - "Wisconsin Dells": { parks: "Timber Falls Adventure Golf" }, - Marshall: { parks: "Little Amerricka" } -}; +const data = [ + { + city: "Denver", + state: "CO", + primary_airport: "Denver International Airport", + population: 704621, + tourism_website: "https://www.denver.org", + theme_parks: "Lakeside Amusement Park" + }, + { + city: "New York City", + state: "NY", + primary_airport: "LaGuardia Airport", + population: 8623000, + tourism_website: "https://www.nyc.com", + theme_parks: "None" + }, + { + city: "Chicago", + state: "IL", + primary_airport: "O'Hare International Airport", + population: 2716000, + tourism_website: "https://www.cityofchicago.org", + theme_parks: "None" + }, + { + city: "Atlanta", + state: "GA", + primary_airport: "Hartsfield-Jackson Atlanta International Airport", + population: 486290, + tourism_website: "https://www.atlanta.com", + theme_parks: "None" + }, + { + city: "Detroit", + state: "MI", + primary_airport: "Detroit Metropolitan Airport", + population: 673104, + tourism_website: "https://www.visitdetroit.com", + theme_parks: "None" + }, + { + city: "Los Angeles", + state: "CA", + primary_airport: "Los Angeles International Airport", + population: 4000000, + tourism_website: "https://www.discoverlosangeles.com", + theme_parks: "None" + }, + { + city: "Philadelphia", + state: "PA", + primary_airport: "Philadelphia International Airport", + population: 1581000, + tourism_website: "https://www.visitphilly.com", + theme_parks: "None" + }, + { + city: "Boston", + state: "MA", + primary_airport: "Logan International Airport", + population: 685094, + tourism_website: "https://www.bostonusa.com", + theme_parks: "None" + }, + { + city: "Miami", + state: "FL", + primary_airport: "Miami International Airport", + population: 463347, + tourism_website: "https://www.visitflorida.com", + theme_parks: "None" + }, + { + city: "Minneapolis", + state: "MN", + primary_airport: "Minneapolis-Saint Paul International Airport", + population: 422331, + tourism_website: "https://www.minneapolis.org", + theme_parks: "None" + }, + { + city: "Austin", + state: "TX", + primary_airport: "Austin-Bergstrom International Airport", + population: 950715, + tourism_website: "https://www.austintexas.org", + theme_parks: "None" + }, + { + city: "Dallas", + state: "TX", + primary_airport: "Dallas/Fort Worth International Airport", + population: 1341000, + tourism_website: "https://www.visitdallas.com", + theme_parks: "None" + }, + { + city: "Seattle", + state: "WA", + primary_airport: "Seattle-Tacoma International Airport", + population: 724745, + tourism_website: "https://www.visitseattle.org", + theme_parks: "None" + }, + { + city: "San Diego", + state: "CA", + primary_airport: "San Diego International Airport", + population: 1420000, + tourism_website: "https://www.sandiego.org", + theme_parks: "SeaWorld San Diego" + }, + { + city: "Las Vegas", + state: "NV", + primary_airport: "McCarran International Airport", + population: 641676, + tourism_website: "https://www.visitlasvegas.com", + theme_parks: "Stratosphere Tower Hotel & Casino" + }, + { + city: "Baltimore", + state: "MD", + primary_airport: "Baltimore-Washington International Airport", + population: 611648, + tourism_website: "https://www.baltimore.org", + theme_parks: "None" + }, + { + city: "Nashville", + state: "TN", + primary_airport: "Nashville International Airport", + population: 691243, + tourism_website: "https://www.visitmusiccity.com", + theme_parks: "None" + }, + { + city: "Louisville", + state: "KY", + primary_airport: "Louisville International Airport", + population: 616261, + tourism_website: "https://www.gotolouisville.com", + theme_parks: "Kentucky Kingdom" + }, + { + city: "New Orleans", + state: "LA", + primary_airport: "Louis Armstrong New Orleans International Airport", + population: 393292, + tourism_website: "https://www.neworleans.com", + theme_parks: "Carousel Gardens" + }, + { + city: "Charlotte", + state: "NC", + primary_airport: "Charlotte Douglas International Airport", + population: 859035, + tourism_website: "https://www.visitnc.com", + theme_parks: "Carowinds" + }, + { + city: "Cleveland", + state: "OH", + primary_airport: "Cleveland Hopkins International Airport", + population: 385525, + tourism_website: "https://www.thisiscleveland.com", + theme_parks: "None" + }, + { + city: "Indianapolis", + state: "IN", + primary_airport: "Indianapolis International Airport", + population: 872680, + tourism_website: "https://www.visitindy.com", + theme_parks: "Indianapolis Zoo" + }, + { + city: "Phoenix", + state: "AZ", + primary_airport: "Phoenix Sky Harbor International Airport", + population: 1626000, + tourism_website: "https://www.visitphoenix.com", + theme_parks: "Enchanted Island" + }, + { + city: "Kansas City", + state: "MO", + primary_airport: "Kansas City International Airport", + population: 488943, + tourism_website: "https://www.visitkc.com", + theme_parks: "Worlds of Fun" + }, + { + city: "Cincinnati", + state: "OH", + primary_airport: "Cincinnati Municipal Airport", + population: 301301, + tourism_website: "https://www.cincinnatiusa.com", + theme_parks: "Coney Island" + }, + { + city: "Oklahoma City", + state: "OK", + primary_airport: "Will Rogers World Airport", + population: 643648, + tourism_website: "https://www.visitokc.com", + theme_parks: "Frontier City" + }, + { + city: "Houston", + state: "TX", + primary_airport: "George Bush International Airport", + population: 2313000, + tourism_website: "https://www.visithoustontexas.com", + theme_parks: "Zuma Fun Center" + }, + { + city: "San Francisco", + state: "CA", + primary_airport: "San Francisco International Airport", + population: 884363, + tourism_website: "https://www.sftravel.com", + theme_parks: "None" + }, + { + city: "Portland", + state: "OR", + primary_airport: "Portland International Airport", + population: 647805, + tourism_website: "https://www.travelportland.com", + theme_parks: "Oaks Park" + }, + { + city: "Milwaukee", + state: "WI", + primary_airport: "General Mitchell International Airport", + population: 595351, + tourism_website: "https://www.visitmilwaukee.org", + theme_parks: "None" + } +]; diff --git a/db/seeds/dev/cities.js b/db/seeds/dev/cities.js index e81916a..1adb8fd 100644 --- a/db/seeds/dev/cities.js +++ b/db/seeds/dev/cities.js @@ -1,42 +1,47 @@ -const cities = require('../../../data/citiesdata.js') -const club = require('../../../data/comedy_clubs.js') +const cities = require("../../../data/citiesdata.js"); +const club = require("../../../data/comedy_clubs.js"); const createCities = (knex, city) => { - return knex('cities').insert({ - city: city.city, - state: city.state, - primary_airport: city.primary_airport, - population: city.population, - tourism_website: city.tourism_website - }, 'id') - .then(cityIds => { - let clubPromises = club[city.city].map(clubs => { - return newClubs(knex, { - name: clubs.name, - street_address: clubs.street_address, - zip_code: clubs.zip_code, - rating: clubs.rating, - city_id: cityIds[0] - }) - }) - return Promise.all(clubPromises) - }) -} + return knex("cities") + .insert( + { + city: city.city, + state: city.state, + primary_airport: city.primary_airport, + population: city.population, + tourism_website: city.tourism_website + }, + "id" + ) + .then(cityIds => { + let clubPromises = club[city.city].map(clubs => { + return newClubs(knex, { + name: clubs.name, + street_address: clubs.street_address, + zip_code: clubs.zip_code, + rating: clubs.rating, + city_id: cityIds[0] + }); + }); + return Promise.all(clubPromises); + }); +}; const newClubs = (knex, club) => { - return knex('comedy_clubs').insert(club) -} + return knex("comedy_clubs").insert(club); +}; exports.seed = function(knex, Promise) { // Deletes ALL existing entries - return knex('comedy_clubs').del() - .then(() => knex('cities').del()) + return knex("comedy_clubs") + .del() + .then(() => knex("cities").del()) .then(() => { let cityPromises = cities.map(city => { - return createCities(knex, city) - }) - return Promise.all(cityPromises) - }) - .then(() => console.log('Seeding complete!')) - .catch(error => console.log(`Error seeding data: ${error}`)) - }; + return createCities(knex, city); + }); + return Promise.all(cityPromises); + }) + .then(() => console.log("Seeding complete!")) + .catch(error => console.log(`Error seeding data: ${error}`)); +}; diff --git a/utils/parkScraper.js b/utils/parkScraper.js index 28efa45..064bede 100644 --- a/utils/parkScraper.js +++ b/utils/parkScraper.js @@ -1,6 +1,7 @@ const Nightmare = require("nightmare"); const nightmare = Nightmare({ show: true }); const fs = require("fs"); +const cities = require("../data/citiesdata"); var cleaner = require("./dataCleaner.js").parkCleaner; @@ -22,7 +23,15 @@ nightmare .end() .then(result => { let cleaned = cleaner(result); - fs.writeFileSync("./data/parkData.js", JSON.stringify(cleaned), err => { + cleaned = cities.map(city => { + let name = city.city; + let park = "None"; + if (cleaned[name]) park = cleaned[name].parks; + + city = { ...city, theme_parks: park }; + return city; + }); + fs.writeFileSync("./data/citiesdata.js", JSON.stringify(cleaned), err => { if (err) throw err; console.log("file saved"); }); From df3766a4ed25dad5e1d1db3cef70c294317c2b3d Mon Sep 17 00:00:00 2001 From: Ahmad Kayyali Date: Thu, 13 Dec 2018 11:38:12 -0700 Subject: [PATCH 13/13] Finalise theme_parks with @benjaminhayek --- data/citiesdata.js | 2 ++ db/seeds/dev/cities.js | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/data/citiesdata.js b/data/citiesdata.js index 4a69b0b..3ccfe13 100644 --- a/data/citiesdata.js +++ b/data/citiesdata.js @@ -240,3 +240,5 @@ const cities = [ theme_parks: "None" } ]; + +module.exports = cities; diff --git a/db/seeds/dev/cities.js b/db/seeds/dev/cities.js index 1adb8fd..0118795 100644 --- a/db/seeds/dev/cities.js +++ b/db/seeds/dev/cities.js @@ -9,7 +9,8 @@ const createCities = (knex, city) => { state: city.state, primary_airport: city.primary_airport, population: city.population, - tourism_website: city.tourism_website + tourism_website: city.tourism_website, + theme_parks: city.theme_parks }, "id" ) @@ -33,6 +34,7 @@ const newClubs = (knex, club) => { exports.seed = function(knex, Promise) { // Deletes ALL existing entries + console.log(cities); return knex("comedy_clubs") .del() .then(() => knex("cities").del())